Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Unix script from ABAP

Former Member
0 Likes
656

Hello,

I have created a FM that is executing the unix script using RFC_REMOTE_PIPE, the script will look for a file for certain time and specified retry times and if it does not find the file then it will wait or fail.

e.g. 3 30 filename

the script will try to find file if it does not find it will wait for 30 seconds and still it does not then again 30 sec and still the file is not there it will fail. What I want to know is while it is in wait mode the SAP job is immediately failing , how can I make my ABAP code to wait till the script is over?

how about running that script in a separate Z program and call it using a SUBMIT and RETURN.. that way, your calling program is active while your script program is running?

3 REPLIES 3
Read only

Former Member
0 Likes
597

how about running that script in a separate Z program and call it using a SUBMIT and RETURN.. that way, your calling program is active while your script program is running?

Read only

Former Member
0 Likes
597
What I want to know is while it is in wait mode the SAP job is immediately failing , how can I make my ABAP code to wait till the script is over?

The reason for this could be because of the high number of work processes running on the system and they are trying to override the jobs which are in Wait mode. This generally should not happen.

Alternate solution which you can try out is,

1. Create a global variable. Initially set the value as 0.

2. Instead of using wait condition use an infinite loop

3. Exit from the loop whenever the global variable's value is 1.

4. If the global variable's value is not 1, then keep checking the status of the script in each iteration.

5. If the status of the script is finished, then set the flag as 1.

6. So, as the value is 1, it would come out of the loop in the next iteration.

This is an alternative solution which you could try. It would look like as shown below

w_flag = 0.

do

if w_flag eq 1.
exit.
else. 
 *write the logic for checking the status of the script.*    
   if the status = Yes.
       w_flag = 1.
   endif.
   
endif.

enddo.

Hope you got what I am tryin to tell you

Thanks,

Babu Kilari

Read only

Former Member
0 Likes
597

Thank you all for your responses.

The problem was in the script that was pulling my abap code down.