ā2008 Nov 28 9:20 AM
Hi abappers,
Any way for define data global into conditional before star-of-selection.
I try explain the problem...
If I want execute the program in background the data:
TYPE-POOLS: slis.
DATA: gt_fieldcat TYPE slis_t_fieldcat_alv,
gs_fieldcat LIKE LINE OF gt_fieldcat,
gss_layout TYPE slis_layout_alv,
ls_print TYPE slis_print_alv,
gt_listheader TYPE slis_t_listheader....
...
But if I wnat execute the program without background the data:
DATA:
go_grid TYPE REF TO cl_gui_alv_grid,
fieldcat TYPE lvc_t_fcat,
gs_layout TYPE lvc_s_layo,
*gt_sort TYPE lvc_t_sort, " Sorting Table
* Internal table for storing info. for ALV grid
i_sort TYPE STANDARD TABLE OF lvc_s_sort INITIAL SIZE 0....
...
I don“t know if with
IF SY-BACH IS INITIAL.
TYPE-POOLS: slis.
DATA: gt_fieldcat TYPE slis_t_fieldcat_alv,
gs_fieldcat LIKE LINE OF gt_fieldcat,
gss_layout TYPE slis_layout_alv,
ls_print TYPE slis_print_alv,
gt_listheader TYPE slis_t_listheader.ELSE.
DATA:
go_grid TYPE REF TO cl_gui_alv_grid,
fieldcat TYPE lvc_t_fcat,
gs_layout TYPE lvc_s_layo,
*gt_sort TYPE lvc_t_sort, " Sorting Table
* Internal table for storing info. for ALV grid
i_sort TYPE STANDARD TABLE OF lvc_s_sort INITIAL SIZE 0.ENDIF.
Can you help me, please.
Cordial greetings.
ā2008 Nov 28 9:24 AM
Hello,
You cannot check that condition before the at selection-screen event.
Why do you want different data selection for background and foreground? Will not cause any issues with the data declaration.
Thanks,
Jayant
ā2008 Nov 28 9:28 AM
Hi Lopez
I checked your code .Their is no need to declare the data seprately for foreground and background reports.
You can declare both the data globally it will not affect your program at all.
if you want to keep the tables seprate then you can do this by declaring two sets of data globally and use it in your program based on condition.
Regards
Neha
ā2008 Nov 28 10:09 AM
Hi ,
thank you for your attention,
IF sy-batch IS INITIAL.
TYPE-POOLS: slis.
DATA: gt_fieldcat TYPE slis_t_fieldcat_alv,
gs_fieldcat LIKE LINE OF gt_fieldcat,
gss_layout TYPE slis_layout_alv,
ls_print TYPE slis_print_alv,
gt_listheader TYPE slis_t_listheader.
else.
DATA:
go_grid TYPE REF TO cl_gui_alv_grid,
fieldcat TYPE lvc_t_fcat,
gs_layout TYPE lvc_s_layo,
i_sort TYPE STANDARD TABLE OF lvc_s_sort INITIAL SIZE 0,
go_custom_container_kna TYPE REF TO cl_gui_custom_container,
go_custom_container_sort TYPE REF TO cl_gui_custom_container,
go_custom_container_lfa TYPE REF TO cl_gui_custom_container,
go_custom_container_yxs TYPE REF TO cl_gui_custom_container.
endif....
...
START-OF-SELECTION....
...
the problem is if I whan execute the program with or without background the data:
I believe that no is correct the conditional IF SY-TABIX but it execute correctelly.
Really the program in background execute a ALV without container and the program with background is executed with other ALV with container.
Then When I execute the ALV in background and read the data definition
DATA:
go_grid TYPE REF TO cl_gui_alv_grid,
fieldcat TYPE lvc_t_fcat,
gs_layout TYPE lvc_s_layo,
i_sort TYPE STANDARD TABLE OF lvc_s_sort INITIAL SIZE 0,
go_custom_container_kna TYPE REF TO cl_gui_custom_container,
go_custom_container_sort TYPE REF TO cl_gui_custom_container,
go_custom_container_lfa TYPE REF TO cl_gui_custom_container,
go_custom_container_yxs TYPE REF TO cl_gui_custom_container.
endif.and that the spool is cacel because error of SAPGUI (believe that read the data definition and then it detect that it is a ALV with container)
Then with the code at first of the post I execute the program
with background and without background OK.
It is correct code ABAP?
Thanks.
Cordial greetings.
Edited by: lopez fernandez on Nov 28, 2008 11:10 AM
ā2008 Nov 28 10:14 AM
Hello,
Are you getting a Dump in background? The error you are getting is because of the OOPS ALV that you have executed in background. If you are in ECC5.0 or higer version of SAP try to replace the OOPS ALV with Normal ALV/Classical report.
In background you are not allowed to create custom container. If you want to use OOPS method then better try for SALV. You will get a lot of demo program, try searching with SALV*.
Thanks,
Jayant
ā2008 Dec 11 6:08 PM
thanks at all,
at last, the problem is solved to make two programs.
the last solution that I post with the IF is ok on version 4.6c but before start-of-selection, the conditional is strange