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: 

Error handling while calling BAPI ?

Former Member
0 Kudos

Hi all,

I am calling 'BAPI_GOODSMVT_CREATE' from a program to create goods receipt with purchase order. Eventhough i am successfully creating the Goods Receipt , i am unable to display the error messages if Goods Receipt is not created.

Please help me on displaying the error messages by specifying procedure and coding ?

Thanks,

Vamshi.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi

CALL FUNCTION 'BAPI_GOODSMVT_CREATE'

EXPORTING

goodsmvt_header =

goodsmvt_code =

  • TESTRUN = ' '

  • IMPORTING

  • GOODSMVT_HEADRET =

  • MATERIALDOCUMENT =

  • MATDOCUMENTYEAR =

tables

goodsmvt_item =

  • GOODSMVT_SERIALNUMBER =

return =

In return table you will get all the errors which thrown by this BAPI. you can go in debug mode and check for the error msg.

Regards

Sowmya

Edited by: Sowmya Sahadevan on Jul 9, 2008 5:38 AM

6 REPLIES 6

Former Member
0 Kudos

Error and Success messages are returned in interface Table "RETURN" of FM ..BAPI_GOODSMVT_CREATE ....

You can loop on this table and write "MESSAGE" variable

Edited by: Sunil Kokane on Jul 9, 2008 9:05 AM

Former Member
0 Kudos

Hi

CALL FUNCTION 'BAPI_GOODSMVT_CREATE'

EXPORTING

goodsmvt_header =

goodsmvt_code =

  • TESTRUN = ' '

  • IMPORTING

  • GOODSMVT_HEADRET =

  • MATERIALDOCUMENT =

  • MATDOCUMENTYEAR =

tables

goodsmvt_item =

  • GOODSMVT_SERIALNUMBER =

return =

In return table you will get all the errors which thrown by this BAPI. you can go in debug mode and check for the error msg.

Regards

Sowmya

Edited by: Sowmya Sahadevan on Jul 9, 2008 5:38 AM

0 Kudos

Hi sunil and sowmya,

Thanks for the quick reply.

I too know that error messages are in RETURN table . I passed IT_RETURN table to it.

But i don't how to retrieve error messages from this .

So, please provide sample code to display error records from RETURN table?

Thanks,

Vamshi.

Former Member
0 Kudos

Messages is formatted in MTEXT

data : MTEXT(255) type c.

if not t_return is initial.

message id t_return-id

type t_return-type

number t_return-number

INTO mtext

with t_return-message_v1

t_return-message_v2

t_return-message_v3

t_return-message_v4.

write : mtext

endif.

0 Kudos

Hi sunil,

Thanks for the reply and it is very helpful.

Now i got the procedure .

Thanks,

Vamshi.

Former Member
0 Kudos

Hi,

.

.

DATA: LT_RETUTN TYPE TABLE OF BAPIRET2.

.

.

CALL FUNCTION 'BAPI_GOODSMVT_CREATE'

EXPORTING

goodsmvt_header =

goodsmvt_code =

TESTRUN = ' '

IMPORTING

GOODSMVT_HEADRET =

MATERIALDOCUMENT =

MATDOCUMENTYEAR =

TABLES

goodsmvt_item =

GOODSMVT_SERIALNUMBER =

return = lt_return.

.

  • ASSIGN OTHER PARAMETERS

You will get the message details in the lt_return internal table. Kindly refer the structure BAPIRET2 for the field details.

Hope, this will help you. Kindly reply if you need more details.

Reward, if it is useful ...

Regards,

SK.