How to handle one SAP T-CODE link to many report/program ?
If you implement SAP more than one company in one machine (client) where few report/program has a same purpose and we have to create few T-CODE for same purpose report/program. The Question is How to create one T-CODE for many report/program.
For handle this
1. Just copy t-code and program in START_REPORT to ZSTART_REPORT and add new dialog screen for input company code and add checking authorization in module user_command.
2. Create table for maintain link between tcode and program name.
Field Type Key
MANDT MANDT X
TCODE TCODE X
BUKRS BUKRS X
REPORTTYPE REPORTTYPE X
REPORT PROGNAME X
EXTDREPORT EXTDREPORT
RVARIANT RALDB_VARI
3. Insert code in user_command_screen 100
CASE d100_okcode.
WHEN c_command_okay.
* submit report
* authority check is disabled. authority will be checked when
CALL SCREEN 9000
STARTING AT 35 05 ENDING AT 70 10.
IF d9000_okcode = 'CANCEL'.
LEAVE TO SCREEN 0.
ENDIF.
SELECT SINGLE * INTO d_linktcode
FROM zco_linktcode
WHERE bukrs = v_bukrs
AND tcode = d_srepovari-report.
IF sy-subrc NE 0.
MESSAGE i181(ds) WITH 'This company not related for this tcode !'.
LEAVE TO SCREEN 0.
ENDIF.
d_srepovari-report = d_linktcode-report.
d_srepovari-reporttype = d_linktcode-reporttype.
d_srepovari-extdreport = d_linktcode-extdreport.
d_srepovari-variant = d_linktcode-rvariant.
**
Hope this tips can help
For handle this
1. Just copy t-code and program in START_REPORT to ZSTART_REPORT and add new dialog screen for input company code and add checking authorization in module user_command.
2. Create table for maintain link between tcode and program name.
Field Type Key
MANDT MANDT X
TCODE TCODE X
BUKRS BUKRS X
REPORTTYPE REPORTTYPE X
REPORT PROGNAME X
EXTDREPORT EXTDREPORT
RVARIANT RALDB_VARI
3. Insert code in user_command_screen 100
CASE d100_okcode.
WHEN c_command_okay.
* submit report
* authority check is disabled. authority will be checked when
CALL SCREEN 9000
STARTING AT 35 05 ENDING AT 70 10.
IF d9000_okcode = 'CANCEL'.
LEAVE TO SCREEN 0.
ENDIF.
SELECT SINGLE * INTO d_linktcode
FROM zco_linktcode
WHERE bukrs = v_bukrs
AND tcode = d_srepovari-report.
IF sy-subrc NE 0.
MESSAGE i181(ds) WITH 'This company not related for this tcode !'.
LEAVE TO SCREEN 0.
ENDIF.
d_srepovari-report = d_linktcode-report.
d_srepovari-reporttype = d_linktcode-reporttype.
d_srepovari-extdreport = d_linktcode-extdreport.
d_srepovari-variant = d_linktcode-rvariant.
**
Hope this tips can help
Comments