CL_GUI_SPLITTER_CONTAINER
Is it possible to disable resize of do not display separation line between cells?
Hello Stephan
The required method calls are:
- Separation line invisible (guess in this case it is also unmovable)
CALL METHOD splitter->set_column_sash
EXPORTING
id = 1
type = cl_gui_splitter_container=>TYPE_SASHVISIBLE
value = cl_gui_splitter_container=>false
* IMPORTING
* RESULT =
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
others = 3.
- Separation line visible yet unmovable
CALL METHOD splitter->set_column_sash
EXPORTING
id = 1
type = cl_gui_splitter_container=>TYPE_MOVABLE
value = cl_gui_splitter_container=>false
* IMPORTING
* RESULT =
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
others = 3.
Regards
Uwe
Similar Messages
-
Column width for cl_gui_splitter_container not working
Hello friends,
I'm trying to set the column width in a splitter, but the width is not being changed. Can anyone help me ? Here is a draft of my code
At the PBO of the screen form I have the following:
data:
gobj_split TYPE REF TO cl_gui_splitter_container,
gobj_container_1 TYPE REF TO cl_gui_container,
gobj_container_2 TYPE REF TO cl_gui_container,
gobj_drawer_container TYPE REF TO cl_gui_docking_container,
gobj_right_container TYPE REF TO cl_gui_docking_container,
*-- Create Container for Drawer (Left)
IF gobj_drawer_container IS INITIAL.
CREATE OBJECT gobj_drawer_container
EXPORTING
repid = gv_repid
dynnr = gv_dynnr
extension = 400
EXCEPTIONS
others = 1.
ENDIF.
*-- Create Container for the right
IF gobj_right_container IS INITIAL.
CREATE OBJECT gobj_right_container
EXPORTING
repid = gv_repid
dynnr = gv_dynnr
side = gobj_right_container->dock_at_right
extension = 1500
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6.
ENDIF.
*-- Create Split Object
CREATE OBJECT gobj_split
EXPORTING
parent = gobj_drawer_container
rows = 2
columns = 1
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
OTHERS = 3.
*-- Split into two rows and one column
CALL METHOD gobj_split->get_container "Container for Date & Information
EXPORTING
row = 1
column = 1
RECEIVING
container = gobj_container_1.
CALL METHOD gobj_split->get_container "Container for Main Options
EXPORTING
row = 2
column = 1
RECEIVING
container = gobj_container_2.
*-- Set Row and Column Modes to absolute
CALL METHOD gobj_split->set_row_mode
EXPORTING
mode = gobj_split->mode_absolute.
CALL METHOD gobj_split->set_column_mode
EXPORTING
mode = gobj_split->mode_absolute.
*-- Set Row Height (THIS IS WORKING)
gobj_split->set_row_height( EXPORTING id = 1
height = 50 ).
*-- Set Column Width ( THIS IS NOT WORKING )
gobj_split->set_column_width( EXPORTING id = 1
width = 50 ).
And this is what I get... no matter value I put in line 80, the width doesn't change.
Does anyone have any idea why this is happening ?
Thank youYou splitted the parent container in two part upper and lower row (2 rows), so you are able to adjust the vertical size, but not the horizontal size (only 1 column) this size must be adjusted on parent container.
Regards,
Raymond -
In CL_GUI_SPLITTER_CONTAINER ALV list is not show in called screen
Hello experts,
i come across a problem while using the class:CL_GUI_SPLITTER_CONTAINER ,
my codes is as follows:
data:declarations is as follows:
data:gr_spliter TYPE REF TO cl_gui_splitter_container,
gr_container1 TYPE REF TO cl_gui_container,
gr_container2 TYPE REF TO cl_gui_container,
gr_grid1 TYPE REF TO cl_gui_alv_grid,
gr_grid2 TYPE REF TO cl_gui_alv_grid,
step 0 Fit table contents:gt_out1 and gt_out2
step 1: CREATE OBJECT gr_spliter
EXPORTING
parent = cl_gui_container=>screen0
ows = 1
columns = 2
step 2: CALL METHOD gr_spliter->get_container
EXPORTING
row = 1
column = 1
RECEIVING
container = gr_container1.
CALL METHOD gr_spliter->get_container
EXPORTING
row = 1
column = 2
RECEIVING
container = gr_container2.
step 3 :call screen 100 to show ALV.
in the screen's PBO ,i show ALV using CL_GUI_ALV_GRID,the codes is:
CREATE OBJECT gr_grid1
EXPORTING
i_parent = gr_container1
CREATE OBJECT gr_grid2
EXPORTING
i_parent = gr_container2
CALL METHOD gr_grid1->set_table_for_first_display
EXPORTING
i_structure_name = Structure of table Gt_OUT1
CHANGING
it_outtab = gt_out1
CALL METHOD gr_grid2>set_table_for_first_display
EXPORTING
i_structure_name = Structure of table Gt_OUT2
CHANGING
it_outtab = gt_out2
But after activing the program ,there is no ALV show in screen 100,I debug the program and find that
all the above object have been created corredtly.
if i create a custom contol named 'CONTAINER',and at Step 1 change the parent's value to 'CONTAINER',
then i could see the ALV whick i hope in screen 100.
If i create a custom control in screen 100, the size of the alv will be different across different computer,
is it possible to use CL_GUI_CONTAINER=>screen0 as cl_gui_splitter_container's attribute parent value???
and i find that there are 10 attributes named screen0 to screen9 in class CL_GUI_CONTAINER,will you tell me the usage of
these attributes?
now i only konw that ,you could set a containers parent value to be CL_GUI_CONTAINER=>screen0,which you do't have to create
a custom control in your screen ,and the alv will be shown in full screen.and what the other attributes use (screen1,screen2,screen3,screen4 and so on)
now i am confused with the problem,i am sure any words from you will give me help to this question!
Hope to receive your advice!
Best regards!
yours Carl
Edited by: lakeandmoon on Aug 27, 2010 11:24 AMDear Carl,
I mean go to screen painter and place there CUSTOM_AREA (the icon with C letter). In program's PBO create CUSTOM_CONTAINER
module pbo output.
if custom_container is initial.
CREATE OBJECT custom_container
EXPORTING container_name = 'CUSTOM_AREA'.\
endif.
endmodule.
Then you work only with CUSTOM_CONTAINER (i.e. as parent to SPLITTER_CONTAINER). Using subscreens here doens't really add the value, so you don't need any.
But how could i stretch the screen and this area to full screen?is it just gragging the screen to full screen and drag the subscreen or the custom control to full screen in screen painter?
Yes, this is what I mean
Regards
Marcin -
Using ADD_CONTROL of CL_GUI_SPLITTER_CONTAINER
Hi Forum,
I would like to add (and remove) the controls of a splitter container grid by program. So I think the methods ADD_CONTROL and REMOVE_CONTROL should be the right choice.
The problem is, that the use of ADD_CONTROL does not work for me. There is no error, but I cannot see the control either...?!?
For example, I would like to throw a splitter_container (inner_split) into another splitter_container (outer_split). First I post a working example without ADD_CONTROL...
* the custom_container named is quite generated...
DATA:
outer_split TYPE REF TO CL_GUI_SPLITTER_CONTAINER,
inner_split TYPE REF TO CL_GUI_SPLITTER_CONTAINER,
gui_cont_1_1 type ref to cl_gui_container.
* the outer splitter
CREATE OBJECT outer_split
EXPORTING
parent = custom_container
rows = 3
columns = 1
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
others = 3.
IF sy-subrc <> 0.
exit.
ENDIF.
* getting the cell I would like to throw the inner_split into...
CALL METHOD outer_split->GET_CONTAINER
EXPORTING
ROW = 1
COLUMN = 1
RECEIVING
CONTAINER = gui_cont_1_1.
* now I can create the inner_split
CREATE OBJECT inner_split
EXPORTING
parent = gui_cont_1_1
rows = 1
columns = 2
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
others = 3.
IF sy-subrc <> 0.
exit.
ENDIF.
This code works fine, but I have to know the parent of inner_split by creation. So I would like to code something like...
* the custom_container named is quite generated...
DATA:
outer_split TYPE REF TO CL_GUI_SPLITTER_CONTAINER,
inner_split TYPE REF TO CL_GUI_SPLITTER_CONTAINER.
* the outer splitter
CREATE OBJECT outer_split
EXPORTING
parent = custom_container
rows = 3
columns = 1
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
others = 3.
IF sy-subrc <> 0.
exit.
ENDIF.
* inner_split
CREATE OBJECT inner_split
EXPORTING
parent = outer_split
rows = 1
columns = 2
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
others = 3.
IF sy-subrc <> 0.
exit.
ENDIF.
* use of add_control
CALL METHOD outer_splitt->ADD_CONTROL
EXPORTING
ROW = 1
COLUMN = 1
control = inner_split.
inner_split->set_visible( visible = 'X' ).
After running the code I cannot see the inner_split? I think the problem could be, that inner_split needs a parent while creation, but I do not really know what to handle here...?
Thanks for response,
DennisHi,
Though described as released methods in the SAP library, these 2 methods are "flagged" obsolete in their description. When I use them in release basis 7.0, I have a popup at SAP GUI (since Release I don't know) side "Error while setting client site! No warranty for further processing! NO WARRANTY FOR ...)|https://service.sap.com/sap/support/notes/653100]
Workaround is to set a null size (set_column_width or set_row_height)
Sandra -
CL_GUI_SPLITTER_CONTAINER and SIZE_CONTROL event not working toghether
Hello,
I am trying to react on the fact that my CL_GUI_SPLITTER_CONTAINER is being resized (= the splitter/sash is moved, thus the child container are resized).
However, no matter what I try, I never get the event to be thrown. I registered both, the splitter control as well as its children to that event, but no luck. Searching here in SDN or via google wasn't turning up anything helpful either...
So could someone please either confirm that this event should work or the opposite, so that I at least know if I am doing something wrong, or if it isn't working at all.
Some central pieces of what I am trying to do:
CALL METHOD gr_splitter->reg_event_size_control
EXPORTING
register = 1.
SET HANDLER gr_splitter_event_receiver->handle_resize FOR gr_splitter.
CLASS lcl_splitter_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS handle_resize
FOR EVENT size_control OF cl_gui_splitter_container.
ENDCLASS. "LCL_SPLITTER_EVENT_RECEIVER
I would be glad for every hint or comment!
Cheers
PhilipHello,
I'm facing the same problem.
I've tried with method set_registered_events. Unfortunately with the same result. The event wasn't handled by my receiver.
Do you found a solution meanwhile?
Thanks,
Peter -
PreSetting cl_gui_splitter_container Split Positions
I have a one row by two column cl_gui_splitter_container set up.
By default, it comes up split 50-50 .
How can I programmatically change this to, for example, 25%-75% ?
Thanks...
...MikeUse Method: SET_COLUMN_WIDTH of class CL_GUI_SPLITTER_CONTAINER to adjust the width.
Regards,
Naimesh Patel -
Report with 5 ALV grids on 1 screen
I am trying to build a screen/report with 5 ALV grids which are interactive. One grid will display all sales order. When I click on a Sales order Hotspot, the items of the sales order would appear in the ALV grid box below.
When i click on an sales order item hotspot, i want the delivery information in another alv grid in the same screen.
There should be 2 more grids - one displaying the customer information -name,address, in one grid and one grid for open items if any. Any advice is welcome . Should I be creating a split container/docking container or multiple containers ? Sample code is welcome.
Edited by: Shareen Hegde on Apr 2, 2008 9:25 PMHello Shareen
Below I have added my sample report ZUS_SDN_THREE_ALV_GRIDS showing three interactive ALV grids. Perhaps it might be useful to you. I would prefer one or multiple splitter containers over multiple "stand-alone" containers.
*& Report ZUS_SDN_THREE_ALV_GRIDS
*& Display Customer data in three ALV lists:
*& 1st ALV: Customers
*& 2nd ALV: Sales order of selected customer (double-click)
*& 3rd ALV: Positions of selected sales order (double-click)
*& Double-click on material -> display material (MM02)
*& NOTE: dynpro does not contain any elements (ok_code -> GD_OKCODE)
*& Flow logic of dynpro '0100':
*&PROCESS BEFORE OUTPUT.
*& MODULE STATUS_0100.
*&PROCESS AFTER INPUT.
*& MODULE USER_COMMAND_0100.
REPORT zus_sdn_three_alv_grids.
DATA:
gd_okcode TYPE ui_func,
go_docking TYPE REF TO cl_gui_docking_container,
go_splitter TYPE REF TO cl_gui_splitter_container,
go_splitter_2 TYPE REF TO cl_gui_splitter_container,
go_cell_top TYPE REF TO cl_gui_container,
go_cell_bottom TYPE REF TO cl_gui_container,
go_cell_left TYPE REF TO cl_gui_container,
go_cell_right TYPE REF TO cl_gui_container,
go_grid1 TYPE REF TO cl_gui_alv_grid,
go_grid2 TYPE REF TO cl_gui_alv_grid,
go_grid3 TYPE REF TO cl_gui_alv_grid.
DATA:
gt_knb1 TYPE STANDARD TABLE OF knb1,
gt_vbak TYPE STANDARD TABLE OF vbak,
gt_vbap TYPE STANDARD TABLE OF vbap.
PARAMETERS:
p_bukrs TYPE bukrs DEFAULT '1000'.
* CLASS lcl_eventhandler DEFINITION
CLASS lcl_eventhandler DEFINITION.
PUBLIC SECTION.
CLASS-METHODS:
handle_double_click FOR EVENT double_click OF cl_gui_alv_grid
IMPORTING
e_row
e_column
es_row_no
sender. " sending control, i.e. ALV grid that raised event
ENDCLASS. "lcl_eventhandler DEFINITION
* CLASS lcl_eventhandler IMPLEMENTATION
CLASS lcl_eventhandler IMPLEMENTATION.
METHOD handle_double_click.
* define local data
DATA:
ls_knb1 TYPE knb1,
ls_vbak TYPE vbak,
ls_vbap TYPE vbap.
* Distinguish according to sending grid instance
CASE sender.
WHEN go_grid1.
READ TABLE gt_knb1 INTO ls_knb1 INDEX e_row-index.
CHECK ( ls_knb1-kunnr IS NOT INITIAL ).
CALL METHOD go_grid1->set_current_cell_via_id
EXPORTING
* IS_ROW_ID =
* IS_COLUMN_ID =
is_row_no = es_row_no.
* Triggers PAI of the dynpro with the specified ok-code
CALL METHOD cl_gui_cfw=>set_new_ok_code( 'ORDERS' ).
WHEN go_grid2.
READ TABLE gt_vbak INTO ls_vbak INDEX e_row-index.
CHECK ( ls_vbak-vbeln IS NOT INITIAL ).
CALL METHOD go_grid1->set_current_cell_via_id
EXPORTING
* IS_ROW_ID =
* IS_COLUMN_ID =
is_row_no = es_row_no.
* Triggers PAI of the dynpro with the specified ok-code
CALL METHOD cl_gui_cfw=>set_new_ok_code( 'ORDER_DETAILS' ).
WHEN go_grid3.
READ TABLE gt_vbap INTO ls_vbap INDEX e_row-index.
CHECK ( ls_vbap-matnr IS NOT INITIAL ).
SET PARAMETER ID 'MAT' FIELD ls_vbap-matnr.
CALL TRANSACTION 'MM02' AND SKIP FIRST SCREEN.
WHEN OTHERS.
RETURN.
ENDCASE.
ENDMETHOD. "handle_double_click
ENDCLASS. "lcl_eventhandler IMPLEMENTATION
START-OF-SELECTION.
SELECT * FROM knb1 INTO TABLE gt_knb1
WHERE bukrs = p_bukrs.
* Create docking container
CREATE OBJECT go_docking
EXPORTING
parent = cl_gui_container=>screen0
ratio = 90
EXCEPTIONS
OTHERS = 6.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Create splitter container
CREATE OBJECT go_splitter
EXPORTING
parent = go_docking
rows = 1
columns = 2
* NO_AUTODEF_PROGID_DYNNR =
* NAME =
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Get cell container
CALL METHOD go_splitter->get_container
EXPORTING
row = 1
column = 1
RECEIVING
container = go_cell_left.
CALL METHOD go_splitter->get_container
EXPORTING
row = 1
column = 2
RECEIVING
container = go_cell_right.
* Create 2nd splitter container
CREATE OBJECT go_splitter_2
EXPORTING
parent = go_cell_left
rows = 2
columns = 1
* NO_AUTODEF_PROGID_DYNNR =
* NAME =
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Get cell container
CALL METHOD go_splitter_2->get_container
EXPORTING
row = 1
column = 1
RECEIVING
container = go_cell_top.
CALL METHOD go_splitter_2->get_container
EXPORTING
row = 2
column = 1
RECEIVING
container = go_cell_bottom.
* Create ALV grids
CREATE OBJECT go_grid1
EXPORTING
i_parent = go_cell_top
EXCEPTIONS
OTHERS = 5.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT go_grid2
EXPORTING
i_parent = go_cell_bottom
EXCEPTIONS
OTHERS = 5.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT go_grid3
EXPORTING
i_parent = go_cell_right
EXCEPTIONS
OTHERS = 5.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Set event handler
SET HANDLER: lcl_eventhandler=>handle_double_click FOR go_grid1.
SET HANDLER: lcl_eventhandler=>handle_double_click FOR go_grid2.
SET HANDLER: lcl_eventhandler=>handle_double_click FOR go_grid3.
* Display data
CALL METHOD go_grid1->set_table_for_first_display
EXPORTING
i_structure_name = 'KNB1'
CHANGING
it_outtab = gt_knb1
EXCEPTIONS
OTHERS = 4.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
REFRESH: gt_vbak.
CALL METHOD go_grid2->set_table_for_first_display
EXPORTING
i_structure_name = 'VBAK'
CHANGING
it_outtab = gt_vbak " empty !!!
EXCEPTIONS
OTHERS = 4.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
REFRESH: gt_vbap.
CALL METHOD go_grid3->set_table_for_first_display
EXPORTING
i_structure_name = 'VBAP'
CHANGING
it_outtab = gt_vbap " empty !!!
EXCEPTIONS
OTHERS = 4.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Link the docking container to the target dynpro
CALL METHOD go_docking->link
EXPORTING
repid = syst-repid
dynnr = '0100'
* CONTAINER =
EXCEPTIONS
OTHERS = 4.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* NOTE: dynpro does not contain any elements (ok_code -> GD_OKCODE)
CALL SCREEN '0100'.
* Flow logic of dynpro:
*PROCESS BEFORE OUTPUT.
* MODULE STATUS_0100.
*PROCESS AFTER INPUT.
* MODULE USER_COMMAND_0100.
END-OF-SELECTION.
*& Module STATUS_0100 OUTPUT
* text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'STATUS_0100'. " contains push button "ORDERS"
* SET TITLEBAR 'xxx'.
* Refresh display of detail ALV list
CALL METHOD go_grid2->refresh_table_display
* EXPORTING
* IS_STABLE =
* I_SOFT_REFRESH =
EXCEPTIONS
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Refresh display of detail ALV list
CALL METHOD go_grid3->refresh_table_display
* EXPORTING
* IS_STABLE =
* I_SOFT_REFRESH =
EXCEPTIONS
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
* text
MODULE user_command_0100 INPUT.
CASE gd_okcode.
WHEN 'BACK' OR
'END' OR
'CANC'.
SET SCREEN 0. LEAVE SCREEN.
* User has pushed button "Display Orders"
WHEN 'ORDERS'.
PERFORM customer_show_orders.
WHEN 'ORDER_DETAILS'.
PERFORM order_show_details.
WHEN OTHERS.
ENDCASE.
CLEAR: gd_okcode.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form CUSTOMER_SHOW_ORDERS
* text
* --> p1 text
* <-- p2 text
FORM customer_show_orders .
* define local data
DATA:
ld_row TYPE i,
ls_knb1 TYPE knb1.
CALL METHOD go_grid1->get_current_cell
IMPORTING
e_row = ld_row.
READ TABLE gt_knb1 INTO ls_knb1 INDEX ld_row.
CHECK ( syst-subrc = 0 ).
SELECT * FROM vbak INTO TABLE gt_vbak
WHERE kunnr = ls_knb1-kunnr.
REFRESH: gt_vbap.
ENDFORM. " CUSTOMER_SHOW_ORDERS
*& Form ORDER_SHOW_DETAILS
* text
* --> p1 text
* <-- p2 text
FORM order_show_details .
* define local data
DATA:
ld_row TYPE i,
ls_vbak TYPE vbak.
CALL METHOD go_grid1->get_current_cell
IMPORTING
e_row = ld_row.
READ TABLE gt_vbak INTO ls_vbak INDEX ld_row.
CHECK ( syst-subrc = 0 ).
SELECT * FROM vbap INTO TABLE gt_vbap
WHERE vbeln = ls_vbak-vbeln.
ENDFORM. " ORDER_SHOW_DETAILS
Regards
Uwe -
ALV report for 5 Grids using Objects and Method
I have few questions in ALV 5Grids ,could you please correct me in the following program logic...
Using this program logic i am able to generate the five Grids and able to populate Header details from VBAK into Grid1,If you click in the Grid 1 and it is populating item details in Grid2 from VBAP,parallally populating the customer data in Grid5 from KNA1.
Now the pending issue is ,
if you click in the Grid2 then we should populate the shipping details in Grid3 and
if you click in the Grid3 then we should populate the billing details in Grid4.
Program Logic;
REPORT ZAREPAS20.
Tables : vbak,vbap,likp,lips,vbrk,vbrp,kna1.
DATA : OK_CODE LIKE SY-UCOMM,
G_CONTAINER TYPE SCRFNAME VALUE 'BCALV7_GRID_DEMO_0100_VASU',
DOCKING TYPE REF TO CL_GUI_DOCKING_CONTAINER,
SPLITTER_1 TYPE REF TO CL_GUI_SPLITTER_CONTAINER,
SPLITTER_2 TYPE REF TO CL_GUI_SPLITTER_CONTAINER,
splitter_3 TYPE REF TO CL_GUI_SPLITTER_CONTAINER,
CELL_TOP1 TYPE REF TO CL_GUI_CONTAINER,
CELL_BOTTOM1 TYPE REF TO CL_GUI_CONTAINER,
CELL_TOP2 TYPE REF TO CL_GUI_CONTAINER,
CELL_BOTTOM2 TYPE REF TO CL_GUI_CONTAINER,
CELL_LEFT TYPE REF TO CL_GUI_CONTAINER,
CELL_middle TYPE REF TO CL_GUI_CONTAINER,
CELL_RIGHT TYPE REF TO CL_GUI_CONTAINER,
GRID1 TYPE REF TO CL_GUI_ALV_GRID,
GRID2 TYPE REF TO CL_GUI_ALV_GRID,
GRID3 TYPE REF TO CL_GUI_ALV_GRID,
GRID4 TYPE REF TO CL_GUI_ALV_GRID,
GRID5 TYPE REF TO CL_GUI_ALV_GRID.
DATA : GT_VBAK TYPE STANDARD TABLE OF VBAK,
GT_VBAP TYPE STANDARD TABLE OF VBAP,
GT_LIKP TYPE STANDARD TABLE OF likp,
GT_LIPS TYPE STANDARD TABLE OF lips,
GT_VBRK TYPE STANDARD TABLE OF vbrk,
GT_VBRP TYPE STANDARD TABLE OF vbrp,
GT_KNA1 TYPE STANDARD TABLE OF kna1.
DATA:begin of itab1 occurs 0,
vbeln type likp-VBELN,
erzet type likp-ERZET,
lfart type likp-LFART,
posnr type lips-POSNR,
END OF ITAB1.
DATA:begin of itab2 occurs 0,
vbeln like vbrk-vbeln,
posnr like vbrk-fktyp,
fkart like vbrk-fkart,
fklmg like vbrp-fklmg,
end of itab2.
*selection screen for selecting range of values
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE text-001.
select-options: S_vbeln for VBAK-vbeln.
selection-screen end of block b1.
CLASS lcl_eventhandler DEFINITION
CLASS lcl_eventhandler DEFINITION.
PUBLIC SECTION.
CLASS-METHODS:
handle_double_click FOR EVENT double_click OF cl_gui_alv_grid
IMPORTING
e_row
e_column
es_row_no
sender. " sending control, i.e. ALV grid that raised event
ENDCLASS. "lcl_eventhandler DEFINITION
CLASS lcl_eventhandler IMPLEMENTATION
CLASS lcl_eventhandler IMPLEMENTATION.
METHOD HANDLE_DOUBLE_CLICK.
*DEFINE LOCAL DATA.
DATA : itab_vbak type VBAK,
itab_vbap type VBAP,
itab_likp type likp,
itab_lips type lips,
itab_vbrk type vbrk,
itab_vbrp type vbrp,
itab_kna1 type kna1.
*DISTINGUISH ACCORDING TO SENDING GRID INSTANCE
CASE SENDER.
WHEN GRID1.
READ TABLE gt_VBAK INTO itab_vbak INDEX e_row-index.
CHECK ( itab_vbak-vbeln IS NOT INITIAL ).
CALL METHOD GRID1->set_current_cell_via_id
EXPORTING
is_ROW_ID =
is_COLUMN_ID =
is_row_no = es_row_no.
Triggers PAI of the dynpro with the specified ok-code
CALL METHOD cl_gui_cfw=>set_new_ok_code( 'ORDER_DETAILS' ).
WHEN GRID2.
READ TABLE gt_VBAP INTO itab_vbap INDEX e_row-index.
CHECK ( itab_vbap-vbeln IS NOT INITIAL ).
CALL METHOD GRID2->set_current_cell_via_id
EXPORTING
is_ROW_ID =
is_COLUMN_ID =
is_row_no = es_row_no.
Triggers PAI of the dynpro with the specified ok-code
CALL METHOD cl_gui_cfw=>set_new_ok_code( 'ORDER_DETAILS' ).
WHEN GRID3.
READ TABLE gt_LIPS INTO itab_LIPS INDEX e_row-index.
CHECK ( itab_lips-vgbel IS NOT INITIAL ).
CALL METHOD GRID3->set_current_cell_via_id
EXPORTING
is_ROW_ID =
is_COLUMN_ID =
is_row_no = es_row_no.
Triggers PAI of the dynpro with the specified ok-code
CALL METHOD cl_gui_cfw=>set_new_ok_code( 'DELIVERY_DETAILS' ).
WHEN GRID4.
READ TABLE gt_VBRP INTO itab_VBRP INDEX e_row-index.
CHECK ( itab_vbrp-vgbel IS NOT INITIAL ).
CALL METHOD GRID4->set_current_cell_via_id
EXPORTING
is_ROW_ID =
is_COLUMN_ID =
is_row_no = es_row_no.
Triggers PAI of the dynpro with the specified ok-code
CALL METHOD cl_gui_cfw=>set_new_ok_code( 'BILLING_DETAILS' ).
WHEN GRID5.
READ TABLE gt_KNA1 INTO itab_KNA1 INDEX e_row-index.
CHECK ( itab_kna1-kunnr IS NOT INITIAL ).
SET PARAMETER ID 'KUN' FIELD itab_KNA1-KUNNR.
CALL TRANSACTION 'MM02' AND SKIP FIRST SCREEN.
WHEN OTHERS.
RETURN.
ENDCASE.
endmethod.
endclass. "lcl_eventhandler IMPLEMENTATION
start-of-selection.
*write :/ 'FEDEX INT''''L' .
SELECT * FROM vbak INTO TABLE gt_VBAK
where vbeln IN S_VBELN.
creating docking container
create object docking
exporting
parent = cl_gui_container=>screen0
ratio = 90
exceptions
others = 6.
if sy-subrc eq 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Create splitter container
CREATE OBJECT splitter_1
EXPORTING
parent = docking
rows = 1
columns = 3
NO_AUTODEF_PROGID_DYNNR =
NAME =
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
OTHERS = 3.
IF sy-subrc eq 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Get cell container
CALL METHOD splitter_1->get_container
EXPORTING
row = 1
column = 1
RECEIVING
container = cell_left.
CALL METHOD splitter_1->get_container
EXPORTING
row = 1
column = 2
RECEIVING
container = cell_middle.
CALL METHOD splitter_1->get_container
EXPORTING
row = 1
column = 3
RECEIVING
container = cell_right.
Create 2nd splitter container
CREATE OBJECT splitter_2
EXPORTING
parent = cell_left
rows = 2
columns = 1
NO_AUTODEF_PROGID_DYNNR =
NAME =
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
OTHERS = 3.
IF sy-subrc eq 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Get cell container
CALL METHOD splitter_2->get_container
EXPORTING
row = 1
column = 1
RECEIVING
container = cell_top1.
CALL METHOD splitter_2->get_container
EXPORTING
row = 2
column = 1
RECEIVING
container = cell_bottom1.
Create 3rd splitter container
CREATE OBJECT splitter_3
EXPORTING
parent = cell_middle
rows = 2
columns = 1
NO_AUTODEF_PROGID_DYNNR =
NAME =
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
OTHERS = 3.
IF sy-subrc eq 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Get cell container
CALL METHOD splitter_3->get_container
EXPORTING
row = 1
column = 1
RECEIVING
container = cell_top2.
CALL METHOD splitter_3->get_container
EXPORTING
row = 2
column = 1
RECEIVING
container = cell_bottom2.
Create ALV grids
CREATE OBJECT grid1
EXPORTING
i_parent = cell_top1
EXCEPTIONS
OTHERS = 5.
IF sy-subrc eq 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT grid2
EXPORTING
i_parent = cell_bottom1
EXCEPTIONS
OTHERS = 5.
IF sy-subrc eq 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT grid3
EXPORTING
i_parent = cell_top2
EXCEPTIONS
OTHERS = 5.
IF sy-subrc eq 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT grid4
EXPORTING
i_parent = cell_bottom2
EXCEPTIONS
OTHERS = 5.
IF sy-subrc eq 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT grid5
EXPORTING
i_parent = cell_right
EXCEPTIONS
OTHERS = 5.
IF sy-subrc eq 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Set event handler
SET HANDLER: lcl_eventhandler=>handle_double_click FOR grid1.
SET HANDLER: lcl_eventhandler=>handle_double_click FOR grid2.
SET HANDLER: lcl_eventhandler=>handle_double_click FOR grid3.
SET HANDLER: lcl_eventhandler=>handle_double_click FOR grid4.
SET HANDLER: lcl_eventhandler=>handle_double_click FOR grid5.
Display data
CALL METHOD grid1->set_table_for_first_display
EXPORTING
i_structure_name = 'VBAK'
CHANGING
it_outtab = gt_VBAK
EXCEPTIONS
OTHERS = 4.
IF sy-subrc eq 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
REFRESH: gt_vbap.
CALL METHOD grid2->set_table_for_first_display
EXPORTING
i_structure_name = 'VBAP'
CHANGING
it_outtab = gt_VBAP " empty !!!
EXCEPTIONS
OTHERS = 4.
IF sy-subrc eq 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
REFRESH: gt_LIPS.
CALL METHOD grid3->set_table_for_first_display
EXPORTING
i_structure_name = 'LIPS'
CHANGING
it_outtab = gt_LIPS " empty !!!
EXCEPTIONS
OTHERS = 4.
IF sy-subrc eq 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
REFRESH: gt_VBRP.
CALL METHOD grid4->set_table_for_first_display
EXPORTING
i_structure_name = 'VBRP'
CHANGING
it_outtab = gt_VBRP " empty !!!
EXCEPTIONS
OTHERS = 4.
IF sy-subrc eq 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
REFRESH: gt_KNA1.
CALL METHOD grid5->set_table_for_first_display
EXPORTING
i_structure_name = 'KNA1'
CHANGING
it_outtab = gt_KNA1 " empty !!!
EXCEPTIONS
OTHERS = 4.
IF sy-subrc eq 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Link the docking container to the target dynpro
CALL METHOD docking->link
EXPORTING
repid = syst-repid
dynnr = '0100'
CONTAINER =
EXCEPTIONS
OTHERS = 4.
IF sy-subrc eq 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
NOTE: dynpro does not contain any elements (ok_code -> GD_OKCODE)
CALL SCREEN '0100'.
Flow logic of dynpro:
*PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.
*PROCESS AFTER INPUT.
MODULE USER_COMMAND_0100.
end-of-selection.
*& Module STATUS_0100 OUTPUT
text
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'STATUS_0100'.
SET TITLEBAR 'xxx'.
Refresh display of detail ALV list
CALL METHOD grid2->refresh_table_display
EXPORTING
IS_STABLE =
I_SOFT_REFRESH =
EXCEPTIONS
OTHERS = 2.
IF sy-subrc eq 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Refresh display of detail ALV list
CALL METHOD grid3->refresh_table_display
EXPORTING
IS_STABLE =
I_SOFT_REFRESH =
EXCEPTIONS
OTHERS = 2.
IF sy-subrc eq 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Refresh display of detail ALV list
CALL METHOD grid4->refresh_table_display
EXPORTING
IS_STABLE =
I_SOFT_REFRESH =
EXCEPTIONS
OTHERS = 2.
IF sy-subrc eq 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Refresh display of detail ALV list
CALL METHOD grid5->refresh_table_display
EXPORTING
IS_STABLE =
I_SOFT_REFRESH =
EXCEPTIONS
OTHERS = 2.
IF sy-subrc eq 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
text
MODULE USER_COMMAND_0100 INPUT.
CASE SY-UCOMM.
WHEN 'BACK' OR
'EXIT' OR
'CANCEL'.
SET SCREEN 0.LEAVE SCREEN.
USER HAS PUSHED BUTTON "DISPLAY OREDERS"
WHEN 'ORDER_DETAILS'.
PERFORM ORDER_SHOW_DETAILS.
when 'DELIVERY_DETAILS'.
PERFORM DELIVERY_SHOW_DETAILS.
WHEN 'BILLING_DETAILS'.
PERFORM BILLING_SHOW_DETAILS.
WHEN OTHERS.
ENDCASE.
CLEAR : OK_CODE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form ORDER_SHOW_DETAILS
text
--> p1 text
<-- p2 text
FORM order_show_details .
define local data
DATA:
ld_row TYPE i,
itab_VBAK TYPE VBAK.
CALL METHOD grid1->get_current_cell
IMPORTING
e_row = ld_row.
READ TABLE gt_VBAK INTO itab_VBAK INDEX ld_row.
CHECK ( syst-subrc = 0 ).
SELECT * FROM KNA1 INTO TABLE gt_KNA1
WHERE KUNNR = itab_VBAK-KUNNR.
SELECT * FROM VBAP INTO TABLE gt_VBAP
WHERE VBELN = ITAB_VBAK-VBELN.
*REFRESH: gt_LIPS.
ENDFORM. " ORDER_SHOW_DETAILS
*& Form DELIVERY_SHOW_DETAILS
text
--> p1 text
<-- p2 text
FORM DELIVERY_SHOW_DETAILS .
define local data
DATA:
ld_row TYPE i,
itab_VBAP TYPE VBAP.
CALL METHOD grid1->get_current_cell
IMPORTING
e_row = ld_row.
READ TABLE gt_VBAP INTO itab_VBAP INDEX ld_row.
CHECK ( syst-subrc = 0 ).
SELECT LIKPVBELN LIKPERZET LIKPLFART LIPSVBELN
INTO CORRESPONDING FIELDS OF TABLE ITAB1
FROM ( LIKP INNER JOIN LIPS ON LIKPVBELN = LIPSVBELN )
WHERE LIKP~VBELN IN S_VBELN.
*REFRESH: gt_LIPS.
ENDFORM. " DELIVERY_SHOW_DETAILS
*& Form BILLING_SHOW_DETAILS
text
--> p1 text
<-- p2 text
FORM BILLING_SHOW_DETAILS .
define local data
DATA:
ld_row TYPE i,
itab_LIPS TYPE LIPS.
CALL METHOD grid1->get_current_cell
IMPORTING
e_row = ld_row.
READ TABLE gt_LIPS INTO itab_LIPS INDEX ld_row.
CHECK ( syst-subrc = 0 ).
SELECT VBRKVBELN VBRKFKTYP VBRKFKART VBRPFKLMG
INTO CORRESPONDING FIELDS OF TABLE ITAB2
FROM ( VBRK INNER JOIN VBRP ON VBRKVBELN = VBRPVBELN )
WHERE VBRK~VBELN IN S_VBELN.
ENDFORM. " BILLING_SHOW_DETAILSHi,
ALV means ABAP List Viewer. Most convenient way to use it is through reuse library (cf.
transaction se83) available from release 4.6 of SAP R/3.
ALV is available in two modes: list and grid. List mode is good old list processing with
standard functionnalities, and grid mode is using a new OCX object displaying grids.
Classical reports needs more coding to set the horizontal and vertical lines.we need to adjust
the lines manually.Even interactive also takes lot of code.
ALV reports reduces the code when compared to classical reports.we use function modules to
generate the output.
that r REUSE_ALV_LIST_DISPLAY,REUSE_ALV_GRID_DISPLAY,REUSE_ALV_HIERSEQ_LIST_DISPLAY etc..
the following threads will give some examples of the functions which you are expecting
Header
regarding function module
hide ALV field
Simply Display selection parameter values in the ALV OUTPUT
Drag and drop in a report
https://www.sdn.sap
Reprots
http://www.sapgenie.com/abap/reports.htm
http://www.allsaplinks.com/material.html
http://www.sapdevelopment.co.uk/reporting/reportinghome.htm
ALV
1. Please give me general info on ALV.
http://www.sapfans.com/forums/viewtopic.php?t=58286
http://www.sapfans.com/forums/viewtopic.php?t=76490
http://www.sapfans.com/forums/viewtopic.php?t=20591
http://www.sapfans.com/forums/viewtopic.php?t=66305 - this one discusses which way should you
use - ABAP Objects calls or simple function modules. -
***INCLUDE LUCR_LSTF03 .
*& Form display_detail_list
FORM display_detail_list_subscreen.
IF g_display_detail_again IS INITIAL.
IF g_display_detail_next IS INITIAL.
* Header text is displayed as dyn. document
IF go_dydo IS INITIAL.
CREATE OBJECT go_dydo.
ELSE.
FREE go_dydo.
CLEAR go_dydo.
CREATE OBJECT go_dydo.
PERFORM free_create_screen_objects.
ENDIF.
ELSE.
IF NOT go_dydo->html_control IS INITIAL.
CALL METHOD go_splitter_container->remove_control
EXPORTING
row = 1
column = 1.
ENDIF.
ENDIF.
ENDIF.
* Initialize document
CALL METHOD go_dydo->initialize_document.
IF LINES( gt_header ) > 0.
* Build and display detail-header
PERFORM build_header TABLES gt_header
USING go_dydo
gs_header.
ENDIF.
* Merge header-document
CALL METHOD go_dydo->merge_document.
* set toolbar-added functions for detailed list
REFRESH gt_toolbar.
IF go_model->ds_tx_data_io_type-documents IS BOUND. "mb210303
PERFORM fill_tool_tab USING:
gt_toolbar gs_toolbar 'UCR_DUMMY' '1',
gt_toolbar gs_toolbar 'UCR_ENTRIES' '2',
gt_toolbar gs_toolbar 'UCR_DUMMY' '3',
gt_toolbar gs_toolbar 'UCR_PREV' '4',
gt_toolbar gs_toolbar 'UCR_NEXT' '5',
gt_toolbar gs_toolbar 'UCR_DUMMY' '6'.
ELSE. "mb210202 beg.
PERFORM fill_tool_tab USING:
gt_toolbar gs_toolbar 'UCR_DUMMY' '1',
gt_toolbar gs_toolbar 'UCR_PREV' '2',
gt_toolbar gs_toolbar 'UCR_NEXT' '3',
gt_toolbar gs_toolbar 'UCR_DUMMY' '4'.
ENDIF. "mb210202 end.
SET HANDLER go_event_grid->handle_toolbar_comp FOR go_grid.
* Display header
CALL METHOD go_dydo->display_document
EXPORTING
parent = go_container_head.
* Set header-control visible with user set or
* predefined height
IF NOT go_splitter_container IS INITIAL.
IF g_height IS INITIAL.
g_height = 27.
ENDIF.
CALL METHOD go_splitter_container->set_row_height
EXPORTING
id = 1
height = g_height.
ENDIF.
* display detail-list
CALL METHOD go_grid->set_table_for_first_display
EXPORTING
i_bypassing_buffer = 'X'
is_layout = gs_layout_save
it_toolbar_excluding = gt_exclude_toolbar
CHANGING
it_fieldcatalog = gt_fieldcat_d
it_outtab = <gt_outtab_detail>.
IF NOT g_display_detail_next IS INITIAL.
CALL METHOD go_grid->refresh_table_display.
ENDIF.
* Set cursor on selected row if necesary
IF NOT gt_row_id_detail IS INITIAL.
CALL METHOD go_grid->set_selected_rows
EXPORTING
it_index_rows = gt_row_id_detail.
REFRESH gt_row_id_detail.
ENDIF.
CLEAR: g_display_detail_next,
g_display_detail_again.
ENDFORM. " display_detail_list_subscreen
*& Form display_main_list
FORM display_main_list_subscreen. "using i_reporting_logic type uc_flg.
CLEAR g_detail.
* set toolbar-added functions
REFRESH gt_toolbar.
IF go_model->ds_tx_data_io_type IS NOT INITIAL.
IF go_model->ds_tx_data_io_type-documents IS BOUND. "mb210303
* and i_reporting_logic is initial.
PERFORM fill_tool_tab USING:
gt_toolbar gs_toolbar 'UCR_DUMMY' '1',
gt_toolbar gs_toolbar 'UCR_ENTRIES' '2',
gt_toolbar gs_toolbar 'UCR_DUMMY' '3',
gt_toolbar gs_toolbar 'UCR_SEL_COND' '4',
gt_toolbar gs_toolbar 'UCR_DUMMY' '5'.
ELSE.
PERFORM fill_tool_tab USING:
gt_toolbar gs_toolbar 'UCR_DUMMY' '1',
gt_toolbar gs_toolbar 'UCR_SEL_COND' '2',
gt_toolbar gs_toolbar 'UCR_DUMMY' '3'.
ENDIF. "mb210303
SET HANDLER go_event_grid->handle_toolbar_comp FOR go_grid.
ELSE .
PERFORM fill_tool_tab USING:
gt_toolbar gs_toolbar 'UCR_DUMMY' '1',
gt_toolbar gs_toolbar 'UCR_SEL_COND' '2',
gt_toolbar gs_toolbar 'UCR_DUMMY' '3'.
SET HANDLER go_event_grid->handle_toolbar_comp FOR go_grid.
ENDIF.
* Set header-control invisible while main-list is displayed
IF NOT go_splitter_container IS INITIAL.
* Header container can be set visible by user on main-screen
CALL METHOD go_splitter_container->set_row_height
EXPORTING
id = 1
height = 0.
IF NOT go_dydo IS INITIAL.
* Display last header if user wants to set it visible
CALL METHOD go_dydo->display_document
EXPORTING
parent = go_container_head.
ENDIF.
ENDIF.
* subscreen with main list simply is started once again
* prepared with current user settings
IF ( LINES( gt_fieldcat_save ) > 0 ) AND
NOT g_display_main_again IS INITIAL.
REFRESH gt_fieldcat.
gt_fieldcat[] = gt_fieldcat_save[].
* clear g_display_main_again.
* is necessary, because current_frontend_fieldcat must be set
CALL METHOD go_grid->set_table_for_first_display
EXPORTING
i_bypassing_buffer = 'X'
i_save = g_save
is_layout = gs_layout
is_variant = gs_variant
it_special_groups = gt_sgrp "mb110403
it_toolbar_excluding = gt_exclude_toolbar
CHANGING
it_fieldcatalog = gt_fieldcat
it_outtab = <gt_outtab>.
* set current fieldcat
CALL METHOD go_grid->set_frontend_fieldcatalog
EXPORTING
it_fieldcatalog = gt_fieldcat.
* now reset other current layout-infos if necessary
PERFORM set_current_layout USING go_grid
gt_filter_save
gt_sort_save
gs_layout_save.
* display current main-list
CALL METHOD go_grid->refresh_table_display.
REFRESH: gt_fieldcat_save, gt_filter_save, gt_sort_save.
CLEAR : gs_layout_save.
ELSE.
* Show ALV
CALL METHOD go_grid->set_table_for_first_display
EXPORTING
i_bypassing_buffer = 'X'
i_save = g_save
is_layout = gs_layout
is_variant = gs_variant
it_special_groups = gt_sgrp "mb110403
it_toolbar_excluding = gt_exclude_toolbar
CHANGING
it_sort = gt_sort
it_fieldcatalog = gt_fieldcat
it_outtab = <gt_outtab>.
CLEAR g_display_detail_again.
g_display_main_again = 'X'.
ENDIF.
* Set cursor on selected row if necesary
IF NOT gt_row_id IS INITIAL.
CALL METHOD go_grid->set_selected_rows
EXPORTING
it_index_rows = gt_row_id.
ENDIF.
ENDFORM. " display_main_list_subscreen
*& Form display_message
FORM display_message USING lo_grid_object TYPE REF TO cl_gui_alv_grid
lf_refresh_msg_table TYPE c.
DATA: l_lines TYPE i,
ls_layout TYPE lvc_s_layo.
* header_main is not used by Worbench
IF g_subscreen IS INITIAL.
PERFORM header_main.
ENDIF.
g_no_data = 'X'.
* if first data selection results no data gt_parameter_save must be
* filled from lt_parameter to take care of further user changed
* parameters from list screen
DESCRIBE TABLE gt_parameter_save LINES l_lines.
IF l_lines = 0.
gt_parameter_save[] = gt_parameter[].
ENDIF.
PERFORM no_data_selected IN PROGRAM (gc_progname)
USING gt_fieldcat_mess
gs_fieldcat_mess
gt_message
gs_message
text-101
text-102
'TEXT'
'LT_MESSAGE'
lf_refresh_msg_table " 'X'
space. " 'C610'. no color, accessibility
*** Start of Comment By Ramesh Babu N,IBM - C1DK900725 ***
* Set header-control invisible while main-list is displayed
* IF NOT go_splitter_container IS INITIAL.
* CALL METHOD go_splitter_container->set_row_height
* EXPORTING
* id = 1
* height = 0.
* CALL METHOD go_splitter_container->set_row_sash
* EXPORTING
* id = 1
* type = cl_gui_splitter_container=>type_sashvisible
* value = cl_gui_splitter_container=>false.
* ENDIF.
*** End of Comment By Ramesh Babu N,IBM - C1DK900725 ***
* display messages
* ls_layout-no_toolbar = 'X'.
CALL METHOD lo_grid_object->set_table_for_first_display
EXPORTING
i_bypassing_buffer = 'X'
it_toolbar_excluding = gt_exclude_toolbar_mess
is_layout = ls_layout
CHANGING
it_fieldcatalog = gt_fieldcat_mess
it_outtab = gt_message.
*** Start of Comment By Ramesh Babu N,IBM - C1DK900725 ***
* Event-Handler for docking-container
* IF go_event_dock IS INITIAL.
* CREATE OBJECT go_event_dock.
* ENDIF.
*** End of Comment By Ramesh Babu N,IBM - C1DK900725 ***
IF go_parameter IS INITIAL.
CALL METHOD cl_uc_parameter=>get_instance
IMPORTING
eo_instance = go_parameter.
ENDIF.
*** Start of Comment By Ramesh Babu N,IBM - C1DK900725 ***
* SET HANDLER go_event_dock->handle_new_parameters FOR go_parameter.
*** End of Comment By Ramesh Babu N,IBM - C1DK900725 ***
ENDFORM. " display_message
*& Form sub_download_data
* Used for downloading BCS data to a TAB delimited file in Custom task *
* <--ct_data HASHED TABLE
FORM f_download_data USING ct_task TYPE uc_task
ct_sel TYPE uc0_ts_sel
gt_param TYPE ucm_ts_parameter
CHANGING ct_message TYPE uc0_t_message
ct_data TYPE HASHED TABLE..
* SUBROUTINE DESCRIPION: Used for downloading BCS data to file in Custome Task
* DEVELOPER: Ramesh Babu Nalla , IBM
* CREATION DATE: 2007-10-11
* DER NUMBER: None
* TRANSPORT NUMBER(S): C1DK900725
* REVISION HISTORY-----------------------------------------------------*
* REVISION NO: C1DK900725 REFERENCE NO: None
* DEVELOPER: Ramesh Babu N,IBM DATE: 2007-10-11
* DESCRIPTION: Copied from SAP FM UCR_LST_LOGIC *
CONSTANTS : c_task01 TYPE uc_task VALUE 'T2700',
c_task02 TYPE uc_task VALUE 'T2490'.
TYPES: BEGIN OF ty_download,
** /bic/zcs_comp TYPE char08, " Unilever-Company
** /bic/zcs_item TYPE char10, " Unilever-Item
** /1fb/move_type TYPE char03, " Unilever-Movement type
** /bic/zcs_pcom TYPE char08, " Unilever-Partner Company
** /bic/zcs_invc TYPE char08, " Unilever-Investee Company
** /bic/zcs_cang TYPE char03, " Unilever-Cost Analysis Group
** /bic/zcs_ad TYPE char08, " Unilever-Aquisitions/Disposals
** /bic/zcs_cd TYPE char08, " Unilever-Continued/Discontinued Ops.
** /bic/zcs_prgp TYPE char08, " Unilever-Product Category
/bic/zfb_comp TYPE char08, " Unilever-Company
/bic/zfb_item TYPE char10, " Unilever-Item
/bic/zfb_move TYPE char03, " Unilever-Movement type
/bic/zfb_pcom TYPE char08, " Unilever-Partner Company
/bic/zfb_invc TYPE char08, " Unilever-Investee Company
/bic/zfb_cang TYPE char03, " Unilever-Cost Analysis Group
/bic/zfb_ad TYPE char08, " Unilever-Aquisitions/Disposals
/bic/zfb_cd TYPE char08, " Unilever-Continued/Discontinued Ops.
/bic/zfb_prgp TYPE char08, " Unilever-Product Category
/1fb/cs_trn_lc TYPE string, " Unilever-Period value in Local currency
/1fb/cs_trn_qty TYPE string, " Unilever-Periodic quantity
unit type string,
END OF ty_download.
* flag
DATA flg_chk TYPE c.
DATA: lr_s_data_out TYPE REF TO data,
lr_t_data_out TYPE REF TO data,
l_outtype TYPE field_type VALUE 'UCR_SX_TX_DATA_LST',
lr TYPE REF TO data,
lo_conv TYPE REF TO lcl_convert_output,
lt_char TYPE lcl_convert_output=>th_comp,
ls_comp TYPE lcl_convert_output=>s_comp,
lr_s_data TYPE REF TO data,
lr_t_data TYPE REF TO data,
l_filename TYPE string,
l_action TYPE i,
l_path TYPE string,
l_seperator TYPE char01 VALUE 'X',
l_fullpath TYPE string,
l_mmyy TYPE string,
lr_sel_data TYPE REF TO data,
lr_t_val TYPE REF TO data,
lr_t_final TYPE REF TO data,
lr_val TYPE REF TO data,
ls_download TYPE REF TO data,
lt_download TYPE REF TO data,
ls_sel TYPE REF TO data,
ls_msg TYPE uc0_s_message.
** SOC by Dpak-------------------------------------------------------------------------------------------
** Changed by Deepak N Jain, IBM on 16/11/2006 as the corresponding field name assigned by Ramesh from
** the structure <LS_DATA_OUT> are not matching. This is because of the new cube from whch the Financial
** data is coming now. The new cube is ZFBCS_T1 which has replaced the old cube ZCS_T1.
** Hence, Short Dump on Execution.
** DATA: l_comp TYPE string VALUE '/BIC/ZCS_COMP', " Unilever-Company
** l_cgcomp TYPE string VALUE '/1FB/SEM_CGCOMP'," Unilever-Consolidation Group
** l_pcomp TYPE string VALUE '/BIC/ZCS_PCOM', " Unilever-Partner Company
** l_doct TYPE string VALUE '/BIC/ZCS_DOCT', " Unilever-Document type
** l_plevel TYPE string VALUE 'CS_PLEVEL', " Unilever-Posting Level
** l_tc TYPE string VALUE '/1FB/CS_TRN_TC', " Unilever-Period value in Transaction currency
** l_qty TYPE string VALUE '/1FB/CS_TRN_QTY'," Unilever-Periodic quantity
** l_trn_lc TYPE string VALUE '/1FB/CS_TRN_LC', " Unilever-Period value in Local currency
** l_bu TYPE string VALUE '/BIC/ZCS_PROF', " Unilever-Business Unit/Cost Centre
** l_low TYPE string VALUE 'LOW'.
DATA: l_comp TYPE string VALUE '/BIC/ZFB_COMP', " Unilever-Company
l_cgcomp TYPE string VALUE '/BIC/ZFB_CG1', " Unilever-Consolidation Group
l_pcomp TYPE string VALUE '/BIC/ZFB_PCOM', " Unilever-Partner Company
l_doct TYPE string VALUE '/BIC/ZFB_DOCT', " Unilever-Document type
l_invc TYPE string VALUE '/BIC/ZFB_INVC', " Unilever-Investee Company
l_plevel TYPE string VALUE 'CS_PLEVEL', " Unilever-Posting Level
l_tc TYPE string VALUE '/1FB/CS_TRN_TC', " Unilever-Period value in Transaction currency
l_qty TYPE string VALUE '/1FB/CS_TRN_QTY'," Unilever-Periodic quantity
l_trn_lc TYPE string VALUE '/1FB/CS_TRN_LC', " Unilever-Period value in Local currency
l_bu TYPE string VALUE '/BIC/ZCS_PROF', " Unilever-Business Unit/Cost Centre
l_low TYPE string VALUE 'LOW',
l_unit TYPE string VALUE 'UNIT'.
** EOC by Dpak-----------------------------------------------------------------------------------------------
** future use **
** FISCVARNT TYPE L0002FISCVARNT,
** FISCPERIOD TYPE L0002FISCPERIOD,
** /BIC/ZFB_VERS TYPE L0002/BIC/ZFB_VERS,
** /BIC/ZFB_CG1 TYPE L0002/BIC/ZFB_CG1,
** /BIC/ZFB_COMP TYPE L0002/BIC/ZFB_COMP,
** /1FB/CS_CHART TYPE L0002/1FB/CS_CHART,
** /BIC/ZFB_MOVE TYPE L0002/BIC/ZFB_MOVE,
** /BIC/ZFB_PCOM TYPE L0002/BIC/ZFB_PCOM,
** ACQ_YEAR TYPE L0002ACQ_YEAR,
** ACQ_PER TYPE L0002ACQ_PER,
** /BIC/ZFB_INVC TYPE L0002/BIC/ZFB_INVC,
** /BIC/ZFB_ALCO TYPE L0002/BIC/ZFB_ALCO,
** CS_PLEVEL TYPE L0002CS_PLEVEL,
** /BIC/ZFB_DOCT TYPE L0002/BIC/ZFB_DOCT,
** BCS_CTFLG TYPE L0002BCS_CTFLG,
** UNIT TYPE L0002UNIT,
** /1FB/CURKEY_TC TYPE L0002/1FB/CURKEY_TC,
** /1FB/CURKEY_LC TYPE L0002/1FB/CURKEY_LC,
** /1FB/CURKEY_GC TYPE L0002/1FB/CURKEY_GC,
** /BIC/ZFB_PRGP TYPE L0002/BIC/ZFB_PRGP,
** /BIC/ZFB_COUN TYPE L0002/BIC/ZFB_COUN,
** /BIC/ZFB_CANG TYPE L0002/BIC/ZFB_CANG,
** /1FB/FUNC_AREA TYPE L0002/1FB/FUNC_AREA,
** /BIC/ZFB_CT TYPE L0002/BIC/ZFB_CT,
** /BIC/ZFB_CD TYPE L0002/BIC/ZFB_CD,
** /BIC/ZFB_AD TYPE L0002/BIC/ZFB_AD,
** /BIC/ZFB_FR01 TYPE L0002/BIC/ZFB_FR01,
** /BIC/ZFB_FR02 TYPE L0002/BIC/ZFB_FR02,
** FISCYEAR TYPE L0002FISCYEAR,
** /BIC/ZFB_ITEM TYPE L0002/BIC/ZFB_ITEM,
** future use **
FIELD-SYMBOLS: <lt_data_out> TYPE STANDARD TABLE,
<ls_data_out> TYPE ANY,
<ls_data> TYPE ANY,
<ls_data_cop> TYPE ANY,
<lt_data_std> TYPE STANDARD TABLE,
<ls_data_std> TYPE ANY,
<ls_download> TYPE ANY,
<lt_download> TYPE STANDARD TABLE,
<comp> TYPE ANY,
<cgcomp> TYPE ANY,
<pcomp> TYPE ANY,
<doct> TYPE ANY,
<plevel> TYPE ANY,
<tc> TYPE ANY,
<invc> TYPE ANY,
<qty> TYPE ANY,
<unit> TYPE ANY,
<trn_lc> TYPE ANY,
<comp1> TYPE ANY,
<cgcomp1> TYPE ANY,
<pcomp1> TYPE ANY,
<doct1> TYPE ANY,
<plevel1> TYPE ANY,
<tc1> TYPE ANY,
<invc1> TYPE ANY,
<qty1> TYPE ANY,
<trn_lc1> TYPE ANY,
<unit1> TYPE ANY,
<bu> TYPE ANY,
<bu1> TYPE ANY,
<low> TYPE ANY,
<l_year> TYPE ANY ,
<l_period> TYPE ANY ,
<l_mmyy> TYPE ANY,
<ls_sel_data> TYPE ANY,
<ls_val> TYPE zbcs_check_val,
<lt_t_val> TYPE STANDARD TABLE,
<lt_t_final> TYPE STANDARD TABLE.
**************** Begin Of Addtion - ASIF MAQBOOL ******************
Data: BEGIN OF l_s_tab,
values TYPE C LENGTH 400,
end OF l_s_tab,
gs_param LIKE LINE OF gt_param,
l_temp_store LIKE gt_param.
Field-SYMBOLS: <gt_param> TYPE ANY TABLE,
<final_gt> TYPE any ,
<gs_fieldname> TYPE any,
<gs_value> TYPE any.
Data: l_t_tab TYPE TABLE OF string INITIAL SIZE 0,
str TYPE string,
str1 TYPE string.
**************** End Of Addtion - ASIF MAQBOOL ******************
* create Line-structure of data table
CREATE DATA lr_s_data LIKE LINE OF ct_data.
ASSIGN lr_s_data->* TO <ls_data_std>.
** create cumulation table
CREATE DATA lr_t_data LIKE STANDARD TABLE OF <ls_data_std>.
ASSIGN lr_t_data->* TO <lt_data_std>.
LOOP AT ct_data INTO <ls_data_std>.
COLLECT <ls_data_std> INTO <lt_data_std>.
ENDLOOP.
FREE ct_data.
* get reference for outtab / create outtab
CALL METHOD go_model->create_data_reference
EXPORTING
io_tx_data_io_type = go_model->ds_tx_data_io_type-totals
i_type = l_outtype "'UCR_SX_TX_DATA_LST'
IMPORTING
er_data = lr_s_data_out.
ASSIGN lr_s_data_out->* TO <ls_data_out>.
ASSIGN lr_s_data_out->* TO <ls_data_cop>.
CREATE DATA lr_t_data_out LIKE STANDARD TABLE OF <ls_data_out>.
ASSIGN lr_t_data_out->* TO <lt_data_out>.
CREATE DATA lr LIKE LINE OF <lt_data_std>.
ASSIGN lr->* TO <ls_data>.
CALL METHOD lcl_convert_output=>get_instance
EXPORTING
io_model = go_model
it_char = lt_char
IMPORTING
eo_instance = lo_conv
CHANGING
cs_data = <ls_data>.
ASSIGN: l_comp TO <comp>,
l_cgcomp TO <cgcomp>,
l_pcomp TO <pcomp>,
l_invc TO <invc>,
l_doct TO <doct>,
l_plevel TO <plevel>,
l_tc TO <tc>,
l_qty TO <qty>,
l_trn_lc TO <trn_lc>,
l_bu TO <bu>,
l_mmyy TO <l_mmyy>,
l_low TO <low>,
l_unit TO <unit>.
LOOP AT <lt_data_std> INTO <ls_data>. " loop
CALL METHOD lo_conv->convert_output. "end of "wis240605
* fill outtab
ASSIGN COMPONENT if_uc_model=>gc_type_comp_s_char
OF STRUCTURE <ls_data> TO <ls_data_cop>.
MOVE-CORRESPONDING <ls_data_cop> TO <ls_data_out>.
ASSIGN COMPONENT if_uc_model=>gc_type_comp_s_kfig
OF STRUCTURE <ls_data> TO <ls_data_cop>.
MOVE-CORRESPONDING <ls_data_cop> TO <ls_data_out>.
IF ct_task = c_task01 OR ct_task = space . "'it can be T2700 or blank
***** aggregate the transactionaldata for given Rules *****
ASSIGN COMPONENT : <comp> OF STRUCTURE <ls_data_out> TO <comp1>,
<cgcomp> OF STRUCTURE <ls_data_out> TO <cgcomp1>,
<pcomp> OF STRUCTURE <ls_data_out> TO <pcomp1>,
<doct> OF STRUCTURE <ls_data_out> TO <doct1>,
<invc> OF STRUCTURE <ls_data_out> TO <invc1>, "added by Asif M.
<plevel> OF STRUCTURE <ls_data_out> TO <plevel1>,
<tc> OF STRUCTURE <ls_data_out> TO <tc1>,
<qty> OF STRUCTURE <ls_data_out> TO <qty1>,
<trn_lc> OF STRUCTURE <ls_data_out> TO <trn_lc1>.
**** 1st Rule ****
* dont include records where '/1FB/CS_TRN_QTY' and '/1FB/CS_TRN_LC' are blank
IF <trn_lc1> = 0 AND <qty1> = 0.
CONTINUE.
ENDIF.
**** 2nd Rule ****
* delete the Posting levels if it is > 1 and clear to blank CS_PLEVEL
CHECK <plevel1> LE 1.
CLEAR <plevel1>.
**** 3rd Rule ****
* replace the Unilever Company with CG without prefix G and compare with Partner comp for deletion
* /BIC/ZCS_COMP with /1FB/SEM_CGCOMP and check with /BIC/ZCS_PCOM
IF ct_task <> space.
*** code added by Ramesh for the removal GBRNCH records while downloading the file.
**** code for removal of GBRNCH records only - Hardcode - sample code
* IF <cgcomp1> <> 'GBRNCH'. " to avoid BRNCH records
** replace Company with CG without prefix G when task name is not blank
* <comp1> = <cgcomp1>+1.
* ELSE.
* CONTINUE.
* ENDIF.
**** code for removal of GBRNCH records only - Hardcode - sample code
*** the assumption here,is consider only records with Legal entity as numeric excepting the first character
IF <cgcomp1>+1 CN sy-abcde. " to avoid BRNCH records
* replace Company with CG without prefix G when task name is not blank
<comp1> = <cgcomp1>+1.
ELSE.
CONTINUE.
ENDIF.
ENDIF.
* removing leading zero's as SAP sometimes adding them to <pcomp1>.
* CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
* EXPORTING
* input = <pcomp1>
* IMPORTING
* output = <pcomp1>.
PERFORM f_alpha_conversion USING <comp1>
CHANGING <comp1>.
PERFORM f_alpha_conversion USING <pcomp1>
CHANGING <pcomp1>.
" removing leading zero's from Investee Unit company - Added By Asif Maqbool, IBM/Unilever, 25/01/2008.
PERFORM f_alpha_conversion USING <invc1>
CHANGING <invc1>.
CHECK <comp1> <> <pcomp1>.
**** 4rth Rule ****
* initialise Document type & PV TC to blank /BIC/ZCS_DOCT & /1FB/CS_TRN_TC
CLEAR: <doct1>,<tc1>.
ENDIF.
COLLECT: <ls_data_out> INTO <lt_data_out>.
ENDLOOP. " end loop
IF <lt_data_out> IS INITIAL.
PERFORM f_build_msgs USING 'UCM0'
'W'
'053'
text-102
space "ct_task
space
space
CHANGING ct_message.
RETURN.
MESSAGE e208(00) WITH text-102.
EXIT.
ENDIF.
* perform various steps based on task name
CASE ct_task.
WHEN c_task01 OR space. " 'T2700' or blank
* download the data into a tab delimited file
**** start of Task 0001 ****
* create Line-structure of download table
CREATE DATA ls_download TYPE ty_download.
ASSIGN ls_download->* TO <ls_download>.
** create Download data internal table for task T2700
CREATE DATA lt_download LIKE STANDARD TABLE OF <ls_download>.
ASSIGN lt_download->* TO <lt_download>.
LOOP AT <lt_data_out> INTO <ls_data_out>.
MOVE-CORRESPONDING <ls_data_out> TO <ls_download>.
ASSIGN COMPONENT <trn_lc> OF STRUCTURE <ls_download> TO <trn_lc1>.
*** 6th Rule **********************
" Check for values, if present remove decimals, if not present clear it of (blank).
UNASSIGN <qty1>.
ASSIGN COMPONENT <qty> of STRUCTURE <ls_download> to <qty1>.
ASSIGN COMPONENT <unit> of STRUCTURE <ls_download> to <unit1>.
if <unit1> = '' OR <unit1> <> '%'.
REPLACE ALL OCCURRENCES OF '.' in <qty1> WITH '' RESPECTING CASE.
<qty1> = ''.
endif.
if <unit1> <> '' And <qty1> <> ''.
<unit1> = ''. " We dont need unit downloaded.
REPLACE ALL OCCURRENCES OF '.' in <qty1> WITH '' RESPECTING CASE.
<qty1> = <qty1>+0(2).
endif.
**** 5th Rule ****
* Move the Negative sign to front
PERFORM f_put_sign_in_front CHANGING <trn_lc1>.
INSERT <ls_download> INTO TABLE <lt_download>.
ENDLOOP.
* move the aggregated data to final table for display
FREE ct_data.
ct_data = <lt_data_out>.
CLEAR: l_path,l_filename,l_fullpath,l_action.
CALL FUNCTION 'GUI_FILE_SAVE_DIALOG'
EXPORTING
window_title = 'Download aggregated BCS data to Tab Delimited file'
default_extension = 'txt'
* DEFAULT_FILE_NAME = dynamic file name as like ALE settings
file_filter = 'Text files (*.txt)'
IMPORTING
filename = l_filename
path = l_path
fullpath = l_fullpath
user_action = l_action .
CALL METHOD cl_gui_cfw=>flush.
" *************************** START OF CHANGE - ASIF MAQBOOL ************************
IF l_action = 0 OR l_action = 1.
ASSIGN gt_param TO <gt_param>.
APPEND '100' to l_t_tab.
READ TABLE gt_param INDEX 6 INTO gs_param.
ASSIGN COMPONENT 2 OF STRUCTURE gs_param to <gs_value>.
APPEND <gs_value> to l_t_tab.
Clear gs_param.
READ TABLE gt_param INDEX 4 INTO gs_param.
ASSIGN COMPONENT 2 OF STRUCTURE gs_param to <gs_value>.
APPEND <gs_value> to l_t_tab.
* LOOP AT <gt_param> INTO gs_param.
* ASSIGN COMPONENT 1 OF STRUCTURE gs_param to <gs_fieldname>.
* CASE <gs_fieldname>.
* WHEN '/BIC/ZFB_VERS'.
* APPEND '100' to l_t_tab.
* WHEN 'FISCPERIOD'.
* ASSIGN COMPONENT 2 OF STRUCTURE gs_param to <gs_value>.
* APPEND <gs_value> to l_t_tab.
* WHEN 'FISCYEAR'.
* ASSIGN COMPONENT 2 OF STRUCTURE gs_param to <gs_value>.
* APPEND <gs_value> to l_t_tab.
* WHEN OTHERS.
* ENDCASE.
* ENDLOOP.
CONCATENATE LINES OF l_t_tab INTO str1 SEPARATED BY cl_abap_char_utilities=>horizontal_tab.
CLEAR l_t_tab.
INSERT str1 INTO TABLE l_t_tab.
ASSIGN l_t_tab TO <final_gt>.
" To Start by adding the Header Data.
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
filename = l_fullpath
write_field_separator = l_seperator "SPACE
CHANGING
data_tab = <final_gt>
EXCEPTIONS
file_write_error = 1.
" Now append the Data after the header data insertion.
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
filename = l_fullpath
write_field_separator = l_seperator "SPACE
append = 'X'
CHANGING
data_tab = <lt_download>
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
not_supported_by_gui = 22
error_no_gui = 23
OTHERS = 24.
" *************************** END OF CHANGE - ASIF MAQBOOL ************************
IF sy-subrc <> 0.
* MESSAHi,
I am also from same project.
We are facing a problem with this code.
How can I increase the length of the field obtained by this method.
CALL METHOD go_model->create_data_reference
EXPORTING
io_tx_data_io_type = go_model->ds_tx_data_io_type-totals
i_type = l_outtype "'UCR_SX_TX_DATA_LST'
IMPORTING
er_data = lr_s_data_out.
ASSIGN lr_s_data_out->* TO <ls_data_out>.
We are getting data overflow error when we try to move some large value to one of the field in <ls_data_out>.
we can avoid this if the field length is increased.
Waiting for your reply.
Regards
Madhu G S -
Requires experts help - abap report in sales order
hello,
for the sales order details - to display partner function and delivery status.
first screen contains selection screen containing sales organization and a check box.
if i enter the sales organization without clicking check box, it displays many sale orders clicking on any sale order, (interactive) takes me to another screen, where i have push buttons for displaying partner func and delivery status. - this output is coming correctly.
if i enter sales org. and <b>click the check box</b>, goes to next screen where i give sale order no. in parameter and after giving i should go to the same screen where i created pushbuttons for displaying the partner functions and delivery status of that particular vbeln.
i am not getting the output for the above thing.
( i am not using dialog module). ordinary report only.
can anybody help me in this regard.
thank you.Hello Akilandeswari
Sorry to say that but your application is an example of a poor user interface (UI).
The following sample report <b>ZUS_SDN_TWO_ALV_GRIDS_SO</b> shows you how to display all sales order for a given sales organisation. Double-clicking on a sales order fills the second ALV list with the partner functions. Obviously, it would be a piece of cake to display the statusinfo in another ALV list (-> Alv).
*& Report ZUS_SDN_TWO_ALV_GRIDS
*& Screen '0100' contains no elements.
*& ok_code -> assigned to GD_OKCODE
*& Flow logic:
* PROCESS BEFORE OUTPUT.
* MODULE STATUS_0100.
* PROCESS AFTER INPUT.
* MODULE USER_COMMAND_0100.
REPORT zus_sdn_two_alv_grids.
DATA:
gd_okcode TYPE ui_func,
go_docking TYPE REF TO cl_gui_docking_container,
go_splitter TYPE REF TO cl_gui_splitter_container,
go_cell_top TYPE REF TO cl_gui_container,
go_cell_bottom TYPE REF TO cl_gui_container,
go_grid1 TYPE REF TO cl_gui_alv_grid,
go_grid2 TYPE REF TO cl_gui_alv_grid,
gs_layout TYPE lvc_s_layo.
DATA:
gt_outtab TYPE STANDARD TABLE OF vbak,
gt_partner TYPE STANDARD TABLE OF vbpavb.
* CLASS lcl_eventhandler DEFINITION
CLASS lcl_eventhandler DEFINITION.
PUBLIC SECTION.
CLASS-METHODS:
handle_double_click FOR EVENT double_click OF cl_gui_alv_grid
IMPORTING
e_row
e_column
es_row_no
sender.
ENDCLASS. "lcl_eventhandler DEFINITION
* CLASS lcl_eventhandler IMPLEMENTATION
CLASS lcl_eventhandler IMPLEMENTATION.
METHOD handle_double_click.
* define local data
DATA:
ls_outtab LIKE LINE OF gt_outtab.
CHECK ( sender = go_grid1 ).
READ TABLE gt_outtab INTO ls_outtab INDEX e_row-index.
CHECK ( ls_outtab-vbeln IS NOT INITIAL ).
CALL METHOD go_grid1->set_current_cell_via_id
EXPORTING
* IS_ROW_ID =
* IS_COLUMN_ID =
is_row_no = es_row_no.
* Triggers PAI of the dynpro with the specified ok-code
CALL METHOD cl_gui_cfw=>set_new_ok_code( 'DETAIL' ).
ENDMETHOD. "handle_double_click
ENDCLASS. "lcl_eventhandler IMPLEMENTATION
PARAMETERS:
p_vkorg TYPE vkorg DEFAULT '1000'.
START-OF-SELECTION.
SELECT * FROM vbak INTO TABLE gt_outtab
WHERE vkorg = p_vkorg.
* Create docking container
CREATE OBJECT go_docking
EXPORTING
parent = cl_gui_container=>screen0
ratio = 90
EXCEPTIONS
OTHERS = 6.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Create splitter container
CREATE OBJECT go_splitter
EXPORTING
parent = go_docking
rows = 2
columns = 1
* NO_AUTODEF_PROGID_DYNNR =
* NAME =
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Get cell container
CALL METHOD go_splitter->get_container
EXPORTING
row = 1
column = 1
RECEIVING
container = go_cell_top.
CALL METHOD go_splitter->get_container
EXPORTING
row = 2
column = 1
RECEIVING
container = go_cell_bottom.
* Create ALV grids
CREATE OBJECT go_grid1
EXPORTING
i_parent = go_cell_top
EXCEPTIONS
OTHERS = 5.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Set event handler
SET HANDLER: lcl_eventhandler=>handle_double_click FOR go_grid1.
CREATE OBJECT go_grid2
EXPORTING
i_parent = go_cell_bottom
EXCEPTIONS
OTHERS = 5.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Display data
gs_layout-grid_title = 'Sales Orders'.
CALL METHOD go_grid1->set_table_for_first_display
EXPORTING
i_structure_name = 'VBAK'
is_layout = gs_layout
CHANGING
it_outtab = gt_outtab
EXCEPTIONS
OTHERS = 4.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
gs_layout-grid_title = 'Partner Functions'.
CALL METHOD go_grid2->set_table_for_first_display
EXPORTING
i_structure_name = 'VBPA'
is_layout = gs_layout
CHANGING
it_outtab = gt_partner " empty !!!
EXCEPTIONS
OTHERS = 4.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Link the docking container to the target dynpro
CALL METHOD go_docking->link
EXPORTING
repid = syst-repid
dynnr = '0100'
* CONTAINER =
EXCEPTIONS
OTHERS = 4.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* NOTE: dynpro does not contain any elements
CALL SCREEN '0100'.
* Flow logic of dynpro (does not contain any dynpro elements):
*PROCESS BEFORE OUTPUT.
* MODULE STATUS_0100.
*PROCESS AFTER INPUT.
* MODULE USER_COMMAND_0100.
END-OF-SELECTION.
*& Module STATUS_0100 OUTPUT
* text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'STATUS_0100'. " contains push button "DETAIL"
* SET TITLEBAR 'xxx'.
* Refresh display of detail ALV list
CALL METHOD go_grid2->refresh_table_display
* EXPORTING
* IS_STABLE =
* I_SOFT_REFRESH =
EXCEPTIONS
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
* text
MODULE user_command_0100 INPUT.
CASE gd_okcode.
WHEN 'BACK' OR
'END' OR
'CANC'.
SET SCREEN 0. LEAVE SCREEN.
* User has pushed button "Display Details"
WHEN 'DETAIL'.
PERFORM entry_show_details.
WHEN OTHERS.
ENDCASE.
CLEAR: gd_okcode.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form ENTRY_SHOW_DETAILS
* text
* --> p1 text
* <-- p2 text
FORM entry_show_details .
* define local data
DATA:
ld_row TYPE i,
ld_title TYPE lvc_title,
ls_outtab LIKE LINE OF gt_outtab,
lt_sadrvb TYPE STANDARD TABLE OF sadrvb.
CALL METHOD go_grid1->get_current_cell
IMPORTING
e_row = ld_row.
READ TABLE gt_outtab INTO ls_outtab INDEX ld_row.
CHECK ( syst-subrc = 0 ).
REFRESH: gt_partner.
CALL FUNCTION 'SD_PARTNER_READ'
EXPORTING
f_vbeln = ls_outtab-vbeln
* OBJECT = 'VBPA'
no_master_adress = 'X'
TABLES
i_xvbadr = lt_sadrvb " dummy, obligatory
i_xvbpa = gt_partner.
CONCATENATE ls_outtab-vbeln 'Partner Functions' INTO ld_title
SEPARATED BY ': '.
go_grid2->set_gridtitle( ld_title ).
CALL FUNCTION 'BAPI_SALESORDER_GETSTATUS'
EXPORTING
salesdocument = ls_outtab-vbeln
* IMPORTING
* RETURN =
* TABLES
* STATUSINFO = gt_status
ENDFORM. " ENTRY_SHOW_DETAILS
Regards
Uwe -
Summing up a Column in ALV report
Hi All,
I have developed an ALV Report which will display Invoices and other details.
Now i need to display the sum of NETWR column, if user wish to select that column and click the "SUM" icon.
As of now, if i select the NETWR column and click 'SUM" column, i am getting Runtime error.
How to resolve this issue?
Regards
PavanHi Pavan,
ALV GRID CONTROL:
This task is performed by the SAP Control Framework.
The R/3 System allows you to create custom controls using ABAP Objects. The application server is the Automation Client, which drives the custom controls (automation server) at the front end.
If custom controls are to be included on the frontend, then the SAPGUI acts as a container for them.
Custom controls can be ActiveX Controls or JavaBeans.
The system has to use a Remote Function Call (RFC) to transfer methods for creating and using a control to the front end.
ABAP objects are used to implement the controls in programs.
An SAP Container can contain other controls (for example, SAP ALV Grid Control, Tree Control, SAP Picture Control, SAP Splitter Control, and so on). It administers these controls logically in one collection and provides a physical area for the display.
Every control exists in a container. Since containers are themselves controls, they can be nested within one another. The container becomes the parent of its control. SAP containers are divided into five groups:
SAP custom container: Displays within an area defined in Screen Painter on screens or sub screens.
Class: CL_GUI_CUSTOM_CONTAINER
SAP dialog box container: Displays in a modeless dialog box or as a full screen. Class:
CL_GUI_DIALOGBOX_CONTAINER
SAP docking container: Displays as docked, resizable sub-window with the option of displaying it as a modeless dialog box. Class: CL_GUI_DOCKING_CONTAINER
SAP splitter container: Displays and groups several controls in one area - that is, splits the area into cells Class: CL_GUI_SPLITTER_CONTAINER
SAP easy splitter container: Displays controls in two cells, which the user can resize using a split bar. Class: CL_GUI_EASY_SPLITTER_CONTAINER.
In the control, you can adjust the column width by dragging, or use the 'Optimum width' function to adjust the column width to the data currently displayed. You can also change the column sequence by selecting a column and dragging it to a new position.
Standard functions are available in the control toolbar. The details display displays the fields in the line on which the cursor is positioned in a modal dialog box.
The sort function in the ALV Control is available for as many columns as required. You can set complex sort criteria and sort columns in either ascending or descending order.
You can use the 'Search' function to search for a string (generic search without *) within a selected area by line or column.
You can use the 'Sum' function to create totals for one or more numeric columns. You can then use the "Subtotals" function to set up control level lists: You can use the 'Subtotal' function to structure control level lists: select the columns (non-numeric columns only) that you want to use and the corresponding control level totals are displayed.
For 'Print' and 'Download' the whole list is always processed, not just the sections displayed on the screen.
You can define display variants to meet your own specific requirements. For information on saving variants, see 'Advanced Techniques'.
The ALV grid control is a generic tool for displaying lists in screens. The control offers standard functions such as sorting by any column, adding numeric columns, and fixed lead columns .
Data collection is performed in the program (with SELECT statements, for example) or by using a logical database. The data records are saved in an internal table and passed on to the ALV control along with a field description.
The field description contains information about the characteristics of each column, such as the column header and output length. This information can defined either globally in the Dictionary (structure in the Dictionary) or in the field catalog in the program itself. You can also merge both techniques.
The ALV link is a standard function of Query and QuickViewer. If multiline queries or Quick View lists have been defined, they will automatically be compressed to a single line and output in the ALV control as a long, single line list.
Use Screen Painter to create a sub screen container for the ALV grid control. The control requires an area where it can be displayed in the screen. You have to create a container control that determines this area.
Use the corresponding icon in the Screen Painter layout to create the container control. The size of area "MY_CONTROL_AREA" determines the subsequent size of the ALV control.
The valid GUI status must be set at the PBO event in the flow logic of the ALV subscreen container.
The OK_CODE processing for the cancel functions must be programmed at the PAI event.
The reference variables for the custom container and the ALV grid control must be declared.
To create reference variables, use ABAP statement TYPE REF TO .
The global classes you need to do this are called cl_gui_custom_container (for the custom container control) and cl_gui_alv_grid (for the ALV grid control).
The global classes are defined in the Class Builder. You can use the Class Builder to display information for the methods, their parameters, exceptions, and so on.
Use ABAP statement CREATE OBJECT to create the objects for the container and the ALV control. Objects Are instances of a class.
When an object is created (CREATE), method CONSTRUCTOR of the corresponding class is executed. The parameters of method CONSTRUCTOR determine which parameters have to be supplied with data when the object is created. In the above example, object alv_grid is given the name of the container control (g_custom_container) in exporting parameter i_parent, which links the two controls. For information on which parameters method CONSTRUCTOR possesses and which of these parameters are required, see the Class Builder.
Objects should only be created once during the program. To ensure that this is the case, enclose the CREATE OBJECT statement(s) in an IF IS INITIAL. ... ENDIF clause. The objects must be generated before the control is displayed for the first time - that is, during the PBO event of the ALV subscreen container.
To display the requested dataset in the ALV control, the data must be passed on to the control as an internal table, and a field description must exist indicating the order in which the columns will be output.
In the simplest case, the field description can use a structure from the Dictionary. The Dictionary also determines the technical field attributes like type and length, as well as the semantic attributes like short and long texts. The ALV control uses this information to determine the column widths and headers. The column sequence is determined by the field sequence in the structure.
If no suitable structure is active in the Dictionary, or you want to output internal program fields in the control, then you will have to define information like the output length and column header in the field catalog.
In a typical program run, the dataset is read first (SELECT ....), the internal table is filled with the data to display (... INTO TABLE ...), and ABAP statement CALL SCREEN is then used to call the ALV sub screen container.
The data transfer to the ALV control takes place during the call of method
set_table_for_first_display from class cl_gui_alv_grid. The method call must be programmed at the PBO event of the ALV subscreen container.
The name of the Dictionary structure that supplies the field description is specified in exporting parameter i_structure_name. The name of the internal table that contains the data records to display is specified in changing parameter it_outtab.
The field description for the ALV control can be ta ken from an active Dictionary structure (fully automatic), by passing a field catalog (manual), or through a mixture of the two options (merge).
The field catalog is in internal table with type lvc_t_fcat. This type is defined globally in the Dictionary.
Each line in the field catalog table corresponds to a column in the ALV control.
The field characteristics (= column characteristics) are defined in the field catalog. The field catalog is in internal table with type lvc_t_fcat. Each line that is explicitly described in the ALV control corresponds to a column in the field catalog table.
The link to the data records to output that are saved in internal table is established through field name . This name must be specified in column "fieldname" in the field catalog.
This field can be classified through a Dictionary reference (ref_table and ref_field) or by specifying an ABAP data type (inttype).
Column headers and field names in the detail view of an ALV control line can be determined in the field catalog in coltext and seltext, respectively.
The position of a field during output can be determined with col_pos in the field catalog.
If you want to hide a column, fill field no_out with an "X" in the field catalog. Hidden fields can be displayed again in a user display variant.
Icons can be displayed in the ALV control. If you want a column to be interpreted as an icon, then the icon name must be known to the program (include .) and icon = "X" must be specified for this column in the field catalog.
The above example shows a semi-automatic field description: Part of the field description comes from the Dictionary structure (sflight), while another part is explicitly defined in the field catalog (gt_fieldcat).
The field catalog (internal table) is filled in the program and is passed on together with the name of the Dictionary structure during the method call. The information is merged accordingly in method set_table_for_first_display.
For a user to save display variants, parameters is_variant and i_save must be passed on during method call set_table_for_first_screen. To assign display variants uniquely to a program, at least the program name must be supplied in the transferred structure (gs_variant).
Program names can be up to 30 characters long.
If you only pass on the current parameters for is_variant, then existing variants can be loaded, but no new ones can be saved. If you use parameter i_save, you must pass on a variant structure with is_variant.
I_SAVE = SPACE No variants can be saved.
I_SAVE = 'U' The user can only save user-specific variants.
I_SAVE = 'X' The user can only save general (shared) variants.
I_SAVE = 'A' The user can save both user-specific and general (shared) variants.
You can use parameter is_layout of method set_table_for_first_display, for example, to define the header in the ALV control and the detail display.
To do this, define a query area in the program in accordance with Dictionary structure lvc_s_layo, and pass on the text to display in field -grid_title or -detailtitl.
If you want to create print lists with zebra stripes, set field -zebra to "X". You can display a print preview for print lists by requesting standard function "Print".
All parameters of method SET_TABLE_FOR_FIRST_DISPLAY from global class
CL_GUI_ALV_GRID are defined in the Class Builder.
Events are defined in global class cl_gui_alv_grid; you can use these events to implement user interaction within the program. To respond to a double -click on a table line, you must respond to event DOUBLE_CLICK.
You receive control in the program, allowing you to implement interactive reporting - such as a full screen details list. The events for cl_gui_alv_grid are located in the Class Builder.
To define an implement a local class in the program, you use a handler method. In this handler method, you program the functionality to trigger by a double -click in the output table.
To activate a handler method at runtime, a class or an object from that class registers itself with an event using command SET HANDLER. The names of the IMPORTING parameters in the handler method correspond to the names of the EXPORTING parameters of the related event.
In the above example, the local class is LCL_ILS and the handler method is ON_DBLCLICK. An object - ALV_DBLCLICK - is created and registers itself for event DOUBLE_CLICK.
You can query parameter e_row-index to determine which output line was requested by the double -click. This parameter corresponds to the line number of the output table (internal table with the data records to output). If you need information for the selected line, you have to read it with READ TABLE itab INDEX e_row-index.
This subsequent read in the output table generally corresponds to the HIDE area in conventional reporting. You first have to make sure that the user has double -clicked a line in the output table (similar to the valid line selection with the HIDE technique).
A field group can contain global data objects, but not data objects that have been defined locally in a subroutine or function module.
You can use INSERT to specify both fields and field symbols. This makes it possible to dynamically insert a data object referred to by a field symbol into a field group at runtime. Any field symbols that have not been assigned are ignored, which means no new field is inserted into the field group.
The EXTRACT statement writes all the fields of a field group as one record to a sequential dataset (transport takes place with similarly named fields). If a HEADER field group is defined, then its fields are placed ahead of each record as sort keys. You can then sort the dataset with SORT and process it with LOOP ...ENDLOOP. In this case, no further EXTRACT is possible.
The INSERT statement is not a declarative statement: This means field groups can also be expanded in the program flow section.
As soon as the first dataset of a field group has been extracted with EXTRACT, that field group can no longer be expanded with INSERT. In particular, the HEADER field group cannot be expanded after the first EXTRACT (regardless of the field group).
When the GET events are processed, the logical database automatically writes hexadecimal zeros in all the fields of a node when it returns to an upper-level node in the hierarchy. Since the HEADER normally contains sort fields for all field groups, these hexadecimal zeros in the HEADER serve as a type of hierarchy key: The more zeros there are, the further up in the control level hierarchy you go.
The SORT statement sorts the extract dataset in accordance with the defined field sequence in field group HEADER. The addition BY ... sets a new sort key.
Each must be either a field of field group HEADER or a field group that consists only of fields of the field group HEADER. You can use the additions ASCENDING and DESCENDING to determine whether the fields are sorted in ascending (default) or descending order.
Fields containing X'00' in the logical databases are always displayed before all other values during a SORT.
Processing of an extract dataset always takes places within a LOOP. The contents of the extract dataset field are placed in program fields with the same names.
The group change always involves the fields of the HEADER. Single record processing for extract datasets is performed using language element AT ( = field group).
CNT() is not a statement, but instead a field that is automatically create d and filled when is a non-numeric field from field group HEADER and is part of the sort key. At the end of the group, CNT() contains the number of different values that the field recorded in this group level.
SUM() is not a statement, but instead a field that is automatically created and filled when is a numeric field of an extract dataset. At the end of the group, SUM() contains the control total of field .
*** and CNT are only available at the end of the group level or at AT LAST.
Single record processing for extract datasets AT WITH is only performed when field group is immediately followed by field group in the temporary dataset.
Loops over an extract dataset cannot be nested. However, several contiguous loops are permitted.
The sequence of the control level changes within the LOOP must correspond to the sort sequence.
Totals can only be calculated within control footer processing.
Extracts allow only appends (EXTRACT), sorting (SORT) and sequential processing (LOOP).
Once a SORT or LOOP has occurred, the intermediate dataset is frozen and cannot be expanded with EXTRACT. Operations that insert into or delete from EXTRACT datasets are not supported.
Extracts allow for several record types (FIELD-GROUPS) with fields that can be set dynamically (INSERT is not a declarative statement!). Internal tables have a single, statically-defined line type.
Internal tables use the sequence of table fields according to the declaration for the hierarchy of the control leve l. The control level structure for internal tables is therefore static, and is independent of which criteria were used to sort the internal table.
Extracts do not depend on the field sequence for control level processing: a re-sort or a completely different control level process can take place. The control level structure for extract datasets is therefore dynamic. It corresponds exactly to the sort key of the extract dataset. The sort key is the sequence of fields from the field group HEADER, and is used to sort the extract dataset.
Extracts rely on the compiler to determine which combinations of group levels and a cumulating field the control level totals desire. The desired control level totals are determined by the processing of LOOP ... ENDLOOP blocks. Internal tables build the control level total with the SUM statement.
This procedure leads to high resource depletion for totaling control levels in internal tables.
Regards,
Chandru -
How to get the multiple lines on the header part in ALV
HI all,
In my program i am using the ALV- Grid functionality through methods. I have 2 different layouts in the same screen , for this i have 2 containers and i am displaying the title through the gird title now i need to add the few more lines under the title .
Please suggest me, how can i proceede now.
Thanks
GiridharHi,
check this sample code, i did it using splitter container. check it, it is weel documented to know what are required ....
REPORT ZTEST_ALV_TOP MESSAGE-ID ZZ .
DATA: G_GRID TYPE REF TO CL_GUI_ALV_GRID.
DATA: L_VALID TYPE C,
V_FLAG,
V_DATA_CHANGE,
V_ROW TYPE LVC_S_ROW,
V_COLUMN TYPE LVC_S_COL,
V_ROW_NUM TYPE LVC_S_ROID.
DATA: IT_ROW_NO TYPE LVC_T_ROID,
X_ROW_NO TYPE LVC_S_ROID.
DATA:BEGIN OF ITAB OCCURS 0,
VBELN LIKE LIKP-VBELN,
POSNR LIKE LIPS-POSNR,
CELLCOLOR TYPE LVC_T_SCOL, "required for color
DROP(10),
END OF ITAB.
"The Below Definitions Must.....
DATA:
* Reference to document
DG_DYNDOC_ID TYPE REF TO CL_DD_DOCUMENT,
* Reference to split container
DG_SPLITTER TYPE REF TO CL_GUI_SPLITTER_CONTAINER,
* Reference to grid container
DG_PARENT_GRID TYPE REF TO CL_GUI_CONTAINER,
* Reference to html container
DG_HTML_CNTRL TYPE REF TO CL_GUI_HTML_VIEWER,
* Reference to html container
DG_PARENT_HTML TYPE REF TO CL_GUI_CONTAINER.
"up to here
* CLASS lcl_event_handler DEFINITION
CLASS LCL_EVENT_HANDLER DEFINITION .
PUBLIC SECTION .
METHODS:
**Hot spot Handler
HANDLE_HOTSPOT_CLICK FOR EVENT HOTSPOT_CLICK OF CL_GUI_ALV_GRID
IMPORTING E_ROW_ID E_COLUMN_ID ES_ROW_NO,
**Double Click Handler
HANDLE_DOUBLE_CLICK FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID
IMPORTING E_ROW E_COLUMN ES_ROW_NO,
TOP_OF_PAGE FOR EVENT TOP_OF_PAGE "event handler
OF CL_GUI_ALV_GRID
IMPORTING E_DYNDOC_ID.
* END_OF_LIST FOR EVENT end_of_list "event handler
* OF CL_GUI_ALV_GRID
* IMPORTING E_DYNDOC_ID.
ENDCLASS. "lcl_event_handler DEFINITION
* CLASS lcl_event_handler IMPLEMENTATION
CLASS LCL_EVENT_HANDLER IMPLEMENTATION.
*Handle Hotspot Click
METHOD HANDLE_HOTSPOT_CLICK .
CLEAR: V_ROW,V_COLUMN,V_ROW_NUM.
V_ROW = E_ROW_ID.
V_COLUMN = E_COLUMN_ID.
V_ROW_NUM = ES_ROW_NO.
* MESSAGE I000 WITH V_ROW 'clicked'.
CLEAR IT_ROW_NO[].
X_ROW_NO-ROW_ID = V_ROW.
APPEND X_ROW_NO TO IT_ROW_NO .
CALL METHOD G_GRID->SET_SELECTED_ROWS
EXPORTING
IT_ROW_NO = IT_ROW_NO.
ENDMETHOD. "lcl_event_handler
*Handle Double Click
METHOD HANDLE_DOUBLE_CLICK.
CLEAR: V_ROW,V_COLUMN,V_ROW_NUM.
V_ROW = E_ROW.
V_COLUMN = E_COLUMN.
V_ROW_NUM = ES_ROW_NO.
IF E_COLUMN = 'VBELN'.
SET PARAMETER ID 'VL' FIELD ITAB-VBELN.
CALL TRANSACTION 'VL03N' AND SKIP FIRST SCREEN.
ENDIF.
IF E_COLUMN = 'POSNR'.
SET PARAMETER ID 'VL' FIELD ITAB-VBELN.
CALL TRANSACTION 'VL03N' AND SKIP FIRST SCREEN."
ENDIF.
ENDMETHOD. "handle_double_click
* METHOD END_OF_LIST. "implementation
** Top-of-page event
* PERFORM EVENT_TOP_OF_PAGE USING DG_DYNDOC_ID.
* ENDMETHOD. "top_of_page
METHOD TOP_OF_PAGE. "implementation
* Top-of-page event
PERFORM EVENT_TOP_OF_PAGE USING DG_DYNDOC_ID.
ENDMETHOD. "top_of_page
ENDCLASS. "LCL_EVENT_HANDLER IMPLEMENTATION
*& Global Definitions
DATA: G_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,"Container1
G_HANDLER TYPE REF TO LCL_EVENT_HANDLER. "handler
DATA: OK_CODE LIKE SY-UCOMM,
SAVE_OK LIKE SY-UCOMM,
G_CONTAINER1 TYPE SCRFNAME VALUE 'TEST',
GS_LAYOUT TYPE LVC_S_LAYO.
data: v_lines type i.
data: v_line(3) type c.
*- Fieldcatalog for First and second Report
DATA: IT_FIELDCAT TYPE LVC_T_FCAT,
X_FIELDCAT TYPE LVC_S_FCAT,
LS_VARI TYPE DISVARIANT.
* START-OF_SELECTION
START-OF-SELECTION.
SELECT VBELN
POSNR
FROM LIPS
UP TO 20 ROWS
INTO CORRESPONDING FIELDS OF TABLE ITAB.
describe table itab lines v_lines.
END-OF-SELECTION.
IF NOT ITAB[] IS INITIAL.
CALL SCREEN 100.
ELSE.
MESSAGE I002 WITH 'NO DATA FOR THE SELECTION'(004).
ENDIF.
*& Form CREATE_AND_INIT_ALV
* text
FORM CREATE_AND_INIT_ALV .
DATA: LT_EXCLUDE TYPE UI_FUNCTIONS.
"attention.....from here
"split your container here...into two parts
"create the container
CREATE OBJECT G_CUSTOM_CONTAINER
EXPORTING CONTAINER_NAME = G_CONTAINER1.
"this is for top of page
* Create TOP-Document
CREATE OBJECT DG_DYNDOC_ID
EXPORTING STYLE = 'ALV_GRID'.
* Create Splitter for custom_container
CREATE OBJECT DG_SPLITTER
EXPORTING PARENT = G_CUSTOM_CONTAINER
ROWS = 2
COLUMNS = 1.
* Split the custom_container to two containers and move the reference
* to receiving containers g_parent_html and g_parent_grid
"i am allocating the space for grid and top of page
CALL METHOD DG_SPLITTER->GET_CONTAINER
EXPORTING
ROW = 1
COLUMN = 1
RECEIVING
CONTAINER = DG_PARENT_HTML.
CALL METHOD DG_SPLITTER->GET_CONTAINER
EXPORTING
ROW = 2
COLUMN = 1
RECEIVING
CONTAINER = DG_PARENT_GRID.
* CALL METHOD DG_SPLITTER->GET_CONTAINER
* EXPORTING
* ROW = 2
* COLUMN = 1
* RECEIVING
* CONTAINER = DG_PARENT_HTML.
* CALL METHOD DG_SPLITTER->GET_CONTAINER
* EXPORTING
* ROW = 1
* COLUMN = 1
* RECEIVING
* CONTAINER = DG_PARENT_GRID.
"you can set the height of it
* Set height for g_parent_html
CALL METHOD DG_SPLITTER->SET_ROW_HEIGHT
EXPORTING
ID = 1
HEIGHT = 5.
"from here as usual..you need to specify parent as splitter part
"which we alloted for grid
CREATE OBJECT G_GRID
EXPORTING I_PARENT = DG_PARENT_GRID.
* Set a titlebar for the grid control
CLEAR GS_LAYOUT.
GS_LAYOUT-GRID_TITLE = TEXT-003.
GS_LAYOUT-ZEBRA = SPACE.
GS_LAYOUT-CWIDTH_OPT = 'X'.
GS_LAYOUT-NO_ROWMARK = 'X'.
GS_LAYOUT-CTAB_FNAME = 'CELLCOLOR'.
CALL METHOD G_GRID->REGISTER_EDIT_EVENT
EXPORTING
I_EVENT_ID = CL_GUI_ALV_GRID=>MC_EVT_ENTER.
CREATE OBJECT G_HANDLER.
SET HANDLER G_HANDLER->HANDLE_DOUBLE_CLICK FOR G_GRID.
SET HANDLER G_HANDLER->HANDLE_HOTSPOT_CLICK FOR G_GRID.
* SET HANDLER G_HANDLER->END_OF_LIST FOR G_GRID.
SET HANDLER G_HANDLER->TOP_OF_PAGE FOR G_GRID.
DATA: LS_CELLCOLOR TYPE LVC_S_SCOL. "required for color
DATA: L_INDEX TYPE SY-TABIX.
"Here i am changing the color of line 1,5,10...
"so you can change the color of font conditionally
LOOP AT ITAB.
L_INDEX = SY-TABIX.
IF L_INDEX = 1 OR L_INDEX = 5 OR L_INDEX = 10.
LS_CELLCOLOR-FNAME = 'VBELN'.
LS_CELLCOLOR-COLOR-COL = '6'.
LS_CELLCOLOR-COLOR-INT = '0'.
LS_CELLCOLOR-COLOR-INV = '1'.
APPEND LS_CELLCOLOR TO ITAB-CELLCOLOR.
MODIFY ITAB INDEX L_INDEX TRANSPORTING CELLCOLOR.
LS_CELLCOLOR-FNAME = 'POSNR'.
LS_CELLCOLOR-COLOR-COL = '6'.
LS_CELLCOLOR-COLOR-INT = '0'.
LS_CELLCOLOR-COLOR-INV = '1'.
APPEND LS_CELLCOLOR TO ITAB-CELLCOLOR.
MODIFY ITAB INDEX L_INDEX TRANSPORTING CELLCOLOR.
ENDIF.
ENDLOOP.
* setting focus for created grid control
CALL METHOD CL_GUI_CONTROL=>SET_FOCUS
EXPORTING
CONTROL = G_GRID.
* Build fieldcat and set editable for date and reason code
* edit enabled. Assign a handle for the dropdown listbox.
PERFORM BUILD_FIELDCAT.
PERFORM SET_DRDN_TABLE.
* Optionally restrict generic functions to 'change only'.
* (The user shall not be able to add new lines).
PERFORM EXCLUDE_TB_FUNCTIONS CHANGING LT_EXCLUDE.
**Vaiant to save the layout
LS_VARI-REPORT = SY-REPID.
LS_VARI-HANDLE = SPACE.
LS_VARI-LOG_GROUP = SPACE.
LS_VARI-USERNAME = SPACE.
LS_VARI-VARIANT = SPACE.
LS_VARI-TEXT = SPACE.
LS_VARI-DEPENDVARS = SPACE.
**Calling the Method for ALV output
CALL METHOD G_GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
IT_TOOLBAR_EXCLUDING = LT_EXCLUDE
IS_VARIANT = LS_VARI
IS_LAYOUT = GS_LAYOUT
I_SAVE = 'A'
CHANGING
IT_FIELDCATALOG = IT_FIELDCAT
IT_OUTTAB = ITAB[].
"do these..{
* Initializing document
CALL METHOD DG_DYNDOC_ID->INITIALIZE_DOCUMENT.
* Processing events
CALL METHOD G_GRID->LIST_PROCESSING_EVENTS
EXPORTING
I_EVENT_NAME = 'TOP_OF_PAGE'
I_DYNDOC_ID = DG_DYNDOC_ID.
"end }
* Set editable cells to ready for input initially
CALL METHOD G_GRID->SET_READY_FOR_INPUT
EXPORTING
I_READY_FOR_INPUT = 1.
ENDFORM. "CREATE_AND_INIT_ALV
*& Form EXCLUDE_TB_FUNCTIONS
* text
* -->PT_EXCLUDE text
FORM EXCLUDE_TB_FUNCTIONS CHANGING PT_EXCLUDE TYPE UI_FUNCTIONS.
* Only allow to change data not to create new entries (exclude
* generic functions).
DATA LS_EXCLUDE TYPE UI_FUNC.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_COPY_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_DELETE_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_APPEND_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_INSERT_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_MOVE_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_COPY.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_CUT.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_PASTE.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_PASTE_NEW_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_UNDO.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
ENDFORM. " EXCLUDE_TB_FUNCTIONS
*& Form build_fieldcat
* Fieldcatalog
FORM BUILD_FIELDCAT .
DATA: L_POS TYPE I.
L_POS = L_POS + 1.
X_FIELDCAT-SCRTEXT_M = 'Delivery'(024).
X_FIELDCAT-FIELDNAME = 'VBELN'.
X_FIELDCAT-TABNAME = 'IT_FINAL'.
X_FIELDCAT-COL_POS = L_POS.
X_FIELDCAT-NO_ZERO = 'X'.
X_FIELDCAT-OUTPUTLEN = '10'.
X_FIELDCAT-HOTSPOT = 'X'.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
L_POS = L_POS + 1.
X_FIELDCAT-SCRTEXT_M = 'Item'(025).
X_FIELDCAT-FIELDNAME = 'POSNR'.
X_FIELDCAT-TABNAME = 'IT_FINAL'.
X_FIELDCAT-COL_POS = L_POS.
X_FIELDCAT-OUTPUTLEN = '5'.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
L_POS = L_POS + 1.
X_FIELDCAT-SCRTEXT_M = 'Drop'(025).
X_FIELDCAT-FIELDNAME = 'DROP'.
X_FIELDCAT-TABNAME = 'IT_FINAL'.
X_FIELDCAT-COL_POS = L_POS.
X_FIELDCAT-OUTPUTLEN = '5'.
X_FIELDCAT-EDIT = 'X'.
X_FIELDCAT-DRDN_HNDL = '1'.
X_FIELDCAT-DRDN_ALIAS = 'X'.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
ENDFORM. " build_fieldcat
*& Module STATUS_0100 OUTPUT
* text
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'MAIN100'.
SET TITLEBAR 'MAIN100'.
IF G_CUSTOM_CONTAINER IS INITIAL.
**Initializing the grid and calling the fm to Display the O/P
PERFORM CREATE_AND_INIT_ALV.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
* text
MODULE USER_COMMAND_0100 INPUT.
CASE SY-UCOMM.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form SET_DRDN_TABLE
* text
FORM SET_DRDN_TABLE.
DATA:LT_DRAL TYPE LVC_T_DRAL,
LS_DRAL TYPE LVC_S_DRAL.
LOOP AT ITAB .
* First listbox (handle '1').
IF SY-INDEX = 1.
LS_DRAL-HANDLE = '1'.
LS_DRAL-VALUE = ' '.
LS_DRAL-INT_VALUE = ' '.
ELSE.
LS_DRAL-HANDLE = '1'.
LS_DRAL-VALUE = ITAB-POSNR.
LS_DRAL-INT_VALUE = ITAB-POSNR.
ENDIF.
APPEND LS_DRAL TO LT_DRAL.
ENDLOOP.
**Setting the Drop down table for Reason Code
CALL METHOD G_GRID->SET_DROP_DOWN_TABLE
EXPORTING
IT_DROP_DOWN_ALIAS = LT_DRAL.
ENDFORM. " set_drdn_table
*& Form EVENT_TOP_OF_PAGE
* text
* -->DG_DYNDOC_ID text
FORM EVENT_TOP_OF_PAGE USING DG_DYNDOC_ID TYPE REF TO CL_DD_DOCUMENT.
"this is more clear.....check it
"first add text, then pass it to comentry write fm
DATA : DL_TEXT(255) TYPE C. "Text
* Populating header to top-of-page
CALL METHOD DG_DYNDOC_ID->ADD_TEXT
EXPORTING
TEXT = 'Test Report'
SAP_STYLE = CL_DD_AREA=>HEADING.
* Add new-line
CALL METHOD DG_DYNDOC_ID->NEW_LINE.
CLEAR : DL_TEXT.
* Move program ID
CONCATENATE 'Program Name :' SY-REPID
INTO DL_TEXT SEPARATED BY SPACE.
* Add Program Name to Document
PERFORM ADD_TEXT USING DL_TEXT.
* Add new-line
CALL METHOD DG_DYNDOC_ID->NEW_LINE.
CLEAR : DL_TEXT.
* Move User ID
CONCATENATE 'User ID :' SY-UNAME INTO DL_TEXT SEPARATED BY SPACE
* Add User ID to Document
PERFORM ADD_TEXT USING DL_TEXT.
* Add new-line
CALL METHOD DG_DYNDOC_ID->NEW_LINE.
CLEAR : DL_TEXT.
* Move count (no of records).
move v_lines to v_line.
CONCATENATE 'No of records :' v_line INTO DL_TEXT SEPARATED BY SPACE.
* Add Client to Document
PERFORM ADD_TEXT USING DL_TEXT.
* Add new-line
CALL METHOD DG_DYNDOC_ID->NEW_LINE.
CLEAR : DL_TEXT.
* Move date
WRITE SY-DATUM TO DL_TEXT.
CONCATENATE 'Date :' DL_TEXT INTO DL_TEXT SEPARATED BY SPACE.
* Add Date to Document
PERFORM ADD_TEXT USING DL_TEXT.
* Add new-line
CALL METHOD DG_DYNDOC_ID->NEW_LINE.
CLEAR : DL_TEXT.
* Move time
WRITE SY-UZEIT TO DL_TEXT.
CONCATENATE 'Time :' DL_TEXT INTO DL_TEXT SEPARATED BY SPACE.
* Add Time to Document
PERFORM ADD_TEXT USING DL_TEXT.
* Add new-line
CALL METHOD DG_DYNDOC_ID->NEW_LINE.
* Populating data to html control
PERFORM HTML.
ENDFORM. " EVENT_TOP_OF_PAGE
*& Form ADD_TEXT
* To add Text
FORM ADD_TEXT USING P_TEXT TYPE SDYDO_TEXT_ELEMENT.
* Adding text
CALL METHOD DG_DYNDOC_ID->ADD_TEXT
EXPORTING
TEXT = P_TEXT
SAP_EMPHASIS = CL_DD_AREA=>HEADING.
ENDFORM. " ADD_TEXT
*& Form HTML
* text
FORM HTML.
DATA : DL_LENGTH TYPE I, " Length
DL_BACKGROUND_ID TYPE SDYDO_KEY VALUE SPACE. " Background_id
* Creating html control
IF DG_HTML_CNTRL IS INITIAL.
CREATE OBJECT DG_HTML_CNTRL
EXPORTING
PARENT = DG_PARENT_HTML.
ENDIF.
* Reuse_alv_grid_commentary_set
CALL FUNCTION 'REUSE_ALV_GRID_COMMENTARY_SET'
EXPORTING
DOCUMENT = DG_DYNDOC_ID
BOTTOM = SPACE
IMPORTING
LENGTH = DL_LENGTH.
* Get TOP->HTML_TABLE ready
CALL METHOD DG_DYNDOC_ID->MERGE_DOCUMENT.
* Set wallpaper
CALL METHOD DG_DYNDOC_ID->SET_DOCUMENT_BACKGROUND
EXPORTING
PICTURE_ID = DL_BACKGROUND_ID.
* Connect TOP document to HTML-Control
DG_DYNDOC_ID->HTML_CONTROL = DG_HTML_CNTRL.
* Display TOP document
CALL METHOD DG_DYNDOC_ID->DISPLAY_DOCUMENT
EXPORTING
REUSE_CONTROL = 'X'
PARENT = DG_PARENT_HTML
EXCEPTIONS
HTML_DISPLAY_ERROR = 1.
IF SY-SUBRC NE 0.
MESSAGE I999 WITH 'Error in displaying top-of-page'(036).
ENDIF.
ENDFORM. " HTML
Regards
vijay -
How to deselect the selected row when we come back again?
Hi all,
I have one screen(100),which contains records.User can select any one record and click 'Details' button.Then it will take to screen 110.When I am coming back to screen 110 again.The previously selected row is again in selected mode only.Now if I am selecting another row and click the 'Detail' button.I am getting the error saying that 'Please select one record'.In debugging mode also I checked using the FM get_current_cell but nothing is getting selected surprisingly.
Even I used CALL METHOD grid->refresh_table_display in the PBO of screen 100.
Below is the code I used in PBO of screen 100
ODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'PF100'.
SET TITLEBAR 'TITLE'.
DATA: G_CONSISTENCY_CHECK TYPE CHAR1.
DATA: G_EXCLUDE TYPE UI_FUNCTIONS.
IF container100 IS INITIAL.
*ex_FUNCTIONS-
*-- Check execution mode (foreground/background)
IF cl_gui_alv_grid=>offline( ) IS INITIAL.
CREATE OBJECT CONTAINER100
EXPORTING CONTAINER_NAME = 'CONTAINER100'.
CREATE OBJECT GRID
EXPORTING I_PARENT = CONTAINER100.
CALL METHOD GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_BYPASSING_BUFFER = 'X'
I_BUFFER_ACTIVE = ''
I_CONSISTENCY_CHECK = G_CONSISTENCY_CHECK
IT_TOOLBAR_EXCLUDING = G_EXCLUDE
IT_TOOLBAR_EXCLUDING = IT_TOOLBAR
I_STRUCTURE_NAME =
IS_VARIANT = gs_layout
I_SAVE = 'A'
I_DEFAULT = 'X'
IS_LAYOUT = X_LAYOUT
IS_PRINT =
IT_SPECIAL_GROUPS =
IT_TOOLBAR_EXCLUDING = IT_TOOLBAR
IT_HYPERLINK =
IT_ALV_GRAPHICS =
IT_EXCEPT_QINFO =
CHANGING
IT_OUTTAB = IT_YAPOHDR_MAIN[]
IT_FIELDCATALOG = IT_FIELDCAT[].
IT_SORT =
IT_FILTER =
EXCEPTIONS
INVALID_PARAMETER_COMBINATION = 1
PROGRAM_ERROR = 2
TOO_MANY_LINES = 3
others = 4.
ENDIF.
*--Register enter key for data changed event
CALL METHOD grid->set_ready_for_input
EXPORTING i_ready_for_input = 0.
create object event_receiver.
Register the 'hotspot' event handler method dynamically...
set handler event_receiver->handle_hotspot_click for grid.
Register the User Command event handler method dynamically...
set handler event_receiver->handle_user_command for grid.
Register the User Command event handler method dynamically...
set handler event_receiver->handle_data_changed for grid.
else.
CALL METHOD grid->refresh_table_display.
endif.
ENDMODULE. " STATUS_0100 OUTPUT
The below is the code I used in PAI of screen 110.
MODULE USER_COMMAND_0110 INPUT.
DATA : LT_DETAILS_MAIN LIKE YAPOPLN_ITM OCCURS 0 WITH HEADER LINE,
LV_POP TYPE C,
APPROVE.
CASE SY-UCOMM.
WHEN 'BACK'.
CALL METHOD grid->REFRESH_TABLE_DISPLAY.
CALL METHOD grid->GET_FRONTEND_FIELDCATALOG.
LEAVE TO SCREEN 0.
WHEN 'EXIT'.
LEAVE TO SCREEN 0.
ENDMODULE. " USER_COMMAND_0110 INPUT
Please Let me know if there is any solution.
Thanks,
BalajiHello Balaji
The sample report <b>ZUS_SDN_TWO_ALV_GRIDS_7</b> shows basically what I meant in my previous answer. There is no row mark available on the first ALV list. Instead of bothering the user to push a button he or she can simply double-click on the ALV lists and sees the details of a customer.
As you can see there is absolutely no need to free any object instances or rebuild grid controls.
Final remark: based on the function module you mention I assume you are still using fm-based ALV lists. Do not use them. OO-based ALV lists are much easier to develop, to maintain and to enhance.
*& Report ZUS_SDN_TWO_ALV_GRIDS_7
*& Description: Display two ALV lists either in single screen or
*& two screens
*& Screen '0100' contains no elements.
*& ok_code -> assigned to GD_OKCODE
*& Flow logic:
* PROCESS BEFORE OUTPUT.
* MODULE STATUS_0100.
* PROCESS AFTER INPUT.
* MODULE USER_COMMAND_0100.
REPORT zus_sdn_two_alv_grids_7.
TYPE-POOLS: abap.
DATA:
gd_repid TYPE syst-repid,
gd_okcode TYPE ui_func,
go_docking TYPE REF TO cl_gui_docking_container,
go_docking2 TYPE REF TO cl_gui_docking_container,
go_splitter TYPE REF TO cl_gui_splitter_container,
go_cell_top TYPE REF TO cl_gui_container,
go_cell_bottom TYPE REF TO cl_gui_container,
go_grid1 TYPE REF TO cl_gui_alv_grid,
go_grid2 TYPE REF TO cl_gui_alv_grid,
gs_layout TYPE lvc_s_layo.
DATA:
gs_knb1 TYPE knb1,
gt_knb1 TYPE STANDARD TABLE OF knb1,
gt_knvv TYPE STANDARD TABLE OF knvv.
* CLASS lcl_eventhandler DEFINITION
CLASS lcl_eventhandler DEFINITION.
PUBLIC SECTION.
CLASS-METHODS:
handle_double_click FOR EVENT double_click OF cl_gui_alv_grid
IMPORTING
e_row
e_column
es_row_no
sender.
ENDCLASS. "lcl_eventhandler DEFINITION
* CLASS lcl_eventhandler IMPLEMENTATION
CLASS lcl_eventhandler IMPLEMENTATION.
METHOD handle_double_click.
* define local data
DATA:
ls_knb1 TYPE knb1.
CHECK ( sender = go_grid1 ).
READ TABLE gt_knb1 INTO ls_knb1 INDEX e_row-index.
CHECK ( ls_knb1-kunnr IS NOT INITIAL ).
CALL METHOD go_grid1->set_current_cell_via_id
EXPORTING
* IS_ROW_ID =
* IS_COLUMN_ID =
is_row_no = es_row_no.
* Triggers PAI of the dynpro with the specified ok-code
** CALL METHOD cl_gui_cfw=>set_new_ok_code( 'DETAIL' ). " not on 4.6c
CALL METHOD cl_gui_cfw=>set_new_ok_code
EXPORTING
new_code = 'DETAIL'
* IMPORTING
* RC =
ENDMETHOD. "handle_double_click
ENDCLASS. "lcl_eventhandler IMPLEMENTATION
PARAMETERS:
p_single RADIOBUTTON GROUP radi, " single screen
p_double RADIOBUTTON GROUP radi. " two screens
START-OF-SELECTION.
SELECT * FROM knb1 INTO TABLE gt_knb1
WHERE bukrs = '1000'.
" Add dummy customer without any master sales data
CLEAR: gs_knb1.
gs_knb1-kunnr = 'DUMMY'.
gs_knb1-bukrs = '1000'.
INSERT gs_knb1 INTO gt_knb1 INDEX 1.
* Create docking container
CREATE OBJECT go_docking
EXPORTING
parent = cl_gui_container=>screen0
ratio = 90
EXCEPTIONS
OTHERS = 6.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
IF ( p_single = abap_true ).
PERFORM create_splitter_container.
ELSE.
* Create 2nd docking container
CREATE OBJECT go_docking2
EXPORTING
parent = cl_gui_container=>screen0
ratio = 90
EXCEPTIONS
OTHERS = 6.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
IF ( p_single = abap_true ).
* Create ALV grids
CREATE OBJECT go_grid1
EXPORTING
i_parent = go_cell_top
EXCEPTIONS
OTHERS = 5.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT go_grid2
EXPORTING
i_parent = go_cell_bottom
EXCEPTIONS
OTHERS = 5.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ELSE.
* Create ALV grids
CREATE OBJECT go_grid1
EXPORTING
i_parent = go_docking
EXCEPTIONS
OTHERS = 5.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT go_grid2
EXPORTING
i_parent = go_docking2
EXCEPTIONS
OTHERS = 5.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
* Set event handler
SET HANDLER: lcl_eventhandler=>handle_double_click FOR go_grid1.
* Display data
gs_layout-grid_title = 'Customers'.
CALL METHOD go_grid1->set_table_for_first_display
EXPORTING
i_structure_name = 'KNB1'
is_layout = gs_layout
CHANGING
it_outtab = gt_knb1
EXCEPTIONS
OTHERS = 4.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
gs_layout-grid_title = 'Customers Details (Sales Areas)'.
CALL METHOD go_grid2->set_table_for_first_display
EXPORTING
i_structure_name = 'KNVV'
is_layout = gs_layout
CHANGING
it_outtab = gt_knvv " empty !!!
EXCEPTIONS
OTHERS = 4.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Link the docking container to the target dynpro(s)
gd_repid = syst-repid.
IF ( p_single = abap_true ).
CALL METHOD go_docking->link
EXPORTING
repid = gd_repid
dynnr = '0100'
* CONTAINER =
EXCEPTIONS
OTHERS = 4.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ELSE.
CALL METHOD go_docking->link
EXPORTING
repid = gd_repid
dynnr = '0100'
* CONTAINER =
EXCEPTIONS
OTHERS = 4.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL METHOD go_docking2->link
EXPORTING
repid = gd_repid
dynnr = '0200'
* CONTAINER =
EXCEPTIONS
OTHERS = 4.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
* NOTE: dynpro does not contain any elements
CALL SCREEN '0100'.
* Flow logic of dynpro (does not contain any dynpro elements):
*PROCESS BEFORE OUTPUT.
* MODULE STATUS_0100.
*PROCESS AFTER INPUT.
* MODULE USER_COMMAND_0100.
" NOTE: screen '0200' uses same flow logic as '0100'
END-OF-SELECTION.
*& Module STATUS_0100 OUTPUT
* text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'STATUS_0100'. " contains push button "DETAIL"
* SET TITLEBAR 'xxx'.
* Refresh display of detail ALV list
CALL METHOD go_grid2->refresh_table_display
* EXPORTING
* IS_STABLE =
* I_SOFT_REFRESH =
EXCEPTIONS
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
* text
MODULE user_command_0100 INPUT.
CASE gd_okcode.
WHEN 'BACK' OR
'EXIT' OR
'CANC'.
IF ( syst-dynnr = '0100' ).
SET SCREEN 0. LEAVE SCREEN.
ELSE.
SET SCREEN 100.
ENDIF.
* User has pushed button "Display Details"
WHEN 'DETAIL'.
PERFORM entry_show_details.
IF ( p_single = abap_true ).
ELSE.
SET SCREEN 200.
ENDIF.
WHEN OTHERS.
ENDCASE.
CLEAR: gd_okcode.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form ENTRY_SHOW_DETAILS
* text
* --> p1 text
* <-- p2 text
FORM entry_show_details .
* define local data
DATA:
ld_row TYPE i,
ls_knb1 TYPE knb1.
CALL METHOD go_grid1->get_current_cell
IMPORTING
e_row = ld_row.
READ TABLE gt_knb1 INTO ls_knb1 INDEX ld_row.
CHECK ( syst-subrc = 0 ).
SELECT * FROM knvv INTO TABLE gt_knvv
WHERE kunnr = ls_knb1-kunnr.
ENDFORM. " ENTRY_SHOW_DETAILS
*& Form CREATE_SPLITTER_CONTAINER
* text
* --> p1 text
* <-- p2 text
FORM create_splitter_container .
* Create splitter container
CREATE OBJECT go_splitter
EXPORTING
parent = go_docking
rows = 2
columns = 1
* NO_AUTODEF_PROGID_DYNNR =
* NAME =
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Get cell container
CALL METHOD go_splitter->get_container
EXPORTING
row = 1
column = 1
RECEIVING
container = go_cell_top.
CALL METHOD go_splitter->get_container
EXPORTING
row = 2
column = 1
RECEIVING
container = go_cell_bottom.
ENDFORM. " CREATE_SPLITTER_CONTAINER
Regards
Uwe -
How to select multiple records in the ALV POP UP by using oops
Hi All,
We have a requirement of ALV POP UP by using the OOPS. How to select the multiple records in the POP UP and After selecting that i want do Inteactive ALV means again one more POP UP in ALV.
Thanks for help....
Regards,
BharaniHello Bharani
Displaying an ALV list in a popup is by no means different from a list displayed on a main screen. The only thing you need to consider is that you set the right screen level when creating the parent container for the ALV.
For more details refer to thread in CL_GUI_SPLITTER_CONTAINER ALV list is not show in called screen
" step 1:
CREATE OBJECT gr_spliter
EXPORTING
parent = cl_gui_container=>screen0 " For first popup use: =>screen1
rows = 1
columns = 2.
Regards
Uwe -
Single Printing for Multiple ALVs in Splitter Containers
Hi,
I am creating multiple ALVs (3 to 4) of CL_GUI_ALV_GRID class in my report. The ALVs are being displayed inside the splitter containers of class CL_GUI_SPLITTER_CONTAINER. My question is how to print all the ALVs inside these multiple containers with a single execution? I've found a close answer to this at this thread but it is using the REUSE_ALV... function.
How to print multiple ALV Grids with only one print dialog?
Is there a way to do this by making use of the CL_GUI_ALV_GRID printing functionality, if there is?
Thanks for your kind attention,
Kamal.-found alternative.
Maybe you are looking for
-
I updated Pages, but now I can't open docs.
I updated Pages a few months ago and loved the updates. Now I can't open any docs I created AFTER the update. When I try to open them, it says that I need to download a newer version of Pages. When I try to download the newer version, it says that
-
Some Questions about Sun Java Studio Creator IDE
I am quiet new to the IDE, but I experienced some behaviours I do not actually understand. I hope I can get some help here. Sun Java Studio Creator Update 9 Each time I change the font size and type using the "Advanced" option of the IDE the font I c
-
Weblogic seems to swallow Oracle Exception
Hi, Weblogic seems to swallow the Oracle Exception when using EntityManager, can someone also verify this ? Here is what I did: SQL> create table AMS_TEST (TEST_ID INTEGER primary key, name VARCHAR2(125), CONSTRAINT X UNIQUE (name)); Table created. S
-
Accessing files created by network scanner using a another username
Hello there, I have a HP network scanner sending files directly to a shared folder on my OSX 10.9. Since it uses SMB and OSX wants me to "save the password in a less secure way" in the sharing options panel I have been using a specific "Sharing-only"
-
Simple for Java guys but not for me,,,
I intend to build an application that will serve as a front end to connect to backend database records. Ideally it will have a UI similar to SQL query tools like TOAD, SQL developer but will be more user friendly so as to avoid making user put comple