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 get BAPI return messages of user-exit message?

Former Member
0 Kudos

Hi ALL.

I have a Zprogram using BAPI 'BAPI_SALESORDER_CREATEFROMDAT2'.

and, I coded SD user-exit (FORM USEREXIT_SAVE_DOCUMENT_PREPARE (MV45AFZZ))

user-exit code is below:

-


FORM USEREXIT_SAVE_DOCUMENT_PREPARE.

 ...

MESSAGE W0001(ZSD).

 ...

ENDFORM.

-


I'd like to get message of user-exit message from BAPI return,

but I can't get that.

I cna get only SAP standard messages from BAPI return.

If you know how to do, let me know please.

Regards.

Rie.

1 ACCEPTED SOLUTION

nabheetscn
Active Contributor
0 Kudos

We have the following three options.

1.You can try exporting the message and importing after BAPI call.

2. Otherwise check how BAPI fills the message.

3. Look for some exit or implicit enhancement.

Hope it helps.

Thanks

Nabheet

12 REPLIES 12

former_member195402
Active Contributor
0 Kudos

Hi Rie,

please try

MESSAGE W001(ZSD).

instead of

MESSAGE W0001(ZSD).

The userexit is for changes and checks, so we used it only with error messages. If the above logic doesn't work, please make a try with E001 instead of W001. Just to check, that the message is given back to you.

Regards,

Klaus

Edited by: Klaus Babl on Jun 17, 2011 7:26 AM

0 Kudos

Thank you, Klaus Babl .

I try to code 'MESSAGE E001(ZSD)'.

I can get the message, but it can't create sales order... of course...

I'd like to get the Warning message from BAPI return, and also it is not Error so I'd like to create a sales order.

is it impossible?

or I can do it using another user-exit??

If you know that, please let me know.

Regards,

Rie.

Edited by: Rie Nagakura on Jun 17, 2011 7:48 AM

0 Kudos

Hi Rie,

did you try W001 instead of W0001? Cuase W0001 was too long for a message number it couldn't work. Are you sure that you don't get W001?

Regards,

Klaus

0 Kudos

Hi, Klaus .

>did you try W001 instead of W0001? Cuase W0001 was too long for a message number it couldn't work. Are you sure that

>you don't get W001?

oh, I made a mistake typing...sorry.

first, I coded 'W001'.

but I can't get a message from BAPI return.

we can't get a message of type W?? only type E??

I tried also type S and type I, but I can't get.

if you have a good idea, please let me know.

Regards.

Rie.

0 Kudos

Hmm,

found SAP note 1054781 which says "only errors" will be filled into bapi return table.

Please have a look at this note for further informations.

Regards,

Klaus

0 Kudos

Thank you, Klaus .

The note is very helpful for me .

I try to FM 'BALW_BAPIRETURN_GET2' that I get the information from the note.

and if I can do it, I share the infomation.

Please wait for your award points!!

Regards,

Rie.

0 Kudos

Hi.

I tried to use 'BALW_BAPIRETURN_GET2', but I don't know how to use the FM.

so I solved using ABAP memory.

I greatly appreciate your reply.

Regards

Rie.

nabheetscn
Active Contributor
0 Kudos

We have the following three options.

1.You can try exporting the message and importing after BAPI call.

2. Otherwise check how BAPI fills the message.

3. Look for some exit or implicit enhancement.

Hope it helps.

Thanks

Nabheet

0 Kudos

Thank you, nabheetmadan09.

>1.You can try exporting the message and importing after BAPI call.

You mean try to use ABAP memory?

I think It's an good idea.

>2. Otherwise check how BAPI fills the message.

>3. Look for some exit or implicit enhancement.

Do you know these exit or enhancement??

Regards,

Rie.

0 Kudos

Hi,

Yes i am talking about ABAP memory.

What version of SAP are you using...?If it is ECC then you can use the concept of Implicit enhancements.

For exit... please let me know what are we trying to acheive then we can look at it.

Thanks

Nabheet

U can use abap memory but its not the right way of doing it ..  call the following code in the user exit and it will return the message in the BAPI.

        perform message_vbfs_aufbauen(sapfv45l) using 'V1'

                                                      '041'

                                                      'S'

                                                      space

                                                      space

                                                      space

                                                      space.

0 Kudos

Thanks former member, who may never see this reply. But this was exactly what I was looking for and it worked with BAPI 'SD_SALESDOCUMENT_CREATE'.
Example on how I used it:

PERFORM MESSAGE_VBFS_AUFBAUEN(SAPFV45L) USING 'ZXXX'  '049'  'E'  XVBAP-POSNR  SPACE  SPACE  SPACE.