Application Development and Automation 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: 
Read only

Handling BAPI responses..

Former Member
0 Likes
1,660

Hi..

I am using the Bapi --> BAPI_MATERIAL_SAVEDATA for material creation.. so while creating the material i am giving the basic and storage data for the creation of a material.

For eg: if i create a new material using this BAPI, if the material was successfully created then a response will get 356 as a success message and the message was The material 0325689 was successfully created, here the 0325689 is the material and in case of failure it is just generating some error with out specifying any name..

In the response i am getting the error message with its 3 digit code, but is it possibe to get the material which it is created..

So, now the problem is how to find that error is occured for that material alone..

regards,

Kishore

14 REPLIES 14
Read only

Former Member
0 Likes
1,593

Hi

Pls check the BAPI Return table, you will get more idea.

I hope, when there is error - Material will not be created

Regards

MD

Read only

0 Likes
1,593

Hi..

I have checked the Return table, there is no field for returning the material

is there anyway to get the material as well with the error in the response..

regards

Kishore

Read only

0 Likes
1,593

Hi

The Return table will capture all the error messages, to capture those messages...pass an internal table similar to the return structure and u can display those messages from your program.

Regards,

Vishwa.

Read only

0 Likes
1,593

are you using external material number ...?

if so you have the material number with you.

if you are using internal number then it will give the material number only when there is no errors , that time it will create the material. and give you. if there is a error why will it give you the material number

Read only

0 Likes
1,593

Viswa,

Actually i dont want any messages, by defalult the bapi throws the error message with its code i can see the possible errors with their codes in message classes in tcode se91, but here i need the material is to be included with the error message..

Suppose if 10 materials are created at an instance, 6 will be succesfully created and 4 r failured and for the 4 materials which are failure will be getting the response as an error messages, now how to find which error message is relevant to which material..

regards

Kishore

Read only

0 Likes
1,593

Vijay,

Actually the material number is generating in WINDCHILL and i am pushing the data to SAP R/3 through XI.. so while pushing the data we are using BAPI_MATERIAL_SAVEDATA, here when we push the data the material is successfully creating and during errors just it is throwing the error code with its appropriate response message..

But we need the material number to be included with the response error message is it possible to get with the standard bapi..

regards

Kishore

Read only

0 Likes
1,593

>Actually the material number is generating in WINDCHILL

it depends how the bapi handles error. since the material already with you why can't you use that for error reporting purpose if at all needed.

Read only

0 Likes
1,593

Hi,

From se37, I tested the Fm...in the Return table it is giving success message along with the material number( external material number)...

Also, there is Returnmessages structure..which holds all the messages..

Please check, If they will meet the requirement.

Regards,

Vishwa.

Read only

0 Likes
1,593

Vijay,

I will be getting an xml file from windchill where i am pushing the xml file to sap using mapping how can i handle the value of a xml file.. here eventhough the material is creating externally but to sap the material number comes as a field value, even though if i hold the value of the material field, during response i cannot handle or include the material number to the response message why because the response trigger happens frm the R/3 side and the structure of the response is standard.. to the BAPI.

regards

Kishore

Read only

0 Likes
1,593

Viswa,

I have checked the BAPI .. in the return parameters i am getting the response message as error or sucess..

while successful creation the response was

  • The material 0325689 has been sucessfully created or extended*

Here the 0325689 is the material number.

during errors ..

It is throwing the error response message such as if i didn't specify the material type it is throwing:

Material Type not maintained

Here when i try to create a 10 materials if i get a 3 response error messages, how to find which error message is related to which material..

i think now u got my problem..

regards,

Kishore

Read only

0 Likes
1,593

Hi

Instead of trying to know the error relates to which material, you can validate the flat file data even before u pass it on to BAPI...

This way, the chances of error are less and you will know which record has the error.

Regards,

Vishwa.

Read only

0 Likes
1,593

Viswa,

Is it possible to get the material number or name with the response message or not.. with the BAPI.

In the return parameter, there is no field to carry the material number or material name.

I need a clear answer for this..

regards,

Kishore

Read only

0 Likes
1,593

Hi

Look... you can get the message as u got that it created...

Material number xxxx was created or extended.

Now... If you dont maintain material type then it will give

Material Type Not maintained

If you give a wrong value.. then it will display the wrong value with the above statement..

I really dont think without validation....and with the help of BAPI.. you can get to know for which Material number,the material type error is coming.

Regards,

Vishwa.

Read only

0 Likes
1,593

you can find some info from the message varaibles if at all SAP handling the material number during.

check there variables of the retun table.

MESSAGE_V1 " generally the material numbe will be stored here..

MESSAGE_V2

MESSAGE_V3

MESSAGE_V4