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: 

retrieving the possible errors from bapi

former_member238007
Contributor
0 Kudos

Hi..

I have done a scenario in XI in which i am transfering the material number to SAP from windchill with Basic data and Storage data..

for this i am using BAPI_MATARIAL_SAVEDATA, so while creating a material i could able to see the response message as "The material has been created or extended". suppose if i want to see all the possible errors list how to see that..

Take an example of i didn't give a material type it throws an error with a 3 digit number stating material type is not maintained for some errors it is throwing just a number without error description, So, how many possible errors are there at back end.. and how could i see that list..

regards

Kishore

1 ACCEPTED SOLUTION

Former Member
0 Kudos

the message classes this bapi uses are

1. M3

2. MG

3. MM

4. MH

5. MK

6. 8Z

to reduces this message list size try searching the bapi with

key words like

RETURN

MESSAGE

MSGTYP

MSGID

MSGNO

Edited by: mrugesh phatak on Oct 1, 2008 10:19 AM

9 REPLIES 9

Former Member
0 Kudos

the message classes this bapi uses are

1. M3

2. MG

3. MM

4. MH

5. MK

6. 8Z

to reduces this message list size try searching the bapi with

key words like

RETURN

MESSAGE

MSGTYP

MSGID

MSGNO

Edited by: mrugesh phatak on Oct 1, 2008 10:19 AM

0 Kudos

Hi Phatak,

The message classes which u have given is checked but unable to find which one will suit for the BAPI_MATERIAL_SAVEDATA, can u be elaborate, in other ways how can i see all these messages..

When i see the MM, it is matching with 356 i.e sucessfule created or extended but when i execute without giving material number it is throwing 262 and the response message was Enter Material Number but where as in the MM i can see the error message for 262 is "The conversion type & does not exist."

regards

Kishore

0 Kudos

as far as message 262 is concern

its from class M3 not "mm"

when u get the message in return parameter

use the combination of

ID & Number

like in tcode se91

give Message class M3

& Number 262

if you don't give number there u will get all the message for particular class you have given in field Message class

0 Kudos

Hi Phatak,

In similar way can u give the Message classes for BAPI_BOM_UPLOAD_SAVE

now the part level was clear and we need the error list for BOM

regards,

Kishore.

0 Kudos

one class is B1.

for others if there are any please search using the keyword I & others have mentioned

in tcode se37

former_member212653
Active Contributor
0 Kudos

Try calling the BAPI: BAPI_MESSAGE_GETDETAIL to get the message details

But I think you are missing something over here...BAPI_MATERIAL_SAVEDATA should return the text of the error messages also. Check the RETURN parameter correctly. The structure of the retun parameter is as below. Here the MESSAGE field will have the text.

Also you will get all the possible error messages in this structure itself. This will have multiple entries.


TYPE
ID
NUMBER
MESSAGE  " Here you will have the text
LOG_NO
LOG_MSG_NO
MESSAGE_V1
MESSAGE_V2
MESSAGE_V3
MESSAGE_V4
PARAMETER
ROW
FIELD
SYSTEM

Edited by: Sourav Bhaduri on Oct 1, 2008 1:51 PM

0 Kudos

Hi

While u execute the BAPI, Pass on an internal table to the return table with the declaration of the table same as that of return.

Then pass on a loop to that internal table.

Use write statement to display the number of errors.

data: it_ret type standard table of bapiret2,
        wa_ret type bapiret2.
call function 'BAPI_MATERIAL_SAVEDATA'



Return = it_ret.


loop at it_ret into wa_ret.

write: / wa_ret-message.

endloop.

Regards,

Vishwa.

0 Kudos

Hi!

Just a small hint to other fans: ES_RETURN structure above is case sensitive, ordered. Field ROW must be of Number type.

Regs.

Former Member
0 Kudos

Hi,

Its difficult to say how many errors are there. But if you simply take a look at the MESSAGE component of the return parameter of the BAPI, it will give you the entire message text.

And of course, there is the type, number and id also available in the return parameter of the bapi.

regards,

Advait