Sunday, December 26, 2010

Checking the PR deletion indicator

Enhancement Name - MEREQ001
Exit Name - EXIT_SAPLMEREQ_005
Exit Import Parameter IM_REQ_ITEM reference to interface IF_PURCHASE_REQUISITION_ITEM.

I need to read PR number from this import parameter, the field corresponds to the PR number is BANFN.
DATA: wf_banfn LIKE eban-banfn.
DATA: obj_requisition TYPE REF TO if_purchase_requisition.
DATA: loc_data_doc TYPE mereq_header.
*--->>>
CALL METHOD im_req_item->get_requisition
RECEIVING
re_requisition = obj_requisition.

IF NOT obj_requisition IS INITIAL.
*--->>> Getting the purchasing Document number
CALL METHOD obj_requisition->get_data
RECEIVING
re_data = loc_data_doc.

wf_banfn = loc_data_doc-banfn. " this will return the PR Number
ENDIF.

Tuesday, November 23, 2010

T-code for logo upload

se78

Function Module to Read Feature value

*&---------------------------------------------------------------------*
*& Report YTEST_FEATURE
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT YTEST_FEATURE.
data structure like pme04.
data feature like t549b-namen.
data back like t549a-abkrs.
data status(1).
BREAK-POINT.
structure-molga = '01'.
structure-persk = 'DN'.
feature = 'ABKRS'.

call function 'HR_FEATURE_BACKFIELD'
exporting
feature = feature
struc_content = structure
kind_of_error = space
importing
back = back
changing
status = status
exceptions
dummy = 1
error_operation = 2
no_backvalue = 3
feature_not_generated = 4
invalid_sign_in_funid = 5
field_in_report_tab_in_pe03 = 6
others = 7.
case sy-subrc.
when 2.
when 3.
when 4.
when 5.
when 6.
endcase.

Sunday, October 10, 2010

Passing Mutiple values to Workflow in BADI

In BADI we cannot include INCLUDE .. So we need to use some other way to pass multiple values to Workflow.

For that, go to SE24 give the interface name.



Then go to goto --> Class-local types --> macros



In the editor, include INCLUDE cntn01_swc instead of INCLUDE




Macros written in the program is also different.

Please see one example code.

***********************************

***---INTERNAL TABLE DECLARATION
DATA : lit_event_container TYPE TABLE OF swcont. "event container

*--Creating a container
swc0_create_container lit_event_container.

*--Filling event container

swc0_set_element lit_event_container 'User' draw-dwnam.
swc0_set_element lit_event_container 'DocumentStatus' new_status.
swc0_set_element lit_event_container 'DocumentStatus_old' old_status.
swc0_set_element lit_event_container 'Document_Desc' lfs_drat-dktxt.

CALL FUNCTION 'SWE_EVENT_CREATE'
EXPORTING
objtype = l_objtype
objkey = l_objkey
event = l_event
* creator = ' '
* take_workitem_requester = ' '
* start_with_delay = ' '
* start_recfb_synchron = ' '
* no_commit_for_queue = ' '
* debug_flag = ' '
* no_logging = ' '
* ident =
IMPORTING
event_id = l_eventid
* receiver_count =
TABLES
event_container = lit_event_container
EXCEPTIONS
objtype_not_found = 1
others = 2
.
IF sy-subrc <> 0.
* message id sy-msgid type sy-msgty number sy-msgno
* with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
COMMIT WORK.

****************************************************

See the event parameter list

Passing Multiple Values to Workflow

Passing Multiple values from the triggering program to Workflow.

First we need to declare the event container variables for the required event.

See the screen shots for creating event container variables.







Now we have defined the event container variables.

After that we need to do the coding in the workflow triggering point.

*-- For Passing Event Container Values
INCLUDE .
swc_container wf_contnr.
*-- create the container of type container
swc_create_container wf_contnr.
swc_set_element wf_contnr 'EvtParameter1' p_gwf_onrname.

*-- Triggering the workflow ( note that we are passing the event container )

CALL FUNCTION 'SWE_EVENT_CREATE'
EXPORTING
objtype = 'ZEHS_RA'
objkey = p_gwf_entryno
event = p_gwf_event
* CREATOR = ' '
* TAKE_WORKITEM_REQUESTER = ' '
* START_WITH_DELAY = ' '
* START_RECFB_SYNCHRON = ' '
* NO_COMMIT_FOR_QUEUE = ' '
* DEBUG_FLAG = ' '
* NO_LOGGING = ' '
* IDENT =
* IMPORTING
* EVENT_ID =
* RECEIVER_COUNT =
TABLES
event_container = wf_contnr
EXCEPTIONS
objtype_not_found = 1
OTHERS = 2
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
COMMIT WORK.

***************************************************
Please see one example program
***************************************************
*-- For Passing Event Container Values
INCLUDE .
swc_container wf_contnr.
* swc_container wf_contnr1.
swc_create_container wf_contnr.
* swc_create_container wf_contnr1.
IF p_gwf_onrname IS NOT INITIAL AND p_gwf_onrname NE space.

swc_set_element wf_contnr 'NextLevel' p_gwf_onrname.
swc_set_element wf_contnr 'Initiator' sy-uname.
ENDIF.
IF p_gwf_onrname IS INITIAL.
swc_set_element wf_contnr 'Initiator' sy-uname.
ENDIF.
*--------------------------------------------------------------*


CALL FUNCTION 'SWE_EVENT_CREATE'
EXPORTING
objtype = 'ZEHS_RA'
objkey = p_gwf_entryno
event = p_gwf_event
* CREATOR = ' '
* TAKE_WORKITEM_REQUESTER = ' '
* START_WITH_DELAY = ' '
* START_RECFB_SYNCHRON = ' '
* NO_COMMIT_FOR_QUEUE = ' '
* DEBUG_FLAG = ' '
* NO_LOGGING = ' '
* IDENT =
* IMPORTING
* EVENT_ID =
* RECEIVER_COUNT =
TABLES
event_container = wf_contnr
EXCEPTIONS
objtype_not_found = 1
OTHERS = 2
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
COMMIT WORK.

Wednesday, June 30, 2010

How to apply SAP notes

Go through following Steps:

1. Check Note Validity

a. Log on to SAPNet (or use SAP Service Marketplace on the Web)

i. Click Gen. Functions

ii. Click Display

iii.Enter note # and click Execute

iv. Click Note Administration

v. Click Support Package Tab to display note package level

If no value exists for package level

a. Follow the steps in the Solution to apply the note

b. Go to transaction code spam

i. Click Package Level to display current package level

c. Compare note package level with current package level

i. If note package level < or = current package level, note hasalready been applied through support packages. No additional steps necessary

ii.If note package level > current package level, note must be applied. Go to Step 2

2. Go to transaction code snote

3. Download SAP note

a. Click Goto à Download SAP note

b. Enter note #

c. Click Execute

4. Implement SAP Note

a. Select note and click Implement SAP Note icon

b. Request – Click Create; Enter note # and description

c. Take note of transport #

5. Test transport before migration

a. Notify requestor to verify changes before migrating to the next environment

b. After thorough testing has been completed, release transport

c. Migrate transport to the other environments

Friday, May 7, 2010

Implicit Enhancements

These types of enhancement are predefined in the following places of an ABAP program:
• At the end of an include (some restrictions apply; for example, at the end of a method include)
• At the end of Private, Protected and Public sections of a Class
• At the end of the Implementation of a Class
• Before the END INTERFACE in an Interface definition
• At the end of a structure definition
• At the beginning and at the end of: forms, functions, methods
• In the parameters list of a method, at the end of: CHANGING, IMPORTING and EXPORTING
To see what Implicit Enhancements are available; in the ABAP editor follow this path: Edit->Enhancement Operations->Show Implicit Enhancement Options.

Screen Shots

Explicit Enhancements

These are predefined enhancement sections, usually defined by SAP. Explicit Enhancements are stored in Enhancement Spots. In program RIAUFMVK you can see some examples of them.
Explicit Enhancements are pretty easy to implement; in the ABAP editor, get into the Enhancement Mode by clicking the spiral button. Then, right click into the enhancement point you plan to implement and select Enhancement Implementation->Create. You will be asked a name and a description and after this you can simply add your code.

Screen Shots

Sunday, March 7, 2010

HR SAP Function Module to get Employee Details from User ID

HR_GETEMPLOYEEDATA_FROMUSER - Input for this function Module is User ID.

Wednesday, January 27, 2010

SAP Function Module Relating to HR Apprisal

Function Module Name - HRHAP_DOCUMENT_GET_DETAIL
EG:
data: lv_APPRAISAL_ID type HAP_S_APPRAISAL_ID,
lit_BODY_CELLS type HAP_T_BODY_CELLS,
lwa_BODY_CELLS type HAP_S_BODY_CELLS.

lv_APPRAISAL_ID-APPRAISAL_ID = appraisal_id.

CALL FUNCTION 'HRHAP_DOCUMENT_GET_DETAIL'
EXPORTING
plan_version = '01'
s_appraisal_id = lv_APPRAISAL_ID
IMPORTING
T_BODY_CELLS = lit_BODY_CELLS.

Monday, January 25, 2010

Function Module to Update Infotype

Function Module Name is - HR_INFOTYPE_OPERATION
Check standard Program - RPUPBSQ4_DYNUPDT

Wednesday, January 13, 2010

Get Infotype 8 Value ( Direct and Indirect Evaluation )

Function Module Name - RP_FILL_WAGE_TYPE_TABLE
Pass the Begin Date, End date and Employee Number.

Monday, January 4, 2010

Transport Request Table

The table where all Transport request and tasks are saved is - E070