ALV OO toolbar event of cl_gui_alv_grid - problem
I have defined a Button in ALV grid toolbar in my program using Event Toolbar OF cl_gui_alv_grid.
I have also disabled/Excluded some of the buttons on Standard Grid toolbar.
My requirement is when i click on Button defined on ALV grid toolbar..i have to trigger a Perform in which code for submit the changes done on the grid is written..
I tried to use event user_command and this method is not getting trigerred when i click on button defined on toolbar, Probably since i have mutiple grids in my output..
suggest me appropriate event handler method or proper approach to go about this?
Hello Ksiva
Have you set the event handler for USER_COMMAND? You can do this either for all or a specific grid instance.
SET HANDLER: lcl_eventhandler=>handle_user_command FOR ALL INSTANCES.
SET HANDLER: lcl_eventhandler=>handle_user_command FOR go_grid1.
Within your event handler method you can easily distinguish between the different grid instance.
CLASS lcl_eventhandler DEFINITION.
METHODS: handle_user_command FOR EVENT user_command
OF cl_gui_alv_grid
IMPORTING
e_ucomm
sender. " !!! Optional parameter, instance which raised the event
CLASS lcl_eventhandler IMPLEMENTATION.
METHOD handle_user_command.
CASE sender.
WHEN go_grid1.
" handle user command
WHEN others.
RETURN.
ENDCASE.
ENDMETHOD.
Regards
Uwe
Similar Messages
-
ALV: Problem with toolbar event
Hi ALV-experts,
I have a dynpro with a header area where I display an ALV table. Below this I have a subscreen with a tabstrip control and two tabs.
In the ALV toolbar I defined an own button. This button gets deactivated after pressing this button. I achieved this by the option "disabled" in the structure stb_button within the event handler for the toolbar event.
This works all fine so far. If I start the dynpro and click on the button in the ALV-toolbar the buttons gets deactivated afterwards. But I have I jump between the tabs before I press the ALV-toolbar button, the button does not get deactivated.
The debugger does not go into the event handler of the toolbar event. I also did system debugging of the method SET_TOOLBAR of the CL_GUI_ALV_GRID-class. Here I pass in both cases the command
raise event toolbar e_object = m_cl_toolbar e_interactive = i_interactive.
but in the second case (when I change the tabs before I press the button) the event handler is not executed and I don't know why. I also tried to register the event handler for all instances of the ALV still with the same result.
The ALV method set_toolbar_interactive( ) did also not solve the problem.
I couldn't find any SAP note about an issue for this event.
Does anybody have an idea or a solution for this problem?
EDIT:
Problem solved, it was typo!
Thanks in advance and regards,
Martin
Edited by: Martin Fischer on Jul 7, 2010 4:53 PMThe problem was a typo!
-
Hi,
I have created an ALV grid control and I am also handling the before_user_command event of cl_gui_alv_grid class.
My aim is to use POPUP_TO_CONFIRM function module when the users click on the add/delete row button.
Control is going to the event if I am clicking on any other button of the control except add/delete row buttons.
And in the class attributes those operation description is saying they are local.
Please let me know how make control to go to before_user_command event when users click on add/delete button.
Thanks in advance,
Suneel CHi Suneel,
For you requirement, I dont see why you cant include the functionality for the pop up within the USER_COMMAND event itself.
Algorithm for the USER_COMMAND event:
Step 1: Check E_UCOMM is 'ADD' or 'DELT'.
Step 2: If yes, call FM for POPUP_TO_CONFIRM; else continue to other E_UCOMM
Step 3: If ans is 'No', exit Method - else continue with Add/ Delete as required
Cheers,
Aditya -
How can I trigger a USER_COMMAND for alv grid "toolbar" ???
Hi,
i have the standard ALV Grid "toolbar" and if i click to the Button "&LOCAL©_ROW" than i want try to make a Refresh to my ALV Table in the Event "afteruser_command"_!!!!
Here is the implementation of my Event *"afteruser_command":*_
METHOD on_after_user_command.
........DATA: ls_stable TYPE lvc_s_stbl.
.....CASE e_ucomm.
.....WHEN '&LOCAL©_ROW'.
........MESSAGE 'LOCAL_COPY_ROW' TYPE 'S' DISPLAY LIKE 'E'.
........ls_stable-row = 'X'.
........ls_stable-col = 'X'.
........CALL METHOD gr_grid_d0100->refresh_table_display
..............EXPORTING
.......................is_stable = ls_stable
..............EXCEPTIONS
.......................finished = 1
.......................OTHERS = 2.
......ENDCASE.
ENDMETHOD.
But it doesnt work.
Is there another function code for the Copy Button????
Thanks
ErsinHello Ersin,
the events "after_user_command", "before_user_command" and "user_command" will not be fired when selecting this command!
In my opinion, there is no solution, to fire these events, using this alv-function!
But there is a trick:
1. Register on the event "toolbar" with an own method:
toolbar_own for event toolbar of cl_gui_alv_grid
importing e_object
e_interactive,
In this method change the function code of "&LOCAL©_ROW", but don´t change the row of the entry, because the button should appear on the same place in the toolbar:
field-symbols: <ls_toolbar> type stb_button.
read table e_object->mt_toolbar with key function = '&LOCAL©_ROW'
assigning <ls_toolbar>.
if sy-subrc = 0.
<ls_toolbar>-function = 'COPYROW_OWN'.
endif.
2. Register on the event "user_command" ( I think, that´s clear ):
user_cmd_own for event user_command
of cl_gui_alv_grid
importing e_ucomm,
( don´t forget the set handler-commands for both events:
set handler po_alv_own->user_cmd_own for po_alv_own.
set handler po_alv_own->toolbar_own for po_alv_own. )
3. Now you can react in the method "user_command" on your own function code:
case e_ucomm.
when 'COPYROW_OWN'.
perform copy_row using me
changing gt_bis_cf_out.
Sample code for copying the current line:
FORM COPY_ROW using po_alv_own type ref to gcl_alv_own
changing pt_table_alv type gt_table_alv_t.
data: l_index type i,
ls_table_alv type gs_table_alvt_t.
call method po_alv_own->get_current_cell
importing
e_row = l_index.
* e_value =
* e_col =
* es_row_id =
* es_col_id =
* es_row_no =
"read the current line:
read table pt_table_alv index l_index
into ls_table_alv_out.
"some changes for the new row:
clear: ls_table_alv-style,
ls_table_alv-tabix.
"insert the new line:
add 1 to l_index.
insert ls_table_alv into pt_table_alv index l_index.
po_alv_own->refresh( ).
ENDFORM. " COPY_ROW
In this manner the events "after_user_command", "before_user_command" are fired, too!
For information: My problem was, that the ALV-function copied the style-information too, so in the new line, some fields are not editable. At least his field must be cleared!
Best regard
Thomas Scheuermann -
Replicating MENU_BUTTON, TOOLBAR events
Hi All,
I wanted to know if the events in CL_GUI_ALV_GRID - MENU_BUTTON and TOOLBAR - are available in the new ALV Object Model. If not, is there a way to replicate them.
I couldn't find anything matching these events in the various CL_SALV* classes.
Thanks and Regards,
Vidya.SALV Model has Functions object which does the job similar to TOOLBAR Event.
In SALV, Add the function in the ALV grid, get the function object and call the method ADD_FUNCTION.
*... §3.1 activate ALV generic Functions
data: lr_functions type ref to cl_salv_functions,
l_text type string,
l_icon type string.
lr_functions = gr_table->get_functions( ).
lr_functions->set_all( gc_true ).
*... §3.2 include own functions
l_text = 'My Button'.
l_icon = icon_complete.
try.
lr_functions->add_function(
name = 'MYFUNCTION'
icon = l_icon
text = l_text
tooltip = l_text
position = if_salv_c_function_position=>right_of_salv_functions ).
catch cx_salv_existing cx_salv_wrong_call.
endtry.
To handle the added function, register the event USER_COMMAND.
data: lr_events type ref to cl_salv_events_table.
lr_events = gr_table->get_event( ).
create object gr_events.
set handler gr_events->on_user_command for lr_events.
Event handler class
class lcl_handle_events definition.
public section.
methods:
on_user_command for event added_function of cl_salv_events
importing e_salv_function.
endclass. "lcl_handle_events DEFINITION
class lcl_handle_events implementation.
method on_user_command.
perform show_function_info using e_salv_function text-i08.
endmethod. "on_user_command
endclass. "lcl_handle_events IMPLEMENTATION
Check program SALV_DEMO_TABLE_FUNCTIONS for more information.
Regards,
Naimesh Patel -
Add Button with ALV Standard Toolbar.
Hi,
Can any one tell me how to add user-defined button with ALV
Standard toolbar? When I add Pf-status for alv output , standard alv toolbar is not displayed.
Plz do needful.On the toolbar event of your alv grid, all the button as shown in the code below.
FORM handle_toolbar USING i_object TYPE REF TO cl_alv_event_toolbar_set .
DATA: ls_toolbar TYPE stb_button.
CLEAR ls_toolbar.
MOVE 'EXCH' TO ls_toolbar-function. "#EC NOTEXT
MOVE 2 TO ls_toolbar-butn_type.
MOVE icon_calculation TO ls_toolbar-icon.
MOVE 'Payment in Other Currencies'(202) TO ls_toolbar-quickinfo.
MOVE ' ' TO ls_toolbar-text.
MOVE ' ' TO ls_toolbar-disabled. "#EC NOTEXT
APPEND ls_toolbar TO i_object->mt_toolbar.
ENDFORM
CLASS lcl_event_handler DEFINITION .
PUBLIC SECTION .
METHODS:
*To add new functional buttons to the ALV toolbar
handle_toolbar FOR EVENT toolbar OF cl_gui_alv_grid
IMPORTING e_object e_interactive ,
ENDCLASS.
CLASS lcl_event_handler IMPLEMENTATION .
*Handle Toolbar
METHOD handle_toolbar.
PERFORM handle_toolbar USING e_object e_interactive .
ENDMETHOD .
ENDCLASS.
DATA gr_event_handler TYPE REF TO lcl_event_handler .
*--Creating an instance for the event handler
CREATE OBJECT gr_event_handler .
*--Registering handler methods to handle ALV Grid events
SET HANDLER gr_event_handler->handle_toolbar FOR gr_alvgrid .
Hope this helps.
Thanks,
Balaji -
Hi,
I am using OOALV to display a report. I have 3 containers in the same screen and each container contains a ALV grid.
I have to add some customized buttons in each of the ALV grid. I am using the event 'TOOLBAR' of class cl_gui_alv_grid.
I have 3 different objects for each grid i.e. Ob1, ob2 and ob3.
I have created a event handler method to handle TOOLBAR event. In this event handler method i want to know that at a particular point of execution, which object is invoking this method (i.e. method is called by ob1, ob2 or Ob3) ?
I have checked the parameter 'e_object' but it is not giving a numeric value but not the object name.
Regards,
Pankaj.Unfortunatelly I don't have access to SAP right now so I will improvise
"event handler class
CLASS lcl_handler DEFINITION.
PUBLIC SECTION.
METHODS:
"create constructor accepting three grid references on input
constructor importing ir_grid1 type ref to cl_gui_alv_grid
ir_grid2 type ref to cl_gui_alv_grid
ir_grid3 type ref to cl_gui_alv_grid,
"and your handler method with SENDER parameter
handle_toolbar FOR EVENT toolbar OF cl_gui_alv_grid
IMPORTING e_object e_interactive sender.
PRIVATE SECTION.
"create 3 attributes to store grid references
data: mr_grid1 type ref to cl_gui_alv_grid,
mr_grid2 type ref to cl_gui_alv_grid,
mr_grid3 type ref to cl_gui_alv_grid.
ENDCLASS.
CLASS lcl_handler IMPLEMENTATION.
METHOD constructor.
me->mr_grid1 = ir_grid1.
me->mr_grid2 = ir_grid2.
me->mr_grid3 = ir_grid3.
ENDMETHOD.
METHOD handle_toolbar.
"check which grid raised the event
case sender.
when me->mr_grid1.
"1st alv
"your coding here...
when me->mr_grid2.
"2nd
"...and here
when me->mr_grid3.
"3rd
"...and here
endcase.
ENDMETHOD.
ENDCLASS.
"now when creating handler object pass all your three grid references
data lr_handler type ref to lcl_handler.
create object lr_handler exporting ir_grid1 = your_grid_ref1
ir_grid2 = your_grid_ref2
ir_grid3 = your_grid_ref3.
SET HANDLER....
This should work
Regards
Marcin -
Multiple selection of e_ucomm in ALV Grid toolbar
Dear SAP friends,
I have created HR report.
On the selection screen the User enters some initial data and ALV Grid get displayed.
In event Handle_toolbar the program adds a custom button to standard ALV grid toolbar named "ABSENCE/ATTENDANCE".
In event handle_menu_button the program adds functions to this button.
Then in event handle_user_command depending on the function selected "e_ucomm" the program repopulates the ALV Grid.
METHOD handle_toolbar.
* Append a separator to standard toolbar
CLEAR gs_toolbar.
gs_toolbar-butn_type = 3.
APPEND gs_toolbar TO e_object->mt_toolbar.
CLEAR gs_toolbar.
gs_toolbar-function = 'ABSENCE/ATTENDANCE'.
gs_toolbar-icon = icon_position_hr.
gs_toolbar-quickinfo = 'Absence/Attendance Type'.
gs_toolbar-butn_type = 2. " 2-Menu type, 0-single button type
gs_toolbar-disabled = space.
APPEND gs_toolbar TO e_object->mt_toolbar.
ENDMETHOD. "handle_toolbar
METHOD handle_menu_button.
* Handle own menubuttons
IF e_ucomm = 'ABSENCE/ATTENDANCE'.
LOOP AT it_aa INTO it_aa_ln.
MOVE it_aa_ln-type TO w-fcode.
CONCATENATE it_aa_ln-type '=' it_aa_ln-text
INTO w-text
SEPARATED BY SPACE.
CALL METHOD e_object->add_function
EXPORTING
fcode = w-fcode
text = w-text.
ENDLOOP.
ENDIF.
ENDMETHOD. "handle_menu_button
METHOD handle_user_command.
MOVE e_ucomm TO w-abstype.
PERFORM abs_att USING w-abstype.
ENDMETHOD. "handle_user_command
Is there a way to select more than one line or e_ucomm in other words at a time?
I would like to give my user a choice of let's say one report with three types of absences at a time rather than three reports with one type each.
Thanks,
TatyanaThe whole point of a toolbar button is to do a specific function.
What I would actually do here is in your menu button add another option say "User Choice" and when this is clicked throw up another screen say another ALV grid where the user can choose the various combinations or do it via a POPUP. A second grid IMO would be the best way to do it as the user can select easily specific rows.
You can either display the 2nd grid in a 2nd custom container on your main screen where you are showing the ALV grid or pass control to a new screen / program. Using a 2nd container is better as you still will have your instance of the original grid available.
Cheers
Jimbo -
Hi,
Is it possible to know the alv grid (TYPE REF TO cl_gui_alv_grid) on the event click? In fact, on a screen, I have 2 alv grids and I would like to store the alv grid name for a process at click moment.
Thanks.
Edited by: Xavier Couloumies on Sep 12, 2008 2:07 PMyou might declare two differents methods for the two grids
PUBLIC SECTION.
METHODS:
HANDLE_DOUBLE_CLICK
FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID
IMPORTING E_ROW
E_COLUMN,
HANDLE_DOUBLE_CLICK2
FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID
IMPORTING E_ROW
E_COLUMN.
something like that
then , in the implementations do something like this
METHOD HANDLE_DOUBLE_CLICK.
PERFORM X USING GRID = '1'.
ENDMETHOD.
METHOD HANDLE_DOUBLE_CLICK2.
PERFORM X USING GRID = '2'.
ENDMETHOD.
and do the respective validations on that form
hope this help -
How can I call functionality of ALV Grid by event of button outside grid?
Hello,
How can I call functionality of ALV Grid by event of button located outside ALV Grid? For example how to fire printing of this ALV Grid by button click elsewhere on the screen (not in toolbar of ALV Grid).
Best regards,
Josef Motlhi Motl,
these are steps to create a button in ALV and trigger an event from it..
1.Use the parameter i_callback_pf_status_set in the function module REUSE_ALV_GRID_DISPLAY
i_callback_program = gd_repid
i_callback_pf_status_set = 'SET_PF_STATUS'
form set_pf_status using rt_extab type slis_t_extab.
set pf-status 'NEWALVSTATUS'.
endform.
You have to copy the standard ALV pf stauts to 'NEWALVSTATUS' and add your button.
2.You have to do the following to process the new button click.
i_callback_user_command = 'USER_COMMAND'
form user_command using i_ucomm like sy-ucomm
is_selfield type slis_selfield.
case i_ucomm.
3. to copy the standard pf status to a new one.go to the ALV screen and take the menu System -> Status. Then look for the standard pf status. Copy this to Z range and then add your new button.
reward points if helpful
regards
satesh -
Anything other than buttons on ALV Grid toolbar?
Does anyone know if anything other than buttons can be placed on a ALV Grid toolbar, eg. a piece of text or an input field? The filter button for data selection may be too cumbersome/slow for a call centre operator; I want to have a display field with a dropdown identifying a data field and an input field to accept a value on which to select.
may be you can do some thing like this..instead of having a input field on the toolbar. have an input field above the ALV grid(this is applicable only when you are using Object Oriented ALV).
| input field : ________________ |
|__________________________________|
| ALV GRID OUTPUT |
|__________________________________|
you can have a button along with input field also. enter the value in it, and press enter . in the enter handling fetch all the data. and display in the ALV grid.
in the screen fiest create input field, and button, then place the custom control. on the custom control you place the grid. -
Why can not catch the standard BACK event in ALV's USER_COMMAND event,
Hi expert, why i can not catch the standard BACK event in ALV's USER_COMMAND event,
Code:
DATA G_CON_UC_FORM TYPE SLIS_FORMNAME VALUE 'F_USER_COMMAND',
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_TOP_OF_PAGE = G_CON_FORM
I_CALLBACK_USER_COMMAND = G_CON_UC_FORM
IT_FIELDCAT = G_TAB_FIELDCAT
IT_SORT = G_TAB_SORT_INF
I_SAVE = G_CON_U
*<<<Liang
IT_EVENTS = G_TAB_ALV_EVENTS
*<<<Liang
TABLES
T_OUTTAB = G_TAB_OUTPUT_DATA
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
*& Form F_USER_COMMAND
ALV USER COMMAND processing
FORM F_USER_COMMAND .
IF SY-UCOMM = '&FO3'.
LEAVE TO SCREEN 0.
ENDIF.
ENDFORM. " F_USER_COMMAND
When I set breakpoint on this subrouting ,and try to click stardard BACK or CANCEL button, the callback form do not run, but if double click one of line of alv report, the callback form works well,
so why??hi
good
check this report and change your code accordingly.
THESE LINES ARE FOR THE MAIN PROGRAM ***
SAP V40B ***
REPORT Z_PICK_LIST .
TABLES: RESB.
SELECTION-SCREEN BEGIN OF BLOCK BL1 WITH FRAME TITLE TEXT-BL1.
SELECT-OPTIONS: S_WERKS FOR RESB-WERKS," Plant
S_AUFNR FOR RESB-AUFNR," Order number
S_BDTER FOR RESB-BDTER." Req. date
SELECTION-SCREEN END OF BLOCK BL1.
PARAMETERS: P_VARI LIKE DISVARIANT-VARIANT DEFAULT '/STANDARD'.
DATA: BEGIN OF OUT OCCURS 10,
AUFNR LIKE RESB-AUFNR, " Order number
MATNR LIKE RESB-MATNR, " Material
BDMNG LIKE RESB-BDMNG, " Requirements in UM
MEINS LIKE RESB-MEINS, " Unit of Measure (UM)
ERFMG LIKE RESB-ERFMG, " Requirements in UE
ERFME LIKE RESB-ERFME, " Unit of Entry (UE)
MAKTX LIKE MAKT-MAKTX, " Mat. description
END OF OUT.
INCLUDE Z_ALV_VARIABLES.
INITIALIZATION.
REPNAME = SY-REPID.
PERFORM INITIALIZE_FIELDCAT USING FIELDTAB[].
PERFORM BUILD_EVENTTAB USING EVENTS[].
PERFORM BUILD_COMMENT USING HEADING[].
PERFORM INITIALIZE_VARIANT.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_VARI.
PERFORM F4_FOR_VARIANT.
AT SELECTION-SCREEN.
PERFORM PAI_OF_SELECTION_SCREEN.
START-OF-SELECTION.
PERFORM GET_ORDERS.
PERFORM GET_MATERIAL_DESCRIPTION.
END-OF-SELECTION.
PERFORM BUILD_LAYOUT USING LAYOUT.
PERFORM BUILD_PRINT USING PRINTS.
PERFORM WRITE_USING_ALV.
FORM INITIALIZE_FIELDCAT *
--> P_TAB *
FORM INITIALIZE_FIELDCAT USING P_TAB TYPE SLIS_T_FIELDCAT_ALV.
DATA: CAT TYPE SLIS_FIELDCAT_ALV.
CLEAR CAT.
ENDFORM. " INITIALIZE_FIELDCAT
*& Form GET_ORDERS
text
FORM GET_ORDERS.
SELECT AUFNR MATNR BDMNG MEINS ERFMG ERFME
FROM RESB
APPENDING TABLE OUT
WHERE XLOEK EQ SPACE " deletion indicator
AND XWAOK EQ 'X' " goods movement indicator
AND WERKS IN S_WERKS " plant
AND BDTER IN S_BDTER " req. date
AND AUFNR IN S_AUFNR. " pr. order
ENDFORM. " GET_ORDERS
*& Form GET_MATERIAL_DESCRIPTION
text
FORM GET_MATERIAL_DESCRIPTION.
SORT OUT BY MATNR.
LOOP AT OUT.
SELECT SINGLE MAKTX
INTO OUT-MAKTX
FROM MAKT
WHERE MATNR EQ OUT-MATNR
AND SPRAS EQ 'EN'.
MODIFY OUT.
ENDLOOP.
SORT OUT BY AUFNR MATNR.
ENDFORM. " GET_MATERIAL_DESCRIPTION
FORM TOP_OF_PAGE *
FORM TOP_OF_PAGE.
DATA: L_POS TYPE P.
first line
WRITE:/ TEXT-001. " Plant:
IF S_WERKS-HIGH NE SPACE.
WRITE: S_WERKS-LOW, TEXT-TO1, S_WERKS-HIGH.
ELSEIF S_WERKS-LOW NE SPACE.
LOOP AT S_WERKS.
WRITE: S_WERKS-LOW.
ENDLOOP.
ELSEIF S_WERKS-LOW EQ SPACE.
WRITE: TEXT-ALL.
ENDIF.
L_POS = ( SY-LINSZ DIV 2 ) - ( STRLEN( TEXT-TIT ) DIV 2 ).
POSITION L_POS. WRITE: TEXT-TIT.
L_POS = SY-LINSZ - 20.
POSITION L_POS. WRITE: TEXT-011, SY-UNAME RIGHT-JUSTIFIED. " User:
second line
WRITE:/ TEXT-002. " Order:
IF S_AUFNR-HIGH NE SPACE.
WRITE: S_AUFNR-LOW, TEXT-TO1, S_AUFNR-HIGH.
ELSEIF S_AUFNR-LOW NE SPACE.
LOOP AT S_AUFNR.
WRITE: S_AUFNR-LOW.
ENDLOOP.
ELSEIF S_AUFNR-LOW EQ SPACE.
WRITE: TEXT-ALL.
ENDIF.
L_POS = SY-LINSZ - 20.
POSITION L_POS. WRITE: TEXT-012,SY-DATUM. " Date:
third line
WRITE:/ TEXT-003. " Req. Date:
IF S_BDTER-HIGH(1) NE '0'.
WRITE: S_BDTER-LOW, TEXT-TO1, S_BDTER-HIGH.
ELSEIF S_BDTER-LOW(1) NE '0'.
LOOP AT S_BDTER.
WRITE: S_BDTER-LOW.
ENDLOOP.
ELSEIF S_BDTER-LOW(1) EQ '0'.
WRITE: TEXT-ALL.
ENDIF.
L_POS = SY-LINSZ - 20.
POSITION L_POS. WRITE: TEXT-013, SY-PAGNO. " Page:
ENDFORM. " TOP_OF_PAGE
FORM END_OF_LIST *
FORM END_OF_LIST.
DATA: L_POS TYPE P.
ULINE.
WRITE:/ '|', TEXT-021. " Delivered by:
L_POS = SY-LINSZ DIV 2.
POSITION L_POS. WRITE: '|', TEXT-031. " Received by:
L_POS = SY-LINSZ.
POSITION L_POS. WRITE: '|'.
WRITE:/ '|'.
L_POS = SY-LINSZ DIV 2.
POSITION L_POS. WRITE: '|'.
L_POS = SY-LINSZ.
POSITION L_POS. WRITE: '|'.
ULINE.
WRITE:/ '|', TEXT-012. " Date:
L_POS = SY-LINSZ DIV 2.
POSITION L_POS. WRITE: '|', TEXT-012. " Date:
L_POS = SY-LINSZ.
POSITION L_POS. WRITE: '|'.
WRITE:/ '|'.
L_POS = SY-LINSZ DIV 2.
POSITION L_POS. WRITE: '|'.
L_POS = SY-LINSZ.
POSITION L_POS. WRITE: '|'.
ULINE.
ENDFORM. " END_OF_LIST
*& Form WRITE_USING_ALV
text
FORM WRITE_USING_ALV.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = REPNAME
I_INTERNAL_TABNAME = 'OUT'
I_INCLNAME = REPNAME
CHANGING
CT_FIELDCAT = FIELDTAB.
IF SY-SUBRC <> 0.
WRITE: 'SY-SUBRC: ', SY-SUBRC, 'REUSE_ALV_FIELDCATALOG_MERGE'.
ENDIF.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = REPNAME
i_callback_pf_status_set = 'PF_STATUS_SET'
i_callback_user_command = 'USER_COMMAND'
I_STRUCTURE_NAME = 'OUT'
IS_LAYOUT = LAYOUT
IT_FIELDCAT = FIELDTAB
I_DEFAULT = 'A'
I_SAVE = G_SAVE
IS_VARIANT = G_VARIANT
IT_EVENTS = EVENTS[]
IS_PRINT = PRINTS
TABLES
T_OUTTAB = OUT.
IF SY-SUBRC <> 0.
WRITE: 'SY-SUBRC: ', SY-SUBRC, 'REUSE_ALV_LIST_DISPLAY'.
ENDIF.
ENDFORM. " WRITE_USING_ALV
THESE LINES ARE FOR THE INCLUDE ***
***INCLUDE Z_ALV_VARIABLES .
TYPE-POOLS: SLIS.
DATA: FIELDTAB TYPE SLIS_T_FIELDCAT_ALV,
HEADING TYPE SLIS_T_LISTHEADER,
LAYOUT TYPE SLIS_LAYOUT_ALV,
EVENTS TYPE SLIS_T_EVENT,
REPNAME LIKE SY-REPID,
F2CODE LIKE SY-UCOMM VALUE '&ETA',
PRINTS TYPE SLIS_PRINT_ALV,
TITLE(40) TYPE C,
G_SAVE(1) TYPE C,
G_EXIT(1) TYPE C,
G_VARIANT LIKE DISVARIANT,
GX_VARIANT LIKE DISVARIANT.
CONSTANTS: FORMNAME_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE',
FORMNAME_END_OF_PAGE TYPE SLIS_FORMNAME VALUE 'END_OF_PAGE',
FORMNAME_END_OF_LIST TYPE SLIS_FORMNAME VALUE 'END_OF_LIST',
FORMNAME_BEFORE_LINE TYPE SLIS_FORMNAME VALUE 'BEFORE_LINE',
FORMNAME_AFTER_LINE TYPE SLIS_FORMNAME VALUE 'AFTER_LINE'.
FORM MAIN_STATEMENTS *
THIS IS THE CODE THAT MUST BE INSERTED IN THE MAIN PROGRAM
FORM MAIN_STATEMENTS.
Declare the parameter P_VARI wherever you want it. If you don't
want it, hide it with NO-DISPLAY, but it must exist.
parameters: p_vari like disvariant-variant. " ALV Variant
You have to add the following line after the data and parameter
declaration:
include z_alv_variables.
Then, after the data/parameter declaration, add these lines:
*initialization.
repname = sy-repid.
perform initialize_fieldcat using fieldtab[].
perform build_eventtab using events[].
perform build_comment using heading[].
perform initialize_variant.
If you are using the variable P_VARI (ALV Variant), also add this:
*at selection-screen on value-request for p_vari.
perform f4_for_variant.
*at selection-screen.
perform pai_of_selection_screen.
After the "END-OF-SELECTION" statement, add these lines:
perform build_layout using layout.
perform build_print using prints.
perform write_using_alv.
You also have to create the following forms: (you can find samples
in this program)
INITIALIZE_FIELDCAT
USER_COMMAND (only if you are creating a STATUS)
WRITE_USING_ALV
ENDFORM.
*& Form INITIALIZE_FIELDCAT_SAMPLE
THIS IS A SAMPLE, DO NOT USE THIS FORM IN YOUR PROGRAM
-->P_FIELDTAB[] text *
FORM INITIALIZE_FIELDCAT_SAMPLE USING P_TAB TYPE SLIS_T_FIELDCAT_ALV.
DATA: CAT TYPE SLIS_FIELDCAT_ALV.
CLEAR CAT. " Always clear before use
CAT-TABNAME = 'I'. " Your internal table
CAT-REF_TABNAME = 'ZCUSTMAS'. " The data dictionary reference table
CAT-FIELDNAME = 'KUNNR'. " Name of your field in the itable.
CAT-COL_POS = 1. " Output position
APPEND CAT TO P_TAB.
CAT-FIELDNAME = 'NAME1'. " Next field
CAT-COL_POS = 2.
APPEND CAT TO P_TAB.
CAT-FIELDNAME = 'STRAS'. " and the next
CAT-COL_POS = 3.
APPEND CAT TO P_TAB.
CAT-FIELDNAME = 'LOEVM'.
CAT-SELTEXT_S = 'Del'. " You can always override the descrip-
CAT-SELTEXT_M = 'Delivery'. " tion (short, medium, large)
CAT-SELTEXT_L = 'Delivery Num'.
CAT-COL_POS = 4.
APPEND CAT TO P_TAB.
CAT-FIELDNAME = 'FKIMG'.
CAT-DO_SUM = 'X'. " You want totals calculated.
CAT-NO_OUT = 'X'. " and hidden.
APPEND CAT TO P_TAB.
ENDFORM. " INITIALIZE_FIELDCAT
*& Form BUILD_EVENTTAB
THIS IS THE SAME FOR ALL THE PROGRAMS
-->P_EVENTS[] text *
FORM BUILD_EVENTTAB USING P_EVENTS TYPE SLIS_T_EVENT.
DATA: LS_EVENT TYPE SLIS_ALV_EVENT.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = P_EVENTS.
READ TABLE P_EVENTS WITH KEY NAME = SLIS_EV_TOP_OF_PAGE
INTO LS_EVENT.
IF SY-SUBRC = 0.
MOVE FORMNAME_TOP_OF_PAGE TO LS_EVENT-FORM.
APPEND LS_EVENT TO P_EVENTS.
ENDIF.
CLEAR LS_EVENT.
READ TABLE P_EVENTS WITH KEY NAME = SLIS_EV_END_OF_LIST
INTO LS_EVENT.
IF SY-SUBRC = 0.
MOVE FORMNAME_END_OF_LIST TO LS_EVENT-FORM.
APPEND LS_EVENT TO P_EVENTS.
ENDIF.
CLEAR LS_EVENT.
READ TABLE P_EVENTS WITH KEY NAME = SLIS_EV_BEFORE_LINE_OUTPUT
INTO LS_EVENT.
IF SY-SUBRC = 0.
MOVE FORMNAME_BEFORE_LINE TO LS_EVENT-FORM.
APPEND LS_EVENT TO P_EVENTS.
ENDIF.
CLEAR LS_EVENT.
READ TABLE P_EVENTS WITH KEY NAME = SLIS_EV_AFTER_LINE_OUTPUT
INTO LS_EVENT.
IF SY-SUBRC = 0.
MOVE FORMNAME_AFTER_LINE TO LS_EVENT-FORM.
APPEND LS_EVENT TO P_EVENTS.
ENDIF.
CLEAR LS_EVENT.
READ TABLE P_EVENTS WITH KEY NAME = SLIS_EV_END_OF_PAGE
INTO LS_EVENT.
IF SY-SUBRC = 0.
MOVE FORMNAME_END_OF_PAGE TO LS_EVENT-FORM.
APPEND LS_EVENT TO P_EVENTS.
ENDIF.
ENDFORM. " BUILD_EVENTTAB
*& Form BUILD_COMMENT
NOT REALLY NEEDED, BUT I'LL LEAVE IT THERE, JUST IN CASE...
-->P_HEADING[] text *
FORM BUILD_COMMENT USING P_HEADING TYPE SLIS_T_LISTHEADER.
DATA: HLINE TYPE SLIS_LISTHEADER,
TEXT(60) TYPE C,
SEP(20) TYPE C.
CLEAR: HLINE, TEXT.
HLINE-TYP = 'H'.
write: text-101 to text+23.
HLINE-INFO = TEXT.
APPEND HLINE TO P_HEADING.
ENDFORM. " BUILD_COMMENT
*& Form INITIALIZE_VARIANT
VERY IMPORTANT WHEN YOU USE VARIANTS!!!
FORM INITIALIZE_VARIANT.
G_SAVE = 'A'.
CLEAR G_VARIANT.
G_VARIANT-REPORT = REPNAME.
GX_VARIANT = G_VARIANT.
CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
EXPORTING
I_SAVE = G_SAVE
CHANGING
CS_VARIANT = GX_VARIANT
EXCEPTIONS
NOT_FOUND = 2.
IF SY-SUBRC = 0.
P_VARI = GX_VARIANT-VARIANT.
ENDIF.
ENDFORM. " INITIALIZE_VARIANT
*& Form PAI_OF_SELECTION_SCREEN
ALSO FOR VARIANTS
FORM PAI_OF_SELECTION_SCREEN.
IF NOT P_VARI IS INITIAL.
MOVE G_VARIANT TO GX_VARIANT.
MOVE P_VARI TO GX_VARIANT-VARIANT.
CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
EXPORTING
I_SAVE = G_SAVE
CHANGING
CS_VARIANT = GX_VARIANT
EXCEPTIONS
WRONG_INPUT = 1
NOT_FOUND = 2
PROGRAM_ERROR = 3.
IF SY-SUBRC EQ 0.
G_VARIANT = GX_VARIANT.
ELSE.
PERFORM INITIALIZE_VARIANT.
ENDIF.
ELSE.
PERFORM INITIALIZE_VARIANT.
ENDIF.
ENDFORM. " PAI_OF_SELECTION_SCREEN
*& Form F4_FOR_VARIANT
text
FORM F4_FOR_VARIANT.
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
IS_VARIANT = G_VARIANT
I_SAVE = G_SAVE
IMPORTING
E_EXIT = G_EXIT
ES_VARIANT = GX_VARIANT
EXCEPTIONS
NOT_FOUND = 2.
IF SY-SUBRC = 2.
MESSAGE ID SY-MSGID TYPE 'S' NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ELSE.
IF G_EXIT = SPACE.
P_VARI = GX_VARIANT-VARIANT.
ENDIF.
ENDIF.
ENDFORM. " F4_FOR_VARIANT
*& Form BUILD_LAYOUT
STANDARD LAYOUT
-->P_LAYOUT text *
FORM BUILD_LAYOUT USING P_LAYOUT TYPE SLIS_LAYOUT_ALV.
P_LAYOUT-F2CODE = F2CODE.
P_LAYOUT-ZEBRA = 'X'.
p_layout-detail_popup = 'X'.
P_LAYOUT-TOTALS_TEXT = SPACE.
P_LAYOUT-SUBTOTALS_TEXT = SPACE.
ENDFORM. " BUILD_LAYOUT
FORM BUILD_PRINT *
STANDARD PRINT OPTIONS *
--> P_PRINT *
FORM BUILD_PRINT USING P_PRINT TYPE SLIS_PRINT_ALV.
P_PRINT-NO_PRINT_LISTINFOS = 'X'.
P_PRINT-NO_PRINT_SELINFOS = ' '.
ENDFORM. " BUILD_PRINT
FORM PF_STATUS_SET *
NAME YOUR STATUS ALV. IF YOU NEED IT.. *
FORM PF_STATUS_SET USING EXTAB TYPE SLIS_T_EXTAB.
SET PF-STATUS 'ALV' EXCLUDING EXTAB.
ENDFORM. " PF_STATUS_SET
FORM USER_COMMAND_SAMPLE *
--> UCOMM *
--> SELFIELD *
FORM USER_COMMAND_SAMPLE USING UCOMM LIKE SY-UCOMM
SELFIELD TYPE SLIS_SELFIELD.
CASE UCOMM.
WHEN 'MSXL'. " Export to Excel
perform set_excel_export.
CLEAR UCOMM.
WHEN 'MM03'.
set parameter id 'MAT' field selfield-value.
call transaction 'MM03' and skip first screen.
CLEAR UCOMM.
WHEN 'BGR1'.
perform fill_available.
perform graph_available.
CLEAR UCOMM.
WHEN 'DOCU'.
call function 'Z_HELP' exporting repname = repname.
ENDCASE.
ENDFORM. " USER_COMMAND
*& Form WRITE_USING_ALV_SAMPLE
*THIS IS A SAMPLE AND MUST BE WRITTEN DIRECTLY IN THE MAIN PROGRAM
FORM WRITE_USING_ALV_SAMPLE.
YOU CAN MERGE WITH A DATA DICTIONARY TABLE USING THIS:
call function 'REUSE_ALV_FIELDCATALOG_MERGE'
exporting
i_program_name = repname
i_internal_tabname = 'I'
i_inclname = repname
changing
ct_fieldcat = fieldtab.
if sy-subrc <> 0.
write: 'SY-SUBRC: ', sy-subrc, 'REUSE_ALV_FIELDCATALOG_MERGE'.
endif.
OR JUST DISPLAY IT USING THIS:
call function 'REUSE_ALV_LIST_DISPLAY'
exporting
i_callback_program = repname
i_callback_pf_status_set = 'PF_STATUS_SET'
i_callback_user_command = 'USER_COMMAND'
i_structure_name = 'I'
is_layout = layout
it_fieldcat = fieldtab
i_default = 'A'
i_save = g_save
is_variant = g_variant
it_events = events[]
is_print = prints
tables
t_outtab = i.
if sy-subrc <> 0.
write: 'SY-SUBRC: ', sy-subrc, 'REUSE_ALV_LIST_DISPLAY'.
endif.
ENDFORM. " WRITE_USING_ALV
thanks
mrutyun^ -
HOW TO FIRE ALV'S ON_SELECT EVENT(NOT ON_LEAD_SELECT )
Hi,
I have created dynamic ALV and it's multi-selected.
I want to check the selected row value when the row is selected.
What I want is The ON_SELECT event like the standard table UI element. But I can't find the ON_SELECT event in ALV.
(ON_LEAD_SELECT EVENT is only fired when lead selection is changed. )
anyone has idea on it?
by the way the select mode is setted to cl_wd_table=>e_selection_mode-multi_no_lead.Hi,
I have a same requirment as you have. I found the note 1281200. Unfrotunately, this event was implemented in enhancement pack 2.
Cheers -
CL_GUI_ALV_GRID Problems when using enter and f4 in one ALV
Hi guys,
i have the following problem:
I Use a ALV, which has a column MATNR. The ALV provides the standard search help for this field automatically. so far so good. BUT i also need to read additional data, such as GLD, Material shortext etc, when the users presses the Enter Key.
Here is my coding:
CLASS lcl_events DEFINITION
CLASS lcl_events_0300 DEFINITION.
PUBLIC SECTION.
METHODS:
handle_data_changed
FOR EVENT data_changed OF cl_gui_alv_grid
IMPORTING er_data_changed sender.
ENDCLASS. "lcl_events DEFINITION
The problem that occurs: if i select a material via f4, i just can add one material to the alv. if i place the cursor into the second line, press f4 again, the alv overwrites the MATNR in the first line
i think the problem has to do with the fact, that the alv runs throug my enter event, when pressing f4.
thats how i registered my event:
g_o_alv_grid_bart_0300->register_edit_event(
EXPORTING
" i_event_id = g_o_alv_grid->MC_EVT_MODIFIED ).
i_event_id = g_o_alv_grid->mc_evt_enter ).
...und EventHandler zuweisen
CREATE OBJECT g_o_alv_events_0300.
SET HANDLER g_o_alv_events_0300->handle_data_changed FOR g_o_alv_grid_bart_0300.
kind regards, mark
Edited by: Mark Wagener on Aug 19, 2010 11:39 AM
Edited by: Mark Wagener on Aug 19, 2010 11:40 AMSorry for forgetting the impl. part of the class!
CLASS lcl_events_0300 IMPLEMENTATION
CLASS lcl_events_0300 IMPLEMENTATION.
METHOD handle_data_changed.
HandleDataChanged ***
DATA: ls_good TYPE lvc_s_modi.
FIELD-SYMBOLS: .
alle Inhalte der geänderten Zellen in die interne Tabelle schreiben
LOOP AT er_data_changed->mt_good_cells INTO ls_good.
Dazu auf die richtige Zeile in der ITAB positionieren:
READ TABLE INDEX ls_good-row_id.
IF sy-subrc = 0.
Und das geänderte Feld dem Feldsymbol zuweisen
ASSIGN COMPONENT ls_good-fieldname OF STRUCTURE .
IF sy-subrc = 0.
Feldwert zuweisen
-matnr
AND bwkey = werks.
ENDLOOP.
Und neu ausgeben
g_o_alv_grid_bart_0300->refresh_table_display( ).
ENDMETHOD. "handle_data_changed -
ALV Tree - register event problem
Hi,
I'm trying to register standard events for ALV Tree. when perform register_events it raises exception 'illegal event combination'. does anybody know what is wrong it this code ?
***INCLUDE ZNT_SLORDERHIER_STATUS_0100O01 .
*& Module STATUS_0100 OUTPUT
* text
module STATUS_0100 output.
set pf-status 'MAIN100'.
if tree1 is initial.
perform f_init_tree.
endif.
call method cl_gui_cfw=>flush.
endmodule. " STATUS_0100 OUTPUT
form register_events.
* define the events which will be passed to the backend
data: lt_events type cntl_simple_events,
l_event type cntl_simple_event.
* define the events which will be passed to the backend
l_event-eventid = cl_gui_column_tree=>eventid_expand_no_children.
append l_event to lt_events.
l_event-eventid = cl_gui_column_tree=>eventid_checkbox_change.
append l_event to lt_events.
l_event-eventid = cl_gui_column_tree=>eventid_header_context_men_req.
append l_event to lt_events.
l_event-eventid = cl_gui_column_tree=>eventid_node_context_menu_req.
append l_event to lt_events.
l_event-eventid = cl_gui_column_tree=>eventid_item_context_menu_req.
append l_event to lt_events.
l_event-eventid = cl_gui_column_tree=>eventid_item_double_click.
append l_event to lt_events.
l_event-eventid = cl_gui_column_tree=>eventid_item_keypress.
append l_event to lt_events.
call method tree1->set_registered_events
exporting
events = lt_events
exceptions
cntl_error = 1
cntl_system_error = 2
illegal_event_combination = 3.
if sy-subrc <> 0.
call function 'POPUP_TO_DISPLAY_TEXT_LO'
exporting
titel = 'Error number:'
textline1 = sy-subrc
start_column = 1
start_row = 6. "#EC NOTEXT
endif.
endform. " register_events
form f_init_tree.
perform f_build_fieldcatalog.
* create container for alv-tree
data: l_tree_container_name(30) type c,
l_custom_container type ref to cl_gui_custom_container.
l_tree_container_name = 'TREE1'.
if sy-batch is initial.
create object l_custom_container
exporting
container_name = l_tree_container_name
exceptions
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5.
if sy-subrc <> 0.
message x208(00) with 'ERROR'. "#EC NOTEXT
endif.
endif.
* create tree control
create object tree1
exporting
parent = l_custom_container
node_selection_mode = cl_gui_column_tree=>node_sel_mode_multiple
item_selection = space
no_html_header = ''
no_toolbar = ''
exceptions
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
illegal_node_selection_mode = 5
failed = 6
illegal_column_name = 7.
if sy-subrc <> 0.
message x208(00) with 'ERROR'. "#EC NOTEXT
endif.
* create Hierarchy-header
data l_hierarchy_header type treev_hhdr.
perform f_build_hierarchy_header changing l_hierarchy_header.
* create info-table for html-header
data: lt_list_commentary type slis_t_listheader,
l_logo type sdydo_value.
perform f_build_comment using
lt_list_commentary
l_logo.
* repid for saving variants
data: ls_variant type disvariant.
ls_variant-report = sy-repid.
CLEAR gt_sorder[].
* create emty tree-control
call method tree1->set_table_for_first_display
exporting
is_hierarchy_header = l_hierarchy_header
it_list_commentary = lt_list_commentary
i_logo = l_logo
i_background_id = 'ALV_BACKGROUND'
i_save = 'A'
is_variant = ls_variant
changing
it_outtab = gt_sorder "table must be emty !!
it_fieldcatalog = gt_fieldcatalog.
* create hierarchy
perform f_create_hierarchy.
perform register_events.
endform. " init_tree
form f_build_fieldcatalog.
DATA gs_fieldcat LIKE LINE OF gt_fieldcatalog.
* get fieldcatalog
call function 'LVC_FIELDCATALOG_MERGE'
exporting
i_structure_name = 'ZVNT_SLALVTREE'
changing
ct_fieldcat = gt_fieldcatalog.
clear gs_fieldcat.
endform.
form f_build_hierarchy_header changing
p_hierarchy_header type treev_hhdr.
p_hierarchy_header-heading = 'Hierarchy Header'. "#EC NOTEXT
p_hierarchy_header-tooltip =
'This is the Hierarchy Header !'. "#EC NOTEXT
p_hierarchy_header-width = 30.
p_hierarchy_header-width_pix = ''.
endform.
form f_build_comment using
pt_list_commentary type slis_t_listheader
p_logo type sdydo_value.
data: ls_line type slis_listheader.
* LIST HEADING LINE: TYPE H
clear ls_line.
ls_line-typ = 'H'.
* LS_LINE-KEY: NOT USED FOR THIS TYPE
ls_line-info = 'ALV-tree: sales order-overview'. "#EC NOTEXT
append ls_line to pt_list_commentary.
* STATUS LINE: TYPE S
p_logo = 'ENJOYSAP_LOGO'.
endform. "build_comment
form f_create_hierarchy.
data: ls_sorder type ty_ZVNT_SLALVTREE,
lt_sorder type ty_ZVNT_SLALVTREE occurs 0.
* get data
select * from ZVNT_SLALVTREE into table lt_sorder up to 200 rows WHERE spras = sy-langu and matnr in s_matnr
and vbeln in s_vbeln.
sort lt_sorder by vbeln.
* add data to tree
data: l_vbeln_key type lvc_nkey,
l_posnr_key type lvc_nkey,
l_last_key type lvc_nkey.
loop at lt_sorder into ls_sorder.
on change of ls_sorder-vbeln.
perform f_add_vbeln_line using ls_sorder
changing l_vbeln_key.
endon.
on change of ls_sorder-posnr.
perform f_add_posnr_line using ls_sorder
l_vbeln_key
changing l_posnr_key.
endon.
perform f_add_complete_line using ls_sorder
l_posnr_key
changing l_last_key.
endloop.
* this method must be called to send the data to the frontend
call method tree1->frontend_update.
endform. " create_hierarchy
form f_add_vbeln_line using ps_sorder type ty_ZVNT_SLALVTREE
p_relat_key type lvc_nkey
changing p_node_key type lvc_nkey.
data: l_node_text type lvc_value,
ls_sorder type ty_ZVNT_SLALVTREE.
* set item-layout
data: lt_item_layout type lvc_t_layi,
ls_item_layout type lvc_s_layi.
ls_item_layout-t_image = '@3P@'.
ls_item_layout-fieldname = tree1->c_hierarchy_column_name.
ls_item_layout-style =
cl_gui_column_tree=>style_intensifd_critical.
append ls_item_layout to lt_item_layout.
* add node
l_node_text = ps_sorder-vbeln.
data: ls_node type lvc_s_layn.
ls_node-n_image = space.
ls_node-exp_image = space.
call method tree1->add_node
exporting
i_relat_node_key = p_relat_key
i_relationship = cl_gui_column_tree=>relat_last_child
i_node_text = l_node_text
is_outtab_line = ls_sorder
is_node_layout = ls_node
it_item_layout = lt_item_layout
importing
e_new_node_key = p_node_key.
endform.
form f_add_posnr_line using ps_sorder type ty_ZVNT_SLALVTREE
p_relat_key type lvc_nkey
changing p_node_key type lvc_nkey.
data: l_node_text type lvc_value,
ls_sorder type ty_ZVNT_SLALVTREE.
* set item-layout
data: lt_item_layout type lvc_t_layi,
ls_item_layout type lvc_s_layi.
ls_item_layout-t_image = '@3Y@'.
ls_item_layout-style =
cl_gui_column_tree=>style_intensified.
ls_item_layout-fieldname = tree1->c_hierarchy_column_name.
append ls_item_layout to lt_item_layout.
* add node
l_node_text = ps_sorder-posnr.
data: relat type int4.
relat = cl_gui_column_tree=>relat_last_child.
call method tree1->add_node
exporting
i_relat_node_key = p_relat_key
i_relationship = relat
i_node_text = l_node_text
is_outtab_line = ls_sorder
it_item_layout = lt_item_layout
importing
e_new_node_key = p_node_key.
endform. " add_connid_line
form f_add_complete_line using ps_sorder type ty_ZVNT_SLALVTREE
p_relat_key type lvc_nkey
changing p_node_key type lvc_nkey.
data: l_node_text type lvc_value.
* set item-layout
data: lt_item_layout type lvc_t_layi,
ls_item_layout type lvc_s_layi.
ls_item_layout-fieldname = tree1->c_hierarchy_column_name.
ls_item_layout-class = cl_gui_column_tree=>item_class_checkbox.
ls_item_layout-editable = 'X'.
append ls_item_layout to lt_item_layout.
l_node_text = ps_sorder-posnr.
data: ls_node type lvc_s_layn.
ls_node-n_image = space.
ls_node-exp_image = space.
call method tree1->add_node
exporting
i_relat_node_key = p_relat_key
i_relationship = cl_gui_column_tree=>relat_last_child
is_outtab_line = ps_sorder
i_node_text = l_node_text
is_node_layout = ls_node
it_item_layout = lt_item_layout
importing
e_new_node_key = p_node_key.
endform. " add_complete_line
form exit_program.
call method tree1->free.
leave program.
endform.
Code Formatted by: Alvaro Tejada Galindo on Feb 14, 2008 9:54 AM
Edited by: Lukasz Sekowski on Feb 14, 2008 4:11 PMI've finally fixed the problem:
there was:
item_selection = space
and should be:
item_selection = 'X'
Maybe you are looking for
-
Itunes crashes with no crash report and won't let me delete the app...
If noone can help me I may seriously lose it... Mactel user with recent crash issues with itunes...crashes consistently about twenty to thirty seconds after opening and offers no crash report...downloaded appzapper and when I try to empty my trash bi
-
How can we get data from One Form to Another Form
Hi All, I have 2Forms.I'm calling one form from another form buy using next form button. If i press itis opening 2nd form,Simultaneously i have to get the data to the 2nd form.Can any one help me in this. Any triggers has to be fire tell me the solut
-
Mapping del credere agent and consignment stockist in sap sd
Dear Gurus My client has trading business with IOCL company acted as a del credere agent and consignment stockist. Generally, IOCL sending the material our company go down. we do the business with the customers and we are paying the amount to the IOC
-
My bookmarks are disappearing/reappearing randomly and I cannot save new ones
Since this morning 8/17 I have had an odd problem with my bookmarks. Initially both my Blogs and News and Views sub-folders came up empty while nothing else was affected and the bookmarks in them were not to be found elsewhere. Later, after a reboot,
-
I can't open attachments from g.mail in my email messages .
This week i have not been able to open attachments sent from g.mail users. Can anyone help ?