Application Development 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: 

What's the best way to trigger an ABAP4 report program to another one

Former Member
0 Kudos

ABAP4 gurus,

I am pretty new to ABAP4. I would love to know the best way to call an ABAP4 report program from another ABAP4 report program.

Anyone's idea is greatly appreciated!

1 ACCEPTED SOLUTION

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

I would suggest using the SUBMIT statement. Do some F1 help on the SUBMIT statement.

Do you have an exact requirement that I could help you with?

Regards,

Rich Heilman

13 REPLIES 13

Former Member
0 Kudos

Use SUBMIT <NAME> ....

Get F1 help on submit keyword , you will get the answer here.

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

I would suggest using the SUBMIT statement. Do some F1 help on the SUBMIT statement.

Do you have an exact requirement that I could help you with?

Regards,

Rich Heilman

0 Kudos

There are many ways in which you can call a program using the SUBMIT statement, you can pass parameters to it using WITH syntax, you can use a selection-table to pass parameters. Here is a sample of both. These pieces of code call MB51 program passing a material and todays data to the selection screen and the executing the report.



data: seltab     type table of rsparams,
      seltab_wa  like line of seltab.

move: 'MATNR'         to seltab_wa-selname,
      'S'             to seltab_wa-kind,
      'I'             to seltab_wa-sign,
      'EQ'            to seltab_wa-option,
      '40000000'      to seltab_wa-low.
append seltab_wa to seltab.


move: 'BUDAT'         to seltab_wa-selname,
      'S'             to seltab_wa-kind,
      'I'             to seltab_wa-sign,
      'EQ'            to seltab_wa-option,
      sy-datum      to seltab_wa-low.
append seltab_wa to seltab.

submit rm07docs
        with selection-table seltab
        and return.


This next peice is a slightly different way of doing the same thing.



tables: mseg, mkpf.
ranges: r_matnr for mseg-matnr,
        r_budat for mkpf-budat.

r_matnr-sign = 'I'.
r_matnr-option = 'EQ'.
r_matnr-low   = '40000000'.
append r_matnr.

r_budat-sign = 'I'.
r_budat-option = 'EQ'.
r_budat-low   = sy-datum.
append r_budat.


submit rm07docs
       with matnr in r_matnr
       with budat in r_budat
           and return.

Regards,

Rich Heilman

0 Kudos

hello Rich,

I am very appreciated your detailed input! Therefore rm07docs is the next program that will be called next, right? What is the relationship between rm07docs and the T-Code MB51?

Thanks a lot and I will give you reward points.

0 Kudos

The transaction code MB51 calls program RM07docs.

Every tcode calls a program, some call a report program, others call a module pool program.

In this case MB51 calls a report program named RM07docs. I used this program as an example, because it is a fairly common report that exists in R/3 systems. If I would have used a "Z" report in my example, it would not have given you anything to work with.

Calling a transaction code(MB51) from the menu, is the same as executing the report program(RM07docs) via SE38.

Make sense?

Regards,

Rich Heilman

Message was edited by: Rich Heilman

0 Kudos

hello Rich,

Actually at the end of the source program, I need to call another program called z1 with two parameters, for example,

report z1 no standard page heading

message-id zu

line-size 80.

parameters: rfcdest like rfcdes-rfcdest, " RFC Destination

eventid like tbtcstrt-eventid. " Event ID

The two parameters will be fixed values that I used to use variant for the report program. Could you elaborate it?

Thanks in advance!

0 Kudos

Also, what does that mean by 'S' for seltab_wa-kind?

0 Kudos

Select-Option

0 Kudos

S is for select options. Use "P" for parameters.

In your example, you can do something like this.

SUBMIT Z1 with rfcdest = 'The_Value'
          with eventid = 'The_Value'
                  and return.

Regards,

Rich Heilman

0 Kudos

hello Rich,

One more question, you know the two parameter values are different among DEV, QAS and PRD environment and we can't touch anything on PRD, then what should we do with the two parameter values on PRD?

Thanks a lot!

0 Kudos

Also could we use variant to input the parameter values in the submit statement?

Thanks

0 Kudos

You have to define those parameters in your report to have the flexibility to change it. Define the same parameters in your selection screen and pass them along to your SUBMIT. That way you can change the values as move through the systems.

0 Kudos

> Also could we use variant to input the parameter

> values in the submit statement?

>

> Thanks

Yes. With the option <b>USING SELECTION-SET vari </b> where vari is your variant.