Issue with badi ME_PROCESS_REQ_CUST for transaction ME51N
Requirement: In t-code me51n, when user selects material and presses enter, the long text(basic text) present in mm03 for that material needs to be fetched and displayed in me51n item text.
My Piece of code:
data: lt_line type table of tline, ls_line type tline, gs_item type mereq_item, g_matnr type thead-tdname, g_fname type thead-tdname, gt_line type table of mmpur_textlines, gs_line type mmpur_textlines, g_longtext type ref to if_longtexts_mm. call method im_item->get_data receiving re_data = gs_item. g_matnr = gs_item-matnr. call function 'READ_TEXT' exporting client = sy-mandt id = 'GRUN' language = sy-langu name = g_matnr object = 'MATERIAL' tables lines = lt_line exceptions id = 1 language = 2 name = 3 not_found = 4 object = 5 reference_check = 6 wrong_access_to_archive = 7 others = 8 . if sy-subrc <> 0. message id sy-msgid type sy-msgty number sy-msgno with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. endif. loop at lt_line into ls_line. move-corresponding ls_line to gs_line. append gs_line to gt_line. *gt_line = lt_line. endloop. call method im_item->if_longtexts_mm~set_text exporting im_tdid = 'B01' im_textlines = gt_line .
I am using Badi ME_PROCESS_REQ_CUST , method PROCESS_ITEM.
The issue I am facing is when I enter material and press enter, it is going to endless loop(i.e. not able to see the output).
Can anybody suggest where I am going wrong or if I need to write the logic in some other method.
Any suggestions will be appreciated.