http://www.saptechnical.com/Tutorials/ALV/Docking/Index.htm 1/4 Search Home Qui z Ti ps Tutori al s Functi onal Cert Q's I ntervi ew Q's Jobs Testi moni al s Adverti se Contact Us Document Categories: ABAP TM Adobe Forms ABAP-HR ALE & IDocs ALV BAPI BASIS BSP Business Objects Business Workflow CRM NEW LSMW SAP Script/Smart Forms BI/BW eXchange Infrastructure (XI) Enterprise Portals (EP) eCATT Object Oriented Programming SAP Query Userexits/BADIs WebDynpro for Java/ABAP TM Others What's New? Understanding Advance with dialog option of SAP Workflow SAP Workflow Scenario: Maintenance Notification Approval Enhancements to a standard class Working with Floating Field in Adobe Forms Inserting data from Internal Table into the step Send Mail Display GL Account long text using enhancement framework Differences between polymorphism in JAVA and ABAP Passing multiline parameters from an ABAP Class event to a Workflow container Concept of Re-evaluate agents for active work items in SAP Workflow Dynamic creation of component usage in ABAP WebDynpro Adobe Forms: Display symbols like copyright and others Deactivate Hold functionality in Purchase order (ME21N) Quiz on OOABAP Add fields in FBL5N using Displaying ALV using a Docking Container By Sandeep Patel, I-novate Technologies Objective This program is used to display Docking Container. Sometimes we get the requirement to place the container at any corner as resizable Ex: ALV and selection parameters in same Screen. To serve purpose we will go for docking container. Introduction As we know that a SAP Container is a control that accommodates other controls, such as the SAP Tree Control, SAP Picture Control, SAP Text edit Control, SAP Splitter Control, and so on. It manages these controls logically in a collection, and provides a physical area in which they are displayed. All controls live in a container. Since containers are themselves controls, you can nest them. There are five kinds of SAP Containers: SAP Custom Container: display controls in an area defined on a normal screen using the Screen Painter. Class: CL_GUI_CUSTOM_CONTAINER SAP Dialog Box Container: display controls in a modal dialog box or full screen. Class: CL_GUI_DIALOGBOX_CONTAINER SAP Docking Container: The SAP Docking Container allows you to attach a control to any of the four edges of a screen as a resizable screen area. You can also detach it so that it becomes an independent modal dialog box. Class: CL_GUI_DOCKING_CONTAINER SAP Splitter Container: to display more than one control in a given area by dividing it into cells. Class: CL_GUI_SPLITTER_CONTAINER SAP Easy Splitter Container: this container allows us to divide an area into two cells with a control in each. The cells are separated by a moveable splitter bar. Class: CL_GUI_EASY_SPLITTER_CONTAINER. Here we display the functionality of docking container. SAP Docking container can be attached on or more areas of screen. To reattach the docking container to a different edge of the screen we use DOCK_AT method. To switch the status of the Docking Container between fixed (docking) and free (floating) we use the method FLOAT. We can use docking container in web Dynpro and sub screen also. Below is the Example of Docking Container. Code Snippet REPORT z75_docking MESSAGE-ID yxnmc. TABLES: mara. *---------------------------------------------------------------------* * W O R K A R E A S * *---------------------------------------------------------------------*
8/28/2014 SAPTechnical.COM - ALV in a docking container http://www.saptechnical.com/Tutorials/ALV/Docking/Index.htm 2/4 BADIs Tutorial on Wide casting Defining a Range in Module Pool Program Copy fields from one structure/table into another structure/table Side Panel Usage in NWBC Introduction to SAP Event Management Display Statistical Report using Function Module Adding Explicit Enhancement to custom program SAP BODS - Beginners guide Contribute? Sample Specs What's Hot? Web Dynpro for ABAP Tutorials Join the Mailing List Enter name and email address below: Name: Email: Subscribe Unsubscribe GO DATA: * Material Data BEGIN OF wa_mara, matnr TYPE mara-matnr, " Material No. mtart TYPE mara-mtart, " Material Type bismt TYPE mara-bismt, " Old material No. matkl TYPE mara-matkl, " Material group meins TYPE mara-meins, " Base Unit of Measure brgew TYPE mara-brgew, " Gross Weight ntgew TYPE mara-ntgew, " Net Weight gewei TYPE mara-gewei, " Weight Unit END OF wa_mara, * Field Catalog wa_fieldcat TYPE lvc_s_fcat. *---------------------------------------------------------------------* * I N T E R N A L T A B L E S * *---------------------------------------------------------------------* DATA: * For Material Data t_mara LIKE STANDARD TABLE OF wa_mara, * For Field Catalog t_fieldcat TYPE lvc_t_fcat. *---------------------------------------------------------------------* * W O R K V A R I A B L E S * *---------------------------------------------------------------------* DATA: * User Command ok_code TYPE sy-ucomm, * Reference Variable for Docking Container r_dock_container TYPE REF TO cl_gui_docking_container, * Reference Variable for alv grid r_grid TYPE REF TO cl_gui_alv_grid. *---------------------------------------------------------------------* * S T A R T O F S E L E C T I O N * *---------------------------------------------------------------------* START-OF-SELECTION. * To Display the Data PERFORM display_output. *&--------------------------------------------------------------------* *& Form display_output * *&--------------------------------------------------------------------* * To Call the screen & display the output * *---------------------------------------------------------------------* * There are no interface parameters to be passed to this subroutine.* *---------------------------------------------------------------------* FORM display_output . * To fill the Field Catalog PERFORM fill_fieldcat USING : 'MATNR' 'T_MARA' 'Material No.', 'MTART' 'T_MARA' 'Material Type', 'BISMT' 'T_MARA' 'Old Material No.', 'MATKL' 'T_MARA' 'Material Group', 'MEINS' 'T_MARA' 'Base Unit of Measure', 'BRGEW' 'T_MARA' 'Gross Weight', 'NTGEW' 'T_MARA' 'Net Weight', 'GEWEI' 'T_MARA' 'Weight Unit'. CALL SCREEN 500. ENDFORM. " Display_output *&--------------------------------------------------------------* *& Form FILL_FIELDCAT * *&--------------------------------------------------------------* * To Fill the Field Catalog * *---------------------------------------------------------------* 8/28/2014 SAPTechnical.COM - ALV in a docking container http://www.saptechnical.com/Tutorials/ALV/Docking/Index.htm 3/4 * Three Parameters are passed * * pv_field TYPE any for Field * * pv_tabname TYPE any for Table Name * * pv_coltext TYPE any for Header Text * *---------------------------------------------------------------* FORM fill_fieldcat USING pv_field TYPE any pv_tabname TYPE any pv_coltext TYPE any . wa_fieldcat-fieldname = pv_field. wa_fieldcat-tabname = pv_tabname. wa_fieldcat-coltext = pv_coltext. APPEND wa_fieldcat TO t_fieldcat. CLEAR wa_fieldcat. ENDFORM. " FILL_FIELDCAT Create the Screen 0500. Flow Logic for Screen 500. *&---------------------------------------------------------------------* *& Module STATUS_0500 OUTPUT * *&---------------------------------------------------------------------* * To Set GUI Status & Title * *----------------------------------------------------------------------* MODULE status_0500 OUTPUT. SET PF-STATUS 'STATUS'. SET TITLEBAR 'TITLE'. ENDMODULE. " STATUS_0500 OUTPUT *&---------------------------------------------------------------------* *& Module CREATE_OBJECTS OUTPUT * *&---------------------------------------------------------------------* * To Call the Docking Container & Display Method * *----------------------------------------------------------------------* MODULE create_objects OUTPUT. * Create a Docking container and dock the control at right side of screen CHECK r_dock_container IS INITIAL. CREATE OBJECT r_dock_container EXPORTING side = cl_gui_docking_container=>dock_at_right extension = 780 caption = 'Materials' EXCEPTIONS cntl_error = 1 cntl_system_error = 2 create_error = 3 lifetime_error = 4 lifetime_dynpro_dynpro_link = 5 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 sy-subrc <> 0. * To Create the Grid Instance CREATE OBJECT r_grid EXPORTING i_parent = r_dock_container EXCEPTIONS error_cntl_create = 1 error_cntl_init = 2 error_cntl_link = 3 error_dp_create = 4 OTHERS = 5. 8/28/2014 SAPTechnical.COM - ALV in a docking container http://www.saptechnical.com/Tutorials/ALV/Docking/Index.htm 4/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. " IF sy-subrc <> 0. * Formatted Output Table is Sent to Control CALL METHOD r_grid->set_table_for_first_display CHANGING it_outtab = t_mara it_fieldcatalog = t_fieldcat * it_sort = * it_filter = 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. " IF sy-subrc <> 0. ENDMODULE. " CREATE_OBJECTS OUTPUT *&---------------------------------------------------------------------* *& Module USER_COMMAND_0500 INPUT * *&---------------------------------------------------------------------* * To Fetch the Material Data & Refresh Table after get User Command* *----------------------------------------------------------------------* MODULE user_command_0500 INPUT. CASE ok_code. WHEN 'EXECUTE'. SELECT matnr " material no. mtart " material type bismt " old material no. matkl " material group meins " base unit of measure brgew " gross weight ntgew " net weight gewei " weight unit FROM mara INTO TABLE t_mara WHERE mtart = mara-mtart. IF sy-subrc <> 0. ENDIF. " IF sy-subrc EQ 0. CALL METHOD r_grid->refresh_table_display. WHEN 'BACK' OR 'CANCEL' OR 'EXIT'. LEAVE TO SCREEN 0. ENDCASE. " CASE ok_code. ENDMODULE. " USER_COMMAND_0500 INPUT Click here to continue... Please send us your feedback/suggestions at webmaster@SAPTechnical.COM Home Contribute About Us Privacy Terms Of Use Disclaimer Safe Companies: Advertise on SAPTechnical.COM | Post Job Contact Us 2006-2007 SAPTechni cal .COM. Al l ri ghts reserved. Al l product names are trademarks of thei r respecti ve compani es. SAPTechni cal .COM i s i n no way affi l i ated wi th SAP AG. SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver, and and any other SAP trademarks are regi stered trademarks of SAP AG i n Germany and i n several other countri es. Every effort i s made to ensure content i ntegri ty. Use i nformati on on thi s si te at your own ri sk. Graphic Design by Round the Bend Wizards