09-18-2008 1:15 PM
Hi Experts,
I want to add new fields to a bapi, for example BAPI_RE_AO_CREATE, how can i do that?
Example: The fields are in z... (zzaltitude) in structure CI_VIBDAO which is found in table vibdao.
In this bapi there is an extention called EXTENSION_IN that i think i have to use, but i don't know how?
ANY IDEA??
Thanks
Mehdi,
09-18-2008 1:20 PM
Hi,
You need to add the fields in this extension structure referred in BAPi using SE11.
Thanks
Sudharshan
09-18-2008 1:30 PM
Hi,
The bapi's name BAPIPAREX and is like this: Component Type Component STRUCTURE | TE_STRUC CHAR 30 VALUEPART1 | VALUEPART CHAR 240 VALUEPART2 | VALUEPART CHAR 240 VALUEPART3 | VALUEPART CHAR 240 VALUEPART4 | VALUEPART CHAR 240 .....................
Do i have to add the fields where i put points (.....) or under STRUCTURE?
thanks
Mehdi,
09-18-2008 1:34 PM
Hi,
Check the below code....
DATA:
lt_extension_in TYPE TABLE OF bapiparex,
ls_extension_in TYPE bapiparex,
ci_data TYPE rebd_business_entity_ci.
fill values for user fields
ci_data-zzaltitude = <Your Value>.
prepare BAPI-parameter
ls_extension_in-structure = 'CI_DATA'.
use instead:
CALL METHOD cl_abap_container_utilities=> fill_container_c
EXPORTING
im_value = ci_data
IMPORTING
ex_container = ls_extension_in-valuepart1
EXCEPTIONS
OTHERS = 0.
APPEND ls_extension_in TO lt_extension_in.
Use lt_extension_in in your BAPI Function Module..
Rgds,
Bujji
Edited by: Bujji on Sep 18, 2008 2:35 PM
09-18-2008 3:16 PM
Basically you need to add the custom fields in the structure CI_DATA
Add. Data: Entry
Description
Separate table parameters are used for transferring user fields for BAPIs:
EXTENSION_IN for the CREATE-BAPI and CHANGE-BAPI for changing user fields
EXTENSION_OUT for the GET_DETAIL and GET_LIST BAPIs for reading user fields
The row type of the EXTENSION_IN and EXTENSION_OUT parameters is the DDIC structure BAPIPAREX. The values for the user fields need to be transferred as follows.
In the first STRUCTURE field, you need to transfer the CI_DATA character string. When processing the BAPI, the system uses this string to recognize user fields for basic data. The system supplies these user fields automatically without the customer being required to do any additional programming
In the VALUEPART1 field, transfer the values of all user fields based on length. If 240 characters are not sufficient, transfer the remaining data to the VALUEPART2 field, and so on as needed. The system regards the fields VALUEPART1 to VALUEPART4 as a character string with the length 960. The data is distributed over 4 fields for technical reasons only.
To enter basic data in the user fields, transfer one entry into the EXTENSION_IN table (with the value CI_DATA in the STRUCTURE field). Other entries are ignored at present. In a later release it will also be possible to supply data for customer-defined tables using BAPIs.
The following example shows the direct call of BAPIs with the transfer of user fields for the business entity. The example assumes that the CI include of the basic data table was extended for the business entity to include the fields ZZVALUE, ZZUNIT, and ZZAKTZEICHEN. ZZVALUE is of the type QUAN with 4 decimal places and ZZAKTZEICHEN of the type CHAR with the length 20.
Formatting parameter for CREATE and CHANGE BAPI:
DATA:
lt_extension_in TYPE TABLE OF bapiparex,
ls_extension_in TYPE bapiparex,
ls_ci_data TYPE rebd_business_entity_ci.
fill values for user fields
ls_ci_data-zzvalue = '4711.1234'.
ls_ci_data-zzunit = 'M2'.
ls_ci_data-zzaktzeichen = 'XY 987'.
prepare BAPI-parameter
ls_extension_in-structure = 'CI_DATA'.
doesn't work with unicode:
ls_extension_in-valuepart1 = ls_ci_data.
use instead:
CALL METHOD cl_abap_container_utilities=> fill_container_c
EXPORTING
im_value = ls_ci_data
IMPORTING
ex_container = ls_extension_in-valuepart1
EXCEPTIONS
OTHERS = 0.
APPEND ls_extension_in TO lt_extension_in.
call BAPI
CALL FUNCTION 'BAPI_RE_BE_CREATE'
EXPORTING
comp_code_ext =
business_entity_number_ext =
...
TABLES
extension_in = lt_extension_in
return =
.
Reading of user fields using GET_DETAIL-BAPI:
DATA:
lt_extension_out TYPE TABLE OF bapiparex,
ls_extension_out TYPE bapiparex,
ls_ci_data TYPE rebd_business_entity_ci.
CALL FUNCTION 'BAPI_RE_BE_GET_DETAIL'
EXPORTING
compcode =
businessentitynumber =
...
TABLES
extension_out = lt_extension_out
return =
.
READ TABLE lt_extension_out INTO ls_extension_out
WITH KEY structure = 'CI_DATA'.
IF sy-subrc = 0.
doesn't work with unicode:
ls_ci_data = ls_extension_out-valuepart1.
use instead
CALL METHOD cl_abap_container_utilities=> read_container_c
EXPORTING
im_container = ls_extension_out-valuepart1
IMPORTING
ex_value = ls_ci_data
EXCEPTIONS
OTHERS = 0.
ENDIF.
Thanks,
SKJ
09-18-2008 3:45 PM
I want to use this bapi in an LSMW, and my pb is in the step of mapping, when i mapped BAPIPAREX-STRUCTURE with the structure (where i added my fields) CI_VIBDAO and i mapped VALUEPART1 my value (123 for example) it doesn't work.
ANY IDEA?
Thanks,
09-19-2008 2:43 PM