09-09-2008 11:45 AM
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??
09-09-2008 11:49 AM
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
09-09-2008 11:49 AM
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
09-09-2008 11:49 AM
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.
09-09-2008 12:01 PM
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,
09-09-2008 12:34 PM
Hi nandi Kishore,
Can i know whether your problem got solved or whether any more help required..?
Regards
Narin
09-09-2008 12:50 PM
09-09-2008 1:57 PM
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.