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 avoid save LE_SHP_DELIVERY_PROC - SAVE_DOCUMENT_PREPARE

vallamuthu_madheswaran2
Active Contributor
0 Kudos
2,607

Hi Friends,

BADI: LE_SHP_DELIVERY_PROC

Method: SAVE_DOCUMENT_PREPARE

I have validated the field ct_xlips-charg.

I gave the error message in CT_LOG. It displays the error message on pop-up screen. If I click "OK" then it came out of the delivery screen.

If I give message type "W" or "S" then press enter it saves the wrong the value.

my requirement is: If the logical condition fails then I need the following things.

  • Won't save the wrong data
  • Dsiplay the error message
  • stay on the same screen

Thnaks with Regards,

Vallamuthu M

1 ACCEPTED SOLUTION

Former Member
0 Kudos
538

You should use method DELIVERY_FINAL_CHECK.  SAVE_DOCUMENT_PREPARE is called after all of the final checks so it really is too late at that point.  That method should be used to prepare customer delivery-related data and not to do a final check prior to save.

Look at the documentation for interface IF_EX_LE_SHP_DELIVERY_PROC method DELIVERY_FINAL_CHECK and it will explain how to pass messages back to the user.  You can also look at the below thread to get a rough example. 

4 REPLIES 4

Former Member
0 Kudos
539

You should use method DELIVERY_FINAL_CHECK.  SAVE_DOCUMENT_PREPARE is called after all of the final checks so it really is too late at that point.  That method should be used to prepare customer delivery-related data and not to do a final check prior to save.

Look at the documentation for interface IF_EX_LE_SHP_DELIVERY_PROC method DELIVERY_FINAL_CHECK and it will explain how to pass messages back to the user.  You can also look at the below thread to get a rough example. 

0 Kudos
538

Hi Aaron,

Thanks for your reply. It wont give error message at all. Kindly find below my code.


  METHOD if_ex_le_shp_delivery_proc~delivery_final_check.
   
*    IF if_tcode = 'VL31N' OR if_tode = 'VL31'.
    TYPES: BEGIN OF gty_mara,
             matnr TYPE mara-matnr,
             mhdrz TYPE mara-mhdrz,
           END OF gty_mara.

    TYPES: BEGIN OF gty_ekpo,
             ebeln TYPE ekpo-ebeln,
             ebelp TYPE ekpo-ebelp,
             revlv TYPE ekpo-revlv,
           END OF gty_ekpo.

   
    DATA: ls_lips TYPE lipsvb.
    DATA: lt_mara TYPE TABLE OF gty_mara,
          lt_ekpo TYPE TABLE OF gty_ekpo.

    DATA: ls_mara TYPE gty_mara,
          ls_ekpo TYPE gty_ekpo.

    DATA: lv_date TYPE sy-datum.

    DATA: lv_not_only_zero TYPE c,
          ls_log           TYPE finchdel.
*    ls_lips = ct_xlips->get-data( ).
    SELECT matnr mhdrz FROM mara
           INTO  TABLE lt_mara
           FOR ALL ENTRIES IN it_xlips
           WHERE matnr = it_xlips-matnr.

    SELECT ebeln ebelp revlv FROM ekpo
           INTO TABLE lt_ekpo
           FOR ALL ENTRIES IN it_xlips
           WHERE ebeln = it_xlips-vgbel.
*             AND ebelp = ct_xlips-vgpos.
    LOOP AT it_xlips INTO ls_lips WHERE charg IS NOT INITIAL.
      CLEAR: lv_not_only_zero.
      IF ls_lips-charg CA sy-abcde.
        lv_not_only_zero = 'X'.
        EXIT.
      ELSE.
        lv_date = ls_lips-charg.
        CALL FUNCTION 'DATE_CHECK_PLAUSIBILITY'
          EXPORTING
            date                      = lv_date
          EXCEPTIONS
            plausibility_check_failed = 1
            OTHERS                    = 2.
        IF sy-subrc <> 0.
* Implement suitable error handling here
          lv_not_only_zero = 'X'.
          EXIT.
        ENDIF.
      ENDIF.
    ENDLOOP.
    IF lv_not_only_zero = 'X'.
      ls_log-pruefung = '99'.
      ls_log-msgty = 'E'.
      ls_log-msgid = 'S5'.
      ls_log-msgno = '001'.
      ls_log-msgv1 = 'YYYYMMDD'.
*     Note: CT_FINCHDEL is a hashed table
      INSERT ls_log INTO TABLE ct_finchdel.

*    exit.
    ENDIF.

  ENDMETHOD.

Thanks with Regards,

Vallamuthu M

0 Kudos
538

Try setting ls_log-vbeln to the delivery in question.

0 Kudos
538

Hi Aaron,

Thanks for your reply.

I've been set the vbeln value. But it create the IBD.

ls_log-vbeln = ls_lips-vbeln.

Thanks with Regards,

Vallamuthu M

I gave message type as "E". But it come out of the Current screen.