This website is not affiliated with, sponsored by, or approved by SAP AG.

Custom message in BAdI LE_SHP_DELIVERY_PROC not displayed

Development (ABAP Development WorkBench, ABAP/4 programming)

Moderators: Snowy, thx4allthefish, YuriT, Gothmog

Custom message in BAdI LE_SHP_DELIVERY_PROC not displayed

Postby bart jongen » Thu Jun 05, 2014 7:50 am

Dear all,

I have programmed Method CHECK_ITEM_DELETION in BAdI LE_SHP_DELIVERY_PROC with the following code, which is to a high extent adapted from SAP's sample code for this BAdI/Method.
Code: Select all
METHOD if_ex_le_shp_delivery_proc~check_item_deletion.

  DATA:         ls_log   TYPE shp_badi_error_log.

  IF is_xlips-matnr = 'BADITEST'.
    cf_item_not_deletable = 'X'.

*   Output of message:
*   'Item &1 contains material &2; item can not be deleted'
    ls_log-msgid = 'ZBJ4'.
    ls_log-msgno = '000'.
    ls_log-msgty = 'W'.
    ls_log-msgv1 = is_xlips-posnr.
    ls_log-msgv2 = is_xlips-matnr.
    APPEND ls_log TO ct_log.

  ENDIF.
ENDMETHOD.

In case the item in the Delivery may not be deleted, a custom message should be displayed.
But this does not happen.
Instead, SAP displays the (standard) message VL399 - The item cannot be deleted due to customer's own checks.
During debugging however, it seems the custom message is determined: Variables determined:
IS_XLIPS-MATNR BADITEST
CF_ITEM_NOT_DELETABLE X
LS_LOG-MSGID ZBJ4
LS_LOG-MSGNO 000
LS_LOG-MSGTY W
IS_XLIPS-POSNR 000010

My question is: how do I need to change the code in order to get my custom message displayed?
Thanks in advance for any clues.
Kind regards,
Bart Jongen
Eindhoven, the Netherlands
bart jongen
 
Posts: 209
Joined: Mon Sep 12, 2005 3:26 am
Location: Eindhoven, The Netherlands

Re: Custom message in BAdI LE_SHP_DELIVERY_PROC not displayed

Postby Gothmog » Thu Jun 05, 2014 8:37 am

Your code seems fine to me - what do you see when you debug after the method call (in form xlips_loeschen_pruefen, include FV50PFLP_XLIPS_LOESCHEN_PRUEFE, right?)?
Is lt_badi_log not filled?
68 74 74 70 3a 2f 2f 74 69 6e 79 75 72 6c 2e 63 6f 6d 2f 62 64 6f 37 6d 77 67
Gothmog
 
Posts: 1941
Joined: Wed Sep 12, 2007 4:46 am
Location: Probably not home

Re: Custom message in BAdI LE_SHP_DELIVERY_PROC not displayed

Postby bart jongen » Thu Jun 05, 2014 8:56 am

Hi Gothmog,

I debugged again and saw the lt_badi_log table gets filled with the item details from the delivery.
Not sure what you mean with "what do you see when you debug after the method call (in form xlips_loeschen_pruefen, include FV50PFLP_XLIPS_LOESCHEN_PRUEFE, right?)?"
I am a functional guy with some ABAP knowledge..:)
Thanks again for your help.
Kind regards,
Bart Jongen
Eindhoven, the Netherlands
bart jongen
 
Posts: 209
Joined: Mon Sep 12, 2005 3:26 am
Location: Eindhoven, The Netherlands

Re: Custom message in BAdI LE_SHP_DELIVERY_PROC not displayed

Postby Gothmog » Thu Jun 05, 2014 9:18 am

Well, searching where this BAdI method is called, I found only one call, in form xlips_loeschen_pruefen of include program FV50PFLP_XLIPS_LOESCHEN_PRUEFE.
Looking at the call there, it stores the method parameter ct_log that you fill in in ternal table lt_badi_log.

If the item can't be deleted, the program loops at this table and sends the messages included in it.
If it finds nothings, it sends message VL399:
Code: Select all
          loop at lt_badi_log into ls_badi_log.
            message id     ls_badi_log-msgid
                    type   'I'
                    number ls_badi_log-msgno
                    with   ls_badi_log-msgv1
                           ls_badi_log-msgv2
                           ls_badi_log-msgv3
                           ls_badi_log-msgv4.
          endloop.
          if sy-subrc ne 0.
            message i399.
          endif.

That's the part I would debug to see what happens.
68 74 74 70 3a 2f 2f 74 69 6e 79 75 72 6c 2e 63 6f 6d 2f 62 64 6f 37 6d 77 67
Gothmog
 
Posts: 1941
Joined: Wed Sep 12, 2007 4:46 am
Location: Probably not home

Re: Custom message in BAdI LE_SHP_DELIVERY_PROC not displayed

Postby bart jongen » Wed Jun 18, 2014 4:50 am

Hi Gothmog,

Thanks for your reply, I understand what you mean now.
I put a breakpoint where you indicated (line 492).
But during debugging, it won't stop at this point.
I also put a breakbpoint a little higher up in the code (line 429):
loop at lt_badi_log into ls_badi_log.
ct_reasons-msgid = ls_badi_log-msgid.
ct_reasons-msgno = ls_badi_log-msgno.
ct_reasons-msgv1 = ls_badi_log-msgv1.
ct_reasons-msgv2 = ls_badi_log-msgv2.
ct_reasons-msgv3 = ls_badi_log-msgv3.
ct_reasons-msgv4 = ls_badi_log-msgv4.
exit.
endloop.
endif.
append ct_reasons.

At this point, the debugger is activated, and table ct_reasons gets filled.
But, like I said, it wont at the point you indicated..

Any further suggestions?
Thanks in advance once again!
Kind regards,
Bart Jongen
Eindhoven, the Netherlands
bart jongen
 
Posts: 209
Joined: Mon Sep 12, 2005 3:26 am
Location: Eindhoven, The Netherlands


Return to ABAP

Who is online

Users browsing this forum: No registered users and 9 guests





loading...


This website is not affiliated with, sponsored by, or approved by SAP AG.