05-22-2009 7:02 AM
Hi all,
can u please tel me hoe to declare the variable globally in abap report so that i can use it in any of my include program in that report.
thanx....
05-22-2009 7:07 AM
Make all Data Declarartions in TOP include.
like
REPORT ZSDR_INV_INR.
include ZSDR_Di_TOP.
include ZSDR_DI_FORM.
START-OF-SELECTION.
PERFORM get_sales_data.
perform get_delivery_data.
perform process_data.
perform refresh_tables.
perform get_sales_data_ZIO2.
perform get_delivery_data_ZIO2.
perform process_data_ZIO2.
*Perform Filter_Fieldcat.
perform display_report_DI.
Here make all ur data declarartions in ZSDR_Di_TOP .
THEN U CAN USE ALL VARIABLES GLOBALLY.
05-22-2009 7:04 AM
Hi
Make declaration of the variable in TOP include , and it can be used across the entire report pgm in any include & FG too
05-22-2009 7:08 AM
>
> Hi
>
> Make declaration of the variable in TOP include , and it can be used across the entire report pgm in any include & FG too
i didnt get TOP include what does it means ??
thanx...
05-22-2009 7:11 AM
Top include is a normal Include program in a report program
For example-
REPORT z_mbbel_consign_pdf .
*Top declaration
INCLUDE z_mbbel_consign_top.
*Include for subroutines
INCLUDE z_mbbel_consign_f01.
i have declared wf_flag under include-INCLUDE z_mbbel_consign_top, then variable WF_FLAG can be accessed in INCLUDE z_mbbel_consign_f01 too
05-22-2009 7:19 AM
Its the SAP practice to SAPERATE out all the global declarations in a INCLUDE program, so that we get better clarity and understanding of the program.
You can open any Function group of your choice and check in the TOP Include program of it.
Example:
Goto SE80->
choose 'Function Group' in the list ->
Type function group name as 'SLVC_FULLSCREEN' (This the function group name of 'Reuse_alv_grid_display' FM'). - >
Check the main program of it.
As a very first statement, it will have an include ' INCLUDE LSLVC_FULLSCREENTOP."
Open it and see, it will contain only the declaration part for that Func group.
regards,
Padma
05-22-2009 7:07 AM
Make all Data Declarartions in TOP include.
like
REPORT ZSDR_INV_INR.
include ZSDR_Di_TOP.
include ZSDR_DI_FORM.
START-OF-SELECTION.
PERFORM get_sales_data.
perform get_delivery_data.
perform process_data.
perform refresh_tables.
perform get_sales_data_ZIO2.
perform get_delivery_data_ZIO2.
perform process_data_ZIO2.
*Perform Filter_Fieldcat.
perform display_report_DI.
Here make all ur data declarartions in ZSDR_Di_TOP .
THEN U CAN USE ALL VARIABLES GLOBALLY.
05-22-2009 7:11 AM
>
> Make all Data Declarartions in TOP include.
>
> like
>
> REPORT ZSDR_INV_INR. > > include ZSDR_Di_TOP. > include ZSDR_DI_FORM. > > START-OF-SELECTION. > > PERFORM get_sales_data. > perform get_delivery_data. > perform process_data. > perform refresh_tables. > perform get_sales_data_ZIO2. > perform get_delivery_data_ZIO2. > perform process_data_ZIO2. > *Perform Filter_Fieldcat. > perform display_report_DI. >
>
> Here make all ur data declarartions in ZSDR_Di_TOP .
>
> THEN U CAN USE ALL VARIABLES GLOBALLY.
and if i also have some standard includes with them, but im not making any changes to them
like.
std incl
std incl
Z incl
std incl
Z incl
like this .
still will it be work in this condition??
thanx..
05-22-2009 7:15 AM
TRY TO FIND OUT TOP INCLUDE IN STADARD AND MAKE CHANGES IN THAT.
OR ELSE DEFINE UR ZTOP INCLUDE BEFORE ALL INCLUDES.
05-22-2009 7:18 AM
It will sure work given that its the first include in the program lines.
Regards
Karthik D
05-22-2009 7:21 AM
>
> TRY TO FIND OUT TOP INCLUDE IN STADARD AND MAKE CHANGES IN THAT.
>
> OR ELSE DEFINE UR ZTOP INCLUDE BEFORE ALL INCLUDES.
i have made the changes as u said but it gives error that
"the variable has already been declared"
and i haven declare it anywhere else.
thanx...
05-22-2009 7:29 AM
Hi,
This error is typical while using includes. Just activate and on error dialog give Activate Anyway...And then check it again...
Regards,
Karthik D