2014 Jul 29 2:16 PM
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.
Thnaks with Regards,
Vallamuthu M
2014 Jul 29 2:27 PM
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.
2014 Jul 29 2:27 PM
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.
2014 Jul 29 3:14 PM
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
2014 Jul 29 3:55 PM
2014 Jul 29 4:29 PM
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.