Mass approve pending absence and insert infotype with RPTARQPOST
We need to develop a program to mass approve the pending absence request and complete the absence workitem.
I created 1 program with following steps:
1) List out all the pending leave from absence standard tables PTREQ*
2) logical delete the workitem of pending leave. We developed a custom workflow which copied from WS12300111
3) insert 1 record in table PTREQ_HEADER with status "APPROVED". Basically, the data is copied from the existing record with status "SENT".
4) SUBMIT RPTARQPOST in order to post the record into infotype
Steps 1 to 3 are fine, but step 4 having a problem. The "APPROVED " record is not reflect in the program RPTARQPOST immediately, thus absence data could not be posted when I SUBMIT RPTARQPOST . I tried to run the RPTARQPOST separately, but still can't see the "Approved" data. Sometimes, it would only be displayed after few hours. Sometimes, does not appear at all.
I'm not sure whether creating a program with these 4 steps is sufficient. Is there anything missing between step 3 and step 4? Or I could have a better option to approve all the pending leave? Please advice.