Application Development 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: 

BAPI_MASTER_SAVEDATA

Former Member
0 Kudos

Hi Friends

I am using bapi_master_savedata. I am getting this error "Field Matnr has been transferred inconistently or is blank"

What can be the cause of this

Thanks and Regards

Neha Kapoor

1 ACCEPTED SOLUTION

Former Member
0 Kudos

See this sample code

report zrich_0003 .

data: headdata type bapimathead.

data: clientdata type bapi_mara.

data: clientdatax type bapi_marax.

data: descdata type table of BAPI_MAKT with header line.

data: return type bapiret2 .

data: returnm type table of bapi_matreturn2 with header line.

data: xmara type mara.

parameters: p_matnr type mara-matnr.

headdata-material = p_matnr.

headdata-ind_sector = 'M'.

headdata-matl_type = 'FERT'.

headdata-basic_view = 'X'.

clientdata-BASE_UOM = 'EA'.

clientdatax-BASE_UOM = 'X'.

clientdata-old_mat_no = 'Old Material'.

clientdatax-old_mat_no = 'X'.

clientdata-division = '00'.

clientdatax-division = 'X'.

descdata-LANGU = sy-langu.

descdata-MATL_DESC = 'This is the description'.

append descdata.

call function 'BAPI_MATERIAL_SAVEDATA'

exporting

headdata = headdata

clientdata = clientdata

clientdatax = clientdatax

  • PLANTDATA =

  • PLANTDATAX =

  • FORECASTPARAMETERS =

  • FORECASTPARAMETERSX =

  • PLANNINGDATA =

  • PLANNINGDATAX =

  • STORAGELOCATIONDATA =

  • STORAGELOCATIONDATAX =

  • VALUATIONDATA =

  • VALUATIONDATAX =

  • WAREHOUSENUMBERDATA =

  • WAREHOUSENUMBERDATAX =

  • SALESDATA =

  • SALESDATAX =

  • STORAGETYPEDATA =

  • STORAGETYPEDATAX =

importing

return = return

tables

MATERIALDESCRIPTION = descdata

  • UNITSOFMEASURE =

  • UNITSOFMEASUREX =

  • INTERNATIONALARTNOS =

  • MATERIALLONGTEXT =

  • TAXCLASSIFICATIONS =

returnmessages = returnm

  • PRTDATA =

  • PRTDATAX =

  • EXTENSIONIN =

  • EXTENSIONINX =

.

check sy-subrc = 0.

Check these links, these might help you..

Regards,

Pavan

3 REPLIES 3

raymond_giuseppi
Active Contributor
0 Kudos

For your material type is field MATNR incremented internally or externally input?

If it is internally incremented find the number first before calling the BAPI_MATERIAL_SAVEDATA.

           CALL FUNCTION 'BAPI_STDMATERIAL_GETINTNUMBER'
               EXPORTING
                  MATERIAL_TYPE        =   headdata-matl_type
                  INDUSTRY_SECTOR      =   headdata-ind_sector
                  REQUIRED_NUMBERS     =   1
               IMPORTING
                   RETURN              =  t_return1
              TABLES
                  MATERIAL_NUMBER      =   t_matnr.

Regards

Former Member
0 Kudos

See this sample code

report zrich_0003 .

data: headdata type bapimathead.

data: clientdata type bapi_mara.

data: clientdatax type bapi_marax.

data: descdata type table of BAPI_MAKT with header line.

data: return type bapiret2 .

data: returnm type table of bapi_matreturn2 with header line.

data: xmara type mara.

parameters: p_matnr type mara-matnr.

headdata-material = p_matnr.

headdata-ind_sector = 'M'.

headdata-matl_type = 'FERT'.

headdata-basic_view = 'X'.

clientdata-BASE_UOM = 'EA'.

clientdatax-BASE_UOM = 'X'.

clientdata-old_mat_no = 'Old Material'.

clientdatax-old_mat_no = 'X'.

clientdata-division = '00'.

clientdatax-division = 'X'.

descdata-LANGU = sy-langu.

descdata-MATL_DESC = 'This is the description'.

append descdata.

call function 'BAPI_MATERIAL_SAVEDATA'

exporting

headdata = headdata

clientdata = clientdata

clientdatax = clientdatax

  • PLANTDATA =

  • PLANTDATAX =

  • FORECASTPARAMETERS =

  • FORECASTPARAMETERSX =

  • PLANNINGDATA =

  • PLANNINGDATAX =

  • STORAGELOCATIONDATA =

  • STORAGELOCATIONDATAX =

  • VALUATIONDATA =

  • VALUATIONDATAX =

  • WAREHOUSENUMBERDATA =

  • WAREHOUSENUMBERDATAX =

  • SALESDATA =

  • SALESDATAX =

  • STORAGETYPEDATA =

  • STORAGETYPEDATAX =

importing

return = return

tables

MATERIALDESCRIPTION = descdata

  • UNITSOFMEASURE =

  • UNITSOFMEASUREX =

  • INTERNATIONALARTNOS =

  • MATERIALLONGTEXT =

  • TAXCLASSIFICATIONS =

returnmessages = returnm

  • PRTDATA =

  • PRTDATAX =

  • EXTENSIONIN =

  • EXTENSIONINX =

.

check sy-subrc = 0.

Check these links, these might help you..

Regards,

Pavan

Former Member
0 Kudos

Hi,

The following error comes when the value of the matnr is empty or the value you have specified does not match with the structure.

Thanks,

Srinivas