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

error handling when runing a ABAP executable program in ABAP report

Former Member
0 Likes
1,838

Hi expert,

          I want to write a ABAP program in which a abap executable program is called.  I use following code.

     REPORT ZBI_PR_0001_AUTODEL_REQU.

     SUBMIT RSSM_AUTODEL_REQU_MASTER_TEXT
               WITH infoprov EQ 'ZEMPLOYEE'
               WITH older EQ ‘7’        
               AND RETURN.

   my questions: (1) is there other way to call executable program except for 'SUBMIT'?

                 (2) how can I control the running process whenever there is something wrong for running

                     'SUBMIT RSSM_AUTODEL_REQU_MASTER_TEXT', such as using SY_subrc when calling function

                     module?

Many Thanks,

Andy

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,398

Hi Andy,

I have checked the program RSSM_AUTODEL_REQU_MASTER_TEXT.

You can achieve this by two ways.

1) Use implicit enhancement in RSSM_AUTODEL_REQU_MASTER_TEXT and use export to memory id syntax to export the value of variable to memory and use Import syntax to gain the value of the variable in ZBI_PR_0001_AUTODEL_REQU.

2) OR Copy this program RSSM_AUTODEL_REQU_MASTER_TEXT to Z. and write the below code.

REPORT  zrssm_autodel_requ_master_text.


FORM RSSM_AUTODEL_REQU_MASTER_TEXT using infoprov older no_del changing ret_variable.

call function 'RSS2_AUTODEL_REQU_MASTER_TEXT'

   exporting

     i_dta                   = infoprov

     i_older_then            = older

     i_remain                = no_del

   exceptions

     no_text_master_infoprov = 1

     error                   = 2

     infoprov_not_found      = 3

     others                  = 4.

if sy-subrc <> 0.

   message id sy-msgid type 'E' number sy-msgno

           with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

endif.

ENDFORM.


From main program : ZBI_PR_0001_AUTODEL_REQU.

     WRITE: 'Before perform', ret_variable.

     PERFORM RSSM_AUTODEL_REQU_MASTER_TEXT IN PROGRAM zrssm_autodel_requ_master_text

     USING infoprov older no_del changing ret_variable.

     WRITE: 'After perform', ret_variable.

I hope you have understood the logic.

Regards,

Rajesh Sadula.

5 REPLIES 5
Read only

Former Member
0 Likes
1,398

Andy,

1. For calling executable programs, SUBMIT / Submit and return is the only way.

You can either specify the name of the program you want to call statically by entering the program name in the code of the calling program, or dynamically by specifying the name of a field (in parentheses) containing the name of the program.

If you omit the AND RETURN addition, all data and list levels of the calling program (the entire internal session) are deleted. After the called executable program has finished, control returns to the level from which you started the calling program.

If you use AND RETURN, the system stores the data of the calling executable program and returns to the calling after processing the called program. The system resumes executing the calling program at the statement following the call.

2.  If the system cannot find the specified executable program when trying to execute the SUBMIT statement, it gives a dump.

Regards,

Guru.

Read only

venkateswaran_k
Active Contributor
0 Likes
1,398

Dear Andy,

For your questions

1.   - Yes you can execute a another report program by calling CALL TRANSACTION with passing the param values as well.

2. - In order to find the status of execution of the program, you can always use an export variable that can be imported in calling program and validate.

Example:

                 progaram A - calls Program b.  (In program b - export a global variable say status = 'Yes'/'No'.

                  In program A - after the call statement check for the glbal variable status by importing it.

Regards,

Venkat

Read only

Former Member
0 Likes
1,399

Hi Andy,

I have checked the program RSSM_AUTODEL_REQU_MASTER_TEXT.

You can achieve this by two ways.

1) Use implicit enhancement in RSSM_AUTODEL_REQU_MASTER_TEXT and use export to memory id syntax to export the value of variable to memory and use Import syntax to gain the value of the variable in ZBI_PR_0001_AUTODEL_REQU.

2) OR Copy this program RSSM_AUTODEL_REQU_MASTER_TEXT to Z. and write the below code.

REPORT  zrssm_autodel_requ_master_text.


FORM RSSM_AUTODEL_REQU_MASTER_TEXT using infoprov older no_del changing ret_variable.

call function 'RSS2_AUTODEL_REQU_MASTER_TEXT'

   exporting

     i_dta                   = infoprov

     i_older_then            = older

     i_remain                = no_del

   exceptions

     no_text_master_infoprov = 1

     error                   = 2

     infoprov_not_found      = 3

     others                  = 4.

if sy-subrc <> 0.

   message id sy-msgid type 'E' number sy-msgno

           with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

endif.

ENDFORM.


From main program : ZBI_PR_0001_AUTODEL_REQU.

     WRITE: 'Before perform', ret_variable.

     PERFORM RSSM_AUTODEL_REQU_MASTER_TEXT IN PROGRAM zrssm_autodel_requ_master_text

     USING infoprov older no_del changing ret_variable.

     WRITE: 'After perform', ret_variable.

I hope you have understood the logic.

Regards,

Rajesh Sadula.

Read only

Former Member
0 Likes
1,398

Thanks you all,

     my code is as follows:

REPORT ZBI_PR_0001_AUTODEL_REQU.

Data: zinfoprov(30) type c occurs 0 with header line.

Select-options: s_infoprov for c.

parameter: zolder(3) type n default 30.

Loop at s_infoprov.

SUBMIT RSSM_AUTODEL_REQU_MASTER_TEXT
               WITH infoprov EQ s_infoprov-low 
               WITH older EQ
zolder        
               AND RETURN.
Endloop.

I have two questions:

(1) I want show some text when running this code, such as:

       'please input older days':  7 days.

     how to change in the code?

(2) in program 'RSSM_AUTODEL_REQU_MASTER_TEXT ', there is calling function module and error handling, do I have to do error handling in 'ZBI_PR_0001_AUTODEL_REQU' for running 'RSSM_AUTODEL_REQU_MASTER_TEXT ' ?

how error handling in 'RSSM_AUTODEL_REQU_MASTER_TEXT ' will impact running 'ZBI_PR_0001_AUTODEL_REQU' ?

Many Thanks,

Bo

Read only

0 Likes
1,398


I will open a new thread for this. this one closed