Skip to Content

How to pass gross weight (MARA-BRGEW) to BAPI_MATERIAL_SAVEDATA

In my current project we are using the BAPI_MATERIAL_SAVEDATA to create and change material master data in SAP from a legacy application. The BAPI was working fine until we got to a point where we were required to populate net and gross weight for a material under Material Master -> basic data 1 view. We found that the BAPI has parameter called CLIENTDATA-NET_WEIGHT but there is no such parameter for gross weight. Upon contacting SAP I learnt that in order to pass Gross Weight (MARA-BRGEW), we need to pass a record in UNITOFMEASURE table for the base unit of measure along with the gross weight value and gross weight unit. Initially my understanding was that UNITOFMEASURE was to be used only for alternate units, which is true. I would not have guessed that we have to pass gross weight for base unit in this fashion unless SAP told me so. I have asked SAP to add this information in the BAPI documentation. The following screen image shows the values you need to pass for this case. Please like and rate this post if you find this information useful.

How to pass gross weight to BAPI.png

How to pass gross weight to BAPI.png
1 Comment
You must be Logged on to comment or reply to a post.
  • Thanks, it worked, but no need to populate UNITSOFMEASUREX-UNIT_OF_WT if you only want to maintain MARA-BRGEW.

    Code Snippet:

    clientdata-base_uom   = 'ST'.

    clientdatax-base_uom   = 'X'.

    clientdata-unit_of_wt   = 'G'.

    clientdatax-unit_of_wt   = 'X'.

    clientdata-net_weight   = 100.

    clientdatax-net_weight   = 'X'.

           <uom>-alt_unit   = clientdata-base_uom.
           <uom>-gross_wt = 150.
           APPEND INITIAL LINE TO lt_unitsofmeasurex ASSIGNING FIELD-SYMBOL(<uomx>).
           <uomx>-alt_unit   = clientdata-base_uom.
           <uomx>-gross_wt = abap_true.