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: 

Reg:how to include a report in another report.

former_member197425
Active Participant
0 Kudos

Hi,

Can anyone please tell me how to call a report from another report.

My requirement is for example please see the below requirement :

In report1 I write the logic.

Zreport1.

select kunnr name1 from kna1 into table itab.

loop at itab.

write: / itab-kunnr,itab-name.

endloop.

In report 2 i write the declaration.

Zreport2.

Tables:kna1.

data:begin of itab occurs 0,

kunnr like kna1-kunnr,

name1 like kna1-name1,

end of itab.

Now I want to include or call the report1 in report2 .Can anyone please tell me how it can be done??

1 ACCEPTED SOLUTION

narin_nandivada3
Active Contributor
0 Kudos

Hi,

write the submit statement as SUBMIT ZREPORT1 AND RETURN in ZREPORT2 program..

If you dont execute the ZREPORT1 independently then its better you write that in a ZINCLUDE... and

include that in your second program where ever necessary..

for that check this...


+ZINCLUDE+ 
select kunnr name1 from kna1 into table itab.
loop at itab.
write: / itab-kunnr,itab-name.
endloop.

*ZINCLUDE ends here...

*Use the above ZINCLUDE as below...
Report Zreport2.
Tables:kna1.
data:begin of itab occurs 0,
kunnr like kna1-kunnr,
name1 like kna1-name1,
end of itab.

INCLUDE ZINCLUDE. " this will do the task mentioned in the include above...

I would rather suggest to go for the second method that is _ Specifying ZINCLUDE_ coz for the first one.. you need to

have data declarations and which is not necessary for just a simple select query.. if you are processing

any further in the first program then go for the first method_( SUBMIT STATEMENT)_ by declaring the necessary variables..

This would solve your issue...

Good luck

Narin

Edited by: Narin Nandivada on Sep 9, 2008 4:37 PM

6 REPLIES 6

narin_nandivada3
Active Contributor
0 Kudos

Hi,

write the submit statement as SUBMIT ZREPORT1 AND RETURN in ZREPORT2 program..

If you dont execute the ZREPORT1 independently then its better you write that in a ZINCLUDE... and

include that in your second program where ever necessary..

for that check this...


+ZINCLUDE+ 
select kunnr name1 from kna1 into table itab.
loop at itab.
write: / itab-kunnr,itab-name.
endloop.

*ZINCLUDE ends here...

*Use the above ZINCLUDE as below...
Report Zreport2.
Tables:kna1.
data:begin of itab occurs 0,
kunnr like kna1-kunnr,
name1 like kna1-name1,
end of itab.

INCLUDE ZINCLUDE. " this will do the task mentioned in the include above...

I would rather suggest to go for the second method that is _ Specifying ZINCLUDE_ coz for the first one.. you need to

have data declarations and which is not necessary for just a simple select query.. if you are processing

any further in the first program then go for the first method_( SUBMIT STATEMENT)_ by declaring the necessary variables..

This would solve your issue...

Good luck

Narin

Edited by: Narin Nandivada on Sep 9, 2008 4:37 PM

Former Member
0 Kudos

While creation of the reports in SE38, select Attribute Types for ZREPORT1 as Executable and for ZREPORT2 as Include.

Now, write your logic in ZREPORT1 and ZREPORT2 as already you have written.

In ZREPORT1...

<add this code>.....

Include Zreport2.

Former Member
0 Kudos

Hi,

This nothing but adding a include in the main program.As ur main program is Zreport1 so just add the include (not report) which contain the data declaration part.

For that create a include with all ur data declaration. like Include Zreport2.

Tables:kna1.

data:begin of itab occurs 0,

kunnr like kna1-kunnr,

name1 like kna1-name1,

end of itab.

Now ur main program

Zreport1.

Include zreport2.

select kunnr name1 from kna1 into table itab.

loop at itab.

write: / itab-kunnr,itab-name.

endloop.

thanks,

narin_nandivada3
Active Contributor
0 Kudos

Hi nandi Kishore,

Can i know whether your problem got solved or whether any more help required..?

Regards

Narin

0 Kudos

Thanks Narin my doubt has been rectified

0 Kudos

Hi Nandi kishore,

I thought my solution helped you.. i don't know it solved you thats why i asked you regarding that..

So i think you had preferred INCLUDE method..!

Good luck

Narin.