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

BAPI return message

Former Member
0 Likes
3,293

Hi,

I am trying to use 'BAPI_INQUIRY_CREATEFROMDATA2' to create Inquiries. It is creating successfully. But if there any pricing errors like 'Pricing error: Mandatory condition SRP5 is missing', it is not giving this return message but instead giving generic return message saying 'The sales document is not yet complete: Edit data'.

If we use BDC to create the Inquiry, if the same problem happens, it does gives the specific return message ('Pricing error: Mandatory condition SRP5 is missing').

Is there a way to get this specific return message from the BAPI as well?

Thanks..

Swetha.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,132

This BAPI does not return back pricing messages like the one you list (V1 801) back in the RETURN table. This message is issued directly to the screen and not captured during BAPI processing.

Note that during online and BDC processing, this message (V1 801) is issued as a success message not an error message.

One way to get this message could be to issue an error message ('E') message during USEREXIT_SAVE_DOCUMENT of SAPMV45A when XVBUV (Incompletion log ) has mandatory pricing missing i.e. XVBUV-TBNAM = 'VBAP' & XVBUV-FDNAM = 'PRSOK'. An error message issued during this userexit will be returned back via the BAPI. If you want, you can limit when this message is issued in the userexit to only when called from the BAPI i.e. when variable CALL_BAPI = 'X' in the userexit. If you want to limit this message only for inquiry documents then check for VBAK-VBTYP = 'A'.

Edited by: Ken Sanghvi on Apr 2, 2008 10:06 AM

11 REPLIES 11
Read only

former_member182371
Active Contributor
0 Likes
2,132

Hi,

you can retrieve and display the bapi messages with fm´s:


 CALL FUNCTION 'MESSAGES_INITIALIZE'. 

LOOP AT it_return_bapi. 
    CALL FUNCTION 'MESSAGE_STORE' 
         EXPORTING 
              arbgb                   = it_return_bapi-id 
              exception_if_not_active = ' ' 
              msgty                   = it_return_bapi-type 
              msgv1                   = it_return_bapi-message_v1 
              msgv2                   = it_return_bapi-message_v2 
              msgv3                   = it_return_bapi-message_v3 
              msgv4                   = it_return_bapi-message_v4 
              txtnr                   = it_return_bapi-number 
              zeile                   = ' ' 
         EXCEPTIONS 
              message_type_not_valid  = 1 
              not_active              = 2 
              OTHERS                  = 3. 
  ENDLOOP.

CALL FUNCTION 'MESSAGES_STOP' 
       EXCEPTIONS 
            a_message = 04 
            e_message = 03 
            i_message = 02 
            w_message = 01. 

 IF NOT sy-subrc IS INITIAL. 
    CALL FUNCTION 'MESSAGES_SHOW' 
         EXPORTING 
              i_use_grid         = 'X' 
              i_amodal_window    = i_amod_window 
         EXCEPTIONS 
              inconsistent_range = 1 
              no_messages        = 2 
              OTHERS             = 3. 
  ENDIF. 

Best regards.

Read only

0 Likes
2,132

Hi pablo casamayor,

Thanks for the help. But I don't understand fully. Could you kindly give me some more explaination on it.

Thanks a lot..

Swetha.

Read only

0 Likes
2,132

Hi,

the code included is just a simple way to retrieve and display the messages arising during the bapi call.

Someone´s answered in this thread that the message does not appear during the bapi call. If this is the case the code i´ve sent you is of no use.

But make sure and check it anyway.

Best regards.

Read only

0 Likes
2,132

Hi,

There can be many errors encountered and BAPI may not give proper error explaination, since bapi updates tables and encounters errors when it cannot update, there is inconsistency or mandatory parameter missing, etc.

However, when you work with BDC, it processes screen after screen, and so BDC can pull out exact data encountered in a screen itself and stops further processing.

So, with BAPI you have to stick to the error messages it throws

Regards, Tapas

<REMOVED BY MODERATOR>

Edited by: Alvaro Tejada Galindo on Apr 3, 2008 4:07 PM

Read only

Former Member
0 Likes
2,133

This BAPI does not return back pricing messages like the one you list (V1 801) back in the RETURN table. This message is issued directly to the screen and not captured during BAPI processing.

Note that during online and BDC processing, this message (V1 801) is issued as a success message not an error message.

One way to get this message could be to issue an error message ('E') message during USEREXIT_SAVE_DOCUMENT of SAPMV45A when XVBUV (Incompletion log ) has mandatory pricing missing i.e. XVBUV-TBNAM = 'VBAP' & XVBUV-FDNAM = 'PRSOK'. An error message issued during this userexit will be returned back via the BAPI. If you want, you can limit when this message is issued in the userexit to only when called from the BAPI i.e. when variable CALL_BAPI = 'X' in the userexit. If you want to limit this message only for inquiry documents then check for VBAK-VBTYP = 'A'.

Edited by: Ken Sanghvi on Apr 2, 2008 10:06 AM

Read only

0 Likes
2,132

Hi Ken Sanghvi,

Thanks a lot for the info. COuld you please let me know when we issue the error message, is it possible to check and send the condition type as well? To send a message exactly like 'Pricing error: Mandatory condition SRP5 is missing'?

Thanks again for your help...

Swetha.

Read only

0 Likes
2,132

In addition to checking for XVBUV, you could also loop through XKOMV where FXMSG is populated. FXMSG should have the message (801) populated for the condition type. Also make sure you check for XKOMV-KINAK = ' ' i.e. active condition only.

Read only

0 Likes
2,132

Hi Ken Sanghvi,

xkomv table has only filled in condition types. If any mandatory condition type not filled in, then it is not coming in xkomv. How do I check whether all the mandatory condition types are filled in and if not get the condition type to display in the error message?

Can you give me some more detailed information. I don't have good experience with Pricing.

Thanks in advance..

Swetha.

Read only

0 Likes
2,132

Another possible way is to read the pricing procedure configuration to determine if a mandatory condition type is missing in XKOMV.

The following select statement should get you back the required condition types for that pricing procedure:



select * from T683S where KVEWE = 'A'
                                 and KAPPL  = 'V'
                                 and KALSM  = VBAK-KALSM
                                 and KOBLI = 'X'.   "Required condition

Read only

0 Likes
2,132

Did this work for you? Just curious.

Read only

0 Likes
2,132

Thanks Ken for all your help & replies..

Like you mentioned, I finally read the pricing procedure configuration to determine if a mandatory condition type is missing..

Thanks..

Swetha