Quantcast
Channel: SCN : All Content - SAP Gateway
Viewing all articles
Browse latest Browse all 2823

How to save text(PR Approver comments) in header level.

$
0
0

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’.

               img1.png

Expand ‘Class Library->Classes’, double click on class ‘CL_GBAPP_APV_PR_API’.img2.png   

Find the method ‘SET_DECISION_REL_COLLECTIVE’, double click on the method.img3.png

Once get into the method click on the Enhance (Shift + F4) button from tool bar.

               img4.png

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.

img5.PNG

Right click at the end of the method, choose 'Enhancement Operations -> Create Implicit Enhancement’. click on 'Code' button.

img6.PNG

'Select or Create Enhancement Implementation' popup will come.It will ask you the Enhancement name & Short description. click on Enter.

img7.PNG

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:-
    1. Check whether the Document Type is not equal to RV (Contract Requisition) or not.
    2. If Document Type is not RV, then initiate the text (FM: INIT_TEXT) with Id = ‘B01’, Name = ‘PR No.’ and Object = ‘EBANH’.
    3. Loop the Item text table and append to the other table (Which is the input table of SAVE_TEXT function module).
    4. 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.


Viewing all articles
Browse latest Browse all 2823

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>