Skip to content

Instantly share code, notes, and snippets.

@weiserman
Last active January 4, 2021 20:56
Show Gist options
  • Select an option

  • Save weiserman/7911117 to your computer and use it in GitHub Desktop.

Select an option

Save weiserman/7911117 to your computer and use it in GitHub Desktop.
Check Purchase Order Long Text in SAP ERP BADI. Example of implementation of BADI ME_PROCESS_PO_CUST sample code for checking long text and issuing errors.
METHOD if_ex_me_process_po_cust~check.
* Check the purchase order type and save the text
DATA: lv_tdid TYPE tdid,
lv_texttype TYPE mmpur_texttypes,
lt_text_lines TYPE mmpur_t_textlines,
lt_text_format TYPE mmpur_bool,
lv_header TYPE mepoheader,
lv_lines TYPE i.
* Macro for messages
INCLUDE mm_messages_mac. "useful macros for message handling
lv_tdid = 'F01'.
* Get the Header data
lv_header = im_header->get_data( ).
im_header->if_longtexts_mm~get_text(
EXPORTING
im_tdid = lv_tdid
im_texttype = lv_texttype
IMPORTING
ex_textlines = lt_text_lines
ex_text_formatted = lt_text_format ).
DESCRIBE TABLE lt_text_lines LINES lv_lines.
IF lv_lines = 0.
ch_failed = 'X'.
mmpur_message_forced 'E' 'ME' '083' 'Enter a rejection reason' ' in the long text' '' ''.
ENDIF.
ENDMETHOD.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment