‎2010 Dec 03 6:44 AM
Hi,
My requirement is i need to populate standard text in purchase requisition item level in text tab tha is text type. i have written the below code in badi ME_PROCESS_REQ_CUST in Process-item.
I have maintianed standard text in So10 and called in read_text function module.
method IF_EX_ME_PROCESS_REQ_CUST~PROCESS_ITEM
if sy-tcode = 'ME51N'.
data: t_line type mmpur_t_textlines,
wa_line LIKE LINE OF t_line,
wa_line1 type tline,
t_line1 type table of tline.
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
ID = 'ST'
LANGUAGE = sy-langu
NAME = 'ZTEXT'
OBJECT = 'TEXT'
TABLES
LINES = t_line1
if t_line1 is not initial.
loop at t_line1 into wa_line1.
wa_line-tdline = wa_line1-tdline.
wa_line-tdobject = 'TEXT' .
wa_line-tdid = 'ST'.
wa_line-tdformat = 'SP'.
append wa_line to t_line.
endloop.
endif.
CALL METHOD im_item->if_longtexts_mm~get_text
EXPORTING
im_tdid = 'B01'.
CALL METHOD im_item->if_longtexts_mm~set_text
EXPORTING
im_tdid = 'B01'
im_textlines = t_line.
CALL METHOD im_item->if_longtexts_mm~adopt_text
EXPORTING
im_tdid = 'B01'.
ENDIF.
endif.
ENDMETHOD.
but my code is not working, it is not displaying any text in item level and when i debugged the code it is looping not coming out of the loop until i click on stop transaction. Can any one please help me,
Thanks,
Alka
‎2010 Dec 04 11:56 AM
To avoid infinate LOOP the code written should be within the if condition "IF im_count eq 1" . See the Wiki post regarding populating Header text in Purchase requistion.[Purchase Req. Header Long Text using Badi - ME_PROCESS_REQ_CUST|https://wiki.sdn.sap.com/wiki/display/stage/PurchaseReq.HeaderLongTextusingBadi-ME_PROCESS_REQ_CUST]