Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

re:bapi

Former Member
0 Likes
355

Hi All,

can u pls help me out in the following issue?

iam very new to using bapi, i got the requirement to upload time data into sap using standard bapi BAPI_CATIMESHEETMGR_INSERT .

in this bapi the data import table have the fileds similar to the fields of catsdb table.but catsdb table also contains some customer fields, these fields doesnot exists in bapi's data import table.

so my question is i need to upload these customer fields also into sap using the same bapi,

how to use the extension in parameter to upload customer fields?

if possible send me the sample mcode also....

thanks in advance..

rahul

1 REPLY 1
Read only

uwe_schieferstein
Active Contributor
0 Likes
299

Hello Rahul

Customer-specific data are imported into the BAPI using the EXTENSIONIN parameter.

Within the BAPI you can see the following coding (on ECC 6.0):


...
  LOOP AT extensionin.
    CALL FUNCTION 'MAP2I_BAPICATS7_TO_CATS_EXT'
      EXPORTING
        extensionin = extensionin
      TABLES
        catsrecords = l_tcats_ext
      EXCEPTIONS
        error_line  = 1
        OTHERS      = 2.
    IF sy-subrc <> 0.
      CLEAR return.
      PERFORM bapi_return2_get
              USING
                 sy-msgty sy-msgid sy-msgno
                 sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
                 param_name_in l_tabix space
              CHANGING
                 return.
      APPEND return.
    ENDIF.
  ENDLOOP.
...

This mapping function module has the following coding:


FUNCTION MAP2I_BAPICATS7_TO_CATS_EXT.
*"----------------------------------------------------------------------
*"*"Lokale Schnittstelle:
*"  IMPORTING
*"     REFERENCE(EXTENSIONIN) LIKE  BAPICATS7 STRUCTURE  BAPICATS7
*"  TABLES
*"      CATSRECORDS STRUCTURE  CATS_EXT
*"  EXCEPTIONS
*"      ERROR_LINE
*"----------------------------------------------------------------------
  DATA: CUSTOM LIKE BAPI_TE_CATSDB.
  IF EXTENSIONIN-STRUCTURE = 'BAPI_TE_CATSDB'.
*    MOVE EXTENSIONIN+C_LENSTRUC TO CUSTOM. YCY
    PERFORM move_extension_to_custom
                USING
                   extensionin
                CHANGING
                   custom.

    READ TABLE CATSRECORDS INDEX CUSTOM-ROW.
    CATCH SYSTEM-EXCEPTIONS CONVERSION_ERRORS  = 1.
      MOVE-CORRESPONDING CUSTOM TO CATSRECORDS.
    ENDCATCH.
    IF SY-SUBRC <> 0.
      MESSAGE E327(LR) WITH CUSTOM-ROW RAISING ERROR_LINE.
    ENDIF.
    MODIFY CATSRECORDS INDEX CUSTOM-ROW.
  ENDIF.
ENDFUNCTION.

Thus, the structure for the EXTENSIONIN parameter is BAPI_TE_CATSDB (containing the customer include CI_CATSDB).

Most likely your custom fields need to be included into structure CATS_EXT, too, otherwise the MOVE-CORRESPONDING statement is useless.

The way how EXTENSIONIN parameters need to be filled is standardized and you should find useful documentation in the SAP online help.

Further reading: [BAPI Conventions|http://www.sap-img.com/abap/bapi-conventions.htm]

Regards

Uwe