Skip to Content

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 T005TLANDX,

        LD_NAME1 TYPE ZZNAME,

        LD_NAME2 TYPE T880NAME1.

* 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_APPENDSCONTENT IS INITIAL.

      VTMFHAZZGENERATION = L_FHA_APPENDSCONTENT+0(2).

      VTMFHAZZCOUNTRY    = L_FHA_APPENDSCONTENT+2(3).

      VTMFHAZZBENEFI     = L_FHA_APPENDSCONTENT+5(10).

      VTMFHAZZTRADPAR    = L_FHA_APPENDSCONTENT+15(25).

    ENDIF.

  ENDLOOP.

  IF NOT VTMFHAZZCOUNTRY IS INITIAL.

    SELECT SINGLE LANDX INTO LD_TEXT1 FROM T005T WHERE LAND1 = VTMFHAZZCOUNTRY AND SPRAS = SYLANGU.

    IF SYSTSUBRC = 0.

      T005TLANDX = LD_TEXT1.

    ENDIF.

  ENDIF.

  IF NOT VTMFHAZZBENEFI IS INITIAL.

    SELECT SINGLE NAME1 INTO LD_NAME1 FROM ZTM_CUST_BOND WHERE ZCUSTOMER = VTMFHAZZBENEFI AND LAND1 = VTMFHAZZCOUNTRY.

    IF SYSTSUBRC = 0.

      ZTM_CUST_BONDNAME1 = LD_NAME1.

    ENDIF.

  ENDIF.

  IF NOT VTMFHAZZTRADPAR IS INITIAL.

    SELECT SINGLE NAME1 INTO LD_NAME2 FROM T880 WHERE RCOMP = VTMFHAZZTRADPAR.

    IF SYSTSUBRC = 0.

      T880NAME1 = 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_TABSREPID    = ‘SAPLZFI_TRM_TM_BOND’. “REPORT

  L_BADI_TABSDYNNR    = ‘0100’.       “Subscreen

  L_BADI_TABSTEXT_TAB = TEXT001.     “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_FIELDSTABNAME = ‘VTMFHA’.

  L_MOD_FIELDSFIELDNAME = ‘ZZGENERATION’.

  IF SYTCODE NE ‘TM_63’.

    L_MOD_FIELDSATTRIBUTE = C_FMOD_INPUT.

  ELSE.

    L_MOD_FIELDSATTRIBUTE = C_FMOD_DISPLAY.

  ENDIF.

  APPEND L_MOD_FIELDS TO L_TAB_MOD_FIELDS.

  L_MOD_FIELDSTABNAME = ‘VTMFHA’.

  L_MOD_FIELDSFIELDNAME = ‘ZZCOUNTRY’.

  IF SYTCODE NE ‘TM_63’.

    L_MOD_FIELDSATTRIBUTE = C_FMOD_INPUT.

  ELSE.

    L_MOD_FIELDSATTRIBUTE = C_FMOD_DISPLAY.

  ENDIF.

  APPEND L_MOD_FIELDS TO L_TAB_MOD_FIELDS.

  L_MOD_FIELDSTABNAME = ‘VTMFHA’.

  L_MOD_FIELDSFIELDNAME = ‘ZZBENEFI’.

  IF SYTCODE NE ‘TM_63’.

    L_MOD_FIELDSATTRIBUTE = C_FMOD_INPUT.

  ELSE.

    L_MOD_FIELDSATTRIBUTE = C_FMOD_DISPLAY.

  ENDIF.

  APPEND L_MOD_FIELDS TO L_TAB_MOD_FIELDS.

  L_MOD_FIELDSTABNAME = ‘VTMFHA’.

  L_MOD_FIELDSFIELDNAME = ‘ZZTRADPAR’.

  IF SYTCODE NE ‘TM_63’.

    L_MOD_FIELDSATTRIBUTE = C_FMOD_INPUT.

  ELSE.

    L_MOD_FIELDSATTRIBUTE = 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.

To report this post you need to login first.

3 Comments

You must be Logged on to comment or reply to a post.

  1. Alfredo Gomez Ripoll

    Very useful blog,  just one question ¿where do you use the function module name Z_START_TM_61?

    I guess that in the BADI , but, how? what field in the badi do you write?

    Thanks a lot

    (0) 

Leave a Reply