2005 Sep 15 5:08 PM
Hi,
How to do:
1)IDENTIFY: All ZPrograms in R/3 that DO NOT have a transaction code assigned
2)CREATE: For all ZPrograms in R/3 that DO NOT have a transaction code assigned we want the following:
Assign a system generated transaction code to the ZProgram ( ** Maybe use Program name as Tcode** )
Any input/help (table names,code,..) is highly appreciated.
Thanks
Naved
2005 Sep 15 5:34 PM
I happen to have done #2 a while ago. You have to create a transport first and then enter it on the selection screen. It runs in the development environment:
report zftu065 no standard page heading line-size 80 message-id zc.
* tables ---------------------------------------------------------------
tables: trdir, "System table TRDIR
trdirt, "Title texts for programs in TRDIR
tadir, "Directory of Repository Objects
e070. "Change & Transport System: Header of Requests/Tasks
* parameters -----------------------------------------------------------
select-options: s_prog for trdir-name obligatory
memory id rid.
selection-screen uline.
parameters: x_upd radiobutton group typ.
parameters: p_trans like ko008-trkorr.
selection-screen uline.
parameters: x_tst radiobutton group typ default 'X'.
* data ----------------------------------------------------------------
data: begin of bdcdata occurs 0.
include structure bdcdata.
data: end of bdcdata.
data: begin of pgm_data_int occurs 0.
include structure trdirt.
data: end of pgm_data_int.
* Global Data
data: ok_code(8).
* initialization -------------------------------------------------------
initialization.
* selection screen -----------------------------------------------------
at selection-screen.
perform check_parms.
at selection-screen on value-request for p_trans.
perform get_trans.
* Main -----------------------------------------------------------------
start-of-selection.
perform init_data.
perform get_data.
end-of-selection.
perform batch_session. "Create Transactions
* Forms ----------------------------------------------------------------
*&---------------------------------------------------------------------*
*& Form GET_DATA
*&---------------------------------------------------------------------*
form get_data.
select * from trdirt
into corresponding fields of table pgm_data_int
where name in s_prog
and sprsl = 'EN'.
loop at pgm_data_int
where text is initial.
pgm_data_int-text = pgm_data_int-name.
modify pgm_data_int.
endloop.
endform. " GET_DATA
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Form BATCH_SESSION
*&---------------------------------------------------------------------*
form batch_session.
perform open_batch_session using 'CREATE_TRANS'.
loop at pgm_data_int.
perform create_trans.
perform insert_batch_session using 'SE93'.
endloop.
perform close_batch_session.
perform start_batch_session using 'CREATE_TRANS'.
endform. " BATCH_SESSION
*&---------------------------------------------------------------------*
*& Form OPEN_BATCH_SESSION
*&---------------------------------------------------------------------*
form open_batch_session using group.
call function 'BDC_OPEN_GROUP'
exporting
group = group
user = sy-uname
exceptions
client_invalid = 01
destination_invalid = 02
group_invalid = 03
holddate_invalid = 04
internal_error = 05
queue_error = 06
running = 07
user_invalid = 08.
if sy-subrc ne 0.
message e025 with 'Unable to open batch input session.'.
endif.
endform. " OPEN_BATCH_SESSION
*&---------------------------------------------------------------------*
*& Form DYNPRO
*&---------------------------------------------------------------------*
form dynpro using dynbegin name value.
clear bdcdata.
if dynbegin = 'X'.
move: name to bdcdata-program,
value to bdcdata-dynpro,
'X' to bdcdata-dynbegin.
else.
move: name to bdcdata-fnam,
value to bdcdata-fval.
endif.
condense: bdcdata-fnam, bdcdata-fval.
append bdcdata.
endform. " DYNPRO
*&---------------------------------------------------------------------*
*& Form INSERT_BATCH_SESSION
*&---------------------------------------------------------------------*
form insert_batch_session using transaction.
call function 'BDC_INSERT'
exporting
tcode = transaction
tables
dynprotab = bdcdata
exceptions
internal_error = 01
not_open = 02
queue_error = 03
tcode_invalid = 04.
if sy-subrc ne 0.
message e025 with 'Unable to insert batch input session.'.
endif.
endform. " INSERT_BATCH_SESSION
*&---------------------------------------------------------------------*
*& Form CLOSE_BATCH_SESSION
*&---------------------------------------------------------------------*
form close_batch_session.
call function 'BDC_CLOSE_GROUP'
exceptions
not_open = 01
queue_error = 02.
endform. " CLOSE_BATCH_SESSION
*&---------------------------------------------------------------------*
*& Form START_BATCH_SESSION
*&---------------------------------------------------------------------*
form start_batch_session using session_name.
commit work.
submit rsbdcsub using selection-set session_name and return.
endform. " START_BATCH_SESSION
*&---------------------------------------------------------------------*
*& Form CREATE_TRANS
*&---------------------------------------------------------------------*
form create_trans.
clear bdcdata.
refresh bdcdata.
perform dynpro using: "Maintain Transaction
'X' 'SAPLSEUK' '0390',
' ' 'TSTC-TCODE' pgm_data_int-name(20),
' ' 'BDC_OKCODE' '/05'. "Create
perform dynpro using: "Create Transaction popup
'X' 'SAPLSEUK' '0300',
' ' 'TSTCT-TTEXT' pgm_data_int-text(36),
' ' 'RSSTCD-S_TRANS' ' ',
' ' 'RSSTCD-S_REPORT' ' ',
' ' 'RSSTCD-S_CLASS' ' ',
' ' 'RSSTCD-S_VARI' ' ',
' ' 'RSSTCD-S_PARA' 'X'. "Parameter Transaction
perform dynpro using: "Create Parameter Transaction
'X' 'SAPLSEUK' '0330',
' ' 'RSSTCD-ST_TCODE' 'X',
' ' 'RSSTCD-CALL_TCODE' 'START_REPORT',
' ' 'RSSTCD-ST_SKIP_1' 'X',
' ' 'G_GUI_INHE' 'X',
' ' 'RSSTCD-PARA_FIELD(1)' 'D_SREPOVARI-REPORT',
' ' 'RSSTCD-PARA_VALUE(1)' pgm_data_int-name,
' ' 'BDC_OKCODE' ok_code. "save or check
if x_upd = 'X'.
perform dynpro using: "Assign a development class
'X' 'SAPLSTRD' '0100',
' ' 'KO007-L_DEVCLASS' 'ZDEV',
' ' 'BDC_OKCODE' 'ADD'. "save
perform dynpro using: "Assign a transport number
'X' 'SAPLSTRD' '0300',
' ' 'KO008-TRKORR' p_trans,
' ' 'BDC_OKCODE' 'LOCK'. "save
perform dynpro using: "Create Parameter Transaction
'X' 'SAPLSEUK' '0330',
' ' 'BDC_OKCODE' '/03'. "back
perform dynpro using: "Maintain Transaction
'X' 'SAPLSEUK' '0390',
' ' 'BDC_OKCODE' '/03'. "Back
else.
perform dynpro using: "Create Parameter Transaction
'X' 'SAPLSEUK' '0330',
' ' 'BDC_OKCODE' '/03'. "back
perform dynpro using: "popup
'X' 'SAPLSPO1' '0100',
' ' 'BDC_CURSOR' 'SPOP-OPTION2'. "choose no
perform dynpro using: "Maintain Transaction
'X' 'SAPLSEUK' '0390',
' ' 'BDC_OKCODE' '/03'. "Back
endif.
endform. " CREATE_TRANS
*&---------------------------------------------------------------------*
*& Form init_data
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
form init_data.
if x_upd = 'X'.
ok_code = 'WB_SAVE'.
else.
ok_code = 'WB_CHECK'.
endif.
endform. " init_data
*&---------------------------------------------------------------------*
*& Form get_trans
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
form get_trans.
call function 'TR_F4_REQUESTS'
exporting
iv_username = sy-uname
iv_trkorr_pattern = 'FISK*'
iv_trfunctions = ' '
iv_trstatus = ' '
iv_title = 'Select a Request...'
importing
ev_selected_request = p_trans.
endform. " get_trans
*&---------------------------------------------------------------------*
*& Form check_parms
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
form check_parms.
* Program may only be run in FIS
if sy-sysid <> 'FIS'.
message e205 with 'Only run this program in FIS'.
endif.
* If test, should be no transport
if x_tst = 'X' and
not p_trans is initial.
message w205 with 'Test run - do not enter a transport number'.
endif.
* If update, should be no transport
if x_upd = 'X' and
p_trans is initial.
message e205 with
'You must specify a transport request for an update run'.
endif.
* If transport entered, it must be valid
if not p_trans is initial.
select single * from e070
where trkorr = p_trans.
if sy-subrc <> 0.
message e205 with 'Transport does not exist'.
elseif ( e070-trfunction <> 'K' and "Workbench request
e070-trfunction <> 'S' ) or "Correction
e070-trstatus <> 'D'. "Modifiable
message e205 with 'Invalid transport'.
endif.
endif.
endform. " check_parmsRob
Hi,
How to do:
1)IDENTIFY: All ZPrograms in R/3 that DO NOT have a transaction code assigned
2)CREATE: For all ZPrograms in R/3 that DO NOT have a transaction code assigned we want the following:
Assign a system generated transaction code to the ZProgram ( ** Maybe use Program name as Tcode** )
Any input/help (table names,code,..) is highly appreciated.
Thanks
Naved
2005 Sep 15 5:18 PM
Hi,
Transaction codes are stored into table TSTC. The programs can be found in table TADIR. Transaction codes are created with tr.code SE93.
Svetlin
2005 Sep 15 5:23 PM
Hi Naved
1- I think you should do a query (table TRDIR) to get out all Zprograms, and after check which programs are in TSCT;
2- You can try to create a BDC (trx SE93) or check some fm of function group SEUK: there's RPY_TRANSACTION_INSERT, but I don't know it;
Regards
Max
Message was edited by: max bianchi
Message was edited by: max bianchi
2005 Sep 15 5:32 PM
Hi
Select all TRDIR where SUBC = '1' ( report programs ).
( function Pools SUBC = 'F' / Module Pools SUBC = 'M' _
For each TRDIR entry Check in TSTC.
All the entries not existing in TSTC will form the set you need to process further.
You can write BDC to create t code .
Cheers
2005 Sep 15 5:34 PM
I happen to have done #2 a while ago. You have to create a transport first and then enter it on the selection screen. It runs in the development environment:
report zftu065 no standard page heading line-size 80 message-id zc.
* tables ---------------------------------------------------------------
tables: trdir, "System table TRDIR
trdirt, "Title texts for programs in TRDIR
tadir, "Directory of Repository Objects
e070. "Change & Transport System: Header of Requests/Tasks
* parameters -----------------------------------------------------------
select-options: s_prog for trdir-name obligatory
memory id rid.
selection-screen uline.
parameters: x_upd radiobutton group typ.
parameters: p_trans like ko008-trkorr.
selection-screen uline.
parameters: x_tst radiobutton group typ default 'X'.
* data ----------------------------------------------------------------
data: begin of bdcdata occurs 0.
include structure bdcdata.
data: end of bdcdata.
data: begin of pgm_data_int occurs 0.
include structure trdirt.
data: end of pgm_data_int.
* Global Data
data: ok_code(8).
* initialization -------------------------------------------------------
initialization.
* selection screen -----------------------------------------------------
at selection-screen.
perform check_parms.
at selection-screen on value-request for p_trans.
perform get_trans.
* Main -----------------------------------------------------------------
start-of-selection.
perform init_data.
perform get_data.
end-of-selection.
perform batch_session. "Create Transactions
* Forms ----------------------------------------------------------------
*&---------------------------------------------------------------------*
*& Form GET_DATA
*&---------------------------------------------------------------------*
form get_data.
select * from trdirt
into corresponding fields of table pgm_data_int
where name in s_prog
and sprsl = 'EN'.
loop at pgm_data_int
where text is initial.
pgm_data_int-text = pgm_data_int-name.
modify pgm_data_int.
endloop.
endform. " GET_DATA
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Form BATCH_SESSION
*&---------------------------------------------------------------------*
form batch_session.
perform open_batch_session using 'CREATE_TRANS'.
loop at pgm_data_int.
perform create_trans.
perform insert_batch_session using 'SE93'.
endloop.
perform close_batch_session.
perform start_batch_session using 'CREATE_TRANS'.
endform. " BATCH_SESSION
*&---------------------------------------------------------------------*
*& Form OPEN_BATCH_SESSION
*&---------------------------------------------------------------------*
form open_batch_session using group.
call function 'BDC_OPEN_GROUP'
exporting
group = group
user = sy-uname
exceptions
client_invalid = 01
destination_invalid = 02
group_invalid = 03
holddate_invalid = 04
internal_error = 05
queue_error = 06
running = 07
user_invalid = 08.
if sy-subrc ne 0.
message e025 with 'Unable to open batch input session.'.
endif.
endform. " OPEN_BATCH_SESSION
*&---------------------------------------------------------------------*
*& Form DYNPRO
*&---------------------------------------------------------------------*
form dynpro using dynbegin name value.
clear bdcdata.
if dynbegin = 'X'.
move: name to bdcdata-program,
value to bdcdata-dynpro,
'X' to bdcdata-dynbegin.
else.
move: name to bdcdata-fnam,
value to bdcdata-fval.
endif.
condense: bdcdata-fnam, bdcdata-fval.
append bdcdata.
endform. " DYNPRO
*&---------------------------------------------------------------------*
*& Form INSERT_BATCH_SESSION
*&---------------------------------------------------------------------*
form insert_batch_session using transaction.
call function 'BDC_INSERT'
exporting
tcode = transaction
tables
dynprotab = bdcdata
exceptions
internal_error = 01
not_open = 02
queue_error = 03
tcode_invalid = 04.
if sy-subrc ne 0.
message e025 with 'Unable to insert batch input session.'.
endif.
endform. " INSERT_BATCH_SESSION
*&---------------------------------------------------------------------*
*& Form CLOSE_BATCH_SESSION
*&---------------------------------------------------------------------*
form close_batch_session.
call function 'BDC_CLOSE_GROUP'
exceptions
not_open = 01
queue_error = 02.
endform. " CLOSE_BATCH_SESSION
*&---------------------------------------------------------------------*
*& Form START_BATCH_SESSION
*&---------------------------------------------------------------------*
form start_batch_session using session_name.
commit work.
submit rsbdcsub using selection-set session_name and return.
endform. " START_BATCH_SESSION
*&---------------------------------------------------------------------*
*& Form CREATE_TRANS
*&---------------------------------------------------------------------*
form create_trans.
clear bdcdata.
refresh bdcdata.
perform dynpro using: "Maintain Transaction
'X' 'SAPLSEUK' '0390',
' ' 'TSTC-TCODE' pgm_data_int-name(20),
' ' 'BDC_OKCODE' '/05'. "Create
perform dynpro using: "Create Transaction popup
'X' 'SAPLSEUK' '0300',
' ' 'TSTCT-TTEXT' pgm_data_int-text(36),
' ' 'RSSTCD-S_TRANS' ' ',
' ' 'RSSTCD-S_REPORT' ' ',
' ' 'RSSTCD-S_CLASS' ' ',
' ' 'RSSTCD-S_VARI' ' ',
' ' 'RSSTCD-S_PARA' 'X'. "Parameter Transaction
perform dynpro using: "Create Parameter Transaction
'X' 'SAPLSEUK' '0330',
' ' 'RSSTCD-ST_TCODE' 'X',
' ' 'RSSTCD-CALL_TCODE' 'START_REPORT',
' ' 'RSSTCD-ST_SKIP_1' 'X',
' ' 'G_GUI_INHE' 'X',
' ' 'RSSTCD-PARA_FIELD(1)' 'D_SREPOVARI-REPORT',
' ' 'RSSTCD-PARA_VALUE(1)' pgm_data_int-name,
' ' 'BDC_OKCODE' ok_code. "save or check
if x_upd = 'X'.
perform dynpro using: "Assign a development class
'X' 'SAPLSTRD' '0100',
' ' 'KO007-L_DEVCLASS' 'ZDEV',
' ' 'BDC_OKCODE' 'ADD'. "save
perform dynpro using: "Assign a transport number
'X' 'SAPLSTRD' '0300',
' ' 'KO008-TRKORR' p_trans,
' ' 'BDC_OKCODE' 'LOCK'. "save
perform dynpro using: "Create Parameter Transaction
'X' 'SAPLSEUK' '0330',
' ' 'BDC_OKCODE' '/03'. "back
perform dynpro using: "Maintain Transaction
'X' 'SAPLSEUK' '0390',
' ' 'BDC_OKCODE' '/03'. "Back
else.
perform dynpro using: "Create Parameter Transaction
'X' 'SAPLSEUK' '0330',
' ' 'BDC_OKCODE' '/03'. "back
perform dynpro using: "popup
'X' 'SAPLSPO1' '0100',
' ' 'BDC_CURSOR' 'SPOP-OPTION2'. "choose no
perform dynpro using: "Maintain Transaction
'X' 'SAPLSEUK' '0390',
' ' 'BDC_OKCODE' '/03'. "Back
endif.
endform. " CREATE_TRANS
*&---------------------------------------------------------------------*
*& Form init_data
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
form init_data.
if x_upd = 'X'.
ok_code = 'WB_SAVE'.
else.
ok_code = 'WB_CHECK'.
endif.
endform. " init_data
*&---------------------------------------------------------------------*
*& Form get_trans
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
form get_trans.
call function 'TR_F4_REQUESTS'
exporting
iv_username = sy-uname
iv_trkorr_pattern = 'FISK*'
iv_trfunctions = ' '
iv_trstatus = ' '
iv_title = 'Select a Request...'
importing
ev_selected_request = p_trans.
endform. " get_trans
*&---------------------------------------------------------------------*
*& Form check_parms
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
form check_parms.
* Program may only be run in FIS
if sy-sysid <> 'FIS'.
message e205 with 'Only run this program in FIS'.
endif.
* If test, should be no transport
if x_tst = 'X' and
not p_trans is initial.
message w205 with 'Test run - do not enter a transport number'.
endif.
* If update, should be no transport
if x_upd = 'X' and
p_trans is initial.
message e205 with
'You must specify a transport request for an update run'.
endif.
* If transport entered, it must be valid
if not p_trans is initial.
select single * from e070
where trkorr = p_trans.
if sy-subrc <> 0.
message e205 with 'Transport does not exist'.
elseif ( e070-trfunction <> 'K' and "Workbench request
e070-trfunction <> 'S' ) or "Correction
e070-trstatus <> 'D'. "Modifiable
message e205 with 'Invalid transport'.
endif.
endif.
endform. " check_parmsRob
2005 Sep 15 5:35 PM
For creating Tcodes u can use FM SRT_CREATE_TCODE_FOR_REPORT
2005 Sep 16 12:14 AM
2005 Sep 16 3:15 AM