Grid using Object Oriented View

Can anyone send me program for grid using object oriented view.

hi Sandeep,
please look at this code
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.
Look this code*****
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.
LOOk this code also.*********
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
***************report over***************
HOPE THIS CODE HELPS U
Reward if its useful.............
thanks and regards
suma sailaja

Similar Messages

  • ALV grid using Object oriented programming

    Hi,
    I need to display a report with 14 fields of which some fields need sub totals and some fields need average values and some other fields require both subtotals and totals. But if I need only the subtotals. I'm not able to find a way for doing so. Please help.
    Thanks and regards
    Radhika

    You will have to specify DO_SUM = X for the fields which you want to totalled or sub-totalled and set DO_SUM = C for getting the average of the field. This needs to be done in the field catalog.
    Also, specify the SORT criteria for the doing the sub-totals in the IT_SORT table, of the SET_TABLE method or the user can do that himself in the report.
    Regards,
    Ravi
    Note - Please mark all the helpful answers

  • Adding color to a row in alv grid not using object oriented.

    Hello Gurus.
    I want to display a row in  color in alv grid using normal alv,  not by using object oriented programming.
    I am having one of the field say spart ie division in internal table itab.
    The spart has values like 12 , 45, 67, 68 ,88 ,99.
    when ever spart is 12 i want to display that row in color format. Here this table is sorted by mblnr so if 1st record is 12 then may be 50 th record will be 12. so when where the record contains the value has 12 then that row should be displayed in color. So please tell me how to do it. Previously i posted the same question but i got is by using object oriented. so please tell me how to do it without using object oriented.
    Thanks for all the replies.

    Check this example code.
    report zrich_0004
           no standard page heading.
    type-pools slis.
    data: fieldcat type slis_t_fieldcat_alv.
    data: begin of imara occurs 0,
          matnr type mara-matnr,
          mtart type mara-mtart,
          maktx type makt-maktx,
          color_line(4) type c,
          tcolor type slis_t_specialcol_alv,  "cell
          end of imara.
    data: xcolor type slis_specialcol_alv.
    start-of-selection.
      perform get_data.
      perform write_report.
    *  Get_Data
    form get_data.
      imara-matnr = 'ABC'.
      imara-mtart = 'ZCFG'.
      imara-maktx = 'This is description for ABC'.
      append imara.
      imara-matnr = 'DEF'.
      imara-mtart = 'ZCFG'.
      imara-maktx = 'This is description for DEF'.
      append imara.
      imara-matnr = 'GHI'.
      imara-mtart = 'ZCFG'.
      imara-maktx = 'This is description for GHI'.
      append imara.
      loop at imara.
        if sy-tabix = 1.
          imara-color_line = 'C410'.   " color line
        endif.
        if sy-tabix = 2.          "color CELL
          clear xcolor.
          xcolor-fieldname = 'MTART'.
          xcolor-color-col = '3'.
          xcolor-color-int = '1'. "Intensified on/off
          xcolor-color-inv = '0'.
          append xcolor to imara-tcolor.
        endif.
        modify imara.
      endloop.
    endform.
    *  WRITE_REPORT
    form write_report.
      data: layout type  slis_layout_alv.
      layout-coltab_fieldname = 'TCOLOR'.
      layout-info_fieldname = 'COLOR_LINE'.
      perform build_field_catalog.
    * CALL ABAP LIST VIEWER (ALV)
      call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                is_layout   = layout
                it_fieldcat = fieldcat
           tables
                t_outtab    = imara.
    endform.
    * BUILD_FIELD_CATALOG
    form build_field_catalog.
      data: fc_tmp type slis_t_fieldcat_alv with header line.
      clear: fieldcat. refresh: fieldcat.
      clear: fc_tmp.
      fc_tmp-reptext_ddic    = 'Material Number'.
      fc_tmp-fieldname  = 'MATNR'.
      fc_tmp-tabname   = 'IMARA'.
      fc_tmp-outputlen  = '18'.
      append fc_tmp to fieldcat.
      clear: fc_tmp.
      fc_tmp-reptext_ddic    = 'Material Type'.
      fc_tmp-fieldname  = 'MTART'.
      fc_tmp-tabname   = 'IMARA'.
      fc_tmp-outputlen  = '4'.
      append fc_tmp to fieldcat.
      clear: fc_tmp.
      fc_tmp-reptext_ddic    = 'Material'.
      fc_tmp-fieldname  = 'MAKTX'.
      fc_tmp-tabname   = 'IMARA'.
      fc_tmp-outputlen  = '40'.
      fc_tmp-emphasize = 'C610'.   " color column
      append fc_tmp to fieldcat.
    endform.
    Regards,
    Rich Heilman

  • How to display horizontal line in top-of-page by using object oriented ALV?

    How to display horizontal line in top-of-page by using object oriented ALV.
    I am created top-of-page in object oriented alv.
    But not be successes in showing horizontal line in it.
    Can any one pls give solution for this..
    Thanks and regards..

    Hi
    Try like this
    data: gt_list_top_of_page type slis_t_listheader. " Top of page text. 
    Initialization. 
    perform comment_build using gt_list_top_of_page[]. 
    form top_of_page. 
    * Note to self: the gif must be loaded into transaction OAOR with 
    * classname 'PICTURES' AND TYPE 'OT' to work with ALV GRID Functions. 
    * I Loaded NOVALOGO2 into system. 
    call function 'REUSE_ALV_COMMENTARY_WRITE' 
         exporting 
    * I_LOGO = 'NOVALOGO2' 
    * i_logo = 'ENJOYSAP_LOGO' 
             it_list_commentary = gt_list_top_of_page. 
    endform. " TOP_OF_PAGE 
    form comment_build using e04_lt_top_of_page type slis_t_listheader. 
    data: ls_line type slis_listheader. 
          clear ls_line. 
          ls_line-typ = 'A'. 
          ls_line-info = 'Special'(001). 
          fgrant = xgrant. 
          concatenate ls_line-info fgrant 
          'Stock Option Report to the board'(002) 
                 into ls_line-info separated by space. 
                        condense ls_line-info. 
          append ls_line to e04_lt_top_of_page. 
    endform. " COMMENT_BUILD
    Use following syntex for footer print in alv:
    * For End of Page
    form END_OF_PAGE.
      data: listwidth type i,
            ld_pagepos(10) type c,
            ld_page(10)    type c.
      write: sy-uline(50).
      skip.
      write:/40 'Page:', sy-pagno .
    endform.
    *  For End of Report
    form END_OF_LIST.
      data: listwidth type i,
            ld_pagepos(10) type c,
            ld_page(10)    type c.
      skip.
      write:/40 'Page:', sy-pagno .
    endform.
    check this link
    http://abapprogramming.blogspot.com/
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/5dc3e690-0201-0010-1ebf-b85b3bed962d
    Changing width of a custom container dynamically
    Display Page numbers in ALV
    Insert picture in selection screen.
    Logo in OO ALV Grid
    Reward all helpfull answers
    Regards
    Pavan

  • How to capture index/row no of row in table using object oriented alv.

    i have a table with many fields. i have an alv grid table displayed using object oriented alv. when i double click on a record, i call another screen. there i want to display the record number. eg, if i doubleclick on the third row, i will go to next screen and display 3 there.
    please let me know how it is done as it is urgent.
    thanks in advance.

    Hi,
    Use the following code to get rowno.
    CLASS lcl_grid_events DEFINITION DEFERRED.
    DATA:
      grid1_events      TYPE REF TO lcl_grid_events.
    CLASS lcl_grid_events DEFINITION.
      PUBLIC SECTION.
        METHODS:
          dbclk
           FOR EVENT double_click  OF cl_gui_alv_grid
           IMPORTING e_row
                     e_column
                     es_row_no.
    ENDCLASS.                    "lcl_grid_events DEFINITION
    CLASS lcl_grid_events IMPLEMENTATION.
      METHOD dbclk.
    *access e_row variable, which contains the record no.
      ENDMETHOD.                    "dbclk
    ENDCLASS.                    "lcl_grid
    write the following code after method call of set_table_for_first_display
        CREATE OBJECT grid1_events.
        SET HANDLER grid1_events->dbclk
                    FOR grid1.
    reward point if useful.

  • Notes on using Object  oriented concept in ABAP

    Hi ,
    I want somes notes on how to use Object  oriented concept in ABAP.
    Thanks in advance.
    Chetan

    Hi, this may help you
    OOPs ABAP uses Classes and Interfaces which uses Methods and events.
    If you have Java skills it is advantage for you.
    There are Local classes as well as Global Classes.
    Local classes we can work in SE38 straight away.
    But mostly it is better to use the Global classes.
    Global Classes or Interfaces are to be created in SE24.
    SAP already given some predefined classes and Interfaces.
    This OOPS concepts very useful for writing BADI's also.
    So first create a class in SE 24.
    Define attributes, Methods for that class.
    Define parameters for that Method.
    You can define event handlers also to handle the messages.
    After creation in each method write the code.
    Methods are similar to ABAP PERFORM -FORM statements.
    After the creation of CLass and methods come to SE38 and create the program.
    In the program create a object type ref to that class and with the help of that Object call the methods of that Class and display the data.
    Example:
    REPORT sapmz_hf_alv_grid .
    Type pool for icons - used in the toolbar
    TYPE-POOLS: icon.
    TABLES: zsflight.
    To allow the declaration of o_event_receiver before the
    lcl_event_receiver class is defined, decale it as deferred in the
    start of the program
    CLASS lcl_event_receiver DEFINITION DEFERRED.
    G L O B A L I N T E R N A L T A B L E S
    *DATA: gi_sflight TYPE STANDARD TABLE OF sflight.
    To include a traffic light and/or color a line the structure of the
    table must include fields for the traffic light and/or the color
    TYPES: BEGIN OF st_sflight.
    INCLUDE STRUCTURE zsflight.
    Field for traffic light
    TYPES: traffic_light TYPE c.
    Field for line color
    types: line_color(4) type c.
    TYPES: END OF st_sflight.
    TYPES: tt_sflight TYPE STANDARD TABLE OF st_sflight.
    DATA: gi_sflight TYPE tt_sflight.
    G L O B A L D A T A
    DATA: ok_code LIKE sy-ucomm,
    Work area for internal table
    g_wa_sflight TYPE st_sflight,
    ALV control: Layout structure
    gs_layout TYPE lvc_s_layo.
    Declare reference variables to the ALV grid and the container
    DATA:
    go_grid TYPE REF TO cl_gui_alv_grid,
    go_custom_container TYPE REF TO cl_gui_custom_container,
    o_event_receiver TYPE REF TO lcl_event_receiver.
    DATA:
    Work area for screen 200
    g_screen200 LIKE zsflight.
    Data for storing information about selected rows in the grid
    DATA:
    Internal table
    gi_index_rows TYPE lvc_t_row,
    Information about 1 row
    g_selected_row LIKE lvc_s_row.
    C L A S S E S
    CLASS lcl_event_receiver DEFINITION.
    PUBLIC SECTION.
    METHODS:
    handle_toolbar FOR EVENT toolbar OF cl_gui_alv_grid
    IMPORTING
    e_object e_interactive,
    handle_user_command FOR EVENT user_command OF cl_gui_alv_grid
    IMPORTING e_ucomm.
    ENDCLASS.
    CLASS lcl_event_receiver IMPLEMENTATION
    CLASS lcl_event_receiver IMPLEMENTATION.
    METHOD handle_toolbar.
    Event handler method for event toolbar.
    CONSTANTS:
    Constants for button type
    c_button_normal TYPE i VALUE 0,
    c_menu_and_default_button TYPE i VALUE 1,
    c_menu TYPE i VALUE 2,
    c_separator TYPE i VALUE 3,
    c_radio_button TYPE i VALUE 4,
    c_checkbox TYPE i VALUE 5,
    c_menu_entry TYPE i VALUE 6.
    DATA:
    ls_toolbar TYPE stb_button.
    Append seperator to the normal toolbar
    CLEAR ls_toolbar.
    MOVE c_separator TO ls_toolbar-butn_type..
    APPEND ls_toolbar TO e_object->mt_toolbar.
    Append a new button that to the toolbar. Use E_OBJECT of
    event toolbar. E_OBJECT is of type CL_ALV_EVENT_TOOLBAR_SET.
    This class has one attribute MT_TOOLBAR which is of table type
    TTB_BUTTON. The structure is STB_BUTTON
    CLEAR ls_toolbar.
    MOVE 'CHANGE' TO ls_toolbar-function.
    MOVE icon_change TO ls_toolbar-icon.
    MOVE 'Change flight' TO ls_toolbar-quickinfo.
    MOVE 'Change' TO ls_toolbar-text.
    MOVE ' ' TO ls_toolbar-disabled.
    APPEND ls_toolbar TO e_object->mt_toolbar.
    ENDMETHOD.
    METHOD handle_user_command.
    Handle own functions defined in the toolbar
    CASE e_ucomm.
    WHEN 'CHANGE'.
    PERFORM change_flight.
    LEAVE TO SCREEN 0.
    ENDCASE.
    ENDMETHOD.
    ENDCLASS.
    S T A R T - O F - S E L E C T I O N.
    START-OF-SELECTION.
    SET SCREEN '100'.
    *& Module USER_COMMAND_0100 INPUT
    MODULE user_command_0100 INPUT.
    CASE ok_code.
    WHEN 'EXIT'.
    LEAVE TO SCREEN 0.
    ENDCASE.
    ENDMODULE. " USER_COMMAND_0100 INPUT
    *& Module STATUS_0100 OUTPUT
    MODULE status_0100 OUTPUT.
    DATA:
    For parameter IS_VARIANT that is sued to set up options for storing
    the grid layout as a variant in method set_table_for_first_display
    l_layout TYPE disvariant,
    Utillity field
    l_lines TYPE i.
    After returning from screen 200 the line that was selected before
    going to screen 200, should be selected again. The table gi_index_rows
    was the output table from the GET_SELECTED_ROWS method in form
    CHANGE_FLIGHT
    DESCRIBE TABLE gi_index_rows LINES l_lines.
    IF l_lines > 0.
    CALL METHOD go_grid->set_selected_rows
    EXPORTING
    it_index_rows = gi_index_rows.
    CALL METHOD cl_gui_cfw=>flush.
    REFRESH gi_index_rows.
    ENDIF.
    Read data and create objects
    IF go_custom_container IS INITIAL.
    Read data from datbase table
    PERFORM get_data.
    Create objects for container and ALV grid
    CREATE OBJECT go_custom_container
    EXPORTING container_name = 'ALV_CONTAINER'.
    CREATE OBJECT go_grid
    EXPORTING
    i_parent = go_custom_container.
    Create object for event_receiver class
    and set handlers
    CREATE OBJECT o_event_receiver.
    SET HANDLER o_event_receiver->handle_user_command FOR go_grid.
    SET HANDLER o_event_receiver->handle_toolbar FOR go_grid.
    Layout (Variant) for ALV grid
    l_layout-report = sy-repid. "Layout fo report
    Setup the grid layout using a variable of structure lvc_s_layo
    Set grid title
    gs_layout-grid_title = 'Flights'.
    Selection mode - Single row without buttons
    (This is the default mode
    gs_layout-sel_mode = 'B'.
    Name of the exception field (Traffic light field) and the color
    field + set the exception and color field of the table
    gs_layout-excp_fname = 'TRAFFIC_LIGHT'.
    gs_layout-info_fname = 'LINE_COLOR'.
    LOOP AT gi_sflight INTO g_wa_sflight.
    IF g_wa_sflight-paymentsum < 100000.
    Value of traffic light field
    g_wa_sflight-traffic_light = '1'.
    Value of color field:
    C = Color, 6=Color 1=Intesified on, 0: Inverse display off
    g_wa_sflight-line_color = 'C610'.
    ELSEIF g_wa_sflight-paymentsum => 100000 AND
    g_wa_sflight-paymentsum < 1000000.
    g_wa_sflight-traffic_light = '2'.
    ELSE.
    g_wa_sflight-traffic_light = '3'.
    ENDIF.
    MODIFY gi_sflight FROM g_wa_sflight.
    ENDLOOP.
    Grid setup for first display
    CALL METHOD go_grid->set_table_for_first_display
    EXPORTING i_structure_name = 'SFLIGHT'
    is_variant = l_layout
    i_save = 'A'
    is_layout = gs_layout
    CHANGING it_outtab = gi_sflight.
    *-- End of grid setup -
    Raise event toolbar to show the modified toolbar
    CALL METHOD go_grid->set_toolbar_interactive.
    Set focus to the grid. This is not necessary in this
    example as there is only one control on the screen
    CALL METHOD cl_gui_control=>set_focus EXPORTING control = go_grid.
    ENDIF.
    ENDMODULE. " STATUS_0100 OUTPUT
    *& Module USER_COMMAND_0200 INPUT
    MODULE user_command_0200 INPUT.
    CASE ok_code.
    WHEN 'EXIT200'.
    LEAVE TO SCREEN 100.
    WHEN'SAVE'.
    PERFORM save_changes.
    ENDCASE.
    ENDMODULE. " USER_COMMAND_0200 INPUT
    *& Form get_data
    FORM get_data.
    Read data from table SFLIGHT
    SELECT *
    FROM zsflight
    INTO TABLE gi_sflight.
    ENDFORM. " load_data_into_grid
    *& Form change_flight
    Reads the contents of the selected row in the grid, ans transfers
    the data to screen 200, where it can be changed and saved.
    FORM change_flight.
    DATA:l_lines TYPE i.
    REFRESH gi_index_rows.
    CLEAR g_selected_row.
    Read index of selected rows
    CALL METHOD go_grid->get_selected_rows
    IMPORTING
    et_index_rows = gi_index_rows.
    Check if any row are selected at all. If not
    table gi_index_rows will be empty
    DESCRIBE TABLE gi_index_rows LINES l_lines.
    IF l_lines = 0.
    CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT'
    EXPORTING
    textline1 = 'You must choose a line'.
    EXIT.
    ENDIF.
    Read indexes of selected rows. In this example only one
    row can be selected as we are using gs_layout-sel_mode = 'B',
    so it is only ncessary to read the first entry in
    table gi_index_rows
    LOOP AT gi_index_rows INTO g_selected_row.
    IF sy-tabix = 1.
    READ TABLE gi_sflight INDEX g_selected_row-index INTO g_wa_sflight.
    ENDIF.
    ENDLOOP.
    Transfer data from the selected row to screenm 200 and show
    screen 200
    CLEAR g_screen200.
    MOVE-CORRESPONDING g_wa_sflight TO g_screen200.
    LEAVE TO SCREEN '200'.
    ENDFORM. " change_flight
    *& Form save_changes
    Changes made in screen 200 are written to the datbase table
    zsflight, and to the grid table gi_sflight, and the grid is
    updated with method refresh_table_display to display the changes
    FORM save_changes.
    DATA: l_traffic_light TYPE c.
    Update traffic light field
    Update database table
    MODIFY zsflight FROM g_screen200.
    Update grid table , traffic light field and color field.
    Note that it is necessary to use structure g_wa_sflight
    for the update, as the screen structure does not have a
    traffic light field
    MOVE-CORRESPONDING g_screen200 TO g_wa_sflight.
    IF g_wa_sflight-paymentsum < 100000.
    g_wa_sflight-traffic_light = '1'.
    C = Color, 6=Color 1=Intesified on, 0: Inverse display off
    g_wa_sflight-line_color = 'C610'.
    ELSEIF g_wa_sflight-paymentsum => 100000 AND
    g_wa_sflight-paymentsum < 1000000.
    g_wa_sflight-traffic_light = '2'.
    clear g_wa_sflight-line_color.
    ELSE.
    g_wa_sflight-traffic_light = '3'.
    clear g_wa_sflight-line_color.
    ENDIF.
    MODIFY gi_sflight INDEX g_selected_row-index FROM g_wa_sflight.
    Refresh grid
    CALL METHOD go_grid->refresh_table_display.
    CALL METHOD cl_gui_cfw=>flush.
    LEAVE TO SCREEN '100'.
    ENDFORM. " save_changes
    chk this blog
    /people/vijaybabu.dudla/blog/2006/07/21/topofpage-in-alv-using-clguialvgrid
    Reward if helpfull.
    Regards Madhu.

  • TOP-OF-PAGE using Object Oriented model

    Hi all,
    (1)  I hve a doubt reg the top-of-page using Object oriented concept . While iam creating the top-of-page iam using a class called ' cl_dd_document' , wht is the purpose of that class ?
    (2) I have displayed a text in the top-of-page container . I want to display another text in a new line in the same container below the first text . How can i do it . plz send me a sample code for it .
    Vighnesh ,

    1. this class cl_dd_document is used to define the properties of the text used in top of page...to change the fonts of texts , to add space between texts, to add a new line and so on..
    2.  to add new line , use this
    CALL METHOD document->new_line.

  • 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_DETAILS

    Hi,
    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.

  • Using objects, design view in NetBeans

    I started using NetBeans a few weeks ago, and I was wondering, if it's possible to visualize an object that you declared manually , in the design view?
    For example, if I manually declare a jTextLabel, Can I see it , in the design view?
    Because I haven't managed to find a way to do it.
    Thanks for your attention.

    zrkd51 wrote:
    I started using NetBeans a few weeks ago, and I was wondering, if it's possible to visualize an object that you declared manually , in the design view?Your terminology is unclear. What does "object" mean in this sentence? The word "object" is not to be used in a blurry context in Java (which is an Object - Oriented programming language).
    For example, if I manually declare a jTextLabel, Can I see it , in the design view?Because of the unclear terminology, your example is unclear too.
    - Do you mean you have implemented a class JTextLabel, and you want to use it in the forms designer? Yes it's possible, you have to right-click on the class and "Add to beans palette", or something along those lines.
    - Do you mean you have added an attribute of type JTextLabel (whatever that is, but maybe you meant JTextField )? Then no, NB will not show it in the forms designer, for the reason Kayaman said (except that in NetBeans, the metadata is stored in a separate +.form+ file, which is generated by the forms designer. Adding your attribute in the Java source does not propagate to the .forms file; and tweaking the .form file manually is something I'd clearly recommend against).
    Note that this is merely a question for NetBeans forums, andsuch questions are generally frowned upon here (myself I don't frown, indeed I find it unfortunate that the NB forums are separate, and I find the NB forums unhelpful in general, but you can't tell until you try them).
    Also note that nothing in your post suggests you read the NetBeans documentation. If you did, please state it, which chapters, and why it doesn't answer your question (the "Add from palette" thing is clearly in the docs).
    Best regards,
    J.

  • Downloading ALV Grid (using objects) output to Excel

    Hi all,
    I'm using objects for ALV Grid. I have few other fields (few are above and few are below the custom control) on screen other than custom control. I want to download the entire screen to excel (including other fields). But using Export option I'm able to download only ALV Grid. I did tried with Excel in place option which is not pulling data from ALV Grid control.
    Please suggest me the solution.
    Regards
    Jaker.

    hi
    use this code in ALV format
    TABLES USR03.
    DATA: BEGIN OF ISAPDAT OCCURS 0,
              BNAME LIKE USR03-BNAME,
              NAME1 LIKE USR03-NAME1,
              NAME2 LIKE USR03-NAME2,
          END OF ISAPDAT.
    PARAMETERS P_FNAME LIKE RLGRAP-FILENAME
                        DEFAULT 'd:\sapdata.xls' OBLIGATORY.
    SELECT * FROM USR03 INTO CORRESPONDING FIELDS OF TABLE ISAPDAT.
    SORT ISAPDAT.
    CALL FUNCTION 'SAP_CONVERT_TO_XLS_FORMAT'
         EXPORTING
              I_FILENAME        = P_FNAME
         TABLES
              I_TAB_SAP_DATA    = ISAPDAT
         EXCEPTIONS
              CONVERSION_FAILED = 1
              OTHERS            = 2.
    IF SY-SUBRC EQ 0.
      WRITE:/ 'Download to Excel complete'.
    ELSE.
      WRITE:/ 'Error with download'.
    ENDIF.
    Code Formatted by: Alvaro Tejada Galindo on Jan 8, 2009 2:34 PM

  • Extremely long build times using object oriented code

    We have a LabVIEW application that we need to build an .exe for distrubution purposes.  The application relies on several object-oriented classes for data handling and dynamic dispatch type casting and function selection.  Currently it takes approximately 1.5 hours to build the application and it seems that most of the time is spent processing the object oriented files.  Has anyone else seen this issue and are there any creative ways to improve the build times?

    Hi again.  We are still having issues using LVOOP due to extrmely long .exe build times as well as long labview loading times.  I traced the source of this to one class hierarchy, shown below.  This hierarchy also relies heavily on overriding top-level functions, declared as virtual VIs in the top level class, which I suspect contributes to this problem.  While debugging another issue, I was trying to build a small piece of my main code into an .exe to verify its functionality and experienced the same extremely long build times.  When I removed this class hierarchy from the VI, it built extremely fast.  Also to be clear, I am using neither the mean function or Mean.vi anywhere in this set of code.  To date we have been delighted with LVOOP and how it has made our code cleaner, mroe robust, and more maintanable.  However, when creating new functionality in the code we often elect NOT to create new objects (even though they would be beneficial) because we are hesitant to introduce the extra time (load and build) required for LabVIEW to handle these classes.  If our entire system was rewritten in LVOOP, I would suspect that it would become unmaintainable and unbuildable due to the LVOOP overhead.  I was hoping that LV2009 would address some of these issues but, alas, it did not. Still looking for a way to improve this and thanks in advance for all of the replies.

  • HTTP post from ABAP using Object Oriented method

    Hi ,
    I want to call HTTP from ABAP. I came to know that using classes & objects is the best way to fulfill it.
    Interface:
    xml_document type ref to cl_xml_document
    method post_xml_document.
    data: client type ref to if_http_client,
    xml_response type ref to cl_xml_document.
    data: xml_string type string,
    xml_xstring type xstring.
    data: zsubrc type sy-subrc.
    cl_http_client=>create_by_url( exporting url = 'http://www.example.com/post-url.xml' importing client = client exceptions others = 1 ).
    client->request->set_header_field( exporting name = '~request_method' value = 'POST' ).
    client->request->set_header_field( exporting name = '~server_protocol' value = 'HTTP/1.1' ).
    client->request->set_header_field( exporting name = 'Content-Type' value = 'text/xml' ).
    xml_document->render_2_string( exporting pretty_print = 'X' importing stream = xml_string ).
    client->request->set_cdata( exporting data = xml_string offset = 0 ).
    client->authenticate( exporting proxy_authentication = space username = 'username' password = 'password' ).
    client->send( exceptions http_communication_failure = 1 http_invalid_state = 2 ).
    client->receive( exceptions http_communication_failure = 1 http_invalid_state = 2 http_processing_failed = 3 ).
    xml_xstring = client->response->get_data( ).
    zsubrc = xml_response->parse_xstring( stream = xml_xstring ).
    endmethod.
    Above code can be used to do my work.
    Apart from the code in ABAP, what are the configurational setting that we need to do ?
    Thanks,
    Shivaa..

    >
    mohammad afzal wrote:
    > apart from usin the code u should have configured the RFC destination
    Thats nonsense, create_by_url does not need an rfc connection. TA SICF is correct.

  • Problem with focus with an ALV grid using object methods

    Hi, i have an editable ALV and there is something wrong that we haven't been able to solve it yet, hope you can understand my explanation
    Supose a grid 2 x 5
    cell 1 - cell 2 - Cell 3 - Cell 4 - Cell 5
    001      John      Doe
    So when a press tab or enter to the any cell diferent from cell 1 the focus get back to the cell 1, and i have to tab ( in this example) 3 times to fill cell 4, and then 4 times to fill cell 5
    Any ideas???
    ttorres

    Hi,
    Use method :SET_CURRENT_CELL_VIA_ID of grid to set the cursor position in a cell.
    Ex:
    CALL METHOD O_GRID->SET_CURRENT_CELL_VIA_ID
          EXPORTING
            IS_ROW_ID    = V_ROW
            IS_COLUMN_ID = V_COLUMN
            IS_ROW_NO    = V_ROW_NUM.
    use methods : get_current_cell_row_id, get_current_cell
    to get the required parameters for SET_CURRENT_CELL_VIA_ID.
    Regards
    Appana

  • How to write Block ALV using Object-oriented methodology?

    Hi all,
    How to write a Block ALV without using 'Reuse_ALV.....' FMs? I want to use the CL_GUI....' methods. What is the procedure? Any sample block ALV?
    Thanks,
    Charles.

    Currently there is not an OO method of implementing the block ALV, it is only available using the REUSE function module.
    Regards,
    RIch Heilman

  • ALV using Object oriented programming concepts

    Hi All,
    I am unable to call a transaction after a hotspot click on a field.... I have used CALL METHOD w_grid->get_current_cell to get the cell info.....but this is not happening.... Can anyone plz tell me how to call a transaction on doing a hotspot click on a field?

    One reason why your code is not working is i think the method you are using is Protected. ie it can't be used outside the class.
    Try the following code.
    In the method definition define the method as follows.
    methods :  HOTSPOT_CLICK
                     FOR EVENT HOTSPOT_CLICK OF CL_GUI_ALV_GRID
                     IMPORTING E_ROW_ID
                                       E_COLUMN_ID
                                       ES_ROW_NO.
    The  E_ROW_ID   E_COLUMN_ID   ES_ROW_NO are the parameters returnned by the event HOT-SPOT click.
    Let us suppose I_MARA is your internal table using which you have displayed your ALV HRID.
    Now in the method Implementation part use the following code.
    METHOD HOTSPOT_CLICK.
        CLEAR : WA_MARA.
        READ TABLE I_MARA INDEX E_ROW_ID INTO WA_MARA.
        IF SY-SUBRC EQ 0.
          IF E_COLUMN_ID-FIELDNAME EQ C_MATNR.
            SET PARAMETER ID 'MAT' FIELD WA_MARA-MATNR.
            SET PARAMETER ID 'WRK' FIELD C_WERKS.
            CALL TRANSACTION 'MD04' AND SKIP FIRST SCREEN.
          ELSE.
            CALL SCREEN 0130 starting at 35 15.
          ENDIF.
        ENDIF.
      ENDMETHOD.
    At the call Transaction point you can call which ever Transaction you want.
    And aslo please check if you have registered the event HOTSPOT.
    Hope this code works.
    Thanks & regards,
    Y Gautham

Maybe you are looking for

  • IPhone 5s is stuck in wiggle mode

    This just started happening today. I tap and hold an app to move it. All the icons wiggle but I can't do anything with them, delete or move. After a few minutes the phone goes to the black screen with the apple icon, then to the logon screen. this in

  • Import Balances into FDM as YTD Even Though ERPi Extracts in Periodic

    Hi All, We are trying to load data into HFM by using FDM using ERPI integrator adaptor.here issue is revnue and expense accounts are loading as periodic insted of YTD,so we have to load revenue ane expense should load as YTD format. oracle analyst gi

  • ISE 1.2 - Custome Reports

    Hi I can't find customer report in V1.2 - i want to create a report for posture that can show not only compliance state but also rules that matched or not as i configured all my posture rules in audit state and i want to create a detailed report , an

  • How do i import music from windows media player to I-tunes?

    can someone please let me know if there is a way to move all of the music i have in Media Player to itunes. Thank you

  • Using HP monitor with MBP 2012

    I have MBP 2012 with the new Maverick OS installed.  Trying to add external monitor.  I bought HP IPS LED monitor and am using the Belkin mini display port to HDMI connector and an HDMI cord.  Monitor cannot find a signal.  I have rebooted my MBP