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

submit program and execute

Former Member
0 Likes
4,109

Hi all,

I have created report which submit another report, is it possible to submit and automatic execute this report.

Main point is to avoid another click on F8 ( direct execute second report).

7 REPLIES 7
Read only

MarcinPciak
Active Contributor
0 Likes
2,157

Hi,

I don't think it is possible with Executable program type (report), unless you are using job to run this report automatically.

This is however possible for Subroutine pool program type. Do the following:

- create Subroutine pool program

- create a class inside it with only one method (though subroutine pools is intended to store subroutines, it can also handle classes)

- in that method place you code which submits another report. It can look like


PROGRAM my_sub_pool.

CLASS my_class DEFINITION.
  PUBLIC SECTION.
     METHODS: main.
ENDCLASS.

CLASS my_class IMPLEMENTATION.
   METHOD main.
      ....
      "here submit your program and do your coding which you do in normal report
      SUBMIT ....
   ENDMETHOD.
ENDCLASS.

- last step is to create an Object Transaction. Right click on program name -> create transaction -> choose the option Method of a class (Object transaction) as an Initial Object . Enter the Class Name and Method ( my_class + main ). Set the Local in Program flag and -> enter the program name.

Save the transaction code.

Now when you use this tcode, it will call main method of class my_class from program my_sub_pool and automatically execute your coding which can also execute another report by means of SUBMIT statement.

Regards

Marcin

Read only

Former Member
0 Likes
2,157

Hi,

Try this code:-

report Y1_program.

DATA abaplist LIKE abaplist OCCURS 0 WITH HEADER LINE.

PARAMETER: p_paydt TYPE dats DEFAULT sy-datum.
PARAMETERS MODE NO-DISPLAY DEFAULT 'X'.

    SUBMIT y2_program USING SELECTION-SETS OF   
          PROGRAM 'Y1_program'
          WITH p_paydt = p_paydt   
          WITH mode = mode        
    AND RETURN EXPORTING LIST TO MEMORY.

    CALL FUNCTION 'LIST_FROM_MEMORY'
      TABLES
        listobject = abaplist
      EXCEPTIONS
        not_found  = 1
        OTHERS     = 2.

Read only

Former Member
0 Likes
2,157

Hi ,

If you do not have any problem to execute this program in BACKGROUND MODE , then

it is possible .

Go to transaction SM36 define a JOB with the starting time (When u want to execute the

Program ) report name etc.

Transaction SM37 is for the Background Job selection .

By this way assigning a Report in background you can execute it with out clicking the F8.

Regards

Pinaki

Read only

0 Likes
2,157

there is no jobs, it is report type program ( list of open items) real time user program, to be clear

is it possible in ABAP use command execute like submit was used !?

.

Read only

0 Likes
2,157

Directly not, but what I described above you can apply also to your first program. So the logic would be like this:

complete steps provided above but change name of submiting program to the first one. This will simulate F8 for first report. Inside first report simply submit another one.

This way user, by means of transaction code, will execute subroutine pool -> which will submit first report (without any further user interaction) -> which will submit second report.

Regards

Marcin

Read only

0 Likes
2,157

Here is simple solution,

SUBMIT zreport WITH SELECTION-TABLE seltab

  • VIA SELECTION-SCREEN " that must me comment !

AND RETURN .

Read only

Former Member
0 Likes
2,157

solved