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: 

how to fill BAPIRET2 parameter

Former Member
0 Kudos

Can anyone please give me sample code to fill the BAPI

return parameter. I am using BAPIRET2.

I am using like this:-

CLEAR ls_return.

CALL FUNCTION 'BALW_BAPIRETURN_GET2'

EXPORTING

type = 'E'

cl = SY-MSGID

number = SY-MSGNO

par1 = 'NO DATA FOUND'

  • par2 = sy-msgv2

  • par3 = sy-msgv3

  • par4 = sy-msgv4

  • LOG_NO = ' '

  • LOG_MSG_NO = ' '

  • PARAMETER = ' '

  • ROW = 0

  • FIELD = ' '

IMPORTING

return = ls_return

.

APPEND ls_return TO return.

EXIT.

Just i want error type and error message

4 REPLIES 4

former_member181962
Active Contributor
0 Kudos

Hi Christopher,

Are you building a custom BAPI?

If you are calling an existing bapi, then you don't need to fill it.

The bapi fills it and returns you the messages.

If you still want to fill it,

You can directly fill the values in th structure:

TYPE = s/w/a/e etc

ID = sy-msgid

NUMBER = sy-msgnr

MESSAGE =

LOG_NO

LOG_MSG_NO

MESSAGE_V1 = sy-msgv1

MESSAGE_V2= sy-msgv2

MESSAGE_V3= sy-msgv3

MESSAGE_V4= sy-msgv4

etc.

Regards,

Ravi

0 Kudos

yes..i m building custom bapi

If there is an error..it should directly exit go to the BAPI return parameter?

0 Kudos

if any error occurs fill BAPIRET2 with the message and then exit from BAPI.

Regards

vijay

0 Kudos

HI Christopher,

Check any existing bapi and see how they are filling.

Sample code:

msgv1 = customerno.

CALL FUNCTION 'BALW_BAPIRETURN_GET1'

EXPORTING

type = 'E'

cl = 'FN'

number = 502

par1 = msgv1

IMPORTING

bapireturn = return.

EXIT.

REgards,

Ravi