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_MATERIAL_SAVEDATA -> Can't change Material Description

michael_fallenbchel
Active Participant
0 Kudos

Hi experts,

I try to change material description using the BADI BAPI_MATERIAL_SAVEDATA.

For header data I enter the material number, then MATERIALDESCRIPTION with the new text + language.

When I try to execute, i got the following Retunr Message:

MK 102 Trying to create: 6694 ____ ____ ____ __________ ____ __ ___ ___

MG 160 The material cannot be maintained since no maintainable data transferred

MK 103 Trying to change: 6694 ____ ____ ____ __________ ____ __ ___ ___

M3 810 No changes made

What is wrong here?

1 ACCEPTED SOLUTION

Former Member
0 Kudos

along with material no, you also give material description, material group, unit of measure, werks(plant), material type. u pass these minimum parameters in bapi and it will work fine. I faced a similar issue.

53 REPLIES 53

Former Member
0 Kudos

Hi,

Can you check whether the material has any views avaliable..I think if no views are maintained for the material you may not able to provide the data.

Regards,

Aditya

0 Kudos

Hi,

sorry, forget to mention:

In the HEADDATA I fill this fields:

MAETERIAL 6694

BASIC_VIEW X

MATERIALDESCRIPTION

LANGU D

MATL_DESC TEST

0 Kudos

Hi,

You should also fill below three parameters in HEADDATA structure.

MATERIAL

IND_SECTOR

MATL_TYPE

Regards,

Ganga

0 Kudos

Hi Ganga,

i tried with filling MATERIAL, IND_SECTOR, MATL_TYPE - nothing happened, exactly the same return message:

H MK 102 Trying to create: 6694 ____ ____ ____ __________ ____ __ ___ ___

S MG 160 The material cannot be maintained since no maintainable data transferred

H MK 103 Trying to change: 6694 ____ ____ ____ __________ ____ __ ___ ___

S M3 810 No changes made

0 Kudos

Did you fill below three fields in MAKT table?

LANGU

LANGU_ISO

MATL_DESC

It worked fine for me. You were showing messages of type 'S'. Check if change has been reflected in material master.

Regards,

Ganga

0 Kudos

Sure, I filled all fileds:

LANGU DE

LANGU_ISO DE

MATL_DESC TEST

Tried also with D...nothing happens, everytime the same error...

0 Kudos

Pass some other text as description and check if the change is reflected in MAKT. It worked perfectly fine for me. It seems like you were passing the same text which is currently in DB as description.

Remember that this BAPI returns success messages as well. Check whether you are getting success or error message finally.

Regards,

Ganga

0 Kudos

No change, nothing happens!

I can enter whatever I want - the text won't be changed.

But there's something curious:

The first time I tried using this BADI, chaning works fine (I can see in the changes, last one by MM01(BAPI)).

But since the second run of the BADI I got this retunr messages as posted before.

I tried it with another material - but the same...

Can't believe

0 Kudos

This message was moderated.

0 Kudos

Hi Dimar,

I made the BAPI_TRANSACTION_COMMIT - no result...

0 Kudos

Plz can you post how you are filling structures and tables and also your BAPI calling, specially if it's in a loop.

thanks

0 Kudos

Here's my coding:

Here I made a loop over my ALV where I can change the MAKTX:

FORM verbuchen .

  LOOP AT t_out_daten INTO t_int_daten.

    SELECT SINGLE * FROM  makt
           WHERE  matnr  = t_int_daten-matlg
           AND    spras  = 'DE'.
    IF sy-subrc = 0.
      CHECK t_int_daten-maktx NE makt-maktx.
      PERFORM kurztext_aendern.
    ENDIF.

  ENDLOOP.

ENDFORM. 

And here I try to update it:

FORM kurztext_aendern .

data: i_client like bapi_mara,
      i_clientx like bapi_marax.

  clear: i_return, i_headdata.
  refresh: it_returnmessages.

i_headdata-material    = t_int_daten-matlg.
i_headdata-basic_view  = 'X'.

wa_bapimakt-langu      = sy-langu.
wa_bapimakt-MATL_DESC  = t_int_daten-maktx.
append wa_bapimakt to it_bapimakt.

CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
  EXPORTING
   headdata                   = i_headdata
   CLIENTDATA                 = i_client
   CLIENTDATAX                = i_clientx
*   PLANTDATA                  =
*   PLANTDATAX                 =
*   FORECASTPARAMETERS         =
*   FORECASTPARAMETERSX        =
*   PLANNINGDATA               =
*   PLANNINGDATAX              =
*   STORAGELOCATIONDATA        =
*   STORAGELOCATIONDATAX       =
*   VALUATIONDATA              =
*   VALUATIONDATAX             =
*   WAREHOUSENUMBERDATA        =
*   WAREHOUSENUMBERDATAX       =
*   SALESDATA                  =
*   SALESDATAX                 =
*   STORAGETYPEDATA            =
*   STORAGETYPEDATAX           =
*   FLAG_ONLINE                = 'X'
*   FLAG_CAD_CALL              = ' '
*   NO_DEQUEUE                 = ' '
*   NO_ROLLBACK_WORK           = ' '
 IMPORTING
   RETURN                     = i_return
 TABLES
   MATERIALDESCRIPTION        = it_bapimakt
*   UNITSOFMEASURE             =
*   UNITSOFMEASUREX            =
*   INTERNATIONALARTNOS        =
*   MATERIALLONGTEXT           =
*   TAXCLASSIFICATIONS         =
   RETURNMESSAGES             = it_returnmessages.
*   PRTDATA                    =
*   PRTDATAX                   =
*   EXTENSIONIN                =
*   EXTENSIONINX               =.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'  .


ENDFORM. 

I tried with filled IND_SECTOR and MATL_TYPE and this way - everytime the same result

0 Kudos

Hi,

Don't pass client and clientx parameters. Make sure to fill the 6 fields which I mentioned in my earlier posts.

Regards,

Ganga

0 Kudos

I will try once more - I only added this to test...

I will give it a try

0 Kudos

OK.... I can see your problem is not Material Description. You are calling that BAPI and you are passing CLIENTDATA and CLIENTDATAX, both structures are empty that's why your error says that cannot change anything because anything has been passed.

Glück!!!

0 Kudos

Last try:

I made a new program, this is the coding:

REPORT  ztest_bapi.

DATA: i_client LIKE bapi_mara,
      i_clientx LIKE bapi_marax.

DATA: wa_bapimakt TYPE bapi_makt.

DATA: it_returnmessages TYPE STANDARD TABLE OF bapiret2,
      i_return TYPE bapiret2,
      i_headdata TYPE bapimathead,
      it_bapimakt TYPE STANDARD TABLE OF bapi_makt.

CLEAR: i_return, i_headdata.
REFRESH: it_returnmessages.


i_headdata-material    = '6694'.
UNPACK i_headdata-material TO i_headdata-material.
i_headdata-basic_view  = 'X'.
i_headdata-ind_sector = 'M'.
i_headdata-matl_type = 'FERT'.

wa_bapimakt-langu      = sy-langu.
wa_bapimakt-matl_desc  = 'NEW TEXT'.
APPEND wa_bapimakt TO it_bapimakt.


CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
  EXPORTING
   headdata                   = i_headdata
*   clientdata                 = i_client
*   clientdatax                = i_clientx
*   PLANTDATA                  =
*   PLANTDATAX                 =
*   FORECASTPARAMETERS         =
*   FORECASTPARAMETERSX        =
*   PLANNINGDATA               =
*   PLANNINGDATAX              =
*   STORAGELOCATIONDATA        =
*   STORAGELOCATIONDATAX       =
*   VALUATIONDATA              =
*   VALUATIONDATAX             =
*   WAREHOUSENUMBERDATA        =
*   WAREHOUSENUMBERDATAX       =
*   SALESDATA                  =
*   SALESDATAX                 =
*   STORAGETYPEDATA            =
*   STORAGETYPEDATAX           =
*   FLAG_ONLINE                = 'X'
*   FLAG_CAD_CALL              = ' '
*   NO_DEQUEUE                 = ' '
*   NO_ROLLBACK_WORK           = ' '
 IMPORTING
   return                     = i_return
 TABLES
   materialdescription        = it_bapimakt
*   UNITSOFMEASURE             =
*   UNITSOFMEASUREX            =
*   INTERNATIONALARTNOS        =
*   MATERIALLONGTEXT           =
*   TAXCLASSIFICATIONS         =
   returnmessages             = it_returnmessages.
*   PRTDATA                    =
*   PRTDATAX                   =
*   EXTENSIONIN                =
*   EXTENSIONINX               =.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' .

You can see I only fill the 2 tables (HEADDATA and MATERIALDESCRIPTION) and then call the BAPI.

The same return message...what am I doing wrong??

0 Kudos

Are you getting error messages or success messages?

Regards,

Ganga

0 Kudos

This I got:

1 H MK 102 Trying to create: 6694 ____ ____ ____ __________ ____ __ ___ ___

2 S MG 160 The material cannot be maintained since no maintainable data transferred

3 H MK 103 Trying to change: 6694 ____ ____ ____ __________ ____ __ ___ ___

4 S M3 810 No changes made

It is a success-message, but nothing changed

0 Kudos

Are you sure that nothing changed?

Regards,

Ganga

0 Kudos

Absolut sure, checked it 2 times now...

Can I say - everything in the coding is correct?

0 Kudos

Seems like every thing is fine.

Pass LANGU_ISO as well and check once.

0 Kudos

Tried it with ISO-Langu also - but nothing happens...

I will try to debug the BAPI, maybe I will find the error

0 Kudos

Hallo Michael,

Why don't you use the leading zeroes in Material Number???

0 Kudos

Hi Dimar,

sorry for my late response.

I work with leading zeros:

UNPACK i_headdata-material TO i_headdata-material.

So this can't be the problem...

0 Kudos

Hi Guys,

I'm encountering almost same error, but for the custom field. I've already done the configuration in SPRO and extended the table MARA, BAPI_TE_MARA and the BAPI_TE_MARAX.

On my return message I'm having an error "The material cannot be maintained since no maintainable data transferred".

I have the following code below....

REPORT zp601931_test_004.

DATA: ls_headdata TYPE bapimathead,

lt_extensionin TYPE STANDARD TABLE OF bapiparex,

ls_extensionin LIKE LINE OF lt_extensionin,

lt_extensioninx TYPE STANDARD TABLE OF bapiparexx,

ls_extensioninx LIKE LINE OF lt_extensioninx,

lt_messages TYPE bapiret2_t,

ls_bapi_te_mara TYPE bapi_te_mara,

ls_bapi_te_marax TYPE bapi_te_marax.

CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'

EXPORTING

input = '100-2520'

IMPORTING

output = ls_headdata-material.

ls_headdata-basic_view = 'X'.

ls_bapi_te_mara-material = ls_headdata-material.

  • Here I want to write 4 in my Append Field !!!!!

ls_bapi_te_mara-zzmar_field1 = '4'.

ls_bapi_te_marax-material = ls_headdata-material.

ls_bapi_te_marax-zzmar_field1 = 'X'.

ls_extensionin-structure = 'BAPI_TE_MARA'.

ls_extensionin-valuepart1+0(18) = ls_bapi_te_mara-material.

ls_extensionin-valuepart1+18(1) = ls_bapi_te_mara-zzmar_field1.

APPEND ls_extensionin TO lt_extensionin.

ls_extensioninx-structure = 'BAPI_TE_MARAX'.

ls_extensioninx-valuepart1+0(18) = ls_bapi_te_mara-material.

ls_extensioninx-valuepart1+18(1) = ls_bapi_te_marax-zzmar_field1.

APPEND ls_extensioninx TO lt_extensioninx.

CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'

EXPORTING

headdata = ls_headdata

TABLES

returnmessages = lt_messages

extensionin = lt_extensionin

extensioninx = lt_extensioninx.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

Thanks and Regards,

Jay

Edited by: jhayyy on May 17, 2011 3:58 AM

Former Member
0 Kudos

Hi,

I guess you are not passing data to the import paramter HEADDATA or change structures properly. (CLIENTDATAX etc).

Please read the documentation and get back in case of any issues.

Regards,

Ganga

Former Member
0 Kudos

along with material no, you also give material description, material group, unit of measure, werks(plant), material type. u pass these minimum parameters in bapi and it will work fine. I faced a similar issue.

0 Kudos

and also pass material no. as 18 digit code.

0 Kudos

OK, now I filled these fields:

i_client-matl_group = '313'.

i_client-base_uom = 'ST'.

i_plantdata-plant = '0001'.

and got this error:

1 E MM 360 Key fields for use data PLANTDATA and checkbox structure PLANTDATAX are different

Just a small issue now...

0 Kudos

I have to do also

i_plantdatax-plant = 'X'

0 Kudos

Sorry I meant you have to do also

i_plantdatax-plant = 'X'.

and pass it to BAPI.

anyway, I think plant is not necessary, clientdata and clientdatax are necessary, i made a sample and it works.

0 Kudos

Unfortunately the same mistake...will try to use clientx also

0 Kudos

As i told in my prevous message plantdata is not necessary... you have to pass clientdata and clientdatax.

0 Kudos

I don't use Plantdata and plantdatax.

Result:

1 H MK 102 Trying to create: 6694 ____ ____ ____ __________ ____ __ ___ ___

2 S MG 160 The material cannot be maintained since no maintainable data transferred

3 H MK 103 Trying to change: 6694 ____ ____ ____ __________ ____ __ ___ ___

4 S M3 810 No changes made

Client & ClientX is filled as you described...

0 Kudos

send the new code to see what can we try to figure out...

0 Kudos

here it is:

REPORT  ztest_bapi.

DATA: i_client LIKE bapi_mara,
      i_clientx LIKE bapi_marax,
      i_plantdata TYPE bapi_marc,
      i_plantdatax TYPE bapi_marcx.

DATA: wa_bapimakt TYPE bapi_makt.

DATA: it_returnmessages TYPE STANDARD TABLE OF bapiret2,
      i_return TYPE bapiret2,
      i_headdata TYPE bapimathead,
      it_bapimakt TYPE STANDARD TABLE OF bapi_makt.

CLEAR: i_return, i_headdata.
REFRESH: it_returnmessages.


i_headdata-material    = '6694'.
UNPACK i_headdata-material TO i_headdata-material.
i_headdata-basic_view  = 'X'.
i_headdata-ind_sector = 'M'.
i_headdata-matl_type = 'FERT'.

wa_bapimakt-langu      = sy-langu.
wa_bapimakt-langu_iso = 'DE'.
wa_bapimakt-matl_desc  = 'NEW TEXT'.
APPEND wa_bapimakt TO it_bapimakt.

i_client-matl_group = '313'.
i_client-base_uom = 'ST'.

i_clientx-matl_group = 'X'.
i_clientx-base_uom = 'X'.

*i_plantdata-plant = '0001'.
*i_plantdatax-plant = '0001'.


CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
  EXPORTING
   headdata                   = i_headdata
   clientdata                 = i_client
   clientdatax                = i_clientx
*   plantdata                  = i_plantdata
*   PLANTDATAX                 = i_plantdatax
*   FORECASTPARAMETERS         =
*   FORECASTPARAMETERSX        =
*   PLANNINGDATA               =
*   PLANNINGDATAX              =
*   STORAGELOCATIONDATA        =
*   STORAGELOCATIONDATAX       =
*   VALUATIONDATA              =
*   VALUATIONDATAX             =
*   WAREHOUSENUMBERDATA        =
*   WAREHOUSENUMBERDATAX       =
*   SALESDATA                  =
*   SALESDATAX                 =
*   STORAGETYPEDATA            =
*   STORAGETYPEDATAX           =
*   FLAG_ONLINE                = 'X'
*   FLAG_CAD_CALL              = ' '
*   NO_DEQUEUE                 = ' '
*   NO_ROLLBACK_WORK           = ' '
 IMPORTING
   return                     = i_return
 TABLES
   materialdescription        = it_bapimakt
*   UNITSOFMEASURE             =
*   UNITSOFMEASUREX            =
*   INTERNATIONALARTNOS        =
*   MATERIALLONGTEXT           =
*   TAXCLASSIFICATIONS         =
   returnmessages             = it_returnmessages.
*   PRTDATA                    =
*   PRTDATAX                   =
*   EXTENSIONIN                =
*   EXTENSIONINX               =.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' .

0 Kudos

Give me a chance to see what can be happening there... even if you are not using plantdata I want to correct that you cannot tell

i_plantdatax-plant = '0001'. but i_plantdatax-plant = 'X'.

I will try to figure out what's happening here... I write you back soon.

0 Kudos

Sure, I thought the same - plant must be a 'X'

I tried it this way, then checked the sturucture. And there you can see that plant is a character field with the lenght of 4. This is why I tried it this way...

OK, check if you can find out what's wrong, thanks a lot so long

0 Kudos

Below code is working fine for me.

i_headdata-material    = '000006949900858600'.
UNPACK i_headdata-material TO i_headdata-material.
i_headdata-basic_view  = 'X'.
i_headdata-ind_sector = 'C'.
i_headdata-matl_type = 'Z001'.

wa_bapimakt-langu      = sy-langu.
wa_bapimakt-langu_iso = 'EN'.
wa_bapimakt-matl_desc  = 'NEW TEXT'.
APPEND wa_bapimakt TO it_bapimakt.

CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
  EXPORTING
   headdata                   = i_headdata
*   clientdata                 = i_client
*   clientdatax                = i_clientx
*   plantdata                  = i_plantdata
*   PLANTDATAX                 = i_plantdatax
*   FORECASTPARAMETERS         =
*   FORECASTPARAMETERSX        =
*   PLANNINGDATA               =
*   PLANNINGDATAX              =
*   STORAGELOCATIONDATA        =
*   STORAGELOCATIONDATAX       =
*   VALUATIONDATA              =
*   VALUATIONDATAX             =
*   WAREHOUSENUMBERDATA        =
*   WAREHOUSENUMBERDATAX       =
*   SALESDATA                  =
*   SALESDATAX                 =
*   STORAGETYPEDATA            =
*   STORAGETYPEDATAX           =
*   FLAG_ONLINE                = 'X'
*   FLAG_CAD_CALL              = ' '
*   NO_DEQUEUE                 = ' '
*   NO_ROLLBACK_WORK           = ' '
 IMPORTING
   return                     = i_return
 TABLES
   materialdescription        = it_bapimakt
*   UNITSOFMEASURE             =
*   UNITSOFMEASUREX            =
*   INTERNATIONALARTNOS        =
*   MATERIALLONGTEXT           =
*   TAXCLASSIFICATIONS         =
   returnmessages             = it_returnmessages.
*   PRTDATA                    =
*   PRTDATAX                   =
*   EXTENSIONIN                =
*   EXTENSIONINX               =.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
  EXPORTING
    wait = 'X'.

A quick question here. Did you log in with 'DE' or 'EN'? LANGU_ISO should be related to LANGU. Check in MAKT table for the language you are passing to the BAPI

Regards,

Ganga

Edited by: Ganga Bhavani R on Feb 23, 2010 7:30 PM