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: 

Return message for BAPI: BAPI_MATERIAL_SAVEREPLICA

Former Member
0 Kudos

Hi,

I use BAPI: BAPI_MATERIAL_SAVEREPLICA to update data for multiple materials.

Most of the materials are updated successfully. However, some of them are failed to be updated.

When I get the data from return message table: RETURNMESSAGES

I get the following information :

S MK 102 Trying to create: RCNWP23177B TUM1 ____ ____ __________ ____ __ ___ ___ row

E MG 144 The field MBEW-HKMAT/BAPI_MBEW-ORIG_MAT is defined as a required field; 0

E MG 144 The field MBEW-HRKFT/BAPI_MBEW-ORIG_GROUP is defined as a required field; 0

S MK 103 Trying to change: RCNWP23177B TUM1 ____ ____ __________ ____ __ ___ ___ 0

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

I just care about the failed updated materials therefore, I only get the information for the rows that have message type as E.

E MG 144 The field MBEW-HKMAT/BAPI_MBEW-ORIG_MAT is defined as a required field; 0

E MG 144 The field MBEW-HRKFT/BAPI_MBEW-ORIG_GROUP is defined as a required field; 0

Now I want to figure out what are exactly the materials that're failed. I notice that the column row in table RETURNMESSAGES

seems to be the suitable one because its description is: "Lines in parameter"

However, this column is always 0 for every rows.

Can anyone tell me how to figure out what is the material that is unsuccessfully updated ?

Thanks,

Hung

4 REPLIES 4

rajasekhar_matukumalli3
Active Participant
0 Kudos

Hello Hung,

We had a similar issue for some other BAPI. But we were able to over come this problem after debugging the BAPI. Basically most of the BAPIs have a RETURN structure of type BAPIRET2 or BAPIRETURN.

In the case of your BAPI, it is having BAPIRET2. Pleas debug your BAPI, internally it will use variables of type BAPIRETURN and will pass the data to variable of type BAPIRET2. Here you have to put an enhancement point to pass the row number approprietly.

Hope this will solve your problem.

Thanks,

ABAPRaj

Enjoy SAP

Former Member
0 Kudos

When processing the Return Message Table, check for message number 102 and 103 which comes just before the message..

the message descriptions for these numbers are TRYING TO CREATE and TRYING TO CHANGE.

in these rows field MESSAGE_V1 contains the MATERIAL NUMBER for which the current error message will be displayed....

So you can copy that material number to all messages for that particular material. There will be 4 messages for every material in the return structure..

From there you can find the material number and proceed further.

<removed by moderator>

Edited by: Thomas Zloch on Dec 13, 2011 8:38 PM

Former Member
0 Kudos

Try this code after the BAPI call, it works fine for every BAPI.

T_return = BAPI return table.

DATA i_amod_window LIKE boole-boole.

CALL FUNCTION 'MESSAGES_INITIALIZE'.

LOOP AT t_return.

CALL FUNCTION 'MESSAGE_STORE'

EXPORTING

arbgb = t_return-id

exception_if_not_active = ' '

msgty = t_return-type

msgv1 = t_return-message_v1

msgv2 = t_return-message_v2

msgv3 = t_return-message_v3

msgv4 = t_return-message_v4

txtnr = t_return-number

zeile = ' '

EXCEPTIONS

message_type_not_valid = 1

not_active = 2

OTHERS = 3.

ENDLOOP.

CALL FUNCTION 'MESSAGES_STOP'

EXCEPTIONS

a_message = 04

e_message = 03

i_message = 02

w_message = 01.

IF NOT sy-subrc IS INITIAL.

CALL FUNCTION 'MESSAGES_SHOW'

EXPORTING

i_use_grid = 'X'

i_amodal_window = i_amod_window

EXCEPTIONS

inconsistent_range = 1

no_messages = 2

OTHERS = 3.

ENDIF.

David Fúnez

Tegucigalpa, Honduras

Former Member
0 Kudos

In Case Of Error, Material Number will be stored in message_vi field of this structure,

from there you can figure out, for which material the error is coming.

Hope this Helps!