on 07-24-2014 12:01 PM
Hi Everyone.......
Having a simple doubt regarding the looping
I have done this select query
SELECT WF_ID
NODE_ID
WI_ID
TASK_ID
LOG_DATE
LOG_TIME
WI_AGENT
RETURNTYP
LOG_COUNT
FROM SWPSTEPLOG
INTO TABLE lt_SWPSTEPLOG
WHERE wf_id = s_wf_id AND
log_date in s_log AND
wi_agent in s_agent.
After this condition i need to introduce a logic as
-Need to identify the task(task_id)
-From the selected task id of the table SWPSTEPLOG need to check the about the RETURNTYP.
-Say condition wen RETURNTYP = RC or EV .
-The return type RC will represent the Start Date/Time for a specific task, while the return type EV represents the action taken by the user for the previous task, so the Completion Date/Time.
Can any one pls help in this case
hi
After getting the start date and time for the RC task, look for the Completion date and time in a subsequent task where:
WF_ID from RC record = WF_ID from EV record
NODE_ID from RC record = NODE_ID from EV record
WI_ID from RC record = WI_ID from EV record
TASK_ID from RC record = TASK_ID from EV record
how can i achieve this by moving from one record to another
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Define your internal table as one the sorted types, use keys TASK_ID and RETURNTYP. Then LOOP at the table and use a logic like
LOOP AT itab ASSIGNING <fs>.
AT NEW task_id.
" initialize a new record in final table (e.g. APPEND INITIAL RECORD ASSIGNING <final>).
ENDAT.
" move some other fields in new final table record
CASE <fs>-returntyp.
WHEN 'RC'.
" move log date/time to final table start fields
WHEN 'EV'.
" move log date/time to final table end fields
ENDCASE.
AT END OF task_id.
" calculate duration
ENDAT.
ENDLOOP.
Regards,
Raymond
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you need more matching criteria fields (*), just add those in internal table keys list, and process the AT NEW/END OF on the last key.
(e.g. define table with keys WF_ID NODE_ID WI_ID TASK_ID and process the AT NEW/END IF in TASK_ID last key)
Regards,
Raymond
(*) From your duplicate posts Error in Condition and Condition Inside a loop ?
Hi,
After getting data in internal table
Read ur internal table no of times according to your requirement.
Read <itab> into <wa> where task_id = xyz returntyp = 'RC'
If sy-subrc eq o.
starttime =
endif.
Read <itab> into <wa> where task_id = xyz returntyp = 'EV'
If sy-subrc eq o.
action taken =
endif.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi meenakshi,
data: wa_SWPSTEPLOG like line of it_SWPSTEPLOG
loop at lt_SWPSTEPLOG into wa_SWPSTEPLOG.
case wa_SWPSTEPLOG-RETURNTYP.
when 'RC'.
******* Start Date/Time for a specific task
you can write actions here
when 'EV'.
******** action taken by the user for the previous task
you can write actions here
endcase.
endloop.
Regards
Ashwin kv
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Meenakshi,
you can create a internal table copy to access the previous task and use case to check the condition.
it_swpsteplog_pre[] = it_swpsteplog[].
* Read selected entries
loop at it_swpsteplog.
Check returntype values
CASE it_swpsteplog-returntyp.
* Returntyp = RC
WHEN 'RC'.
"your logic about Start Date/Time
* Returntyp = EV
WHEN 'EV'.
"your logic about Completion Date/Time
"read your auxiliar internal table it_swpsteplog_pre
"to get previous task (example using logic key... or
"using sy-tabix logic...)
ENDCASE
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.