Complete the following steps to use an SAP function in the ABAP program flow:
Import the SAP function in the Source Analyzer.
Insert the SAP function in the ABAP program flow.
Assign values and variables to function parameters.
Generate the ABAP program.
For example, you have a source table that contains company codes and information about each company. You want to get details about each company based on the company code. Use the SAP function BAPI_COMPANYCODE_GETDETAIL to get the information.
Complete the following steps to use the SAP function BAPI_COMPANYCODE_GETDETAIL:
Import the SAP function in the Source Analyzer.
The Source Analyzer displays the following parameters for BAPI_COMPANYCODE_GETDETAIL:
Scalar input parameter: CompanyCodeID
Scalar output parameters: CompanyCode_Detail, CompanyCode_Address, and Return
Insert the SAP function into the ABAP program flow.
The ABAP program flow in the Application Source Qualifier shows objects in the ABAP program. Insert BAPI_COMPANYCODE_GETDETAIL below the source table in the ABAP program flow.
Assign values to function parameters.
You want to get details about each company based on the company code. Assign the source field that contains company code to the scalar input parameter CompanyCodeID.
Based on the company code, the SAP function gets details about each company and company address. The results of the function are the scalar output parameters CompanyCode_Detail and CompanyCode_Address. You need variables to hold the results of the function. You create a variable called VAR1 and assign it to CompanyCode_Detail. Create another variable and assign it CompanyCode_Address.
Generate the ABAP program.
When you generate the ABAP program, the Designer generates a CALL FUNCTION statement to call the SAP function.