Hi,
the Blog describes how to save text(PR Approver comments) in header level for Standard fiori PR App.
- Enhancements :-
- Ø Implicit Enhancement for Collective Approve Action (SET_DECISION_REL_COLLECTIVE).
- Ø Implicit Enhancement for Collective Reject Action (SET_DECISION_REJECT_COLLECTIVE).
- Implicit Enhancement - SET_DECISION_REL_COLLECTIVE:-
Execute SE80-> choose Package-> specify package name ‘GBAPP_APV_PR’.
Expand ‘Class Library->Classes’, double click on class ‘CL_GBAPP_APV_PR_API’.
Find the method ‘SET_DECISION_REL_COLLECTIVE’, double click on the method.
Once get into the method click on the Enhance (Shift + F4) button from tool bar.
Right click on the method at starting line, choose ‘Enhancement Operations -> Show Implicit Enhancement Options’. It will show like below arrow at both start & end of the the method.
Right click at the end of the method, choose 'Enhancement Operations -> Create Implicit Enhancement’. click on 'Code' button.
'Select or Create Enhancement Implementation' popup will come.It will ask you the Enhancement name & Short description. click on Enter.
Implement custom logic(Logic provide below) between ENHANCEMENT and ENDENHANCEMENT. Save and activate it.
- Implicit Enhancement - SET_DECISION_REJECT_COLLECTIVE:-
Same as ‘Implicit Enhancement - SET_DECISION_REL_COLLECTIVE’.
- Custom Logic:-
- Check whether the Document Type is not equal to RV (Contract Requisition) or not.
- If Document Type is not RV, then initiate the text (FM: INIT_TEXT) with Id = ‘B01’, Name = ‘PR No.’ and Object = ‘EBANH’.
- Loop the Item text table and append to the other table (Which is the input table of SAVE_TEXT function module).
- Pass the Header details (Id + Name + Object) and Text table to the SAVE_TEXT fm.
Code:
DATA : l_thead TYPE thead,
lt_tline TYPE STANDARD TABLE OF tline INITIAL SIZE 30,
l_tline TYPE tline,
l_txfunction TYPE cdupdkz.
DATA : lv_bsart TYPE bbsrt.
IF NOT iv_approval_text IS INITIAL.
SELECT SINGLE bsart
FROM eban
INTO lv_bsart
WHERE banfn = iv_pr_number.
IF lv_bsart <> 'RV'.
l_thead-tdid = 'B01'.
l_thead-tdname = iv_pr_number.
l_thead-tdobject = 'EBANH'.
* initialize text
CALL FUNCTION 'INIT_TEXT'
EXPORTING
id = l_thead-tdid
language = sy-langu
name = l_thead-tdname
object = l_thead-tdobject
IMPORTING
header = l_thead
TABLES
lines = lt_tline
EXCEPTIONS
OTHERS = 1.
LOOP AT lt_text INTO ls_text.
l_tline-tdformat = ls_text-tdformat.
l_tline-tdline = ls_text-tdline.
APPEND l_tline TO lt_tline.
ENDLOOP.
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
header = l_thead
IMPORTING
function = l_txfunction
TABLES
lines = lt_tline
EXCEPTIONS
OTHERS = 1.
ENDIF.
ENDIF.
Regards,
Kiran.