ABAP-HR, Organization managemnt function module
Hi friends,
In ABAP-HR, i want all function modules we use regularly or hardly.
Thanks&Regards,
Shiva Prasad
Certain function modules which work with PA infotypes are HR_READ_INFTY and HR_INFOTYPE_OPERATION.
Function modules which work with PP infotypes you can find by selecting using
RH_READ_INFTY_*
Some function groups used in HR are given below.
RPAI HR: Analysis from Infotypes
RPBS HR Error Processing
HRGL Read leave data
HRTIM00WORK-SCHED-CONVERT Replacement Modules for Func. Group RPTM
RPTM H
HRPAY99_OC New off-cycle functions
HRTIM00ACTUALTIMES Calculation of Actual Personnel Times
PA03 HR: Read personnel control record (PA03)
CAPP Time Sheet: Approval
APPL Business Object Applicant
VAP1 Concerns Applicant
HRP3 Module for feature tree maintenance
HRXSS_CAT_WEBDYNP Web Dynpro: RFC
RPAT Data transfer and interfaces
RHOV HR-CA Utilities for Vacancies
PAPL HR applicant data workflow
RPAP_WORDPROCESSOR Interface Between PA-RC and MS Word
RPAP_DATA_MINING Data Collection PA-RC Letters
HRCM Compensation Management
RHBY_2 Integration Switches
HRTC HR-CA: Account Assignment Block/Check
PARA Annual salary functionality (ANSAL)
RPCA Function Modules for CATT Procedures
PTWS HR-TIM: Personal Work Schedule
PDSU Connection to SAP Structural Graphics
Regards,
Aravind
Similar Messages
-
How to create Inbound Idocs in a ABAP program? Any function Module?
Hello Experts,
My requirement is : I have sales order data which I extracted from third party system in my internal tables. In the same box I need to create inbound Idocs and then consequently create sales orders.
I have used the function module IDOC_INBOUND_WRITE_TO_DB to create inbound Idocs from Sales Orders data in internal tables. I have populated all the data records with correct PSGNUM and HLEVEL values. My plan is to create inbound idocs with this function module and send those to IDOC_INPUT_ORDERS function module which creates Sales Orders.
If a sales order in the internal table in ABAP program contains only one item, then I am getting correct idocs. But if more than one item exists for a sales order then the line item segments which got repeated in Idoc are having PSGNUM and HLEVEL values as zero when I checked in WE02. As a result the hierarchy from the second item segment is getting disturbed and getting the status 60.
I populated T_EDIDD with data records from IDOC_INBOUND_WRITE_TO_DB.
To the function module IDOC_INPUT_ORDERS, T_EDIDC and T_EDIDD are the input. I observed that in T_EDIDD also the PSGNUM and HLEVEL values are blank.
I am getting Status 60 with message 'EDI: Syntax error in IDoc (segment cannot be identified)' for idocs which have more than one item.
I need to extract sales data from third party and create inbound idocs and create sales orders in one ABAP program only. I need to display corresponding Idoc numbers for the corresponding third party sales order number in a listoutput.
Can anybody please provide inputs?
Regards.Hi Anjali,
Thanks for the response.
I have passed the PSGNUM and HLEVEL values while populating the data records. Then I sent the data records and control record information to the function module IDOC_INBOUND_WRITE_TO_DB. Inside this function module there is code to clear the PSGNUM values and HLEVEL values.
for compatibility: clear administration data of data records
perform data_records_wipe
tables
t_data_records.
FORM DATA_RECORDS_WIPE
TABLES
T_DATA_RECORDS_IN STRUCTURE EDIDD.
LOOP AT T_DATA_RECORDS_IN.
CLEAR: T_DATA_RECORDS_IN-MANDT,
T_DATA_RECORDS_IN-DOCNUM,
T_DATA_RECORDS_IN-SEGNUM,
T_DATA_RECORDS_IN-PSGNUM,
T_DATA_RECORDS_IN-HLEVEL.
modify t_data_records_in.
ENDLOOP.
ENDFORM. " DATA_RECORDS_WIPE
This is the code which is clearing all the PSGNUM and HLEVEL values. After coming out of this function module we are getting the error idocs created with disturbed hierarchy.
I need to create INBOUND Idocs with the data in ABAP program.
Please let me know if any inputs? Is there any function module existing to create Inbound Idocs inside an ABAP program?
Regards -
Call an ABAP program or a function module from command prompt/python script
Dear All,
I want to call a function module/ABAP program from command prompt or a python script.
Let me explain with an example.
There is a function module "z_add" that takes two integers as input parameters and generates their sum.
the sum is the output parameter.
Now i want to call this function module from command prompt / python script and pass parameters to this function module.
In return i must get the sum(i.e. the output of function module).
I tried using STARTRFC ,was able to call the FM but could not get the return value(output) from FM.
Can you please provide me the code of such a function module and the method to call it thereby passing parameters and getting the sum.
Thanks and regards,
Gaurav
Edited by: gauravkec2005 on Mar 4, 2010 7:41 AMthank you both! helpful answers! :o)
anyway!
i have written the program which is called from the SAPScript:
/: PERFORM GET_VATNUMBER IN PROGRAM ZFI_F140_OPERATIONS
/: USING &BKPF-BUKRS&
/: CHANGING &VATNUMBER&
CE VAT Registration No : &VATNUMBER&
REPORT zfi_f140_operations.
FORM get_vatnumber TABLES in_par STRUCTURE itcsy
out_par STRUCTURE itcsy.
DATA: lv_co_code TYPE bukrs,
lv_vat_no TYPE stceg.
READ TABLE in_par WITH KEY name = 'BKPF-BUKRS'.
MOVE in_par-value TO lv_co_code.
SELECT SINGLE stceg FROM t001
INTO lv_vat_no WHERE bukrs = lv_co_code.
out_par-name = 'VATNUMBER'.
WRITE lv_vat_no TO out_par-value.
CONDENSE out_par-value.
MODIFY out_par INDEX 1.
ENDFORM.
it is not working and i cannot work out why...
i have not been ABAPing for very long but have had a go....
any thoughts as to what i have done wrong?
or point me where i should be looking? thank you! -
ABAP Dump when calling Function Module Starting New Task
Hi all. I have a tricky situation now, I am doing a POC on parallel processing.
I am getting an ABAP dump on the following Call Function line which is in class lcl_steer_114numc (See below for full program):
METHOD start.
CALL FUNCTION 'Z_ZZCLS_STEER_114NUMC'
STARTING NEW TASK me->id
CALLING me->finish ON END OF TASK.
ENDMETHOD. "start
However I get the following ABAP dump:
Short text
Statement "CALL FUNCTION .. DESTINATION/STARTING NEW TASK/IN BACKGROUND TASK"
The function module only contains a wait statement to simulate parallel processing. It is strange that it dumps here, because when I change the FM call to another call that has been triggered successfully from other classes, it still produces the same ABAP dump.
The background of the Proof Of Concept is to see if I can get an event to trigger the next process that depends on the outcome of the previous process. Parallel processes are run in the start methods by calling RFC.
<Garbled code removed>
Moderator Message: Please post relevant portions of the code only.
Edited by: Suhas Saha on Jul 17, 2011 1:17 PMWell, the thing is I did manage to run 3 other Function Modules asynchronously succeesfully prior to that function call, with the same exact function call syntax. Further more, I have tried editing it with your suggestion but I get the exact same dump.
The complete function group can be downloaded here (slinkee file):
https://docs.google.com/leaf?id=0B3sua1Bw4XK4ZmFhNzcwMTgtYzQ0Mi00NzQ4LTg5YTMtNDNlNWUxYTM2NTg3&hl=en_US
The complete program can be downloaded here (slinkee file):
https://docs.google.com/leaf?id=0B3sua1Bw4XK4YWJmNjU3ODYtODRmMy00Nzg2LThkNTUtZjNkNDRhZGQ3MTUw&hl=en_US
The complete ST22 dump can be found here:
https://docs.google.com/leaf?id=0B3sua1Bw4XK4ZDU1YmFkZDAtOTU5MS00ZTgwLWFlZTktNWZhMDUxMzJlZWNl&hl=en_US
Basically I ST22 gives me the following:
Runtime Errors RPERF_ILLEGAL_STATEMENT
Date and Time 17.07.2011 05:29:54
|Short text |
| Statement "CALL FUNCTION .. DESTINATION/STARTING NEW TASK/IN BACKGROUND TASK" |
|What happened? |
| Error in the ABAP Application Program |
| |
| The current ABAP program "Z_ZZB1_CLOSE_PERIOD_TEST2" had to be terminated |
| because it has |
| come across a statement that unfortunately cannot be executed. |
And it explains it here (but is not helpful / relevant at all) as I ran the program from SE38.
|Error analysis |
| There is probably an error in the program |
| "Z_ZZB1_CLOSE_PERIOD_TEST2". |
| The program was probably called in a conversion exit |
| or in a field exit. These are implemented by |
| function modules called CONVERSION_EXIT_xxxxx_INPUT/OUTPUT or |
| USER_EXIT_xxxxx_INPUT. |
| Conversion exits are triggered during screen field transports or |
| WRITE statements, field exits during field transports from the |
| screen to the ABAP/4 program. |
| In this connection, the following ABAP/4 statements are not allowed: |
| |
I hope you try to download the slinkee files and you will notice the call function I performed was no different than the other call function RFC calls that really are working. -
IDOC with ABAP - PI Port , RFC Function module
Hi ,
I am creating outbound Idoc in one system, In the same system I am using a ABAP - PI port and assigned a RFC function module.
So when ever the outbound IDOC is created it will go to the port and triggers the RFC function module.
now my question is how to get the outbound IDOC number in the RFC function module.
I thought of reading the table EDIDC with message type, but all previous IDOC's aslo coming .
Regards
BhaskarHi Bhaskar, the IDOC control record or records are transfered to your function module in table paramater I_EDIDC. You could read the IDOC data by calling function modules EDI_DOCUMENT_OPEN_FOR_PROCESS and EDI_SEGMENTS_GET_ALL for each control record.
Regards Jack -
ABAP Programing help regarding function modules coding
Hi,
i'm currently creating a function module that retrieve a number from a table and add one to it and return back the value to the table.
the codes are as follow:
FUNCTION ZFM_NUMBER
" * " Local Interface:
" EXPORTING
" VALUE (ZZNUMBER) TYPE ZNUMBER
" VALUE (ZENUMBER) TYPE ZNUMBER
SELECT ZNUMBER FROM ZTAB_NUM into ZZNUMBER.
END SELECT.
ZENUMBER = ZZNUMBER + 1.
UPDATE ZTAB_NUM SET ZNUMBER = ZENUMBER WHERE ZNUMBER = ZZNUMBER.
END FUNCTION.
this function module works finely, but now i need to concatenate the number with the year to store it into another table.
i know something about the sysdatum where i select only the first 4 characters...but i'm not sure how could i do that?
do i need to create another function module to call the above function module and concatenate it with the year?
or i just need to continue the codes in the same function module?
and how should i code it?
i'm very new to abap coding and i could'nt get help from anyone in my team. your help is very much appreciated!!!
Thanks,
leesyyhi you can do it in the same function module.
SELECT ZNUMBER FROM ZTAB_NUM into ZZNUMBER.
END SELECT.
instead of the above statement use the following statement, it improves performance of your program
SELECT single ZNUMBER FROM ZTAB_NUM into ZZNUMBER.
in the above statement you can also specify some where condition
ZENUMBER = ZZNUMBER + 1.
UPDATE ZTAB_NUM SET ZNUMBER = ZENUMBER WHERE ZNUMBER = ZZNUMBER.
data: var_date type sy-datum,
var_yyyy(4) type c,
var_numyear(10) type c.
var_date = sy-datum.
var_yyyy = var_date+0(4).
concatenate ZENUMBER var_yyyy into var_numyear.
UPDATE ZTAB_NUMyear SET ZNUMyear = var_numyear WHERE ZNUMBER = ZZNUMBER.
Regards
Sajid
Edited by: shaik sajid on Jan 14, 2010 5:08 AM
Edited by: shaik sajid on Jan 14, 2010 5:09 AM -
Organization Management - Function module
Hi,
I am looking for function module to update the Sales organization data in Business partner transaction for the role Sold-to-party.
In BP transaction, for a business partner in role sold-to-party, we assign sales organization. I would like to know function module which could be used to assign/ change the Sales Org. assigned to a business partner.
Helpful answers would be rewarded!
Jash.Hi Doshi,
Check this FM : CRM_EMPLOYEE_GETORGUNIT. I am sure you should be able to read the organizational unit assigned to BP, but I am not sure whether you can update.
<b>Reward if helps</b>,
Regards,
Paul Kondaveeti -
HR-ABAP Any BAPI or Function module to update infotypes 167 & 170
Hi,
Can anyone let me know is there any BAPI or Function module to update infotypes 167(Health Plans) & 170(Flexible Spending Accounts).
Thanks,
SandeepHi,
U can use HR_BEN_CREATE_PLANS internally it calls HR infotype operation as specified by suresh.
Suresh : If there are approximately 3000 records to be updated on regular basis do u think is it better to use BAPI's or BDC
regards
Vick -
Hi Experts,
The following is the ABAP Code used in Function Module to extract Master Data from R/3 to BW.Could please convert that into human language (Explain logic of code)
FUNCTION MDEX_MATERIAL_MD .
""Lokale Schnittstelle:
*" IMPORTING
*" VALUE(I_REQUNR) TYPE SBIWA_S_INTERFACE-REQUNR OPTIONAL
*" VALUE(I_CHABASNM) TYPE SBIWA_S_INTERFACE-CHABASNM OPTIONAL
*" VALUE(I_MAXSIZE) TYPE SBIWA_S_INTERFACE-MAXSIZE OPTIONAL
*" VALUE(I_INITFLAG) TYPE SBIWA_S_INTERFACE-INITFLAG OPTIONAL
*" VALUE(I_UPDMODE) TYPE SBIWA_S_INTERFACE-UPDMODE OPTIONAL
*" VALUE(I_DATAPAKID) TYPE SBIWA_S_INTERFACE-DATAPAKID OPTIONAL
*" VALUE(I_S_TIMEINT) TYPE SBIWA_S_TIMEINT OPTIONAL
*" VALUE(I_RLOGSYS) TYPE SRSC_S_INTERFACE-RLOGSYS OPTIONAL
*" VALUE(I_PRIVATE_MODE) OPTIONAL
*" TABLES
*" I_T_SELECT TYPE SBIWA_T_SELECT OPTIONAL
*" I_T_FIELDS TYPE SBIWA_T_FIELDS OPTIONAL
*" E_T_BIW_MARA_S STRUCTURE BIW_MARA_S OPTIONAL
*" E_T_BIW_MARC_S STRUCTURE BIW_MARC_S OPTIONAL
*" E_T_BIW_MARD_S STRUCTURE BIW_MARD_S OPTIONAL
*" E_T_BIW_MVKE_S STRUCTURE BIW_MVKE_S OPTIONAL
*" E_T_BIW_MARM_S STRUCTURE BIW_MARM_S OPTIONAL
*" EXCEPTIONS
*" NO_MORE_DATA
*" ERROR_PASSED_TO_MESS_HANDLER
function acts as a S-API-compatible interface for the SD-extractor
MATERIAL_DYNAM_DATA_SELECTION
STATICS: L_FIRST_CALL TYPE SBIWA_FLAG,
L_NO_SELECT TYPE C.
DATA: L_SUBRC TYPE SBIWM_SUBRC.
DATA: L_T_CHABASCMP LIKE RSSOSFIELD OCCURS 0 WITH HEADER LINE,
L_S_REQUEST TYPE RSAP_S_REQUEST,
L_SLOGSYS LIKE TBDLS-LOGSYS,
L_RODCHABGEN LIKE RODCHABGEN,
L_LINES TYPE I,
L_TX_SELECT TYPE SBIWA_TX_SELECT,
L_T_SELECT TYPE SBIWA_T_SELECT,
L_S_SELECT TYPE SBIWA_S_SELECT.
DATA: L_T_MARA LIKE MARA OCCURS 10 WITH HEADER LINE,
L_T_MARC LIKE MARC OCCURS 10 WITH HEADER LINE,
L_T_MARD LIKE MARD OCCURS 10 WITH HEADER LINE,
L_T_MVKE LIKE MVKE OCCURS 10 WITH HEADER LINE,
L_T_MARM LIKE MARM OCCURS 10 WITH HEADER LINE.
DATA: L_S_MATNR_MATERIAL_KEYS LIKE PRE03,
L_S_WERKS_MATERIAL_KEYS LIKE PRE01,
L_S_LGORT_MATERIAL_KEYS LIKE PRE08,
L_S_VTLIN_MATERIAL_KEYS LIKE PRE10.
Variable to read compound information "note383430 insED08052001
DATA: i_chabasnm_cmp TYPE sbiwa_s_interface-chabasnm.
"note383430 insED08052001
IF I_INITFLAG = 'X'.
Initialization: check input parameters
buffer input parameters
prepare data selection
Invalid second initialization call -> error exit
IF NOT G_FLAG_INTERFACE_INITIALIZED IS INITIAL.
IF 1 = 2. MESSAGE E008(R3). ENDIF.
LOG_WRITE 'E' "message type
'R3' "message class
'008' "message number
' ' "message variable 1
' '. "message variable 2
RAISE ERROR_PASSED_TO_MESS_HANDLER.
ELSE.
G_FLAG_INTERFACE_INITIALIZED = SBIWA_C_FLAG_ON.
ENDIF.
Check for supported update mode
CASE I_UPDMODE.
WHEN SBIWA_C_UPDMODE_FULL.
WHEN SBIWA_C_UPDMODE_DELTAINIT.
WHEN SBIWA_C_UPDMODE_DELTA.
WHEN OTHERS.
IF 1 = 2. MESSAGE E011(R3). ENDIF.
LOG_WRITE 'E' "message type
'R3' "message class
'011' "message number
I_UPDMODE "message variable 1
' '. "message variable 2
RAISE ERROR_PASSED_TO_MESS_HANDLER.
ENDCASE.
Initialize variable to read compound information
i_chabasnm_cmp = i_chabasnm. "note383430 insED08052001
**Check InfoObject validity and set IO-dependent parameters
G_TAB1_FLG = G_TAB2_FLG = G_TAB3_FLG = G_TAB4_FLG = ' '.
g_tab5_flg = ' '. "note417314 insED04072001
G_NO_MARM = 'X'.
CASE I_CHABASNM.
WHEN '0MATERIAL'.
G_TAB1_FLG = 'X'.
G_TABLENAME = 'MARA'.
WHEN '0ARTICLE'. "note383430 insED30042001
G_TAB1_FLG = 'X'. "note383430 insED30042001
G_TABLENAME = 'MARA'. "note383430 insED30042001
i_chabasnm_cmp = '0MATERIAL'. "note383430 insED08052001
WHEN '0ME_MATERIAL'. "note759687
G_TAB1_FLG = 'X'. "note759687
G_TABLENAME = 'MARA'. "note759687
i_chabasnm_cmp = '0MATERIAL'. "note759687
WHEN '0MAT_PLANT'.
G_TAB2_FLG = 'X'.
G_TABLENAME = 'MARC'.
WHEN '0ART_PLANT'. "note383430 insED30042001
G_TAB2_FLG = 'X'. "note383430 insED30042001
G_TABLENAME = 'MARC'. "note383430 insED30042001
i_chabasnm_cmp = '0MAT_PLANT'. "note383430 insED08052001
WHEN '0MAT_ST_LOC'.
G_TAB3_FLG = 'X'.
G_TABLENAME = 'MARD'.
WHEN '0ART_ST_LOC'. "note383430 insED30042001
G_TAB3_FLG = 'X'. "note383430 insED30042001
G_TABLENAME = 'MARD'. "note383430 insED30042001
i_chabasnm_cmp = '0MAT_ST_LOC'. "note383430 insED08052001
WHEN '0MAT_SALES'.
G_TAB4_FLG = 'X'.
G_TABLENAME = 'MVKE'.
when '0ART_SALES'. "note383430 insED30042001 "delED
g_tab4_flg = 'x'. "note383430 insED30042001 "delED
g_tablename = 'MVKE'. "note383430 insED30042001 "delED
WHEN '0ART_SALES'. "insED
G_TAB4_FLG = 'X'. "insED
G_TABLENAME = 'MVKE'. "insED
i_chabasnm_cmp = '0MAT_SALES'. "note383430 insED08052001
WHEN '0MAT_UNIT'.
G_TAB1_FLG = 'X'. "note417314 delED04072001
g_tab5_flg = 'X'. "note417314 insED04072001
G_TABLENAME = 'MARM'.
G_NO_MARM = ' '.
WHEN OTHERS.
IF 1 = 2. MESSAGE E009(R3). ENDIF.
LOG_WRITE 'E' "message type
'R3' "message class
'009' "message number
I_CHABASNM "message variable 1
' '. "message variable 2
RAISE ERROR_PASSED_TO_MESS_HANDLER.
ENDCASE.
** fill parameter buffer for data extraction calls
G_S_EXTR_IF-REQUNR = I_REQUNR.
G_S_EXTR_IF-CHABASNM = I_CHABASNM.
G_S_EXTR_IF-MAXSIZE = I_MAXSIZE.
G_S_EXTR_IF-INITFLAG = I_INITFLAG.
G_S_EXTR_IF-UPDMODE = I_UPDMODE.
G_S_EXTR_IF-DATAPAKID = I_DATAPAKID.
g_s_interface-read_opt =.
G_S_INTERFACE-MAX_MATNR = I_MAXSIZE.
g_s_interface-max_lifnr =.
g_s_interface-max_kunnr =.
g_s_interface-max_werks =.
CASE I_UPDMODE.
WHEN SBIWA_C_UPDMODE_DELTA.
** settings for delta data transfer
** get additional information about current extraction
CALL FUNCTION 'RSAN_LOGSYS_DETERMINE'
EXPORTING
I_CLIENT = SY-MANDT
IMPORTING
E_LOGSYS = L_SLOGSYS.
L_S_REQUEST-SNDPRN = L_SLOGSYS.
L_S_REQUEST-RCVPRN = I_RLOGSYS.
*----- Fill Content release so get_rodchabgen will work ok -
PERFORM GET_BWBCRL IN PROGRAM SAPLRSAP "OSS 1054070/2000
USING L_S_REQUEST-RCVPRN "OSS 1054070/2000
CHANGING L_SUBRC. "OSS 1054070/2000
PERFORM GET_RODCHABGEN IN PROGRAM SAPLRSAP
USING L_RODCHABGEN
I_CHABASNM
L_S_REQUEST.
** get base characteristic information
PERFORM DETERMINE_COMPOSITES IN PROGRAM SAPLRSAM
TABLES L_T_CHABASCMP
USING I_CHABASNM.
USING i_chabasnm_cmp. "note383430 insED08052001
** Get information about modified data objects
PERFORM FILL_MD_SELECT_ENTRYTABLE IN PROGRAM SAPLRSAP
TABLES L_T_CHABASCMP
USING L_RODCHABGEN-MSGTYP
I_CHABASNM
CHANGING L_TX_SELECT
L_SUBRC.
DESCRIBE TABLE L_TX_SELECT LINES L_LINES.
IF L_LINES = 0.
L_NO_SELECT = 'X'.
ENDIF.
** fill key-table for extractor
REFRESH G_T_MATNR_MATERIAL_KEYS.
REFRESH G_T_WERKS_MATERIAL_KEYS.
REFRESH G_T_LGORT_MATERIAL_KEYS.
REFRESH G_T_VTLIN_MATERIAL_KEYS.
refresh g_t_marm_material_keys. "note417314 insED04072001
LOOP AT L_TX_SELECT INTO L_T_SELECT.
CASE I_CHABASNM.
WHEN '0MATERIAL' OR '0ARTICLE' "note383430 insED30042001
OR '0ME_MATERIAL'.
READ TABLE L_T_SELECT
INTO L_S_SELECT
WITH KEY FIELDNM = 'MATNR'.
L_S_MATNR_MATERIAL_KEYS-MATNR = L_S_SELECT-LOW.
APPEND L_S_MATNR_MATERIAL_KEYS TO G_T_MATNR_MATERIAL_KEYS.
WHEN '0MAT_PLANT' OR '0ART_PLANT'. "note383430 insED30042001
READ TABLE L_T_SELECT
INTO L_S_SELECT
WITH KEY FIELDNM = 'MATNR'.
L_S_WERKS_MATERIAL_KEYS-MATNR = L_S_SELECT-LOW.
READ TABLE L_T_SELECT
INTO L_S_SELECT
WITH KEY FIELDNM = 'WERKS'.
L_S_WERKS_MATERIAL_KEYS-WERKS = L_S_SELECT-LOW.
APPEND L_S_WERKS_MATERIAL_KEYS TO G_T_WERKS_MATERIAL_KEYS.
WHEN '0MAT_ST_LOC' OR '0ART_ST_LOC'.
"note383430 insED30042001
READ TABLE L_T_SELECT
INTO L_S_SELECT
WITH KEY FIELDNM = 'MATNR'.
L_S_LGORT_MATERIAL_KEYS-MATNR = L_S_SELECT-LOW.
READ TABLE L_T_SELECT
INTO L_S_SELECT
WITH KEY FIELDNM = 'WERKS'.
L_S_LGORT_MATERIAL_KEYS-WERKS = L_S_SELECT-LOW.
READ TABLE L_T_SELECT
INTO L_S_SELECT
WITH KEY FIELDNM = 'LGORT'.
L_S_LGORT_MATERIAL_KEYS-LGORT = L_S_SELECT-LOW.
APPEND L_S_LGORT_MATERIAL_KEYS TO G_T_LGORT_MATERIAL_KEYS.
WHEN '0MAT_SALES' OR '0ART_SALES'. "note383430 insED30042001
READ TABLE L_T_SELECT
INTO L_S_SELECT
WITH KEY FIELDNM = 'MATNR'.
L_S_VTLIN_MATERIAL_KEYS-MATNR = L_S_SELECT-LOW.
READ TABLE L_T_SELECT
INTO L_S_SELECT
WITH KEY FIELDNM = 'VKORG'.
L_S_VTLIN_MATERIAL_KEYS-VKORG = L_S_SELECT-LOW.
READ TABLE L_T_SELECT
INTO L_S_SELECT
WITH KEY FIELDNM = 'VTWEG'.
L_S_VTLIN_MATERIAL_KEYS-VTWEG = L_S_SELECT-LOW.
APPEND L_S_VTLIN_MATERIAL_KEYS TO G_T_VTLIN_MATERIAL_KEYS.
ENDCASE.
ENDLOOP.
IF L_SUBRC <> 0.
IF 1 = 2. MESSAGE E009(R3). ENDIF.
LOG_WRITE 'E' "message type
'R3' "message class
'009' "message number
I_CHABASNM "message variable 1
' '. "message variable 2
RAISE ERROR_PASSED_TO_MESS_HANDLER.
EXIT.
ENDIF.
** settings for full data transfer or delta init.
*----- Selektionsbedingungen müssen immer übernommen werden -
WHEN sbiwa_c_updmode_full "DEL"TH090800
OR sbiwa_c_updmode_deltainit. "DEL"TH090800
REFRESH g_t_sel_table. "DEL"TH090800
LOOP AT i_t_select INTO l_s_select. "DEL"TH090800
g_s_sel_table-table = g_tablename. "DEL"TH090800
g_s_sel_table-field = l_s_select-fieldnm. "DEL"TH090800
MOVE-CORRESPONDING l_s_select TO g_s_sel_table. "DEL"TH090800
APPEND g_s_sel_table TO g_t_sel_table. "DEL"TH090800
ENDLOOP. "DEL"TH090800
WHEN OTHERS.
ENDCASE.
*----- Selektionsbedingungen müssen immer übernommen werden -
REFRESH G_T_SEL_TABLE. "INS"TH090800
LOOP AT I_T_SELECT INTO L_S_SELECT. "INS"TH090800
G_S_SEL_TABLE-TABLE = G_TABLENAME. "INS"TH090800
G_S_SEL_TABLE-FIELD = L_S_SELECT-FIELDNM. "INS"TH090800
MOVE-CORRESPONDING L_S_SELECT TO G_S_SEL_TABLE. "INS"TH090800
APPEND G_S_SEL_TABLE TO G_T_SEL_TABLE. "INS"TH090800
ENDLOOP. "INS"TH090800
REFRESH G_T_FIELDS.
APPEND LINES OF I_T_FIELDS TO G_T_FIELDS.
ELSE. "Initialization mode or data extraction ?
IF ( G_MORE_DATA_EXISTS = ' ' ) AND ( G_COUNTER_DATAPAKID NE 0 ).
RAISE NO_MORE_DATA.
EXIT.
ENDIF.
IF G_S_EXTR_IF-UPDMODE = SBIWA_C_UPDMODE_DELTA.
IF NOT L_NO_SELECT IS INITIAL.
RAISE NO_MORE_DATA.
ENDIF.
ENDIF.
IF ( G_MORE_DATA_EXISTS = 'X' ) OR ( G_COUNTER_DATAPAKID = 0 ).
REFRESH L_T_MARA.
REFRESH L_T_MARC.
REFRESH L_T_MARD.
REFRESH L_T_MVKE.
REFRESH L_T_MARM.
CALL FUNCTION 'MATERIAL_DYNAM_DATA_SELECTION'
EXPORTING
NO_MARM_DATA = G_NO_MARM
READ_MARA_DATA = G_TAB1_FLG
READ_MARC_DATA = G_TAB2_FLG
READ_MARD_DATA = G_TAB3_FLG
READ_MVKE_DATA = G_TAB4_FLG
read_marm_data = g_tab5_flg "note417314 insED04072001
JOIN_OPTION = 'O'
IN_MAX_MATNR = G_S_INTERFACE-MAX_MATNR
TABLES
IN_SELECT_FIELDS = G_T_SEL_TABLE
IN_MATNR_KEYS = G_T_MATNR_MATERIAL_KEYS
IN_WERKS_KEYS = G_T_WERKS_MATERIAL_KEYS
IN_VTLIN_KEYS = G_T_VTLIN_MATERIAL_KEYS
IN_LGORT_KEYS = G_T_LGORT_MATERIAL_KEYS "insED22032001
in_marm_keys = g_t_marm_material_keys "note417314
"insED04072001
OUT_MARA_TAB = L_T_MARA
OUT_MARC_TAB = L_T_MARC
OUT_MARD_TAB = L_T_MARD
OUT_MVKE_TAB = L_T_MVKE
OUT_MARM_TAB = L_T_MARM
CHANGING
MORE_DATA_EXISTS = G_MORE_DATA_EXISTS
EXCEPTIONS
WRONG_INPUT_DATA = 1
OTHERS = 2
IF SY-SUBRC <> 0.
IF 1 = 2. MESSAGE E011(R3). ENDIF.
LOG_WRITE 'E' "message type
'R3' "message class
'011' "message number
SY-SUBRC "message variable 1
' '. "message variable 2
RAISE ERROR_PASSED_TO_MESS_HANDLER.
ENDIF.
G_COUNTER_DATAPAKID = G_COUNTER_DATAPAKID + 1.
LOOP AT L_T_MARA.
MOVE-CORRESPONDING L_T_MARA TO E_T_BIW_MARA_S.
APPEND E_T_BIW_MARA_S.
ENDLOOP.
LOOP AT L_T_MARC.
MOVE-CORRESPONDING L_T_MARC TO E_T_BIW_MARC_S.
provide additional attributes not contained in MARC
PERFORM MARC_ADD_ATTRIBUTES CHANGING E_T_BIW_MARC_S
L_SUBRC.
IF L_SUBRC <> 0.
IF 1 = 2. MESSAGE E501(R§). ENDIF.
"insED03082001 begin note216922
log_write 'W' "message type
'R§' "message class
'501' "message number
e_t_biw_marc_s-werks "message variable 1
' '. "message variable 2
"insED03082001 end note216922
"delED03082001 begin note216922
LOG_WRITE 'E' "message type
'R§' "message class
'501' "message number
E_T_BIW_MARC_S-WERKS "message variable 1
' '. "message variable 2
RAISE ERROR_PASSED_TO_MESS_HANDLER.
"delED03082001 end note2169222
ENDIF.
APPEND E_T_BIW_MARC_S.
ENDLOOP.
LOOP AT L_T_MARD.
MOVE-CORRESPONDING L_T_MARD TO E_T_BIW_MARD_S.
APPEND E_T_BIW_MARD_S.
ENDLOOP.
LOOP AT L_T_MVKE.
MOVE-CORRESPONDING L_T_MVKE TO E_T_BIW_MVKE_S.
APPEND E_T_BIW_MVKE_S.
ENDLOOP.
LOOP AT L_T_MARM.
MOVE-CORRESPONDING L_T_MARM TO E_T_BIW_MARM_S.
APPEND E_T_BIW_MARM_S.
ENDLOOP.
ENDIF.
ENDIF.
ENDFUNCTION.
ThanksHi,
This might not be the right forum for this. You can post your question in more relevant forum like Netweaver-Exchange Infrastructure. -
ABAP code which will use function module during field mapping in LSMW
Hi,
During field mapping in LSMW, for one of the field called field, I want to use a function module 'QF05_RANDOM_INTEGER', which will generate random numbers and map that random number to that field.
How do I write ABAP code which uses function module, during filed mapping for a particluar field in LSMW ?
Please help...
Regards,
Tushar.Hi Tushar,
You can write in FORM ROUTINE and LSMW.
I hope you know how to write ABAP code at field level.
If not ...
Come to change mode->select the field->Rule->ABAP Code
write a perform statement in ABAP code at field level.
<b>PERFORM test</b> using val
changing valu.
Go to Utilities(at menu)->switch layout-> extras ->select Layout->check Form routine-> it will display a FORM Routine... at bottom
this is the place where you can write some code for
<b> FORM test</b> using value
changing value1
FM call....
.ENDFORM
Get the value1 returned and use for the Field population.
Reward points if this Helps.
Manish
Message was edited by:
Manish Kumar -
BW/ABAP- Function module is called infinitely by Datasource Extractor.
Hi All,
A quick ABAP question related to Function Modules and BW data source extractors.
Ive written a function module to select data from a database and simply output the data as a table. I then created a text Datasource using transaction rso2 and set it to Extraction by Function Module.
When I test this using transaction rsa6, I can manipulate the number of calls to my function module using the Display Extra Calls field.
However, when I test this using transaction rsa1, my function module seems to be called infinite times. So, the number of records being retrieved is increasing exponentially and finally ends with a dump.
My question: Do I need to include something in my code such that the Function Module by itself will only be called once?
Or is there some configuration for the Datasource that will limit my function module call to once only.
Tried so far
Introducing a static variable in the function module that exits as soon as the value is greater than 1.
o Is there another way out?
Regards,
Preethi.You need to raise the EXEPTION NO_MORE_DATA afte the last record is populated in the output table. Otherwise the program goes into an infinite loop.
* From now on records get fetched from the database or gets read from the internal table
FETCH NEXT CURSOR v_cursor
APPENDING CORRESPONDING FIELDS
OF TABLE <internal table>
PACKAGE SIZE i_s_if-maxsize.
IF sy-subrc <> 0.
CLOSE CURSOR v_cursor.
RAISE no_more_data.
ENDIF.
* Populate the Output Data Structure into table E_T_DATA and you need to raise the EXEPTION NO_MORE_DATA and close the cursor to avoid any memory leaks -
What tech. do I need just to generate PDFs based on ABAP function modules
Hello,
We have mySAP ERP 2005 and Enterprise Portal 7. Until know we offered employees (in the portal) to print some "reports" such as travel data and payslip. We used the functionality to convert a spool job into a PDF in this case.
Now, we want to migrate to a more advanced way of generating the PDFs with the following advantages:
- template based design, better maintenance thus
- richer formatting
- option for integrating graphics
Our current technology is hard to maintain (mostly write() based reports...).
We do NOT want interactive forms as discussed here - but is it the same technology to use? I heard that you need a dedicated Adobe server for this and far as I know we just have a more or less default installation of mySAP ERP 2005 plus EP7 (so adding servers or other modifications e.g. opening new network ports should be avoided...).
When developing new PDFs, I want to go shure that we are using an up-to-date technology. I do not know if perhaps we should vote for Smartforms?
Instead of ABAP report we have function modules, so the technology should be able to call them in any way (directly, RFC or even JCo).
Thanks for any advice, regards,
TimoHello,
yes the SAP Interactive Forms by Adobe is the way to go, also in case of print forms.
The ADS can run on your existing J2EE engine, as long as it is installed on a plattform, what is released for ADS. http://service.sap.com/PAM
Kind regards,
Dezso -
ABAP Unit for Function Module(Function Group)
Hi, Gurus:
Can we use ABAP Unit to test Function Module(Function Group).
If can, give me a simple example. how to create methods. Thanks.
Regards,I'm a little unclear about your question, Yunfa.
Do you want to single-test a SE37 function-module? This can be easily done, just hit the F8 button, and it takes you to a single-test environment.
Do you want to test an FM using an ABAP-program? This too is easy to do. To code the FM-call, there's a button called Pattern, in the standard SE38 screen, where you can put in your FM name, and it inserts the relevant code in your program.
Note that if you're testing BAPIs using the single-test environment, the actual document posting will not happen, because that requires a BAPI_COMMIT_WORK call. So, the way to test BAPIs which post documents would be to write an SE38 program, which also calls the commit-bapi.
Hope this answers your question! -
Different types of function module
hi,
When we create a function module : in one of the tabs we can find
1 general function module
2. remote function module
3. update function module.
What is meant by update function module and remote function module. can anyone explain me with an example and when shd we opt for 2 and 3.
thanxs
hariFunction Modules:
Function modules allow you to encapsulate and reuse global functions in the R/3 System.
They are stored in a central library. The R/3 System contains a wide range of predefined
function modules that you can call from any ABAP program.
Unlike subroutines, you do not define function modules in the source code of your program.
Instead, you use the Function Builder. The actual ABAP interface definition remains hidden
from the programmer. You can define the input parameters of a function module as optional.
You can also assign default values to them. Function modules also support exception handling.
This allows you to catch certain errors while the function module is running. You can test
function modules without having to include them in a program using the Function Builder.
Function Groups:
Function groups are containers for function modules. You cannot execute a function group.
When you call a function module, the system loads the whole of its function group into the
internal session of the calling program.
Calling Function Modules in ABAP:
To call a function module, use the CALL FUNCTION statement:
CALL FUNCTION <module>
[EXPORTING f1 = a 1.... f n = a n]
[IMPORTING f1 = a 1.... f n = a n]
[CHANGING f1 = a 1.... f n = a n]
[TABLES f1 = a 1.... f n = a n]
[EXCEPTIONS e1 = r 1.... e n = r n [ERROR_MESSAGE = r E]
[OTHERS = ro]].
You can specify the name of the function module <module> either as a literal or a variable.
Each interface parameter <fi> is explicitly assigned to an actual parameter <a i>. You can
assign a return value <r i> to each exception <e i>. The assignment always takes the form
<interface parameter> = <actual parameter>. The equals sign is not an assignment operator
in this context.
After EXPORTING, you must supply all non-optional import parameters with values
appropriate to their type. You can supply values to optional import parameters if you
wish.
[email protected]
34
After IMPORTING, you can receive the export parameters from the function module by
assigning them to variables of the appropriate type.
After CHANGING or TABLES, you must supply values to all of the non-optional
changing or tables parameters. When the function module has finished running, the
changed values are passed back to the actual parameters. You can supply values to
optional changing or tables parameters if you wish.
You can use the EXCEPTIONS option to handle the exceptions of the function module. If an
exception <e i > is raised while the function module is running, the system terminates the
function module and does not pass any values from the function module to the program,
except those that were passed by reference. If <e i > is specified in the EXCEPTION option,
the calling program handles the exception by assigning <r i > to SY-SUBRC. <r i > must be a
numeric literal.
If you specify of ERROR_MESSAGE in the exception list you can influence the message
handling of function modules. Normally, you should only call messages in function modules
using the MESSAGE ... RAISING statement. With ERROR_MESSAGE you can force the system
to treat messages that are called without the RAISING option in a function module as follows
for various FM's
http://www.erpgenie.com/abap/functions.htm
Calling Function Modules
http://help.sap.com/saphelp_46c/helpdata/en/9f/db98ef35c111d1829f0000e829fbfe/content.htm
remote enabled fm's are BAPI's
refer
Introduction to BAPIs:
Definition
The SAP Business Objects held in the Business Object Repository (BOR) encapsulate their data
and processes. External access to the data and processes is only possible by means of specific
methods - BAPIs (Business Application Program Interfaces).
A BAPI is defined as a method of a SAP Business Object.
For example, the functionality that is implemented with the SAP Business Object type
"Material" includes a check for the materials availability. Thus, the Business Object type
"Material" offers a BAPI called "Material.CheckAvailability".
Use
To use a BAPI method, an application program only needs to know how to call the method;
that is, it needs to know the methods interface definition. Therefore, when including a BAPI
invocation in your application program, you only need to supply the appropriate interface
information.
A BAPI interface is defined by:
Import parameters, which contain data to be transferred from the calling program to
the BAPI
Export parameters, which contain data to be transferred from the BAPI back to the
calling program
Import/export (table) parameters for both importing and exporting data
Structure
The BAPIs in the R/3 System are currently implemented as function modules, all of which are
held in the Function Builder. Each function module underlying a BAPI:
Supports the Remote Function Call (RFC) protocol
Has been assigned as a method to an SAP Business Object in the BOR
Is processed without returning any screen dialogs to the calling application
Integration
The architecture enables SAP to change the details of a BAPIs implementation without
affecting external applications, which are using the BAPI.
Advantages of Using BAPIs
BAPIs are standardized methods of SAP Business Objects that enable customers and third
parties to integrate their software components with the R/3 System and the Business
Framework.
Business Standard
SAP Business Objects and their BAPIs provide a business content standard, rather than a
technical interoperability standard; that is, they enable the integration of R/3 and other
software components on a business level, not on a technical level.
[email protected]
97
Standards Conformance
BAPIs are being developed as part of the SAP joint initiative with customers, partners, and
leading standards organizations. BAPIs are becoming a communication standard between
business systems.
You can access SAP Business Objects and their BAPIs by using object-oriented interfacing
technologies such as Microsofts COM/DCOM (Component Object Model/Distributed Component
Object Model).
The SAP Business Objects already comply with the Open Applications Group (OAG)
specifications, and, in conjunction with ObjectBridge from VisualEdge, conform to the Object
Management Groups CORBA (Common Object Request Broker Architecture) guidelines.
Stability and Downward Compatibility
Once a BAPI is implemented and released by SAP, its interface definition and parameters
remain stable in the long term, thus ensuring that your application program remains
unaffected by any changes to the underlying R/3 software and data.
SAP can make any necessary extensions to the BAPIs, for example, additional optional
parameters, without destabilizing the operation of existing applications and, at the same time,
can offer the enhanced functionality to new applications.
Object Orientation
As methods of the SAP Business Objects, BAPIs provide access to R/3 data and processes
following an object-oriented programming model. BAPIs can be called using object-oriented
interfacing technologies, such as COM/DCOM, thus enabling software components from SAP
and third parties to interact freely.
Openness
You can access BAPIs from all development platforms that support the SAP Remote Function
Call (RFC) protocol.
BAPI Definition
A Business Application Programming Interface (BAPI) is a precisely defined interface providing
access to processes and data in business application systems such as R/3. BAPIs are defined
as API methods of SAP Business Objects. These business objects and their BAPIs are described
and stored in the Business Object Repository (BOR).
A BAPI is implemented, however, as a function module, that is stored and described in the
Function Builder.
BAPIs can be called within the R/3 System from external application systems and other
programs. BAPIs are the communication standard for business applications. BAPI interface
technology forms the basis for the following developments:
R/3 satellite systems
Isolating components within the R/3 System in the context of Business Framework
Distributed R/3 scenarios using Application Link Enabling (ALE)
Connecting R/3 Systems to the Internet using Internet Application Components (IACs)
Visual Basic programs as front-end to R/3 Systems
Workflow applications that extend beyond system boundaries
Customers and partners own developments
Connections to non-SAP software
Connections to legacy systems
[email protected]
98
Standardized BAPIs
Some BAPIs and methods provide basic functions and can be used for most SAP Business
Objects. Such BAPIs are known as "standardized" BAPIs.
Using the descriptions below as a guide, verify whether you can implement the BAPI as a
standardized BAPI.
Features
BAPIs for Reading Data
The following BAPIs provide you with read-only access to data in the associated business
object:
GetList
With this BAPI you can select a range of object key values, for example, company
codes and material numbers. To specify appropriate selection requirements the calling
program must pass the relevant parameters to the interface. The key values selected
by the BAPI GetList are returned to the calling program in a table, together with other
useful information, for example, short texts. The key values can then be passed on to
another BAPI for further processing, for example, the BAPI GetDetail, as listed below.
GetDetail
The BAPI GetDetail uses a key to retrieve details about an instance(s specific
occurrence) of a business object and returns this data to the calling program.
GetStatus
The BAPI GetStatus is used to query the status of an SAP Business Object, for
example, to display the processing status of a sales order. This BAPI is used only for
displaying the status of an object and does not retrieve full details like the BAPI
GetDetail.
ExistenceCheck
The BAPI ExistenceCheck checks, whether an entry exists for an SAP Business Object,
for example, whether the customer master has been created. You should implement
this method as a workflow method and not as a BAPI (RFC capable function module).
The method CompanyCode.ExistenceCheck of the business object CompanyCode
(BUS0002) is an example of this. This workflow method is indirectly invoked when the
calling program instantiates an object, for example, by using
GetSAPObject("CompanyCode") from within Visual Basic.
BAPIs for Creating or Changing Data
The following BAPIs can create, change or delete instances of a business object: If required,
you can implement these BAPIs so that, several instances of a business object can be created,
deleted or modified simultaneously in the same call. In such cases "multiple" is added to the
method name, for example ChangeMultiple.
BAPIs that can create, change or delete instances are:
Create or CreateFromData
The BAPI Create or CreateFromData creates an instance of an SAP Business Object,
for example, a sales order. Create is the preferred name for this BAPI. Use the name
CreateFromData only when a workflow method called Create already exists for the
business object in question.
[email protected]
99
Change
The BAPI Change changes an existing instance of a SAP Business Object, for example,
a sales order.
Delete
The BAPI Delete deletes an instance of a SAP Business Object, for example, sales
order.
BAPIs for Replicating Business Object Instances
The BAPIs below can be implemented as methods of business objects that can be replicated.
They enable specific instances of an object type to be copied to one or more different systems.
These BAPIs are used mainly to transfer data between distributed systems within the context
of Application Link Enabling (ALE).
The method below must be implemented for each business object to be replicated.
Replicate
The BAPI Replicate is called in the system, which contains the originals of the business
object instances to be replicated. It is used to:
Identify the business objects to be replicated and to organize the required data.
Call the clone methods described below in the receiving system
Moreover, at least one of the clone methods below must be implemented for each business
object to be replicated.
Clone
The BAPI Clone is used by a system to replicate one business object on another
system or to modify one business object that has already been cloned.
CloneMultiple
The BAPI CloneMultiple is used by a system to replicate several business objects on
another system or to modify several business objects that have already been cloned.
Defining and Implementing the BAPI
Purpose
Various components of the ABAP Workbench are used when you define and implement a BAPI.
A BAPI is an API method of a business object and is defined as such in the Business Object
Repository (BOR). However, a BAPI is implemented as an RFC capable function module, which
is maintained in the Function Builder. The definitions and descriptions of the data structures
used by the BAPI are stored in the ABAP Dictionary.
For function modules that implement BAPIs, certain standards and rules must be adhered to
over and above the standard programming rules for function modules. For example, COMMIT
WORK commands must not be used in the function modules that a BAPI is based on.
The following sections guide you through the steps involved in developing a BAPI. The sections
contain information about the guidelines and conventions that you should adhere to when
defining and implementing a BAPI. When implementing BAPIs follow the requirements below
to ensure you achieve consistent behavior and representation of BAPIs as object oriented
methods of SAP Business Objects.
[email protected]
100
BAPI Programming
BAPI Definition
A Business Application Programming Interface (BAPI) is a precisely defined interface providing
access to processes and data in business application systems such as R/3.
BAPIs are defined as API methods of SAP Objects. These objects and their BAPIs are described
and stored in the BOR (BOR).
Use
BAPIs can be called within the R/3 System from external application systems and other
programs. A BAPI call can either be made as an object oriented method call or as a remote
function call (RFC).
BAPIs are a global communication standard for business applications.
Examples of what BAPIs can be used for include:
R/3 satellite systems
Distributed R/3 scenarios using Application Link Enabling (ALE)
Connecting R/3 Systems to the Internet using Internet application components (IACs)
Visual Basic programs as front-end to R/3 Systems
Workflow applications that extend beyond system boundaries
Customers and partners own developments
Connections to non-SAP software
Connections to legacy systems
BOR Definition
The Business Object Repository (BOR) is the object-oriented repository in the R/3 System. It
contains, among other objects, SAP Business Objects and their methods. In the BOR a
Business Application Programming Interface (BAPI) is defined as an API method of an SAP
Business Object. Thus defined, the BAPIs become standard with full stability guarantees as
regards their content and interface.
Use
With regard to SAP Business Objects and their BAPIs, the BOR has the following functions:
Provides an object-oriented view of R/3 System data and processes.
R/3 application functions are accessed using methods (BAPIs) of SAP Business
Objects. Implementation information is encapsulated; only the interface functionality
of the method is visible to the user.
Arranges the various interfaces in accordance with the component hierarchy, enabling
functions to be searched and retrieved quickly and simply.
Manages BAPIs in release updates.
BAPI interface enhancements made by adding parameters are recorded in the BOR.
Previous interface versions can thus be reconstructed at any time. When a BAPI is
created the release version of the new BAPI is recorded in the BOR. The same applies
when any interface parameter is created.
The version control of the function module that a BAPI is based on is managed in the
Function Builder.
Ensures interface stability.
Any interface changes that are carried out in the BOR, are automatically checked for
syntax compatibility against the associated development objects in the ABAP
Dictionary.
[email protected]
101
Integration
You should only define a BAPI as a SAP Business Object method in the BOR if the function
module that the BAPI is based on has been fully implemented. Full access to the BOR is
restricted to the persons responsible for the objects involved and for quality control.
BOR-BAPI Wizard
The BOR-BAPI Wizard assists with creating new BAPI methods in the BOR. It takes you
through the creation process step by step.
Transaction Model for Developing BAPIs Purpose
The transaction model in which BAPIs are used determines how you have to program BAPIs.
The transaction model described here has been used to develop BAPIs for R/3 Releases 3.1
and 4.0A.
Logical Unit of Work (LUW) and Statelessness
Within the context of this transaction model a transaction represents one processing step or
one logical unit of work (LUW). When a transaction is called, database operations are either
fully executed or not at all. The whole transaction must be programmed to be stateless.
This transaction model requires that:
No data is imported that may indirectly affect the result. If a transaction is called more
than once, each call must have the same result. For BAPIs this means, for example,
that Set or Get parameters cannot be used. However, you can keep Customizing data
in a global memory, as this data remains unchanged even if transaction calls are
repeated.
There must be no functional dependencies between two transactions.
Either all relevant data has to be changed in the database or none at all.
Determining the SAP Business Object and Its Key Fields
You have to identify the relevant SAP Business Object in the Business Object Repository (BOR)
and determine whether the key fields of the Business Object are relevant for your BAPI.
A key is defined in the BOR for most SAP Business Objects. This key can consist of several key
fields. The content of these key fields uniquely identifies one individual instance of an SAP
Business Object.
You can differentiate between instance-dependent and instance-independent BAPI methods.
Unlike instance-independent methods, instance-dependent methods relate to one instance
(one specific occurrence) of an SAP Business Object type, for example to one specific sales
order.
In the case of instance-dependent BAPIs, the key fields of the corresponding SAP Business
Object must be used as parameters in the function module the BAPI is based on so that the
associated object instance can be identified. The names of the key fields in the SAP Business
Object and the corresponding parameters in the BAPI function module must be the same,
because the name links the key fields to the parameters.
All the key fields defined in the BOR for the SAP Business Object in question must be used as
the parameters in the function module.
Example
SAP Business Object Creditor has a key field named CreditorId.
This key field must be defined as a parameter with the name CREDITORID in the function
modules of the instant-dependent BAPIs for this Business Object.
[email protected]
102
To display the Business Object and its key fields follow the steps below:
1. Select Tools -> ABAP Workbench -> Overview -> Business Object Browser . The
business objects are displayed in the order of the R/3 application hierarchy.
2. Select the required SAP Business Object in the application hierarchy and double click it
to open it.
3. To display the Business Objects key fields, expand the node Key fields.
Defining the Interface Structure of the BAPI
In this step you are going to define the BAPI interface, that is, the individual import, export
and table parameters required for calling the BAPI.
Caution
You cannot use Changing and Exception parameters in a function module which implements a
BAPI.
Process Flow
To define the interface parameters, proceed as follows:
1. Check whether the key fields of the SAP Business Object are required in the interface. The
key fields of the SAP Business Object are some of the most important BAPI parameters.
If a key value is to be passed to the BAPI by the calling program, the key field must be set as
an import parameter in the function module of the BAPI. That way a specific instance of the
Business Object is identified.
For example, this could be a customer number (CustomerNo) in the BAPIs Customer.GetDetail
and Customer.CheckPassword, or the number of a sales document in the BAPI
SalesOrder.GetStatus.
For BAPIs that generate instances, for example, the BAPIs Create or CreateFromData, the key
field of the Business Object should be set as an export parameter in the BAPI function module.
These BAPIs return one key value, for example, an order number in the BAPI
SalesOrder.CreateFromData.
For BAPIs that are class methods a key field is neither set as an import nor as an export
parameter in the BAPI function module. Class methods are instance-independent and are
called without the use of key values. Usually they return a table with a selection of key values.
2. Specify what other data is relevant as import, export or table parameters for the BAPI.
Every BAPI must have an Export parameter return that reports messages back to the calling
program.
Example
The BAPI to be developed is to read data from the SAP Business Object Creditor. To read
creditor details, the calling program has to pass the ID of the creditor and the company code.
The creditor data returned is to include general details, specific details and bank details.
To map these requirements onto the BAPI interface, the following parameters must be set in
the function module which the BAPI is based on:
The key field CreditorID of the SAP Business Object as an import parameter
An import parameter for the company code
A Return parameter that reports messages back to the calling program
A parameter for general details of the creditor
A parameter for specific details of the creditor
A parameter for bank details of the creditor
for BAPI list
refer www.sapbapi.com
for FM's refer www.se37.com
regards
srinivas
<b>*reward for useful answers*</b> -
Exception on a select condition in a Function Module
Abap Experts,
I have function module. The selection conditions fails sometimes. Even if it fails I want to carry out the remaining part of the function module.
Wondering how to create a exception on a selection condition.
Any suggestions appreciated.
Many thanks in advance.
BWerDon't clear your problem.
Your function module is created by you?
if so, you can check the select result of select, like this:
SELECT XXXX
FROM XXX
WHERE ....
IF SY-SUBRC = 0.
SELECT SUCCESS
ELSE.
SELECT FAILED
ENDIF.
Does it what you want? if not, please explain more details about your problem.
Maybe you are looking for
-
Problem in Creating excel file from internal table
Hi Experts, here iam having a proble with creating an excel file from an internal table which is having around 15 records, when iam generating an excel file, its getting only upto 255 chars, after that its breaking and new record is being
-
Issue while uploading large size file to sharepoint
How to upload 2GB into sharepoint 2010 document library using client object model. Upto 150MB its working well. While uploading more than 150MB i faced this error-- system.outofmemory exception was thrown
-
VIDEO_TS to H.264 workflow
Hello, I would like to transcode a video DVD to an H.264 file in order to access it with Front Row. Any hints how to import the VIDEO_TS folder to Compressor 3? Thank you. Fernando
-
Pcipsy: cannot load driver in solaris 10
on a Sun SPARC Enterprise T5120 server install patches some details from 142909-17 kernel patch them, 144300-01 ln, cp patch, patch 145006-03 webmin and utilities patch 119254-76 and reboot the server to load the installed new patches could not start
-
Framemaker 12 - "Liste von" defekt?
Guten Tag, wenn ich diese Funktion auswähle und bei den Einstellungen "Importierte Grafiken" oder "ungelöste Querverweise" angebe, bekomme ich keine oder eine unvollständige Liste. Haben wir irgendwelche Einstellungen falsch? Oder ist das ein Bug in