Quantcast
Channel: Jive Syndication Feed
Viewing all articles
Browse latest Browse all 10881

Custom Screen in Transaction Manager, Facility

$
0
0

Custom Screen in Transaction Manager - TM_61/ 62/63

 

In this Blog, lets see how to enhance a the transaction manager screen using a BADI. Basically adding a new custom tab.

 

Transaction manager is TM_61.

 

The basic table behind this transaction is VTBFHA.

 

We need to create the Append structure for this table with the needed fields that you think must be there in the screen,

 

append.JPG

Now comes the tricky part. Which BADI to use and how to implement the logic.

The BADI here to be used is 'FTR_CUSTOMER_EXTENT'.

 

Create a BADi implementation for this BADI.

 

BADI.JPG

Next step is that we have to create a function Group.

 

Now we need 2 things.

1. Screen where we will have the new fields must be created in this Function group.

Note: The screen must be created as a sub-screen.

 

screen.JPG

 

 

scrren1.JPG

 

scrren2.JPG

Write Logic in PBO & PAI accordingly.

 

PBO1.JPG

 

Now comes one more interesting aspect of how you need to handle this custom fields in your PBO.

 

We need to get the custom data fields using the 'GET_CUST_DATA' method and then do further logics.

 

 

 

FORM 100_PREPARE_OUTPUT  CHANGING P_VTMFHA.

  DATA: L_FHA_APPENDS LIKE LINE OF G_TAB_FHA_APPENDS.

  DATA: LD_TEXT1 TYPE T005T-LANDX,

        LD_NAME1 TYPE ZZNAME,

        LD_NAME2 TYPE T880-NAME1.

* try to get append data from VTBFHA

  CALL METHOD G_PROXY_CUST_DATA->GET_CUST_DATA

    IMPORTING

      PE_TAB_FHA_APPENDS = G_TAB_FHA_APPENDS

    EXCEPTIONS

      OTHERS             = 4.

  LOOP AT G_TAB_FHA_APPENDS INTO L_FHA_APPENDS.

    IF NOT L_FHA_APPENDS-CONTENT IS INITIAL.

      VTMFHA-ZZGENERATION = L_FHA_APPENDS-CONTENT+0(2).

      VTMFHA-ZZCOUNTRY    = L_FHA_APPENDS-CONTENT+2(3).

      VTMFHA-ZZBENEFI     = L_FHA_APPENDS-CONTENT+5(10).

      VTMFHA-ZZTRADPAR    = L_FHA_APPENDS-CONTENT+15(25).

    ENDIF.

  ENDLOOP.



  IF NOT VTMFHA-ZZCOUNTRY IS INITIAL.

    SELECT SINGLE LANDX INTO LD_TEXT1 FROM T005T WHERE LAND1 = VTMFHA-ZZCOUNTRY AND SPRAS = SY-LANGU.

    IF SYST-SUBRC = 0.

      T005T-LANDX = LD_TEXT1.

    ENDIF.

  ENDIF.



  IF NOT VTMFHA-ZZBENEFI IS INITIAL.

    SELECT SINGLE NAME1 INTO LD_NAME1 FROM ZTM_CUST_BOND WHERE ZCUSTOMER = VTMFHA-ZZBENEFI AND LAND1 = VTMFHA-ZZCOUNTRY.

    IF SYST-SUBRC = 0.

      ZTM_CUST_BOND-NAME1 = LD_NAME1.

    ENDIF.

  ENDIF.



  IF NOT VTMFHA-ZZTRADPAR IS INITIAL.

    SELECT SINGLE NAME1 INTO LD_NAME2 FROM T880 WHERE RCOMP = VTMFHA-ZZTRADPAR.

    IF SYST-SUBRC = 0.

      T880-NAME1 = LD_NAME2.

    ENDIF.

  ENDIF.



  CALL METHOD G_PROXY_FMOD->APPLY_FMOD.

 

Next is PAI

PAI.JPG

PAI2.JPG

You need to concatenate all the values and send into the CONTENT and the system will take care of splitting it and storing using the SET_CUST_DATA.

 

2. A Function module which we will use in the BADI to call this screen. The structure is a standard and is a copy from the standard FM but you need to implement your logic inside to get the right screen created above to be called.

FM.JPG

 

 

 

DATA: L_BADI_TABS LIKE LINE OF PC_TAB_BADI_TABS.

  DATA: L_TAB_MOD_FIELDS TYPE FTRG_TAB_FIELD_MODIFY.

  DATA: L_MOD_FIELDS LIKE LINE OF L_TAB_MOD_FIELDS.



* save references in the global memory of the function module first

  G_PROXY_TRANSACTION  = PI_PROXY_TRANSACTION.

  G_PROXY_CUST_DATA    = PI_CUST_TRANSACTION.

  G_PROXY_MESSAGES     = PI_PROXY_MESSAGES.

  G_PROXY_FCODE        = PI_PROXY_FCODE.

  G_PROXY_FMOD         = PI_PROXY_FMOD.



  L_BADI_TABS-REPID    = 'SAPLZFI_TRM_TM_BOND'. "REPORT

  L_BADI_TABS-DYNNR    = '0100'.       "Subscreen

  L_BADI_TABS-TEXT_TAB = TEXT-001.     "Text (max. 30 CHAR) to displayed

  MODIFY PC_TAB_BADI_TABS FROM L_BADI_TABS

                          TRANSPORTING REPID DYNNR TEXT_TAB

                          WHERE FCODE = C_CUSTOM_GUI_FCODE1. "1st FCODE



  L_MOD_FIELDS-TABNAME = 'VTMFHA'.

  L_MOD_FIELDS-FIELDNAME = 'ZZGENERATION'.

  IF SY-TCODE NE 'TM_63'.

    L_MOD_FIELDS-ATTRIBUTE = C_FMOD_INPUT.

  ELSE.

    L_MOD_FIELDS-ATTRIBUTE = C_FMOD_DISPLAY.

  ENDIF.

  APPEND L_MOD_FIELDS TO L_TAB_MOD_FIELDS.



  L_MOD_FIELDS-TABNAME = 'VTMFHA'.

  L_MOD_FIELDS-FIELDNAME = 'ZZCOUNTRY'.

  IF SY-TCODE NE 'TM_63'.

    L_MOD_FIELDS-ATTRIBUTE = C_FMOD_INPUT.

  ELSE.

    L_MOD_FIELDS-ATTRIBUTE = C_FMOD_DISPLAY.

  ENDIF.

  APPEND L_MOD_FIELDS TO L_TAB_MOD_FIELDS.



  L_MOD_FIELDS-TABNAME = 'VTMFHA'.

  L_MOD_FIELDS-FIELDNAME = 'ZZBENEFI'.

  IF SY-TCODE NE 'TM_63'.

    L_MOD_FIELDS-ATTRIBUTE = C_FMOD_INPUT.

  ELSE.

    L_MOD_FIELDS-ATTRIBUTE = C_FMOD_DISPLAY.

  ENDIF.

  APPEND L_MOD_FIELDS TO L_TAB_MOD_FIELDS.





  L_MOD_FIELDS-TABNAME = 'VTMFHA'.

  L_MOD_FIELDS-FIELDNAME = 'ZZTRADPAR'.

  IF SY-TCODE NE 'TM_63'.

    L_MOD_FIELDS-ATTRIBUTE = C_FMOD_INPUT.

  ELSE.

    L_MOD_FIELDS-ATTRIBUTE = C_FMOD_DISPLAY.

  ENDIF.

  APPEND L_MOD_FIELDS TO L_TAB_MOD_FIELDS.



  CALL METHOD G_PROXY_FMOD->SET_FIELDMOD

    EXPORTING

      PI_MODIFIED_FIELDS = L_TAB_MOD_FIELDS.

 

Now you are done with the steps and when you open the transaction TM_61 you can find the new tab coming up in the screen.

 

TM63.JPG

 

 

You can follow similar steps for the other transactions where you need to enhance a screen using a BADI. To ensure that you can use the BADI check if there is a FCODE and Screen in the BADI.

 

Appreciate your comments & feedback.


Viewing all articles
Browse latest Browse all 10881

Trending Articles



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