Handling ALV Toolbar in Customized Global Class
Hi Experts!!
We have a global class ZCL_TEST_DISP in which there is a private attribute go_grid TYPE REF TO cl_gui_alv_grid. Now in this custom class, we have methods like SET_DISPLAY, EXCLUDE_TOOLBAR etc in which instance of go_grid is created and methods of cl_gui_alv_grid are called.
Now my requirement is to create a new pushbutton in ALV output. I know how to do it normally. I checked BCALV_GRID_05 for this. But as instance of grid is in ZCL_TEST_DISP, I must create methods to hanle toolbar using this class only. I am wondering how to proceed.
Can somebody please help me out?
Thanks a lot.
Checked an existing global class as reference and solved.
Similar Messages
-
Global classes / Doppelclick
Hello Every Body,
please can someone tell me how can implement Doppelclick using Global classes.!!
Best regards.
danielHello Daniel
I assume you want to handle DOUBLE_CLICK events of controls (e.g. ALV grid, tree) using global classes.
That's a piece of cake. Below I outline a possible procedure:
(1) Create your control instance (e.g. go_grid, CL_GUI_ALV_GRID)
(2) Create an instance of your global class. The CONSTRUCTOR method may look like this:
CREATE OBJECT go_myclass
EXPORTING
io_instance = go_grid. " Assumption: class should only handle ALV grid events
METHOD constructor.
me->mo_grid = io_instance. " class may have instance attribute for grid instance
me->set_handler( ). " perhaps private method for setting event handler
ENDMETHOD.
METHOD set_handler.
SET HANDLER: handle_double_click FOR me->mo_grid.
ENDMETHOD.
(3) Create an event handler method (e.g. HANDLE_DOUBLE_CLICK for event DOUBLE_CLICK of cl_gui_alv_grid) within your global class.
That's it. As soon as the user double-clicks on a row in the ALV grid (go_grid) the method HANDLE_DOUBLE_CLICK of your global class will be called to handle the event.
Regards
Uwe -
Major global classes used in abap objects
Hi,
I am new to the abap objects and till now i am to understand that the role of the global classes are important in the abap object program. I had tried to search on the net but i was not able to get the desired result.
I want to know which are the major global classes which are used in the ABAP objects.
Plzz provide me guidelines for it.Ricx,
It depends on your requirement.
For alv's we use these global classes. For Webdynpro related alv we use different global classes.
CL_GUI_ALV_GRID (List Viewer)
CL_GUI_ALV_GRID_BASE (Basis Class for ALV grid)
CL_GUI_ALV_TREE (ALV Tree Control)
CL_GUI_ALV_TREE_SIMPLE (Simple ALV Tree)
CL_ALV_TABLE_CREATE (Dynamic Creation of ALV Data Table)
CL_ALV_TREE_BASE (Basis Class ALV Tree Control)
CL_CK_ALVTREE_NKEY_2_OBJECT (Converter Node Key Object)
CL_ALV_EVENT_DATA (Changing Data Container for Events)
CL_ALV_EVENT_TOOLBAR_SET (ALV Context menu)
Regards,
Arun. -
Event handling in global class (abap object)
Hello friends
I have 1 problem regarding events in abap object... how to handel an event in global class in se24 .
Regards
Reema jain.
Message was edited by:
Reema JainHello Reema
The following sample report shows how to handle event in principle (see the § marks)..
The following sample report show customer data ("Header"; KNB1) in the first ALV list and sales areas ("Detail"; KNVV) for the selected customer (event double-click) in the second ALV list.
*& Report ZUS_SDN_TWO_ALV_GRIDS
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_knb1 TYPE STANDARD TABLE OF knb1,
gt_knvv TYPE STANDARD TABLE OF knvv.
"§1. Define and implement event handler method
" (Here: implemented as static methods of a local class)
* 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' ).
ENDMETHOD. "handle_double_click
ENDCLASS. "lcl_eventhandler IMPLEMENTATION
START-OF-SELECTION.
SELECT * FROM knb1 INTO TABLE gt_knb1
WHERE bukrs = '1000'.
* 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.
"§2. Set event handler (after creating the ALV instance)
SET HANDLER: lcl_eventhandler=>handle_double_click FOR go_grid1. " Or:
" SET HANDLER: lcl_eventhandler=>handle_double_click FOR all instances.
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 = '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
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,
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
Regards
Uwe -
Add on custom button to ALV toolbar in std tcode ME51N, ME52N and ME53N.
Hi All,
I have the requirement to add on the custom button to ALV toolbar in ITEM OVERVIEW for standard transaction ME51N, ME52N and ME53N. Does anyone know what enhancement point or user exit i should apply and how i can add on the custom button?
Thanks.There are no user exits or badi's for COOIS. You may have to make copy of the PPIO_ENTRY to ZPPIO_ENTRY including all the varians without changing their names like copy SAP&COOIS to SAP&COOIS. Create a T-Code ZCOOIS and replace COOIS in variant SAP&COOIS to ZCOOIS not in the name of the variant but in the field "Check Authorization for".
The PF-Status is found in the include LCOISOUTPUTF16 which is located in the function group COISOUTPUT you may have to copy that too. Finally you need to copy SAPLCOISOUTPUT with its GUI status GENERAL and add your custom button there. -
How can my custom DCErrorHandler class throw/handle an exception?
I had written a custom DCErrorHandler extending the DCErrorhandlerImpl as similar as shown in SRDemo example.
Assume that i have a method authenticateUser() in AppmoduleService Class calling from Backing Bean.java where in i encountered ArrayOutOfBoundsException. So how can i catch this exception without using try catch block? if i use
try{
authenticateUser();
catch(Exception eX)
{} the exception is well-handled.Then what exactly my customErrorHandler class doing?
Do the above customErrorHandler class help in this case by replacing try-catch?From where my customErrorHandler's methods are invoked.
If i want to do it exlicitly from any method of my backing bean class can i do it?
LoginBackingBean.java
public String loginButton_Action()
ArrayList userDetailsList = null;
LoginService service = (LoginService)ADFUtils.getLoginServiceInterface();
if(service != null)
userDetailsList = service.checkUserLoginDetails(getUsername(), getPassword());
if(userDetailsList != null && userDetailsList.size()>0) {
JSFUtils.storeOnSession("key_loggedUserDetails",userDetailsList);
return "success";
else
JSFUtils.addFacesErrorMessage("You have entered an invalid User name and/or Password.");
return "wrongLogin";
else{
return "wrongLogin";
Now assume that i have customDCErrorHandler class and also assume that an exception will be thrown ..say ArrayOutOfBoundException.
if i keep the above code in try and catch block the user login screen is remained as it is by catching the exception.
if i remove the try and catch block user screen if filled up with so many debugging messages as shown : "500 Internal Server Error
javax.faces.FacesException: #{login.loginButton_Action}: javax.faces.el.EvaluationException: java.lang.IndexOutOfBoundsException: Index: 1, Size: 0 at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:98) at oracle.adf.view.faces.component.UIXCommand.broadcast(UIXCommand.java:211) at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:287) at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:401) at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:95) at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:245) at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:110) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:213)
So can we avoid this by using my customDCErrorHandler ???? If so i need a sample code.
More over if i use a customDCErrorHandler class,
Do i need to bother about the exceptions occuring in the application? -
Hi all,
I am working on handling events in global classes.
but my event is not triggererd,i m not able to find where it's going wrong.
Below is my code.
Global Class:ZCL_TEST_EVENT
events :EXCEEDEDRANGE
methods:CHECKRANGE,DISPLAYVENDOR.
Checkrange is event handler for exceededrange.
below is the code for methods.
method checkrange.
write:/ 'Vendor not within the range'(001).
exit.
endmethod.
method displayvendor.
DATA : exlfa1 TYPE lfa1.
IF imlifnr NOT BETWEEN 1000 AND 2000.
RAISE EVENT exceededrange.
ENDIF.
SELECT SINGLE * FROM lfa1
INTO exlfa1
WHERE lifnr = imlifnr
IF sy-subrc = 0.
WRITE : / exlfa1-lifnr,exlfa1-name1.
ELSE.
WRITE : / 'No vendor found'(002).
ENDIF.
endmethod.
below is the report I developed.
REPORT ztest_113.
parameters :plifnr type lfa1-lifnr obligatory.
data : obj type ref to ZCL_TEST_EVENT.
START-OF-SELECTION.
CREATE OBJECT obj.
CALL METHOD obj->displayvendor
EXPORTING
imlifnr = plifnr
Please helpYes, you do need to write the SET HANDLER statement. As per your current design, you can set the event handler in your method CONSTRUCTOR. Like:
method constructor.
SET HANDLER me->CHECKRANGE FOR me.
endmethod.
Regards,
Naimesh Patel -
Global class event handler not called
I am having a problem where I created a function module that instatiates an application log class. This application log class has methods ON_* for public events of other classes.
The function module then processes its routines and as a result some of these events are raised. Ex: The function module creates a Purchase order and in that class I have a public even PO_CREATED that is raised upon succesfull creation of the PO. The global class APPLICATION_LOG I created has a method ON_PO_CREATED for event PO_CREATED of class ZCL_MAT_PO.
I put a break point in the APPLICATION LOG method but is os not called.
ANy idea of what Iam doing wrong or missing?
Thanks,
LeoHi Leo, did you set the handler method?
SET HANDLER <method_name> FOR <object>.
Regards,
Rich Heilman -
Should Standard Toolbar FIND work on an ALV within a custom container ?
I have an ALV in a custom container on a screen.
The FIND and FIND NEXT of the ALV toolbar work fine against the grid.
Should the FIND and FIND NEXT of the standard toolbar also work against the ALV if they are "activate" in the GUI status?
If so, what do I call/execute in response to the "FIND" ok-code?
I've tried calling the function ALV_POPUP_TO_SEARCH2 and the popup comes up, but it doesn't do anything.
Please advise at your earliest convenience.
Thanks
djhHi Rich,
Absolutely. Especially as they can paint the picture, and then blame the techies when their fiction is exposed.
Similarly, we had a situation where the Expense Report WD was failing, and the functional person ensured that everyone knew it was a technical problem and therefore my fault (with SAP as the popular co-conspirator).
Sadly the message above the Java stack messages was "No entry in table T706Z for argument ' '". Had the functional check their config and all was well. No one apologised though......
Last week at a different site the same thing happened (this time with TA20C) but the funky took one look at it and reviewed their config to solve - so they're not ALL the same.
Cheers
Gareth -
How to insert the new toolbar icons to a ALV report in custom container
Hi,
I found the exporting parameter for excluding the toolbar icons in the method "set_table_for_first_display" but I didn't find any parameter for including the new toolbar icons. I do not want to include the toolbar icons through the PF-Status, but want to include them with the method. Please tell me is there any option of including toolbar icons with using the above method.
Thanks,
Srinivas.Hi Srinivas,
Refer to the link
Adding buttons to standard alv toolbar in OOALV
Thanks -
Menu Button in ALV toolbar (multiple choices for a button)
Hi abapers,
I would like to have a button with multiple choices in the toolbar;
at the moment I have created a menu button with just one function.
Here is my code:
CLASS lcl_event_receiver (Definition)
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS:
handle_toolbar
FOR EVENT toolbar OF cl_gui_alv_grid
IMPORTING e_object e_interactive.
ENDCLASS. "lcl_event_receiver DEFINITION
CLASS lcl_event_receiver (Implementation)
CLASS lcl_event_receiver IMPLEMENTATION.
METHOD handle_toolbar.
DATA: ls_toolbar TYPE stb_button.
*Separator
CLEAR ls_toolbar.
MOVE 3 TO ls_toolbar-butn_type.
APPEND ls_toolbar TO e_object->mt_toolbar.
*Button
CLEAR ls_toolbar.
MOVE 1 TO ls_toolbar-butn_type.
MOVE 'EDIT' TO ls_toolbar-function.
MOVE icon_change TO ls_toolbar-icon.
MOVE ' Modifica'(l02) TO ls_toolbar-text.
MOVE ' ' TO ls_toolbar-disabled.
MOVE 'Modifica' TO ls_toolbar-quickinfo.
APPEND ls_toolbar TO e_object->mt_toolbar.
ENDMETHOD. "handle_toolbar
ENDCLASS. "lcl_event_receiver IMPLEMENTATIONhi,
check this code and reward me if it helps you..
TYPE-POOLS : slis,icon.
*Structure declaration for tcodes
TYPES : BEGIN OF ty_table,
tcode TYPE tcode,
pgmna TYPE progname,
END OF ty_table.
*Structure for tocde text
TYPES : BEGIN OF ty_itext,
tcode TYPE tcode,
ttext TYPE ttext_stct,
sprsl TYPE sprsl,
END OF ty_itext.
*Structure for output display
TYPES : BEGIN OF ty_output,
tcode TYPE tcode,
pgmna TYPE progname,
ttext TYPE ttext_stct,
END OF ty_output.
*internal table and work area declarations
DATA : it_table TYPE STANDARD TABLE OF ty_table INITIAL SIZE 0,
it_output TYPE STANDARD TABLE OF ty_output INITIAL SIZE 0,
it_ittext TYPE STANDARD TABLE OF ty_itext INITIAL SIZE 0,
wa_table TYPE ty_table,
wa_output TYPE ty_output,
wa_ittext TYPE ty_itext.
*Class definition for ALV toolbar
CLASS: lcl_alv_toolbar DEFINITION DEFERRED.
*Declaration for toolbar buttons
DATA : ty_toolbar TYPE stb_button.
Data declarations for ALV
DATA: c_ccont TYPE REF TO cl_gui_custom_container, "Custom container object
c_alvgd TYPE REF TO cl_gui_alv_grid, "ALV grid object
it_fcat TYPE lvc_t_fcat, "Field catalogue
it_layout TYPE lvc_s_layo, "Layout
c_alv_toolbar TYPE REF TO lcl_alv_toolbar, "Alv toolbar
c_alv_toolbarmanager TYPE REF TO cl_alv_grid_toolbar_manager. "Toolbar manager
*Initialization event
INITIALIZATION.
*Start of selection event
START-OF-SELECTION.
*Subroutine to get values from tstc table
PERFORM fetch_data.
*subroutine for alv display
PERFORM alv_output.
CLASS lcl_alv_toolbar DEFINITION
ALV event handler
CLASS lcl_alv_toolbar DEFINITION.
PUBLIC SECTION.
*Constructor
METHODS: constructor
IMPORTING
io_alv_grid TYPE REF TO cl_gui_alv_grid,
*Event for toolbar
on_toolbar
FOR EVENT toolbar
OF cl_gui_alv_grid
IMPORTING
e_object.
ENDCLASS. "lcl_alv_toolbar DEFINITION
CLASS lcl_alv_toolbar IMPLEMENTATION
ALV event handler
CLASS lcl_alv_toolbar IMPLEMENTATION.
METHOD constructor.
Create ALV toolbar manager instance
CREATE OBJECT c_alv_toolbarmanager
EXPORTING
io_alv_grid = io_alv_grid.
ENDMETHOD. "constructor
METHOD on_toolbar.
Add customized toolbar buttons.
variable for Toolbar Button
ty_toolbar-icon = icon_generate.
ty_toolbar-butn_type = 0.
ty_toolbar-text = 'Button1'.
APPEND ty_toolbar TO e_object->mt_toolbar.
ty_toolbar-icon = icon_voice_output.
ty_toolbar-butn_type = 0.
ty_toolbar-text = 'Button2'.
APPEND ty_toolbar TO e_object->mt_toolbar.
ty_toolbar-icon = icon_phone.
ty_toolbar-butn_type = 0.
ty_toolbar-text = 'Button3'.
APPEND ty_toolbar TO e_object->mt_toolbar.
ty_toolbar-icon = icon_mail.
ty_toolbar-butn_type = 0.
ty_toolbar-text = 'Button4'.
APPEND ty_toolbar TO e_object->mt_toolbar.
ty_toolbar-icon = icon_voice_input.
ty_toolbar-butn_type = 0.
ty_toolbar-text = 'Button5'.
APPEND ty_toolbar TO e_object->mt_toolbar.
Call reorganize method of toolbar manager to
display the toolbar
CALL METHOD c_alv_toolbarmanager->reorganize
EXPORTING
io_alv_toolbar = e_object.
ENDMETHOD. "on_toolbar
ENDCLASS. "lcl_alv_toolbar IMPLEMENTATION
*& Form fetch_data
text
--> p1 text
<-- p2 text
FORM fetch_data .
Select the tcodes upto 200 rows from TSTC
SELECT tcode
pgmna
FROM tstc
INTO CORRESPONDING FIELDS OF TABLE it_table
UP TO 200 ROWS
WHERE dypno NE '0000'.
*Select the tcode textx
IF it_table[] IS NOT INITIAL.
SELECT ttext
tcode
sprsl
FROM tstct
INTO CORRESPONDING FIELDS OF TABLE it_ittext
FOR ALL ENTRIES IN it_table
WHERE tcode = it_table-tcode
AND sprsl = 'E'.
ENDIF.
Apppending the data to the internal table of ALV output
LOOP AT it_table INTO wa_table.
wa_output-tcode = wa_table-tcode.
wa_output-pgmna = wa_table-pgmna.
For texts
READ TABLE it_ittext INTO wa_ittext WITH KEY tcode = wa_table-tcode.
wa_output-ttext = wa_ittext-ttext.
APPEND wa_output TO it_output.
CLEAR wa_output.
ENDLOOP.
ENDFORM. " fetch_data
*& Form alv_output
text
--> p1 text
<-- p2 text
FORM alv_output .
*Calling the ALV
CALL SCREEN 0600.
ENDFORM. " alv_output
Calling the ALV screen with custom container
On this statement double click it takes you to the screen painter SE51.Enter the attributes
*Create a Custom container and name it CC_CONT and OK code as OK_CODE.
*Save check and Activate the screen painter.
Now a normal screen with number 600 is created which holds the ALV grid. PBO of the actual screen , Here we can give a title and *customized menus
*& Module STATUS_0600 OUTPUT
text
MODULE status_0600 OUTPUT.
SET PF-STATUS 'xxxxxxxx'.
SET TITLEBAR 'xxx'.
ENDMODULE. " STATUS_0600 OUTPUT
calling the PBO module ALV_GRID.
*& Module ALV_GRID OUTPUT
text
MODULE alv_grid OUTPUT.
*create object for custom container
CREATE OBJECT c_ccont
EXPORTING
container_name = 'CC_CONT'.
*create object of alv grid
CREATE OBJECT c_alvgd
EXPORTING
i_parent = c_ccont.
create ALV event handler
CREATE OBJECT c_alv_toolbar
EXPORTING
io_alv_grid = c_alvgd.
Register event handler
SET HANDLER c_alv_toolbar->on_toolbar FOR c_alvgd.
Fieldcatalogue for ALV
PERFORM alv_build_fieldcat.
ALV attributes FOR LAYOUT
PERFORM alv_report_layout.
CHECK NOT c_alvgd IS INITIAL.
Call ALV GRID
CALL METHOD c_alvgd->set_table_for_first_display
EXPORTING
is_layout = it_layout
CHANGING
it_outtab = it_output
it_fieldcatalog = it_fcat
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
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.
ENDMODULE. " ALV_GRID OUTPUT
*& Form alv_build_fieldcat
text
<--P_IT_FCAT text
FORM alv_build_fieldcat.
DATA lv_fldcat TYPE lvc_s_fcat.
CLEAR lv_fldcat.
lv_fldcat-row_pos = '1'.
lv_fldcat-col_pos = '1'.
lv_fldcat-fieldname = 'TCODE'.
lv_fldcat-tabname = 'IT_OUTPUT'.
lv_fldcat-outputlen = 8.
lv_fldcat-scrtext_m = 'TCODE'.
APPEND lv_fldcat TO it_fcat.
CLEAR lv_fldcat.
lv_fldcat-row_pos = '1'.
lv_fldcat-col_pos = '2'.
lv_fldcat-fieldname = 'PGMNA'.
lv_fldcat-tabname = 'IT_OUTPUT'.
lv_fldcat-outputlen = 15.
lv_fldcat-scrtext_m = 'PROGNAME'.
APPEND lv_fldcat TO it_fcat.
CLEAR lv_fldcat.
lv_fldcat-row_pos = '1'.
lv_fldcat-col_pos = '3'.
lv_fldcat-fieldname = 'TTEXT'.
lv_fldcat-tabname = 'IT_OUTPUT'.
lv_fldcat-outputlen = 60.
lv_fldcat-scrtext_m = 'Description'.
APPEND lv_fldcat TO it_fcat.
CLEAR lv_fldcat.
ENDFORM. " alv_build_fieldcat
*& Form alv_report_layout
text
<--P_IT_LAYOUT text
FORM alv_report_layout.
it_layout-cwidth_opt = 'X'.
it_layout-zebra = 'X'.
ENDFORM. " alv_report_layout
PAI module of the screen created. In case we use an interactive ALV or
*for additional functionalities we can create OK codes
*and based on the user command we can do the coding.
*& Module USER_COMMAND_0600 INPUT
text
MODULE user_command_0600 INPUT.
ENDMODULE. " USER_COMMAND_0600 INPUT
thanks,
gupta -
ALV-Toolbar : Control the &LOCAL& Buttons
Hi, all
I have the following problem with ALV-Toolbar.
If I use editable ALV-Grid Control, I get in the toolbar new buttons such as DELETE_ROW or UNDO. This buttons dont trigger any events of the class CL_GUI_ALV_GRID.
If I look at Function Code of such buttons in the Table mt_toolbar they are quiet similar. All of them have &LOCAL& .
How could I control this buttons with my program .
Many thanks for your help
Vladimir GolovtchinerHello Anand,
Thank you for your answers.
I thought that these buttons are belonged to Front-End.
I hope that ALV-Grid is an OCX. Or not? If it is an OCX-Object, is it possible to communicate with it?
I have no any idea now, how to solve that, but I could explain to you why I need to handle these buttons.
I use an editable Grid of CL_GUI_ALV_GRID. For the last two columns I use Drag and Drop to move data from the pre-last column to the last column. It work properly until the following situation:
For example I have two rows in a Grid. I place the cursor to the last row and press the button COPY_ROW two times ( I have 4 rows in a Grid now). Immediately after that I try to do Drag&Drop at the last row (4th) from the Grid. As I drop the cursor on the last cell of the last row I get always the result in the last cell of the 2nd row ( the last row before I insert two rows).
It doesnt matter how many rows I had or how many rows I inserted to the Grid. It happens also in the middle of the Grid not only at the end.
After the first Drag&Drop it begins to work properly.
I debugged the handler of Drag&Drop and I saw that the Drag&Drop object has in the structure E_ROW each time the number of the last row before insertion. I forced the update of backend in the handle of on Drag event with CHECK_CHANGED_DATA before I create the Drag&Drop object and passed the Drag&Drop handle to the internal table. It didnt work.
That is why I thought that I should do this update after each insertion or deletion with these buttons.
In other words I dont want to change the functionality of these buttons I want to add something before.
Best regards
Vladimir Golovtchiner -
How to use global classes and display returned data?
Hello experts,
I have the following code in a program which accesses a global class (found in the class library). It executes one it's static methods. What I would like to do is to get hold of some elements of the returned data. How do I do that please?
Your help is greatly appreciated.
***Use global class CL_ISU_CUSTOMER_CONTACT
DATA: o_ref TYPE REF TO CL_ISU_CUSTOMER_CONTACT.
DATA: dref_tab LIKE TABLE OF O_ref.
DATA: begin OF o_ref2,
CONTACTID TYPE CT_CONTACT,
P_INSTANCES TYPE string,
P_CONTEXT TYPE CT_BPCCONF,
P_CONTROL TYPE ISU_OBJECT_CONTROL_DATA,
P_DATA TYPE BCONTD, "<<<=== THIS IS A STRUCTURE CONTAINING OTHER DATA ELEMENTS
P_NOTICE TYPE EENOT_NOTICE_AUTO,
P_OBJECTS TYPE BAPIBCONTACT_OBJECT_TAB,
P_OBJECTS_WITH_ROLES TYPE BAPIBCONTACT_OBJROLE_TAB,
end of o_ref2.
TRY.
CALL METHOD CL_ISU_CUSTOMER_CONTACT=>SELECT "<<<=== STATIC METHODE & PUBLIC VISIBILITY
EXPORTING
X_CONTACTID = '000001114875' "Whatever value here
RECEIVING
Y_CONTACTLOG = o_ref
ENDTRY.
WHAT I WOULD LIKE TO DO IS TO MOVE o_ref TO o_ref2 and then display:
1) P_DATA-PARTNER
2) P_DATA-ALTPARTNER
How can I do this please?I now have the following code. But when I check for syntax I get different error. They are at the end of the list.
Here is the code the way it stands now:
================================================
***Use global class CL_ISU_CUSTOMER_CONTACT
DATA: oref TYPE REF TO CL_ISU_CUSTOMER_CONTACT.
DATA: dref_tab LIKE TABLE OF oref.
DATA: begin OF oref2,
CONTACTID TYPE CT_CONTACT,
P_INSTANCES TYPE string,
P_CONTEXT TYPE CT_BPCCONF,
P_CONTROL TYPE ISU_OBJECT_CONTROL_DATA,
P_DATA TYPE BCONTD, "THIS IS A STRUCTURE CONTAINING OTHER DATA ELEMENTS
P_NOTICE TYPE EENOT_NOTICE_AUTO,
P_OBJECTS TYPE BAPIBCONTACT_OBJECT_TAB,
P_OBJECTS_WITH_ROLES TYPE BAPIBCONTACT_OBJROLE_TAB,
end of oref2.
TRY.
CALL METHOD CL_ISU_CUSTOMER_CONTACT=>SELECT " STATIC METHODE & PUBLIC VISIBILITY
EXPORTING
X_CONTACTID = '000001114875' "Whatever value here
RECEIVING
Y_CONTACTLOG = oref
ENDTRY.
field-symbols: <FS1> type any table,
<wa_oref2> type any.
create data dref_tab type handle oref. " <<===ERROR LINE
assign dref->* to <FS1>.
Loop at <FS1> assigning <wa_oref2>.
*use <wa_orfe2> to transfer into oref2.
endloop.
write: / 'hello'.
=========================================
Here are the errors I get:
The field "DREF" is unknown, but there is a field with the similar name "OREF" . . . .
When I replace itr by OREF I get:
"OREF" is not a data reference variable.
I then try to change it to dref_tab. I get:
"DREF_TAB" is not a data reference variable.
Any idea? By the way, must there be a HANDLE event for this to work?
Thanks for your help. -
How to display standard ALV toolbar function in Webdynpro ABAP
Hi All,
Could any one please let me know that how to display the standard ALV functions. What I tried is as follows:
data :lr_config_table type ref to cl_salv_wd_config_table.
data lr_function type ref to cl_salv_wd_function_std
Got the reference by calling the get_model().
Now tried to display a standard button say :
CALL METHOD lr_config_table ->if_salv_wd_function_settings~get_function_std
EXPORTING
id = 'SALV_WD_INPUT_INSERT_ROW'
RECEIVING
value = lr_function.
CALL METHOD lr_function->set_visible
EXPORTING
value = cl_wd_uielement=>e_visible-visible.
But I can't see the button added to my ALV toolbar! Could any one please help me out on this if I am missing something.
Many Thanks!
SomnathHi..
ALV report which when displayed normally allows users to insert and delete rows using the methods below from class Cl_Salv_Wd_Config_Table:
I think add these lines to your code and check..
IF_SALV_WD_TABLE_SETTINGS~SET_READ_ONLY (false)
IF_SALV_WD_STD_FUNCTIONS~SET_EDIT_INSERT_ROW_ALLOWED (true).
DATA: l_ref_cmp_usage TYPE REF TO if_wd_component_usage.
l_ref_cmp_usage = wd_this->wd_cpuse_alv_basic( ).
IF l_ref_cmp_usage->has_active_component( ) IS INITIAL.
l_ref_cmp_usage->create_component( ).
ENDIF.
DATA l_salv_wd_table TYPE REF TO iwci_salv_wd_table.
l_salv_wd_table = wd_this->wd_cpifc_alv_basic( ).
DATA l_table TYPE REF TO cl_salv_wd_config_table.
l_table = l_salv_wd_table->get_model( ).
l_table->if_salv_wd_table_settings~set_read_only( abap_false ).
l_table->if_salv_wd_std_functions~set_edit_append_row_allowed( abap_false ).
l_table->if_salv_wd_std_functions~set_edit_insert_row_allowed( abap_false ).
l_table->if_salv_wd_std_functions~set_edit_delete_row_allowed( abap_false ).
Cheers,
Kris. -
Long Text of a custom message class on a pop up screen
Hi All,
I have a custom message class and i have few custom messages with short text and long texts.
Then i have a ALV report output which displays the message class and message number and my requirement is when i do F1 on the message number i want the long text to be displayed on a popup screen
Can anyone give me an idea as how to approach this
Thanks in advancehi,
try the below code.
DATA: HELPINFO LIKE HELP_INFO.
DATA: LONGTEXT LIKE TLINE OCCURS 1 WITH HEADER LINE.
DATA: EXCLUDEFUN LIKE SY-UCOMM OCCURS 1 WITH HEADER LINE.
longtext-tdline = 'Sales Order test help'.
append longtext.
CALL FUNCTION 'HELP_DOCULINES_SHOW'
EXPORTING
CUCOL = 10
CUROW = 3
HELP_INFOS = HELPINFO
LINENR = 1
TABLES
EXCLUDEFUN = EXCLUDEFUN
HELPLINES = LONGTEXT
Maybe you are looking for
-
How can i export my video on iMovie 11?
i have a 13 minute 1080p video that says it cannot export either because theres no room in heaping zone (which can't be right because i just bought this computer) or theres a parameter list error, i really want to export it in 1080p, how do i fix it?
-
Problem using MDX functions in Answers Filter
I'm using OBIEE 10.1.3.2. I'm using an Essbase cube as my datasource (aggregate storage). My level 0 members in my Date dimension are of the format yyyy-mm-dd (e.g., 2011-08-13) I have a dashboard prompt selecting the date from a calendar which retur
-
Revision: 3246 Author: [email protected] Date: 2008-09-17 15:31:25 -0700 (Wed, 17 Sep 2008) Log Message: Fix fasttrack bug SDK-16910 - Simple List populated with strings throws RTE. This is fallout from the Group/DataGroup split. DefaultItemRenderer
-
Good morning, Does a trigger of a view start like a trigger of a table ? I mean, a view searches its data in a table of a linked DB. If a row is added in the table, will the trigger of the view run ? Thank you very much. Patrick
-
Windows 7 and Blackberry Desktop 6
I have written about this problem in the past, but found no help. Under Windows 7, Blackberry Desktop 5 works just fine, but Desktop 6 crashes as it attempts to sync with Yahoo. (Yes, I do remove 5 before installing 6.) The Event log shows the follow