Skip to Content

I still see a lot of misunderstandings about updating tables on several forums. There are even people doing direct table updates. Which for me is a case to get fired.

While doing updates on tables there are bapi’s avalaible for almost every table.

How to find a BAPI for Particular transaction?

For example we want to create some material in the material master.

-First execute transaction: MM01 to create the material master record.

-Go to:  <<< System >> <<< Status >>>

– Then double click on the field transaction

– In the next screen double click on Package

You will get the following screen:

Within the transaction BAPI you can find the right BAPI’s available via the previous spotted Application Component. It was LO-MD-MM.

 

 

 

The application component was LO-MD-MM, when clicking the object names.  you will see the application component. The object names Material, RetailMaterial and StandardMaterial, all have an application component LO-MD-MM.

 

 

When clicking on the Methods under the object names you will find the BAPI  available. Make sure that the Release status is Released.

I have now found the BAPI_MATERIAL_SAVEDAT. When I double click on the BAPI name, I am entering the BAPI and can read the ‘FUNCTION MODULE DOCUMENTATION’.

 

How can this BAPI update Custom fields?

 Up to now we only have found the BAPI which we can use. I now will demonstrate how it works with updating some Custom field (ZZFields). I am assuming that you will find your way in filling all the other structures.

 

 Good luck with it!

To report this post you need to login first.

13 Comments

You must be Logged on to comment or reply to a post.

  1. Steffen Froehlich
    Thanks for this blog! That’s an interessting example, but what’s up with BAPIs where I couldn’t find such external structure to put in various data (e.g. BAPI_PRODORDCONF_CREATE_TT)? This BAPI updates CAUFV. Append ZZ-Fields on CAUFV couldn’t be updated with this Standard-BAPI. So should it (and all other included BAPIs) be modified with such external structure?
    (0) 
    1. Guido Koopmann Post author
      Hi,

      In all enhancement-enabled BAPIs the parameter ExtensionIn can be used to extend import parameters and/or the parameter ExtensionOut can be used to extend export parameters.

      If BAPI table extensions cannot be used, you should insert customer exits in suitable places in the source code of the BAPI, to enable customers to program their own exits and to include them in the BAPI.

      http://help.sap.com/saphelp_45b/helpdata/en/b9/323056db5d11d1ad10080009b0fb56/frameset.htm

      It would be nice if all updating BAPI’s have the extensionin.

      Best regards,

      Guido Koopmann

      (0) 
  2. Adam Szigeti
    Hi,
    You wrote “Within the transaction BAPI you can find the right BAPI’s available via the previous spotted Application Component”.
    How can I query for BAPIs based on the Application Component?
    Thanks,
    Ádám
    (0) 
  3. Sandra Rossi
    Thank you for this blog. Just one remark about your example how to fill EXTENSIONIN. CONCATENATE won’t work well if the fields end with blanks. Instead, use the method indicated by SAP here: http://help.sap.com/saphelp_nw04/helpdata/en/6b/3f6d2b6d0711d396a50004ac96334b/frameset.htm

    Moreover, if you have lots of custom fields, you’ll have to fill also VALUEPART2 to VALUEPART4 components of EXTENSIONIN. In this wiki http://wiki.sdn.sap.com/wiki/display/ABAP/BAPI, that I added after your blog ;-), I provide a routine that you may call this way based on your example:

    DATA lwa_extensionin TYPE bapiparex.
    DATA lta_extensionin TYPE TABLE OF bapiparex.
    DATA lwa_extensioninx TYPE bapiparex.
    DATA lta_extensioninx TYPE TABLE OF bapiparex.
    DATA ls_bapi_te_mara TYPE bapi_te_mara.
    DATA ls_bapi_te_marax TYPE bapi_te_marax.

    lwa_extensionin-structure = ‘BAPI_TE_MARA’.
    ls_bapi_te_mara-material = lv_matnr.
    ls_bapi_te_mara-zzfld01  = lv_zzfld01.
    ls_bapi_te_mara-zzfld02  = lv_zzfld02.
    PERFORM transfer_to_extensionin USING ls_bapi_te_mara CHANGING lwa_extensionin.
    APPEND lwa_extensionin TO lta_extensionin.

    lwa_extensioninx-structure = ‘BAPI_TE_MARAX’.
    ls_bapi_te_marax-material = lv_matnr.
    ls_bapi_te_marax-zzfld01  = ‘X’.
    ls_bapi_te_marax-zzfld02  = ‘X’.
    PERFORM transfer_to_extensionin USING ls_bapi_te_marax CHANGING lwa_extensioninx.
    APPEND lwa_extensioninx TO lta_extensioninx.

    (0) 
    1. Guido Koopmann Post author
      Nice, that my blog has initiated you to write some follow up. Too bad it’s not OO. As subroutines will be absolute in the future. (TechEd 2008 Berlijn) ๐Ÿ˜‰
      (0) 
    2. Guido Koopmann Post author
      Nice, that my blog has initiated you to write some follow up. Too bad it’s not OO. As subroutines will be absolute in the future. (TechEd 2008 Berlijn) ๐Ÿ˜‰
      (0) 

Leave a Reply