Hi Vince,
I used implicit enhancements wherever possible and Created 3 Z impl for the Enhancement Spot ES_RIAUFK20 : With the BADi you can create only 2 buttons. Steps to follow : (1) First go to SE38 and go to program - RIAFVC20. This is the program which executes the transaction - IW37. Go to the following line: ENHANCEMENT-POINT RIAFVC20_01 SPOTS ES_RIAFVC20 STATIC. Create an explicit enhancement at this particular point and code as given below. (Make sure that the Include Program is made before the enhancement and have it activated. Then SAVE and ACTIVATE the enhancement. {ENHANCEMENT 8 Z_IW37_PRINT_WO_INCLUDE. "active version INCLUDE ZRIAFVC20_PRINT. ENDENHANCEMENT. }(2) Now go to program - MIOLVC20 and repeat the same procedure for the following enhancement spot: ENHANCEMENT-POINT create_fieldgroups_l_01 SPOTS es_miolvc20 INCLUDE BOUND. Code in the enhancement spot as given below: { ENHANCEMENT 28 Z_IW37_PRINT_WO. "active version IF SY-TCODE EQ 'IW37'. G_FORM_SET_PF_STAT = 'ZSET_PF_STAT_F14'. ENDIF.ENDENHANCEMENT. } (3) Now go to program - MIOLXF16 and make an implicit enhancement at the end of the subroutine - "FORM user_command_f16 USING p_ucomm LIKE sy-ucomm p_selfield TYPE slis_selfield." Coding for this point is given below : { ENHANCEMENT 9 Z_IW37_PRINT_WO_INCLUDE. "active version *Add user command enhancement for custom button - 'PRN_CUS' CASE P_UCOMM. WHEN 'PRN_CUS'. IF SY-TCODE EQ 'IW37'. PERFORM zuser_command_f16 USING p_ucomm p_selfield. ENDIF. ENDCASE. ENDENHANCEMENT. } (4) Now go to INCLUDE ZRIAFVC20_PRINT and code as below : { FORM ZSET_PF_STAT_F14 USING RT_EXTAG TYPE SLIS_T_EXTAB. "#EC CALLED * Perform SAP default code. PERFORM SET_PF_STAT_F14 USING RT_EXTAG. "#EC * Overwrite SAP's GUI with custom GUI, stored in program 'ZRIAFVC20_MAIN'and make sure that the PF-STATUS of the program is defined already . IF G_AKTYP = 'V'. "#EC * SET PF-STATUS 'ZAEND' OF PROGRAM 'ZRIAFVC20_MAIN' EXCLUDING RT_EXTAG."#EC * ENDIF. ENDFORM. "ZSET_PF_STAT_F14 FORM ZUSER_COMMAND_F16 USING P_UCOMM LIKE SY-UCOMM P_SELFIELD TYPE SLIS_SELFIELD. message 'This is developed using Enhancement Framework' type 'I'. ENDFORM. "zuser_command_f16 (5) Finally make a test program - 'ZRIAFVC20_MAIN'. Here the new GUI status has to be defined (copy the standard GUI status to this program and then add your own button). Please make sure that you name the GUI status ZAEND or fix the above code to reflect the changed PF-Status.