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: 

Problem in BAPI_MATERIAL_SAVEDATA

Former Member
0 Kudos
328

Helo Friends.

I am updating MM02 using BAPI_MATERIAL_SAVEDATA.

I am passing all the correct parameters, but still its not updating.

Kindly find sample code below:-

CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'

EXPORTING

headdata = T_HEAD

  • CLIENTDATA =

  • CLIENTDATAX =

PLANTDATA = T_MARC

PLANTDATAX = T_MARCX

  • FORECASTPARAMETERS =

  • FORECASTPARAMETERSX =

  • PLANNINGDATA =

  • PLANNINGDATAX =

STORAGELOCATIONDATA = T_MARD

STORAGELOCATIONDATAX = T_MARDX

  • VALUATIONDATA =

  • VALUATIONDATAX =

  • WAREHOUSENUMBERDATA =

  • WAREHOUSENUMBERDATAX =

SALESDATA = T_MVKE

SALESDATAX = T_MVKEX

  • STORAGETYPEDATA =

  • STORAGETYPEDATAX =

  • FLAG_ONLINE = ' '

  • FLAG_CAD_CALL = ' '

  • NO_DEQUEUE = ' '

IMPORTING

RETURN = T_RETURN

  • TABLES

  • MATERIALDESCRIPTION =

  • UNITSOFMEASURE =

  • UNITSOFMEASUREX =

  • INTERNATIONALARTNOS =

  • MATERIALLONGTEXT =

  • TAXCLASSIFICATIONS =

  • RETURNMESSAGES =

  • PRTDATA =

  • PRTDATAX =

  • EXTENSIONIN =

  • EXTENSIONINX =

.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

WAIT = 'X'

    • IMPORTING

    • RETURN = T_RETURN

.

ENDLOOP.

Plz help me out.

Thanks in advance.

5 REPLIES 5

Former Member
0 Kudos
110

Hi!

You have to check the table T_RETURN after, you called the BAPI, but before the commit.

If you see "E" or "A" TYPE messages in it, you have to solve these errors. After this, your material will be saved.

Regards

Tamá

0 Kudos
110

Hi. Thanks for your reply.

But, can you please explain in brief how to check that table t_return?

0 Kudos
110

Hi!

Set a break point into your code.

CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA' ...

BREAK-POINT. "or BREAK username.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

When your program has stopped at the breakpoint, you can check the vaues, what the T_RETURN table contains.

Regards

Tamá

0 Kudos
110

Hi.

here is what i got while debugging

IF WAIT EQ SPACE.

COMMIT WORK.

ELSE.

COMMIT WORK AND WAIT.

IF SY-SUBRC NE 0.

CALL FUNCTION 'BALW_BAPIRETURN_GET2'

EXPORTING

TYPE = 'E'

CL = 'S&'

NUMBER = '150'

IMPORTING

RETURN = RETURN.

ENDIF.

uwe_schieferstein
Active Contributor
0 Kudos
110

Hello Pansee

The BAPI returns two types of messages:

- EXPORTING parameter RETURN (holds last message of RETURNMESSAGES)

- TABLES parameter RETURNMESSAGES

Now check the RETURNMESSAGES for details about the problems:


DATA:
  ls_return                TYPE bapi_matreturn2.
  lt_returnmessages  TYPE STANDADRD TABLE OF bapi_matreturn2.

" Retrieve the return messages into lt_returnmessages

  LOOP AT lt_returnmessages into ls_return
                                             WHERE ( type CA 'AEX' ). " abort, error, dump
"   debug here and check the error details
  ENDLOOP.

Regards

Uwe