12-12-2011 9:33 PM
Hi ,
Whenever save the Purchase order, i am populating text editor and entering the text into it while creating purchase order.
if there is no text in the heade text , the text from the Text editor update into the BADI ME_PROCESS_PO_CUST-POST
and update in the header text.
If already text in the Header text, it is not updating into the header text.
Can anybody help me.
12-13-2011 8:48 AM
Hi
Have you tried to use IF_LONGTEXTS_MM~SET_TEXT of interface IF_PURCHASE_ORDER_MM in the BADI?
Regards
Eduardo
Edited by: E_Hinojosa on Dec 13, 2011 9:48 AM
12-13-2011 4:10 PM
hi,
I am using the same method to update header text from the BADI, but still it is not updating.
Regards,
Madhavi
12-14-2011 10:48 AM
Hi madhavi,
once go through this code, i hope it resolves your issue.
METHOD if_ex_me_process_req_cust~process_item.
02.IF im_count EQ 1. " to avoid infinate Loop"
03.DATA : ls_item_data TYPE mereq_item,
04.lc_source TYPE REF TO cl_source_of_supply_mm,
05.lt_source TYPE mereq_t_source_of_supply,
06.ls_source TYPE REF TO cl_source_of_supply_mm,
07.ls_source_data TYPE mereq_source,
08.lv_obj TYPE REF TO object,
09.lv_attr TYPE string,
10.lv_aktyp TYPE aktyp,
11.lv_source_n TYPE sy-tabix.
12.
13.DATA : lv_tdobject TYPE tdobject,
14.lv_metafield TYPE mmpur_metafield,
15.lt_texttypes TYPE mmpur_t_texttypes,
16.ls_texttypes TYPE mmpur_texttypes,
17.lt_textlines TYPE mmpur_t_textlines,
18.ls_textlines TYPE mmpur_textlines.
19.
20.FIELD-SYMBOLS : <fs_lcl> TYPE ANY,
21.<fs_source> TYPE ANY.
22.
23.*************************************************
24.** Access Attributes value of Local Class
25.** for getting the transaction mode of Line item
26.** H-> Create
27.*************************************************
28.lv_obj ?= im_item.
29.MOVE 'MY_STATE->AKTYP' TO lv_attr.
30.ASSIGN lv_obj->(lv_attr) TO <fs_lcl>.
31.lv_aktyp = <fs_lcl>.
32.
33.IF lv_aktyp EQ 'H'. "While creating line item"
34.*************************************************
35.** Extracting existing Item Data and Modify the fields
36.** Requestor Name (AFNAM) & Source of supply details
37.*************************************************
38.CLEAR : ls_item_data.
39.ls_item_data = im_item->get_data( ).
40.MOVE ls_item_data-ernam TO ls_item_data-afnam.
41.
42.** Get source of supply details
43.
44.CLEAR : ls_source.
45.lc_source = im_item->get_source_of_supply( ).
46.lt_source = lc_source->update( im_nomei = 'X' ).
47.DESCRIBE TABLE lt_source LINES lv_source_n.
48.IF lv_source_n EQ 1. "Assign the default data otherwise populate the list"
49.READ TABLE lt_source ASSIGNING <fs_source> INDEX 1.
50.IF sy-subrc EQ 0.
51.ls_source ?= <fs_source>.
52.ls_source_data = ls_source->get_data( ).
53.MOVE-CORRESPONDING ls_source_data TO ls_item_data.
54.ENDIF.
55.ENDIF.
56.im_item->set_data(
57.EXPORTING
58.im_data = ls_item_data ).
59.*************************************************
60.** Populating item text while creating Line item
61.*************************************************
62.** Get Text Object **
63.CLEAR : lv_metafield, lv_tdobject.
64.im_item->if_longtexts_mm~get_textobject(
65.IMPORTING
66.ex_tdobject = lv_tdobject
67.ex_metafield = lv_metafield ).
68.** Get Text IDs **
69.REFRESH : lt_texttypes.
70.CLEAR : ls_texttypes.
71.im_item->if_longtexts_mm~get_types(
72.IMPORTING
73.ex_texttypes = lt_texttypes ).
74.** Updating Item Text
75.LOOP AT lt_texttypes INTO ls_texttypes.
76.CLEAR : ls_textlines.
77.REFRESH : lt_textlines.
78.MOVE lv_tdobject TO ls_textlines-tdobject.
79.MOVE ls_texttypes-tdid TO ls_textlines-tdid.
80.MOVE '*' TO ls_textlines-tdformat.
81.CONCATENATE 'Test : ' ls_texttypes-tdtext INTO ls_textlines-tdline.
82.APPEND ls_textlines TO lt_textlines.
83.im_item->if_longtexts_mm~set_text(
84.EXPORTING
85.im_tdid = ls_texttypes-tdid
86.im_textlines = lt_textlines ).
87.ENDLOOP.
88.ENDIF.
89.ENDIF.
90.ENDMETHOD.
Regards,
Ravi