P. 1
A Tutorial on BAPI

A Tutorial on BAPI

|Views: 5,453|Likes:
Published by api-27047119

More info:

Published by: api-27047119 on Oct 18, 2008
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

10/07/2014

pdf

text

original

This example function module implements the BAPI CompanyCode.GetDetail of the SAP
Business Object CompanyCode (BUS0002).

The BAPI CompanyCode.GetDetail reads details of a company code.

Note the following in the source code:

• The name of the function module is in the format: BAPI_<Business Object
name
>_<Method name>.

• Specific BAPI data structures are used, identified by the prefix BAPI.
• The key field parameter "COMPANYCODEID" is defined as the import parameter.
• The function module performs authorization checks.
• The function module covers all exceptions.

Source Code:

function bapi_companycode_getdetail.

*"------------------------------------------------------

*"*"Local interface:

*" IMPORTING

*" VALUE(COMPANYCODEID) LIKE BAPI0002_2-COMP_CODE

*" EXPORTING

*" VALUE(COMPANYCODE_DETAIL) LIKE BAPI0002_2

*" STRUCTURE BAPI0002_2

*" VALUE(COMPANYCODE_ADDRESS) LIKE BAPI0002_3

*" STRUCTURE BAPI0002_3

*" VALUE(RETURN) LIKE BAPIRETURN

*" STRUCTURE BAPIRETURN

*"------------------------------------------------------

...

* authority check: S_TABU_DIS V_T001

perform check_authority_t001 changing return.

check return is initial.

* company code

call function 'FI_COMPANY_CODE_DATA'

exporting

i_bukrs = companycodeid

importing

e_t001 = t001

exceptions

error_message = 1

others = 0.

if sy-subrc ne 0.

perform set_return using '10' changing return.

endif.

check return-code is initial.

...

endfunction.

_________ __________________________________________________________________
27

A Tutorial on Business Application Programming Interface_____________________________

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->