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: 

To block delivery in VL01N and VL02N using LE_SHP_DELIVERY_PROC Badi

Former Member
0 Kudos

Hello Everyone

I want to update the Delivery block (LIKP-LIFSK) and show a popup information message in VL01N and VL02N once the 'Save' button is pressed in both these transactions. I have some checks which I'm doing and if the Outbound delivery exists within these checks, then only the pop up should trigger.

Here is my code.

IF NOT ct_xlips[] IS INITIAL.

     SELECT COUNT(*) FROM zreachregulation FOR ALL ENTRIES IN ct_xlips WHERE matnr = ct_xlips-matnr.

      IF sy-subrc = 0.

           cs_likp-lifsk = 'YT'.

           CALL FUNCTION 'POPUP_FOR_INTERACTION'

                EXPORTING

                     HEADLINE = text-001

                     TEXT1    = text-002

                     TEXT2    = text-003

                     TICON    = 'I'

                     BUTTON_1 = text-005.

            IF SY-SUBRC <> 0.

                 MESSAGE text-004 TYPE 'E'.

            ENDIF.

        ENDIF.

ENDIF.

I put this code in the method 'READ_DELIVERY', but this doesn't trigger with the Save button and also doesn't work with VL01N.

How do I do the updation of delivery block using this Badi? in which method should I write my code?

Please help.

5 REPLIES 5

karthikeyan_p3
Contributor
0 Kudos

Hi Payal,

You can use the method SAVE_DOCUMENT_PREPARE of the BADI LE_SHP_DELIVERY_PROC.

Also make use of interface parameter IF_TRTYP ( 'H' - Add or 'V' - Change) to check if the delivery is being created or changed.

Regards,

Karthikeyan

0 Kudos

Hello Karthikeyan.

I tried in that Function. but the problem was, the pop up was displaying, but the delivery block was not getting added and also, the whole delivery was not getting saved after creation. It would give me a delivery number saying it has been created. But when I checked in VL02n with the same delivery number, it says doesnot exist.

And i need it to trigger both for the creation of delivery (vl 01n) and change of delivery (vl 02n)

0 Kudos

This is the code I'm adding in the method SAVE_DOCUMENT_PREPARE.

IF NOT ct_xlips[] IS INITIAL.

               SELECT COUNT(*) FROM zreachregulation FOR ALL ENTRIES IN ct_xlips

                               WHERE matnr = ct_xlips-matnr.

               IF sy-subrc = 0.

                 IF wa_xlikp-lifsk IS INITIAL.

                   wa_xlikp-lifsk = 'ZF'.

                 ENDIF.

                 MODIFY ct_xlikp FROM wa_xlikp.

                 COMMIT WORK AND WAIT.

                 CALL FUNCTION 'POPUP_FOR_INTERACTION'

                   EXPORTING

                     HEADLINE = text-001

                     TEXT1    = text-002

                     TEXT2    = text-003

                     TICON    = 'I'

                     BUTTON_1 = text-005.

                 IF SY-SUBRC <> 0.

                   MESSAGE text-004 TYPE 'E'.

                 ENDIF.

               ENDIF.

             ENDIF.


The block is not being added and also somehow the delivery is not getting created.

When I try in VL01N, it says the delivery is saved. And when I try in VL02N to see the delivery, it says the delivery does not exist. Why is this happening? Please help.

Former Member
0 Kudos

This is the code I'm adding in the method SAVE_DOCUMENT_PREPARE.

IF NOT ct_xlips[] IS INITIAL.

               SELECT COUNT(*) FROM zreachregulation FOR ALL ENTRIES IN ct_xlips

                               WHERE matnr = ct_xlips-matnr.

               IF sy-subrc = 0.

                 IF wa_xlikp-lifsk IS INITIAL.

                   wa_xlikp-lifsk = 'ZF'.

                 ENDIF.

                 MODIFY ct_xlikp FROM wa_xlikp.

                 COMMIT WORK AND WAIT.

                 CALL FUNCTION 'POPUP_FOR_INTERACTION'

                   EXPORTING

                     HEADLINE = text-001

                     TEXT1    = text-002

                     TEXT2    = text-003

                     TICON    = 'I'

                     BUTTON_1 = text-005.

                 IF SY-SUBRC <> 0.

                   MESSAGE text-004 TYPE 'E'.

                 ENDIF.

               ENDIF.

             ENDIF.


The block is not being added and also somehow the delivery is not getting created.

When I try in VL01N, it says the delivery is saved. And when I try in VL02N to see the delivery, it says the delivery does not exist. Why is this happening? Please help.

0 Kudos

Remove the COMMIT WORK AND WAIT statement. You should not use commit work in the user exit as it will break the LUW.

Also, set the breakpoint at Modify statement and confirm if ct_xlikp is updated with correct value in lifsk. You could also use TRANSPORTING clause in MODIFY statement and making sure only LIFSK is updated in ct_xlikp.


http://help.sap.com/saphelp_nw70/Helpdata/en/fc/eb35eb358411d1829f0000e829fbfe/content.htm


If delivery is not created after the number is assigned, check if there are any update terminations in SM13.


Regards,

Karthikeyan