‎2009 May 20 5:33 PM
hello,
I am working on a program where I want to have the user enter options and then loop thru a internal table using these options to process the data.the options are the user id and the t-code. I can get the user id to work but I am having problems with the t-code option. The only way that I can get the values to work in my selection process is to code in the ranges tab. If I enter a single t-code or a list of t-codes, this does not work. it does work for the user id field. I can do single selects, ranges, and selects using lists of users.
I am not sure what I I am doing wrong.
I have attached a portion of the code that highlights the process.
If someone could take a look at this and let me know if there is something that I am missing or have coded wrong, that would be a big help
TABLES: tstct,
usr02.
Structure for select options of bukrs(Company Code)
TYPES: BEGIN OF ty_tcode,
sign(1) TYPE c,
option(2) TYPE c,
low TYPE tstct-tcode,
high TYPE tstct-tcode,
END OF ty_tcode,
Structure for select options of lifnr(Vendor Number)
BEGIN OF ty_empl,
sign(1) TYPE c,
option(2) TYPE c,
low TYPE xubname,
high TYPE xubname,
END OF ty_empl,
SELECTION-SCREEN BEGIN OF BLOCK a WITH FRAME TITLE text-001.
SELECT-OPTIONS: s_tcode for tstct-tcode, " Transaction code
s_empl FOR usr02-bname. " Vendor Number
SELECTION-SCREEN END OF BLOCK a.
PERFORM process_data USING it_summu[]
CHANGING it_outdata.
FORM process_data USING p1_it_summu TYPE ty_t_summu
CHANGING p1_it_outdata TYPE ty_t_outdata.
LOOP AT p1_it_summu INTO wa_summu
WHERE entry_id IN s_tcode
and account in s_empl.
MOVE wa_summu-account TO wa_outdata-account.
MOVE wa_summu-entry_id TO wa_outdata-tcode.
ENDLOOP. " LOOP AT IT_SUMMU
ENDFORM. " FORM PROCESS_DATA
‎2009 May 20 5:49 PM
Hi ..
Try like below code..
TABLES: tstct,
usr02.
data : BEGIN OF t_tcode occurs 0,
tcode TYPE tstct-tcode,
END OF t_tcode,
* Structure for select options of lifnr(Vendor Number)
BEGIN OF t_empl occurs 0,
bname TYPE xubname,
END OF t_empl,
SELECTION-SCREEN BEGIN OF BLOCK a WITH FRAME TITLE text-001.
SELECT-OPTIONS: s_tcode for tstct-tcode, " Transaction code
s_empl FOR usr02-bname. " Vendor Number
SELECTION-SCREEN END OF BLOCK a.
Start-of-selection
select tcode from tstc into table t_tcode where tcode in s_tcode. "add this
select bname from user02 into table t_empl where bname in s_empl. "add this
PERFORM process_data USING it_summu[]
CHANGING it_outdata.
FORM process_data USING p1_it_summu TYPE ty_t_summu
CHANGING p1_it_outdata TYPE ty_t_outdata.
LOOP AT p1_it_summu INTO wa_summu.
read table t_code with key tcode = wa_summu-entry_id binary search.
if sy-subrc = 0.
MOVE wa_summu-entry_id TO wa_outdata-tcode.
read table t_empl with key bname = wa_summu-account binary search.
if sy-subrc = 0.
MOVE wa_summu-account TO wa_outdata-account.
append wa_outdata to t_outdata.
endif.
endif.
ENDLOOP. " LOOP AT IT_SUMMU
ENDFORM. " FORM PROCESS_DATA
Regards,
Prabhduas
‎2009 May 20 5:44 PM
It looks quite OK, however, you are comparing field 'entry_id' with s_tcode. Do these types differ? Has the field 'entry_id' the same type as s_tcode (CHAR20)?
Otherwise, it might be a good idea to post the whole code in here. Make sure you put this code in between
& for better formatting and that it does not exceed 2500 (or was it 5000) characters.
‎2009 May 20 5:47 PM
HI,
Try this one ..
FORM process_data USING p1_it_summu TYPE ty_t_summu
CHANGING p1_it_outdata TYPE ty_t_outdata.
LOOP AT p1_it_summu INTO wa_summu
WHERE entry_id IN s_tcode
and account in s_empl.
MOVE wa_summu-account TO wa_outdata-account.
MOVE wa_summu-entry_id TO wa_outdata-tcode.
*append wa_outdata to p1_it_outdata.*
*clear wa_outdata.*
ENDLOOP. " LOOP AT IT_SUMMU
ENDFORM. " FORM PROCESS_DATAThanks
Sudheer
‎2009 May 20 5:49 PM
Hi ..
Try like below code..
TABLES: tstct,
usr02.
data : BEGIN OF t_tcode occurs 0,
tcode TYPE tstct-tcode,
END OF t_tcode,
* Structure for select options of lifnr(Vendor Number)
BEGIN OF t_empl occurs 0,
bname TYPE xubname,
END OF t_empl,
SELECTION-SCREEN BEGIN OF BLOCK a WITH FRAME TITLE text-001.
SELECT-OPTIONS: s_tcode for tstct-tcode, " Transaction code
s_empl FOR usr02-bname. " Vendor Number
SELECTION-SCREEN END OF BLOCK a.
Start-of-selection
select tcode from tstc into table t_tcode where tcode in s_tcode. "add this
select bname from user02 into table t_empl where bname in s_empl. "add this
PERFORM process_data USING it_summu[]
CHANGING it_outdata.
FORM process_data USING p1_it_summu TYPE ty_t_summu
CHANGING p1_it_outdata TYPE ty_t_outdata.
LOOP AT p1_it_summu INTO wa_summu.
read table t_code with key tcode = wa_summu-entry_id binary search.
if sy-subrc = 0.
MOVE wa_summu-entry_id TO wa_outdata-tcode.
read table t_empl with key bname = wa_summu-account binary search.
if sy-subrc = 0.
MOVE wa_summu-account TO wa_outdata-account.
append wa_outdata to t_outdata.
endif.
endif.
ENDLOOP. " LOOP AT IT_SUMMU
ENDFORM. " FORM PROCESS_DATA
Regards,
Prabhduas
‎2009 May 20 7:02 PM
Prabhduas
thanks for the code. I tried it and it is working.
what is happening is that the summu table contains data from the FM SAPWL_WORKLOAD_GET_STATISTIC. this data is the data that is displayed when you do a ST03N transaction. what is happening is that when the t-code is being checked, it is not selecting some of the t-codes that are showing up on a ST03N display because these are not in the TSTC table.
‎2009 May 20 7:28 PM
I think you are missing append statement in the loop
LOOP AT p1_it_summu INTO wa_summu.
....
....
Move.....
append wa_output to i_output "<<<<
ENDLOOP.
a®
‎2009 May 21 12:59 PM