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

BAPI_MATERIAL_SAVEDATA - BAPI_MARA-NET_WEIGHT

Former Member
0 Likes
1,935

Hello everyone,

I want to create new material with BAPI_MATERIAL_SAVEDATA. When I'm using mm01 I'm not entering NTGEW,PRDHA,GEWEI fields. But when fm calling it's throwing these fields are required fields. How can i do it that?

The field MARA-NTGEW/BAPI_MARA-NET_WEIGHT is defined as a required field; it does not contain an entry

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,551

Hello everyone,

I solved that problem but have new one . The FM is throwing the following error. Any idea?

ERROR

First create the valuation-type-independent data

9 REPLIES 9
Read only

Former Member
0 Likes
1,551

Read only

0 Likes
1,551

I'm already passing it. here is my code, where am I doing wrong?

headdata-ind_sector = tm_data-mbrsh.

     headdata-matl_type = tm_data-mtart.

     if tm_data-matnr ne space.

       headdata-material = tm_data-matnr.

     else.

       call function 'BAPI_MATERIAL_GETINTNUMBER'

         exporting

           material_type          = tm_data-mtart

          industry_sector        = tm_data-mbrsh

*           REQUIRED_NUMBERS       = 1

*         IMPORTING

*           RETURN                 =

         tables

           material_number        = materialnumber

                 .

       if materialnumber[] is not initial.

         read table materialnumber index 1.

         headdata-material = materialnumber-material.

       endif.

     endif.

     headdata-basic_view = 'X'.

*    headdata-sales_view = 'X'.

*    headdata-purchase_view = 'X'.

*    headdata-mrp_view = 'X'.

*    headdata-forecast_view = 'X'.

*    headdata-work_sched_view = 'X'.

*    headdata-prt_view = 'X'.

*    headdata-storage_view = 'X'.

*    headdata-warehouse_view = 'X'.

*    headdata-quality_view = 'X'.

*    headdata-account_view = 'X'.

*    headdata-cost_view = 'X'.

*    headdata-inp_fld_check = 'X'.

     materialdescription-langu = 'T'.

     materialdescription-langu_iso = 'TR'.

     materialdescription-matl_desc = tm_data-maktx.

     append materialdescription.

     clientdata-base_uom = tm_data-meins.

     clientdatax-base_uom = 'X'.

     call function 'UNIT_OF_MEASURE_SAP_TO_ISO'

       exporting

         sap_code = tm_data-meins

       importing

         iso_code = clientdata-base_uom_iso.

     if sy-subrc eq 0.

       clientdata-base_uom_iso = 'X'.

     endif.

     clientdata-matl_group = tm_data-matkl.

     clientdatax-matl_group = 'X'.

     clientdata-old_mat_no = tm_data-bismt.

     clientdatax-old_mat_no = 'X'.

     clientdata-item_cat = tm_data-mtpos_mara.

     clientdatax-item_cat = 'X'.

     clientdata-trans_grp = tm_data-tragr.

     clientdatax-trans_grp = 'X'.

     clientdata-po_unit = tm_data-bstme.

     clientdatax-po_unit = 'X'.

     if tm_data-bstme ne space.

       call function 'UNIT_OF_MEASURE_SAP_TO_ISO'

         exporting

           sap_code = tm_data-bstme

         importing

           iso_code = clientdata-po_unit_iso.

       if sy-subrc eq 0.

         clientdatax-po_unit_iso = 'X'.

       endif.

     endif.

     clientdata-unit_of_wt = 'KG'.

     call function 'UNIT_OF_MEASURE_SAP_TO_ISO'

       exporting

         sap_code = 'KG'

       importing

         iso_code = clientdata-unit_of_wt_iso.

     clientdatax-unit_of_wt = 'X'.

     clientdatax-unit_of_wt_iso = 'X'.

     clientdata-net_weight = '0.00'.

     clientdatax-net_weight = 'X'.

     plantdata-plant = tm_data-werks.

     plantdatax-plant = tm_data-werks.

     plantdata-loadinggrp = tm_data-ladgr.

     plantdatax-loadinggrp = 'X'.

     plantdata-pur_group = tm_data-ekgrp.

     plantdatax-pur_group = 'X'.

     plantdata-mrp_type = tm_data-dismm.

     plantdatax-mrp_type = 'X'.

     plantdata-mrp_ctrler = tm_data-dispo.

     plantdatax-mrp_ctrler = 'X'.

     plantdata-lotsizekey = tm_data-disls.

     plantdatax-lotsizekey = 'X'.

     plantdata-proc_type = tm_data-beskz.

     plantdatax-proc_type = 'X'.

     plantdata-sm_key = tm_data-fhori.

     plantdatax-sm_key = 'X'.

     plantdata-safety_stk = tm_data-eisbe.

     plantdatax-safety_stk = 'X'.

     plantdata-production_scheduler = tm_data-fevor.

     plantdatax-production_scheduler = 'X'.

     plantdata-prodprof = tm_data-sfcpf.

     plantdatax-prodprof = 'X'.

     plantdata-profit_ctr = tm_data-prctr.

     plantdatax-profit_ctr = 'X'.

     plantdata-lot_size = tm_data-losgr.

     plantdatax-lot_size = 'X'.

     plantdata-round_val = tm_data-bstrf.

     plantdatax-round_val = 'X'.

     plantdata-plnd_delry = tm_data-plifz.

     plantdatax-plnd_delry = 'X'.

     plantdata-pl_ti_fnce = 0.

     plantdata-pl_ti_fnce = 'X'.

     storagelocationdata-stge_bin = tm_data-lgpbe.

     storagelocationdatax-stge_bin = 'X'.

     storagelocationdata-plant = tm_data-werks.

     storagelocationdatax-plant = tm_data-werks.

     storagelocationdata-stge_loc = tm_data-lgort.

     storagelocationdatax-stge_loc = tm_data-lgort.

call function 'BAPI_MATERIAL_SAVEDATA'

           exporting

             headdata             = headdata

             clientdata           = clientdata

             clientdatax          = clientdatax

             plantdata            = plantdata

             plantdatax           = plantdatax

             storagelocationdata  = storagelocationdata

             storagelocationdatax = storagelocationdatax

*           valuationdata        = valuationdata

*           valuationdatax       = valuationdatax

           importing

             return               = ls_return

           tables

             materialdescription  = ekveri

             unitsofmeasure       = olcu

             unitsofmeasurex      = unitsofmeasurex

             taxclassifications   = taxclassifications.


Read only

0 Likes
1,551

Hi

I see that you are marking the field

"clientdatax-net_weight = 'X'."

Why mark it if you  are not transferrign any value.

Do not pass X to that field

It might work.

Regards,

Vamsi

Read only

Former Member
0 Likes
1,551

Hi Ahmet,

Create a material using MM01 and Check in MARA Table , is above fields having some default value to the respective material number and material type.

Which material type you are create using BAPI and MM01 T-code ?

or is any BADI Implemented like "BADI_MATERIAL_CHECK "  for above field ?

Regard's

Smruti

Read only

Former Member
0 Likes
1,552

Hello everyone,

I solved that problem but have new one . The FM is throwing the following error. Any idea?

ERROR

First create the valuation-type-independent data

Read only

0 Likes
1,551

Are you passing valuation data  into BAPI_MATERIAL_SAVEDATA,

VALUATIONDATA-VAL_TYPE          ??

VALUATIONDATAX-VAL_TYPE         ??

Regard's

Smruti

Read only

0 Likes
1,551

Yes

  valuationdata-val_area = tm_data-werks. "1002

valuationdata-val_type = tm_data-bwtty.  " B

valuationdatax-val_area = tm_data-werks. "1002

valuationdatax-val_type = tm_data-bwtty.  "B

Read only

0 Likes
1,551

I hope you check once Variable Mapping is wrong , you are trying to assign Valuation Category to Valuation Type of BAPI Parameter .

valuationdata-val_type       " Valuation Type


bwtty                            "Valuation Category


check with below code ...

valuationdata-val_area = tm_data-werks. "1002

valuationdata-VAL_CAT = tm_data-bwtty.  " B

valuationdatax-val_area = tm_data-werks. "1002

valuationdatax-VAL_CAT = tm_data-bwtty.  " X

Regard's

Smruti


Read only

Former Member
0 Likes
1,551

I solved with your help, thank you for helping.