Skip to Content
0
Former Member
Aug 19, 2013 at 08:25 AM

wrong qid being obtained

56 Views

Hallo,

I am starting some job using the events and obtaining the qid of the job during runtime but sometimes the qid being obained is wrong and hence not the right job being started.

The query/Logic to obtain the Qid is as follows.

SELECT * INTO TABLE lt_qid
FROM apqi
WHERE groupid = gc_jobname AND
creator = sy-uname AND
credate = sy-datum.
SORT lt_qid DESCENDING BY cretime.
LOOP AT lt_qid INTO ls_qid.
IF ls_qid-qstate IS INITIAL.
lv_qid = ls_qid-qid.
EXIT.
ENDIF.
ENDLOOP.

Here i am considering that the job which is newly created is having the status as Initial and hence taking that for further processing.

sometimes this logic is getting me the qid of the previous job which is already finished and having the status as Finsihed (F).

Any Hints please !

Thanks