Urgent  :  code for the change/display button in the ALV Grid control

Hi gurus,
Here i have the following situation,
I must place a button which should work as both change/display,
first click should be change and the next click should be display,
when i click for the first time the row/rows selected should be locked and when again click on the same button that should be unlocked.
If you have the solution please come back with the solution.
Bharath Kumar<b></b>

Hi,
try this
*&      Form  SET_PF_STATUS
      text
     -->EXTAB      text
FORM SET_PF_STATUS USING EXTAB TYPE SLIS_T_EXTAB.
DATA GIT_FCODE TYPE TABLE OF SY-UCOMM.
  IF GIT_ITEMS IS INITIAL.   ( you have to maintain a counter )
( like data: g_count type i.
and if it is divisible by 2 then display
other wise change.
    CLEAR GIT_FCODE.
    APPEND 'CHANGE' TO GIT_FCODE.
    SET PF-STATUS 'ZPF_STATUS' EXCLUDING GIT_FCODE.
  ELSE.
    CLEAR GIT_FCODE.
    APPEND 'DISP' TO GIT_FCODE.
    SET PF-STATUS 'ZPF_STATUS' EXCLUDING GIT_FCODE.
  ENDIF.
thanks & regards,
Venkatesh

Similar Messages

  • Urgent :  how to select the rows in the ALV Grid Control

    How to select the rows in the ALV Grid control,
    I am facing the situation where i need to select the row/rows in the Grid control and then to lock the entries,
    If anyone have the solution please help me out
    <b>Its very Urgent</b>

    Hi Bharath,
    Go through this hope u can understand.
    SEL_MODE. Selection mode, determines how rows can be selected. Can have the following values:
    A Multiple columns, multiple rows with selection buttons.
    B Simple selection, listbox, Single row/column
    C Multiple rows without buttons
    D Multiple rows with buttons and select all ICON
    Setting and getting selected rows (Columns) and read line contents
    You can read which rows of the grid that has been selected, and dynamic select rows of the grid using methods get_selected_rows and set_selected_rows. There are similar methods for columns.
    Note that the grid table always has the rows in the same sequence as displayed in the grid, thus you can use the index of the selected row(s) to read the information in the rows from the table. In the examples below the grid table is named gi_sflight.
    Data declaration:
    DATA:
    Internal table for indexes of selected rows
    gi_index_rows TYPE lvc_t_row,
    Information about 1 row
    g_selected_row LIKE lvc_s_row.
    Example 1: Reading index of selected row(s) and using it to read the grid table
      CALL METHOD go_grid->get_selected_rows
        IMPORTING
          et_index_rows = gi_index_rows.
      DESCRIBE TABLE gi_index_rows LINES l_lines.
      IF l_lines = 0.
        CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT'
             EXPORTING
                  textline1 = 'You must choose a valid line'.
        EXIT.
      ENDIF.
      LOOP AT gi_index_rows INTO g_selected_row.
         READ TABLE gi_sflight INDEX g_selected_row-index INTO g_wa_sflight.
        ENDIF.
      ENDLOOP.
    Example 2: Set selected row(s).
      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.
      ENDIF.
    Reward points if helpful.
    Thanks
    Naveen khan

  • ALV grid using classes(displaying subtotals groupwise in ALV grid control)

    Hello ,
      please can any body help me its urgent tome.
    displaying subtotals groupwise ..say for ex..
    cost group  costelement         amount     
    10          101         100.00
    10                            102          200.00
    10                            103          300.00
    20                            104          400.00
    20                            105          500.00
    20                            106          600.00
                    101         100.00
                    102         200.00
                    103         300.00
    10                          600.00
              104         400.00
              105         500.00
              106         600.00
    20                         1500.00
    In ALV grid control using classes.
    Thanks in Advance

    Hi alson,
    MODULE pbo OUTPUT.
    SET PF-STATUS 'MAIN100'.
    IF g_custom_container IS INITIAL.
    CREATE OBJECT g_custom_container
    EXPORTING container_name = g_container.
    CREATE OBJECT grid1
    EXPORTING i_parent = g_custom_container.
    <b>CALL METHOD grid1->set_table_for_first_display
    EXPORTING IS_LAYOUT = it_LAY
    CHANGING it_fieldcatalog = fieldcat
    it_sort = it_sort
    it_outtab = itab[].</b>
    ENDIF.
    ENDMODULE. " PBO OUTPUT
    keep the below code
    <b>CALL METHOD grid1->set_table_for_first_display
    EXPORTING IS_LAYOUT = it_LAY
    CHANGING it_fieldcatalog = fieldcat
    it_sort = it_sort
    it_outtab = itab[].</b>
    here
    IF pdel = 'X'.
    *BEGIN OF CHANGES BY VINAY DASARI
    PERFORM get_data.
    <b>CALL METHOD grid1->set_table_for_first_display
    EXPORTING IS_LAYOUT = it_LAY
    CHANGING it_fieldcatalog = fieldcat
    it_sort = it_sort
    it_outtab = itab[].</b>
    ENDIF.

  • Color change of a field  in ALV Grid Control

    Hi,
    One small help needed....
    My req is explained below:
    I have 3 fields empno, ename and deptno. and the records of these fields would be displayed in ALV grid control.
    When I hover the mouse on ename field, the color of the complete field should change to other color, say "RED".
    How do I get this. Are there any Mouse events in SAP?
    Kalyan

    Hi,
    Once i changed the color of a field in a alv (not grid alv), i suspose that the same in alv grid. Also i used an mouse event.
    To manage the color:
    TYPE-POOLS : SLIS, and check this type:  SLIS_T_SPECIALCOL_ALV.
    when you call the function to display the alv, there is a parameter in which you should pass an internal table that references the type  SLIS_T_SPECIALCOL_ALV.
    To manage the mouse:
    1.- You should add the event user command:
    for example:
    DATA: I_EVENT TYPE SLIS_ALV_EVENT.
    Llamo al la función que obtiene los eventos validos para el ALV
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
           EXPORTING
                I_LIST_TYPE     = 0
           IMPORTING
                ET_EVENTS       = P_EVENTS
           EXCEPTIONS
                LIST_TYPE_WRONG = 1
                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.
      ELSE.
      agrega evento user command
        READ TABLE P_EVENTS INTO I_EVENT
          WITH KEY NAME = SLIS_EV_USER_COMMAND.
        IF SY-SUBRC EQ 0.
          I_EVENT-FORM  = SLIS_EV_USER_COMMAND.
          MODIFY P_EVENTS FROM I_EVENT INDEX SY-TABIX.
        ENDIF.
      ENDIF.
    2.- you work with the user command event:
    FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
                            RS_SELFIELD TYPE SLIS_SELFIELD .
      CASE R_UCOMM.
        WHEN C_DOBLE_CLICK.
        here you do the things that you need when the mouse *     bottom it's pressed
          PERFORM xxxxxxx.
      ENDCASE.
    ENDFORM.
    3.- you can change the form of the mouse, but i don't remember exactly how to do that... try to check that, it's helpfull in order to display the fields that can execute a funtion in your alv.
    I hope this help you, and sorry for my english.
    Albio.-

  • Allow to erase values under the input-check of the ALV Grid Control

    Hi,<br />
    in my ALV Grid I do have a cell which automatically checks the values entered by the user. When the user does not enter the values belonging to the DDIC Domain Value Range of the data element, the cell is rendered with a red border and an ALV error message comes up telling the user to enter the correct values from the F4 help.
    In general, this is really great, but in case the user needs to erase the value, this automatical ALV Grid error message keeps popping up asking him to enter at least one value from the value range.
    (I assume this is due to the fact that the Domain value range does not contain the value 'empty'.)
    <br />
    I would like to keep the functionality of checking the entered value but want to switch off the error message in case nothing was entered. How can I achive this?
    <br /> <br />
    This is what I did so far: <br />
    1. Upon initializing ALV Grid, I define the field catalog like this: <br />
    ls_fieldcat-fieldname = 'REACTION'.                       "#EC NOTEXT <br />
      ls_fieldcat-edit       = abap_true. <br />
      ls_fieldcat-coltext   = 'Reaction'.                       "#EC NOTEXT <br />
      ls_fieldcat-outputlen = '8'.                              "#EC NOTEXT  <br />
    <br />
    * This forces the user to set at least one value; not allowing him to delete it!! <br />
      ls_fieldcat-ref_table = 'CRMS_ES_FOREIGN_ATTRIBUTE'.      "#EC NOTEXT <br />
      ls_fieldcat-ref_field =  'REACTION'. <br />
      ls_fieldcat-key = abap_true. <br />
    <br />
      ls_fieldcat-checktable = '!'. <br />
      ls_fieldcat-f4availabl  = 'X'. "shows the handle for F4 help <br />
      ls_fieldcat-col_id = 7.
    <br />
    (I would assume here that the ls_fieldcat - structure would allow an additional field which allows empty values, but I could not find one!) <br />
    <br />
    2. For my ALV Grid instance, I am registering the F4 during initialization:<br />
    call method gr_fkt_grid->register_f4_for_fields <br />
            exporting <br />
              it_f4 = lt_f4. <br />
    <br />
          ls_f4-fieldname  = 'REACTION'.   "EC SYNTCHAR <br />
          ls_f4-register   = abap_true. <br />
          insert ls_f4 into table lt_f4. <br />
          call method gr_fkt_grid->register_f4_for_fields <br />
            exporting <br />
              it_f4 = lt_f4. <br />
    <br /> <br />
    3. Then I am setting the handler while initializing: <br />
          set handler lr_grid_event_receiver->handle_f4 <br />
          for all instances. <br />
    <br /> <br />
    4. I also have checking methods in PAI for the ALV cells, but they do not apply in this case, <br />
        since ALV itself performs this check described above. I cannot see a chance for <br />
        interfering myself in PAI. <br />
    <br />
    Does anyone have an idea how I could prevent the ALV Grid of bringing up the message "Enter a valid value" and <br />
    allowing to delete the cell content while keeping its checks in case the user enters a wrong value? <br />
    <br />
    Thank you very much,<br />
    regards,<br />
    Konrad<br />

    Hi Konrad,
    Inside the handler method for event DATA_CHANGED,  always suppress the error log by calling method activate_display_protocol with dialog = ''.
    Whenever u need error log call  method display_protocol based on ok_code(sy-ucomm).
    Ex:
    method data_changed.  " Handler method for event 'DATA_CHANGED'
    *Suppressing error log
        call method g_o_grid->activate_display_protocol        "  Always suppress error log when grid is changed
          exporting
            i_dialog = ''.
        if er_data_changed->mt_protocol[] is not initial.
          if ok_code = 'BACK' or ok_code = 'SAVE'.      "  Based  on  ok_code display error log
    *Display error log
            call method er_data_changed->display_protocol.
          endif.
        endif.
      endmethod.                    "data_changed
    Might solve ur problem
    Thanks,
    Edited by: Sap Fan on Oct 14, 2009 5:35 AM

  • Can we disable the default push buttons on the ALV Grid

    Hi,
        Can we disable the default push buttons on the ALV
    Grid Control...
        If so, pls send me the procedure...
    thanks and regards
       raghu

    Hi,
    In the PBO:
      PERFORM f9100_exclude_functions USING :
                             i_exclude[]  '&CHECK',
                             i_exclude[]  '&REFRESH',
                             i_exclude[]  '&LOCAL&CUT' ,
                             i_exclude[]  '&LOCAL&COPY',
                             i_exclude[]  '&LOCAL&PASTE',
                             i_exclude[]  '&LOCAL&PASTE_NEW_ROW',
                             i_exclude[]  '&LOCAL&UNDO' ,
                             i_exclude[]  '&LOCAL&APPEND',
                             i_exclude[]  '&LOCAL&INSERT_ROW',
                             i_exclude[]  '&LOCAL&DELETE_ROW',
                             i_exclude[]  '&SORT_ASC',
                             i_exclude[]  '&SORT_DSC',
                             i_exclude[]  '&FIND',
                             i_exclude[]  '&SUMC',
                             i_exclude[]  '&SUBTOT',
                             i_exclude[]  '&MINIMUM',
                             i_exclude[]  '&MAXIMUM' ,
                             i_exclude[]  '&VGRID' ,
                             i_exclude[]  '&VEXCEL' ,
                             i_exclude[]  '&VCRYSTAL',
                             i_exclude[]  '&HTML',
                             i_exclude[]  '&MAINTAIN',
                             i_exclude[]  '&SAVE',
                             i_exclude[]  '&GRAPH',
                             i_exclude[]  '&HELP',
                             i_exclude[]  '&ALL' ,
                             i_exclude[]  '&SAL' .
    *                         i_exclude[]  '&EXCLALLFC'.
    *&      Form  f9100_exclude_functions
    * This form exclude buttons  from the toolbar.
    *      -->P_IEXCLUDE  text
    *      -->P_1150   text
    FORM f9100_exclude_functions USING   pexclude LIKE i_exclude
                                   value(pfunction).
      DATA: l_exclude TYPE ui_func.
      l_exclude = pfunction.
      APPEND l_exclude TO pexclude.
    ENDFORM.                    " f9100_exclude_functions
    This will exculde the default push buttons.
    Let us know if it works for you.
    Regards,
    Anjali

  • Error whil adding Header to the ALV grid using OO

    Hi Guys,
                 I want to display the Header for the ALV grid using Splitter .
    when i am doing like that .I am getting  a screen on the top of that screen I am getting a EMPTY screen .I don't know why likat.
    What i need is just to display a Grid with header?Can anybody Please help me reagarding this problem.
    the Code is Below.
    *& Report  Z_TEST_PGM
    REPORT  Z_TEST_PGM NO STANDARD PAGE HEADING
                                      LINE-SIZE 120 MESSAGE-ID zotc.
    Tables : CKMLMV003 , CKMLMV001.
    TYPE-POOLS: slis.
    Types : Begin of t_CKMLMV003_out,
                 WERKS type CKMLMV003-WERKS,
                 MATNR type CKMLMV003-MATNR,
                 MISCH_VERH type CKMLMV003-MISCH_VERH,
                 KALNR_BAL type CKMLMV003-KALNR_BAL,
                 GJAHR type CKMLMV003-GJAHR,
                 PERIO type CKMLMV003-PERIO,
                 MGTYP type CKMLMV003-MGTYP,
            End of t_CKMLMV003_out,
            Begin of t_CKMLMV001_out,
                 MATNR type CKMLMV001-MATNR,
                 KALNR type CKMLMV001-KALNR,
                 LIFNR_ND type CKMLMV001-LIFNR_ND,
                 EKORG_ND type CKMLMV001-EKORG_ND,
            End of t_CKMLMV001_out,
            Begin of t_CKMLMV003_Temp,
                 MATNR type CKMLMV003-MATNR,
                 GJAHR type CKMLMV003-GJAHR,
                 PERIO type CKMLMV003-PERIO,
            End of t_CKMLMV003_Temp,
            Begin of t_Final_out,
                 MATNR type CKMLMV003-MATNR,
                 GJAHR type CKMLMV003-GJAHR,
                 PERIO type CKMLMV003-PERIO,
                 WERKS type CKMLMV003-WERKS,
                 LIFNR_ND1 type CKMLMV001-LIFNR_ND,
                 MISCH_VERH1 type CKMLMV003-MISCH_VERH,
                 LIFNR_ND2 type CKMLMV001-LIFNR_ND,
                 MISCH_VERH2 type CKMLMV003-MISCH_VERH,
                 LIFNR_ND3 type CKMLMV001-LIFNR_ND,
                 MISCH_VERH3 type CKMLMV003-MISCH_VERH,
                 LIFNR_ND4 type CKMLMV001-LIFNR_ND,
                 MISCH_VERH4 type CKMLMV003-MISCH_VERH,
                 LIFNR_ND5 type CKMLMV001-LIFNR_ND,
                 MISCH_VERH5 type CKMLMV003-MISCH_VERH,
                 LIFNR_ND6 type CKMLMV001-LIFNR_ND,
                 MISCH_VERH6 type CKMLMV003-MISCH_VERH,
                 LIFNR_ND7 type CKMLMV001-LIFNR_ND,
                 MISCH_VERH7 type CKMLMV003-MISCH_VERH,
                 LIFNR_ND8 type CKMLMV001-LIFNR_ND,
                 MISCH_VERH8 type CKMLMV003-MISCH_VERH,
                 LIFNR_ND9 type CKMLMV001-LIFNR_ND,
                 MISCH_VERH9 type CKMLMV003-MISCH_VERH,
                 LIFNR_ND10 type CKMLMV001-LIFNR_ND,
                 MISCH_VERH10 type CKMLMV003-MISCH_VERH,
                 LIFNR_ND11 type CKMLMV001-LIFNR_ND,
                 MISCH_VERH11 type CKMLMV003-MISCH_VERH,
                 LIFNR_ND12 type CKMLMV001-LIFNR_ND,
                 MISCH_VERH12 type CKMLMV003-MISCH_VERH,
                 LIFNR_ND13 type CKMLMV001-LIFNR_ND,
                 MISCH_VERH13 type CKMLMV003-MISCH_VERH,
             End of t_Final_out,
           Begin of t_Final_out1,
                 MATNR type CKMLMV003-MATNR,
                 GJAHR type CKMLMV003-GJAHR,
                 PERIO type CKMLMV003-PERIO,
                 LIFNR_ND1 type CKMLMV001-LIFNR_ND,
                 MISCH_VERH1 type CKMLMV003-MISCH_VERH,
                 LIFNR_ND2 type CKMLMV001-LIFNR_ND,
                 MISCH_VERH2 type CKMLMV003-MISCH_VERH,
                 LIFNR_ND3 type CKMLMV001-LIFNR_ND,
                 MISCH_VERH3 type CKMLMV003-MISCH_VERH,
                 LIFNR_ND4 type CKMLMV001-LIFNR_ND,
                 MISCH_VERH4 type CKMLMV003-MISCH_VERH,
                 LIFNR_ND5 type CKMLMV001-LIFNR_ND,
                 MISCH_VERH5 type CKMLMV003-MISCH_VERH,
                 LIFNR_ND6 type CKMLMV001-LIFNR_ND,
                 MISCH_VERH6 type CKMLMV003-MISCH_VERH,
                 LIFNR_ND7 type CKMLMV001-LIFNR_ND,
                 MISCH_VERH7 type CKMLMV003-MISCH_VERH,
                 LIFNR_ND8 type CKMLMV001-LIFNR_ND,
                 MISCH_VERH8 type CKMLMV003-MISCH_VERH,
                 LIFNR_ND9 type CKMLMV001-LIFNR_ND,
                 MISCH_VERH9 type CKMLMV003-MISCH_VERH,
                 LIFNR_ND10 type CKMLMV001-LIFNR_ND,
                 MISCH_VERH10 type CKMLMV003-MISCH_VERH,
                 LIFNR_ND11 type CKMLMV001-LIFNR_ND,
                 MISCH_VERH11 type CKMLMV003-MISCH_VERH,
                 LIFNR_ND12 type CKMLMV001-LIFNR_ND,
                 MISCH_VERH12 type CKMLMV003-MISCH_VERH,
                 LIFNR_ND13 type CKMLMV001-LIFNR_ND,
                 MISCH_VERH13 type CKMLMV003-MISCH_VERH,
             End of t_Final_out1.
                          Global Structures                              *
    Data : i_CKMLMV003_str   type   t_CKMLMV003_out,
           i_CKMLMV001_str   type   t_CKMLMV001_out,
           i_Final_str   type  t_Final_out,
           i_Final_str1   type  t_Final_out,
           i_CKMLMV003_Temp type   t_CKMLMV003_Temp.
                              Global Internal Tables                        *
    Data : i_CKMLMV003_out   type standard table of  t_CKMLMV003_out,
           i_CKMLMV001_out  type standard table of  t_CKMLMV001_out,
           i_Final_out   type standard table of  t_Final_out,
           i_Final_out1   type standard table of  t_Final_out.
    ALV Report Internal tables    *
    DATA : t_fieldcatalog TYPE slis_t_fieldcat_alv,
           s_fieldcatalog TYPE slis_fieldcat_alv,
           t_basic_fieldcatalog TYPE slis_t_fieldcat_alv,
           s_basic_fieldcatalog TYPE slis_fieldcat_alv,
           t_sort  TYPE slis_t_sortinfo_alv,
           v_repid TYPE sy-repid.
    *ALV Header declarations
    Data: t_header type slis_t_listheader,
          i_header_str type slis_listheader,
          i_line_event_str TYPE slis_alv_event,
          i_events TYPE slis_t_event,
          wa_layout  type slis_layout_alv.
    Data : grid1 type ref to cl_gui_alv_grid,
           g_custom_container1 type ref to cl_gui_custom_container,
           grid2 type ref to cl_gui_alv_grid,
           g_custom_container2 type ref to cl_gui_custom_container,
           i_FCAT TYPE  LVC_T_FCAT,
           i_FCAT_str type lvc_s_fcat,
    Structure  for layout
          i_layout_s   TYPE  lvc_s_layo,
           gt_final1 type table of  t_Final_out.
    DATA: CCCONTAINER1 TYPE SCRFNAME VALUE 'CCCONTAINER1',
          CCCONTAINER2 TYPE SCRFNAME VALUE 'CCCONTAINER2',
          G_PARENT_TOP TYPE REF TO CL_GUI_CONTAINER ,
          G_SPLITTER   TYPE REF TO CL_GUI_SPLITTER_CONTAINER,
          G_DYNDOC_ID  TYPE REF TO CL_DD_DOCUMENT,
          G_PARENT_GRID TYPE REF TO CL_GUI_CONTAINER.
                          Global Variables                              *
    Data :cnt(4) type n value '0',
          g_plant type CKMLMV003-WERKS ,
          g_QuanTStr type CKMLMV003-MGTYP ,
          g_PurchOrg type CKMLMV001-EKORG_ND,
          flag type n value '0',
          g_cnt6 type n value '0',
          g_cnt7 type n value '0',
          g_cnt8 type n value '0',
          g_cnt9 type n value '0',
          g_cnt10 type n value '0',
          g_cnt11 type n value '0',
          g_cnt12 type n value '0',
          g_cnt13 type n value '0'.
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-011.
    SELECTION-SCREEN: BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 2(20) TEXT-006 for field s_matnr.
    Select-Options : S_MATNR for CKMLMV003-MATNR .
    SELECTION-SCREEN: END OF LINE.
    SELECTION-SCREEN: BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 2(20) TEXT-007 for field S_WERKS.
    SELECT-OPTIONS:S_WERKS for CKMLMV003-WERKS Default '2003'.
    SELECTION-SCREEN: END OF LINE.
    SELECTION-SCREEN: BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 2(20) TEXT-008 for field S_GJAHR.
    SELECT-OPTIONS:S_GJAHR for CKMLMv003-GJAHR default Sy-DATUM(4) .
    SELECTION-SCREEN: END OF LINE.
    SELECTION-SCREEN: BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 2(20) TEXT-009 for field S_PERIO.
    SELECT-OPTIONS:S_PERIO for CKMLMV003-PERIO .
    SELECTION-SCREEN: END OF LINE.
    SELECTION-SCREEN: BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 2(25) TEXT-010 for field P_MGTYP.
    Parameters : P_MGTYP type CKMLMV003-MGTYP .
    SELECTION-SCREEN: END OF LINE.
    SELECTION-SCREEN END OF BLOCK b1 .
    At Selection-Screen on s_matnr .
      Perform Validate_MatNumber.
    At Selection-Screen on s_werks .
      Perform Validate_CostingPlant.
    At Selection-Screen on s_GJAHR .
      Perform Validate_FiscalYear.
    At Selection-Screen on s_PERIO .
      Perform Validate_Period.
    At Selection-Screen on p_MGTYP .
      Perform Validate_QuantityStrType.
    *&      Form  Validate_MatNumber
          text
    Form Validate_MatNumber.
      DATA l_MATNR TYPE CKMLMV003-MATNR.
      IF NOT S_MATNR[] IS INITIAL .
        CLEAR L_MATNR.
        SELECT  single MATNR FROM CKMLMV003
          INTO l_MATNR
          WHERE MATNR = s_MATNR-LOW or MATNR = s_MATNR-HIGH.
       ENDSELECT.
        IF sy-subrc NE 0.
          MESSAGE e999 WITH
                  'Enter a Valid Material Number'(001).
        ENDIF.
      ENDIF.
    ENDFORM.                    "Validate_MatNumber
    *&      Form  Validate_CostingPlant
          text
    Form Validate_CostingPlant.
      DATA l_werks TYPE CKMLMV003-WERKS.
      IF NOT S_WERKS[] IS INITIAL .
        CLEAR L_WERKS.
        SELECT single  WERKS FROM T001W
          INTO l_WERKS
          WHERE WERKS =  s_WERKS-low or  WERKS =  s_WERKS-high.
       ENDSELECT.
        IF sy-subrc NE 0.
          MESSAGE e999 WITH
                  'Enter a Valid Costing Plant'(002).
        ENDIF.
      ENDIF.
    ENDFORM.                    "Validate_CostingPlant
    *&      Form  Validate_FiscalYear
          text
    Form Validate_FiscalYear.
      DATA l_GJAHR TYPE CKMLMV003-GJAHR.
      IF NOT S_GJAHR-low IS INITIAL or S_GJAHR-high IS INITIAL.
        CLEAR L_GJAHR.
       SELECT SINGLE GJAHR FROM CKMLMV003
         INTO l_GJAHR
         WHERE GJAHR LE sy-DATUM(4) .
       IF NOT S_GJAHR-low LE sy-DATUM(4) or S_GJAHR-high LE sy-DATUM(4).
         MESSAGE e999 WITH
                 'Enter a Valid Fiscal year'(003).
       ENDIF.
      ENDIF.
    ENDFORM.                    "Validate_FiscalYear
    *&      Form  Validate_Period
          text
    Form Validate_Period.
      DATA l_PERIO TYPE CKMLMV003-PERIO.
      IF NOT S_PERIO[] IS INITIAL .
        CLEAR L_PERIO.
        SELECT single PERIO FROM CKMLMV003
          INTO l_PERIO
          WHERE PERIO GE 1 and PERIO LE 12 .
       ENDSELECT.
        IF sy-subrc NE 0.
          MESSAGE e999 WITH
                  'Enter a Valid Period'(004).
        ENDIF.
      ENDIF.
    ENDFORM.                    "Validate_Period
    *&      Form  Validate_QuantityStrType
          text
    Form Validate_QuantityStrType.
      DATA l_MGTYP TYPE CKMLMV003-MGTYP.
      IF NOT p_MGTYP IS INITIAL.
        CLEAR L_MGTYP.
        SELECT SINGLE MGTYP FROM CKMLMV003
          INTO l_MGTYP
          WHERE MGTYP = p_MGTYP .
        IF sy-subrc NE 0.
          MESSAGE e999 WITH
                  'Enter a Valid Quantity Structure Type'(005).
        ENDIF.
      ENDIF.
    ENDFORM.                    "Validate_QuantityStrType
    INITIALIZATION of Fields
    Class LCL_EVENT_HANDLER DEFINITION.
      Public section.
        Methods:
        TOP_OF_PAGE for Event TOP_OF_PAGE OF CL_GUI_ALV_GRID
                                IMPORTING E_DYNDOC_ID.
    ENDCLASS.                    "LCL_EVENT_HANDLER DEFINITION
    CLASS LCL_EVENT_HANDLER IMPLEMENTATION.
    METHOD TOP_OF_PAGE.
    Top-of-page event <br />
    PERFORM EVENT_TOP_OF_PAGE USING G_DYNDOC_ID.
    ENDMETHOD.                            "top_of_page
    ENDCLASS.       "LCL_EVENT_HANDLER IMPLEMENTATION
    Data : G_HANDLER TYPE REF TO LCL_EVENT_HANDLER.
    Initialization.
      v_repid = sy-repid.
    Start-of-Selection.
      Perform get_CKMLMV003.
      Perform get_CKMLMV001.
      Perform Get_Finaldata.
    Perform Layout_FieldCatalog.
      call screen '101'.
    Perform  ALVGrid_Final_Display.
    *&      Form  Layout_FieldCatalog
          text
    Form Layout_FieldCatalog.
      s_fieldcatalog-col_pos = 1.
      s_fieldcatalog-fieldname = 'MATNR'.
      s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
      s_fieldcatalog-seltext_l = Text-024.
      append s_fieldcatalog to t_fieldcatalog.
      clear s_fieldcatalog.
      s_fieldcatalog-col_pos = 2.
      s_fieldcatalog-fieldname = 'GJAHR'.
      s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
      s_fieldcatalog-seltext_l = Text-012.
      append s_fieldcatalog to t_fieldcatalog.
      clear s_fieldcatalog.
      s_fieldcatalog-col_pos = 3.
      s_fieldcatalog-fieldname = 'PERIO'.
      s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
      s_fieldcatalog-seltext_l = Text-013.
      append s_fieldcatalog to t_fieldcatalog.
      clear s_fieldcatalog.
      s_fieldcatalog-col_pos = 4.
      s_fieldcatalog-fieldname = 'WERKS'.
      s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
      s_fieldcatalog-seltext_l = Text-025.
      append s_fieldcatalog to t_fieldcatalog.
      clear s_fieldcatalog.
      s_fieldcatalog-col_pos = 5.
      s_fieldcatalog-fieldname = 'LIFNR_ND1'.
      s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
      s_fieldcatalog-seltext_l = Text-014.
      append s_fieldcatalog to t_fieldcatalog.
      clear s_fieldcatalog.
      s_fieldcatalog-col_pos = 6.
      s_fieldcatalog-fieldname = 'MISCH_VERH1'.
      s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
      s_fieldcatalog-seltext_l = Text-015.
      append s_fieldcatalog to t_fieldcatalog.
      clear s_fieldcatalog.
      s_fieldcatalog-col_pos = 7.
      s_fieldcatalog-fieldname = 'LIFNR_ND2'.
      s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
      s_fieldcatalog-seltext_l = Text-016.
      append s_fieldcatalog to t_fieldcatalog.
      clear s_fieldcatalog.
      s_fieldcatalog-col_pos = 8.
      s_fieldcatalog-fieldname = 'MISCH_VERH2'.
      s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
      s_fieldcatalog-seltext_l = Text-017.
      append s_fieldcatalog to t_fieldcatalog.
      clear s_fieldcatalog.
      s_fieldcatalog-col_pos = 9.
      s_fieldcatalog-fieldname = 'LIFNR_ND3'.
      s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
      s_fieldcatalog-seltext_l = Text-018.
      append s_fieldcatalog to t_fieldcatalog.
      clear s_fieldcatalog.
      s_fieldcatalog-col_pos = 10.
      s_fieldcatalog-fieldname = 'MISCH_VERH3'.
      s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
      s_fieldcatalog-seltext_l = Text-019.
      append s_fieldcatalog to t_fieldcatalog.
      clear s_fieldcatalog.
      s_fieldcatalog-col_pos = 11.
      s_fieldcatalog-fieldname = 'LIFNR_ND4'.
      s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
      s_fieldcatalog-seltext_l = Text-020.
      append s_fieldcatalog to t_fieldcatalog.
      clear s_fieldcatalog.
      s_fieldcatalog-col_pos = 12.
      s_fieldcatalog-fieldname = 'MISCH_VERH4'.
      s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
      s_fieldcatalog-seltext_l = Text-021.
      append s_fieldcatalog to t_fieldcatalog.
      clear s_fieldcatalog.
      s_fieldcatalog-col_pos = 13.
      s_fieldcatalog-fieldname = 'LIFNR_ND5'.
      s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
      s_fieldcatalog-seltext_l = Text-022.
      append s_fieldcatalog to t_fieldcatalog.
      clear s_fieldcatalog.
      s_fieldcatalog-col_pos = 14.
      s_fieldcatalog-fieldname = 'MISCH_VERH5'.
      s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
      s_fieldcatalog-seltext_l = Text-023.
      append s_fieldcatalog to t_fieldcatalog.
      clear s_fieldcatalog.
      if g_cnt6 <> '0'.
        s_fieldcatalog-col_pos = 14.
        s_fieldcatalog-fieldname = 'LIFNR_ND6'.
        s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
       s_fieldcatalog-NO_OUT = 'X'.
        s_fieldcatalog-seltext_l = Text-022.
        append s_fieldcatalog to t_fieldcatalog.
        clear s_fieldcatalog.
        s_fieldcatalog-col_pos = 15.
        s_fieldcatalog-fieldname = 'MISCH_VERH6'.
        s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
       s_fieldcatalog-NO_OUT = 'X'.
        s_fieldcatalog-seltext_l = Text-023.
        append s_fieldcatalog to t_fieldcatalog.
        clear s_fieldcatalog.
      ENDIF.
      if g_cnt7 <> '0'.
        s_fieldcatalog-col_pos = 16.
        s_fieldcatalog-fieldname = 'LIFNR_ND7'.
        s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
       s_fieldcatalog-NO_OUT = 'X'.
        s_fieldcatalog-seltext_l = Text-022.
        append s_fieldcatalog to t_fieldcatalog.
        clear s_fieldcatalog.
        s_fieldcatalog-col_pos = 17.
        s_fieldcatalog-fieldname = 'MISCH_VERH7'.
        s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
       s_fieldcatalog-NO_OUT = 'X'.
        s_fieldcatalog-seltext_l = Text-023.
        append s_fieldcatalog to t_fieldcatalog.
        clear s_fieldcatalog.
      ENDIF.
      if g_cnt8 <> '0'.
        s_fieldcatalog-col_pos = 18.
        s_fieldcatalog-fieldname = 'LIFNR_ND8'.
        s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
       s_fieldcatalog-NO_OUT = 'X'.
        s_fieldcatalog-seltext_l = Text-022.
        append s_fieldcatalog to t_fieldcatalog.
        clear s_fieldcatalog.
        s_fieldcatalog-col_pos = 19.
        s_fieldcatalog-fieldname = 'MISCH_VERH8'.
        s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
       s_fieldcatalog-NO_OUT = 'X'.
        s_fieldcatalog-seltext_l = Text-023.
        append s_fieldcatalog to t_fieldcatalog.
        clear s_fieldcatalog.
      ENDIF.
      if g_cnt9 <> '0'.
        s_fieldcatalog-col_pos = 20.
        s_fieldcatalog-fieldname = 'LIFNR_ND9'.
        s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
       s_fieldcatalog-NO_OUT = 'X'.
        s_fieldcatalog-seltext_l = Text-022.
        append s_fieldcatalog to t_fieldcatalog.
        clear s_fieldcatalog.
        s_fieldcatalog-col_pos = 21.
        s_fieldcatalog-fieldname = 'MISCH_VERH9'.
        s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
       s_fieldcatalog-NO_OUT = 'X'.
        s_fieldcatalog-seltext_l = Text-023.
        append s_fieldcatalog to t_fieldcatalog.
        clear s_fieldcatalog.
      ENDIF.
      if g_cnt10 <> '0'.
        s_fieldcatalog-col_pos = 22.
        s_fieldcatalog-fieldname = 'LIFNR_ND10'.
        s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
       s_fieldcatalog-NO_OUT = 'X'.
        s_fieldcatalog-seltext_l = Text-022.
        append s_fieldcatalog to t_fieldcatalog.
        clear s_fieldcatalog.
        s_fieldcatalog-col_pos = 23.
        s_fieldcatalog-fieldname = 'MISCH_VERH10'.
        s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
       s_fieldcatalog-NO_OUT = 'X'.
        s_fieldcatalog-seltext_l = Text-023.
        append s_fieldcatalog to t_fieldcatalog.
        clear s_fieldcatalog.
      ENDIF.
      if g_cnt11 <> '0'.
        s_fieldcatalog-col_pos = 24.
        s_fieldcatalog-fieldname = 'LIFNR_ND11'.
        s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
       s_fieldcatalog-NO_OUT = 'X'.
        s_fieldcatalog-seltext_l = Text-022.
        append s_fieldcatalog to t_fieldcatalog.
        clear s_fieldcatalog.
        s_fieldcatalog-col_pos = 25.
        s_fieldcatalog-fieldname = 'MISCH_VERH11'.
        s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
       s_fieldcatalog-NO_OUT = 'X'.
        s_fieldcatalog-seltext_l = Text-023.
        append s_fieldcatalog to t_fieldcatalog.
        clear s_fieldcatalog.
      ENDIF.
      if g_cnt12 <> '0'.
        s_fieldcatalog-col_pos = 26.
        s_fieldcatalog-fieldname = 'LIFNR_ND12'.
        s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
       s_fieldcatalog-NO_OUT = 'X'.
        s_fieldcatalog-seltext_l = Text-022.
        append s_fieldcatalog to t_fieldcatalog.
        clear s_fieldcatalog.
        s_fieldcatalog-col_pos = 27.
        s_fieldcatalog-fieldname = 'MISCH_VERH12'.
        s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
       s_fieldcatalog-NO_OUT = 'X'.
        s_fieldcatalog-seltext_l = Text-023.
        append s_fieldcatalog to t_fieldcatalog.
        clear s_fieldcatalog.
      ENDIF.
      if g_cnt13 <> '0'.
        s_fieldcatalog-col_pos = 29.
        s_fieldcatalog-fieldname = 'LIFNR_ND13'.
        s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
       s_fieldcatalog-NO_OUT = 'X'.
        s_fieldcatalog-seltext_l = Text-022.
        append s_fieldcatalog to t_fieldcatalog.
        clear s_fieldcatalog.
        s_fieldcatalog-col_pos = 30.
        s_fieldcatalog-fieldname = 'MISCH_VERH13'.
        s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
       s_fieldcatalog-NO_OUT = 'X'.
        s_fieldcatalog-seltext_l = Text-023.
        append s_fieldcatalog to t_fieldcatalog.
        clear s_fieldcatalog.
      ENDIF.
    ENDFORM.                    "Layout_FieldCatalog
    *&      Form  get_CKMLMV003
          text
    Form get_CKMLMV003.
      Select WERKS
             MATNR
             MISCH_VERH
             KALNR_BAL
             GJAHR
             PERIO
             MGTYP
             from CKMLMV003
             into table i_CKMLMV003_out
             Where ( MATNR in s_MATNR and
                     WERKS in s_WERKS and
                     GJAHR in s_GJAHR and
                     PERIO in s_PERIO and
                     MGTYP = p_MGTYP ).
      Sort i_CKMLMV003_out by MATNR  KALNR_BAL.
    ENDFORM.                    "get_CKMLMV003
    *&      Form  get_CKMLMV001
          text
    Form get_CKMLMV001.
      If Not i_CKMLMV003_out is Initial.
        Select MATNR
               KALNR
               LIFNR_ND
               EKORG_ND
               from CKMLMV001
               into Table i_CKMLMV001_out
               for all entries in i_CKMLMV003_out
               Where ( KALNR = i_CKMLMV003_out-KALNR_BAL
                      and WERKS = i_CKMLMV003_out-WERKS
                      and MATNR = i_CKMLMV003_out-MATNR ).
        sort i_CKMLMV001_out by MATNR  KALNR.
      ENDIF.
    ENDFORM.                    "get_CKMLMV001
    *&      Form  Get_Finaldata
          text
    Form Get_Finaldata.
      Loop at  i_CKMLMV001_out into i_CKMLMV001_str.
        Loop at  i_CKMLMV003_out into i_CKMLMV003_str.
          If ( i_CKMLMV001_str-KALNR = i_CKMLMV003_str-KALNR_BAL  and i_CKMLMV003_str-MATNR = i_CKMLMV001_str-MATNR  ) .
            If ( flag = 0 ).
              g_plant = i_CKMLMV003_str-WERKS.
              g_PurchOrg = i_CKMLMV001_str-EKORG_ND.
              g_quantstr = i_CKMLMV003_str-MGTYP.
              flag = 1.
            ENDIF.
            Move i_CKMLMV003_str-MATNR  to  i_Final_str-MATNR.
            Move i_CKMLMV003_str-WERKS  to  i_Final_str-WERKS.
            Move i_CKMLMV003_str-GJAHR  to  i_Final_str-GJAHR.
            Move i_CKMLMV003_str-PERIO  to  i_Final_str-PERIO.
            Move i_CKMLMV003_str-MISCH_VERH  to  i_Final_str-MISCH_VERH1.
            Move i_CKMLMV001_str-LIFNR_ND  to  i_Final_str-LIFNR_ND1.
           Move-Corresponding i_CKMLMV003_str to i_CKMLMV003_temp.
            Append i_Final_str to i_Final_out.
            Clear : i_CKMLMV003_str   .
          ENDIF.
        ENDLOOP.
        Clear : i_CKMLMV001_str ,  i_Final_str , i_CKMLMV003_temp.
      ENDLOOP.
      Sort i_Final_out by WERKS MATNR GJAHR  PERIO .
      Loop at i_Final_out into i_Final_str.
        if i_Final_str-MATNR = i_Final_str1-MATNR and i_Final_str-GJAHR = i_Final_str1-GJAHR and i_Final_str-PERIO = i_Final_str1-PERIO and i_Final_str-WERKS = i_Final_str1-WERKS.
          cnt = cnt + 1.
          Case cnt.
            When 2.
              Move i_Final_str-MISCH_VERH1  to  i_Final_str1-MISCH_VERH2.
              Move i_Final_str-LIFNR_ND1  to  i_Final_str1-LIFNR_ND2.
            When 3.
              Move i_Final_str-MISCH_VERH1  to  i_Final_str1-MISCH_VERH3.
              Move i_Final_str-LIFNR_ND1  to  i_Final_str1-LIFNR_ND3.
            When 4.
              Move i_Final_str-MISCH_VERH1  to  i_Final_str1-MISCH_VERH4.
              Move i_Final_str-LIFNR_ND1  to  i_Final_str1-LIFNR_ND4.
            When 5.
              Move i_Final_str-MISCH_VERH1  to  i_Final_str1-MISCH_VERH5.
              Move i_Final_str-LIFNR_ND1  to  i_Final_str1-LIFNR_ND5.
            When 6.
              Move i_Final_str-MISCH_VERH1  to  i_Final_str1-MISCH_VERH6.
              Move i_Final_str-LIFNR_ND1  to  i_Final_str1-LIFNR_ND6.
              g_cnt6 = 1.
            When 7.
              Move i_Final_str-MISCH_VERH1  to  i_Final_str1-MISCH_VERH7.
              Move i_Final_str-LIFNR_ND1  to  i_Final_str1-LIFNR_ND7.
              g_cnt7 = 1.
            When 8.
              Move i_Final_str-MISCH_VERH1  to  i_Final_str1-MISCH_VERH8.
              Move i_Final_str-LIFNR_ND1  to  i_Final_str1-LIFNR_ND8.
              g_cnt8 = 1.
            When 9.
              Move i_Final_str-MISCH_VERH1  to  i_Final_str1-MISCH_VERH9.
              Move i_Final_str-LIFNR_ND1  to  i_Final_str1-LIFNR_ND9.
              g_cnt9 = 1.
            When 10.
              Move i_Final_str-MISCH_VERH1  to  i_Final_str1-MISCH_VERH10.
              Move i_Final_str-LIFNR_ND1  to  i_Final_str1-LIFNR_ND10.
              g_cnt10 = 1.
            When 11.
              Move i_Final_str-MISCH_VERH1  to  i_Final_str1-MISCH_VERH11.
              Move i_Final_str-LIFNR_ND1  to  i_Final_str1-LIFNR_ND11.
              g_cnt11 = 1.
            When 12.
              Move i_Final_str-MISCH_VERH1  to  i_Final_str1-MISCH_VERH12.
              Move i_Final_str-LIFNR_ND1  to  i_Final_str1-LIFNR_ND12.
              g_cnt12 = 1.
            When 13.
              Move i_Final_str-MISCH_VERH1  to  i_Final_str1-MISCH_VERH13.
              Move i_Final_str-LIFNR_ND1  to  i_Final_str1-LIFNR_ND13.
              g_cnt13 = 1.
          ENDCASE.
        ELSE.
          if cnt GE 1 .
            append i_Final_str1 to i_Final_out1.
            Clear : i_Final_str1.
          ENDIF.
          Move-Corresponding i_Final_str to i_Final_str1.
          cnt = 0.
          cnt = cnt + 1.
        ENDIF.
        Clear :  i_Final_str.
      Endloop.
      append i_Final_str1 to i_Final_out1.
       if i_Final_str-MATNR = i_Final_str1-MATNR and i_Final_str-GJAHR = i_Final_str1-GJAHR and i_Final_str-PERIO = i_Final_str1-PERIO .
         cnt = cnt + 1.
         Case cnt.
           When 2.
             Move i_Final_str-MISCH_VERH1  to  i_Final_str1-MISCH_VERH2.
             Move i_Final_str-LIFNR_ND1  to  i_Final_str1-LIFNR_ND2.
           When 3.
             Move i_Final_str-MISCH_VERH1  to  i_Final_str1-MISCH_VERH3.
             Move i_Final_str-LIFNR_ND1  to  i_Final_str1-LIFNR_ND3.
           When 4.
             Move i_Final_str-MISCH_VERH1  to  i_Final_str1-MISCH_VERH4.
             Move i_Final_str-LIFNR_ND1  to  i_Final_str1-LIFNR_ND4.
           When 5.
             Move i_Final_str-MISCH_VERH1  to  i_Final_str1-MISCH_VERH5.
             Move i_Final_str-LIFNR_ND1  to  i_Final_str1-LIFNR_ND5.
         ENDCASE.
    **Move-Corresponding i_Final_str to i_Final_str1.
       ELSE.
         if cnt GE 1 .
           append i_Final_str1 to i_Final_out1.
           Clear : i_Final_str1.
         ENDIF.
         Move-Corresponding i_Final_str to i_Final_str1.
         cnt = 0.
         cnt = cnt + 1.
       ENDIF.
       Clear :  i_Final_str.
    Endloop.
    append i_Final_str1 to i_Final_out1.
    ENDFORM.                    "Get_Finaldata
    *&      Form  top_of_page
          text
    Form top_of_page.
      clear t_header.
      refresh t_header.
      i_header_str-typ = 'H'.
      I_header_Str-info = Text-035.
      append I_header_str to t_header.
      clear I_header_str.
    Date
      I_header_str-typ = 'S'.
      I_header_str-key = Text-036.
      CONCATENATE sy-datum+6(2) '.'
      sy-datum+4(2) '.'
      sy-datum(4) INTO I_header_str-info. "todays date
      append I_header_str to t_header.
      clear: I_header_str.
      i_header_str-typ = 'S'.
      I_header_Str-Key = 'Quantity Structure Type :'.
      I_header_Str-info = g_QuantStr.
      append I_header_str to t_header.
      clear I_header_str.
      i_header_str-typ = 'S'.
      I_header_Str-Key = 'Purchase Org :'.
      I_header_Str-info = g_PurchOrg.
      append I_header_str to t_header.
      clear I_header_str.
      i_header_str-typ = 'S'.
      I_header_Str-Key = 'Plant :'.
      I_header_Str-info = g_Plant.
      append I_header_str to t_header.
      clear I_header_str.
      CLEAR i_line_event_str.
      i_line_event_str-name = 'TOP_OF_PAGE'.
      APPEND i_line_event_str TO i_events.
      call function 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary = t_header.
    i_logo = 'Z_LOGO'.
    ENDFORM.                    "top_of_page
    *&      ALVGrid_Final_Display
    Form ALVGrid_Final_Display.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program     = v_repid
           i_DEFAULt              = c_valx
          i_callback_top_of_page = 'TOP_OF_PAGE'
           i_Save                 = c_valx
          it_fieldcat            = t_fieldcatalog
           it_sort                = t_sort
          it_events              = I_events
        TABLES
          t_outtab               = i_final_out1.
    ENDFORM.                    "ALVGrid_Final_Display
    *&      Form  ALVGRID_OO_Display
          text
    Form ALVGRID_OO_Display.
      i_FCAT_str-col_pos = 1.
      i_FCAT_str-fieldname = 'MATNR'.
      i_FCAT_str-tabname = 'I_FINAL_OUT1'.
    i_fcat_str-seltext = 'MATERIAL'.
      i_fcat_str-scrtext_m = Text-024.
      append i_FCAT_str to i_FCAT.
      clear i_FCAT_str.
      i_FCAT_str-col_pos = 2.
      i_FCAT_str-fieldname = 'GJAHR'.
      i_FCAT_str-tabname = 'I_FINAL_OUT1'.
      i_fcat_str-scrtext_m = Text-012.
      append i_FCAT_str to i_FCAT.
      clear i_FCAT_str.
      i_FCAT_str-col_pos = 3.
      i_FCAT_str-fieldname = 'PERIO'.
      i_FCAT_str-tabname = 'I_FINAL_OUT1'.
      i_fcat_str-scrtext_m = Text-013.
      append i_FCAT_str to i_FCAT.
      clear i_FCAT_str.
      i_FCAT_str-col_pos = 4.
      i_FCAT_str-fieldname = 'WERKS'.
      i_FCAT_str-tabname = 'I_FINAL_OUT1'.
      i_FCAT_str-scrtext_m = Text-025.
      append i_FCAT_str to i_FCAT.
      clear i_FCAT_str.
      i_FCAT_str-col_pos = 5.
      i_FCAT_str-fieldname = 'LIFNR_ND1'.
      i_FCAT_str-tabname = 'I_FINAL_OUT1'.
      i_fcat_str-scrtext_m = Text-014.
      append i_FCAT_str to i_FCAT.
      clear i_FCAT_str.
      i_FCAT_str-col_pos = 6.
      i_FCAT_str-fieldname = 'MISCH_VERH1'.
      i_FCAT_str-tabname = 'I_FINAL_OUT1'.
      i_FCAT_str-scrtext_m = Text-015.
      append i_FCAT_str to i_FCAT.
      clear i_FCAT_str.
      i_FCAT_str-col_pos = 7.
      i_FCAT_str-fieldname = 'LIFNR_ND2'.
      i_FCAT_str-tabname = 'I_FINAL_OUT1'.
      i_FCAT_str-scrtext_m = Text-016.
      append i_FCAT_str to i_FCAT.
      clear i_FCAT_str.
      i_FCAT_str-col_pos = 8.
      i_FCAT_str-fieldname = 'MISCH_VERH2'.
      i_FCAT_str-tabname = 'I_FINAL_OUT1'.
      i_FCAT_str-scrtext_m = Text-017.
      append i_FCAT_str to i_FCAT.
      clear i_FCAT_str.
      i_FCAT_str-col_pos = 9.
      i_FCAT_str-fieldname = 'LIFNR_ND3'.
      i_FCAT_str-tabname = 'I_FINAL_OUT1'.
      i_FCAT_str-scrtext_m = Text-018.
      append i_FCAT_str to i_FCAT.
      clear i_FCAT_str.
      i_FCAT_str-col_pos = 10.
      i_FCAT_str-fieldname = 'MISCH_VERH3'.
      i_FCAT_str-tabname = 'I_FINAL_OUT1'.
      i_FCAT_str-scrtext_m = Text-019.
      append i_FCAT_str to i_FCAT.
      clear i_FCAT_str.
      i_FCAT_str-col_pos = 11.
      i_FCAT_str-fieldname = 'LIFNR_ND4'.
      i_FCAT_str-tabname = 'I_FINAL_OUT1'.
      i_FCAT_str-scrtext_m = Text-020.
      append i_FCAT_str to i_FCAT.
      clear i_FCAT_str.
      i_FCAT_str-col_pos = 12.
      i_FCAT_str-fieldname = 'MISCH_VERH4'.
      i_FCAT_str-tabname = 'I_FINAL_OUT1'.
      i_FCAT_str-scrtext_m = Text-021.
      append i_FCAT_str to i_FCAT.
      clear i_FCAT_str.
      i_FCAT_str-col_pos = 13.
      i_FCAT_str-fieldname = 'LIFNR_ND5'.
      i_FCAT_str-tabname = 'I_FINAL_OUT1'.
      i_FCAT_str-scrtext_m = Text-022.
      append i_FCAT_str to i_FCAT.
      clear i_FCAT_str.
      i_FCAT_str-col_pos = 14.
      i_FCAT_str-fieldname = 'MISCH_VERH5'.
      i_FCAT_str-tabname = 'I_FINAL_OUT1'.
      i_FCAT_str-scrtext_m = Text-023.
      append i_FCAT_str to i_FCAT.
      clear i_FCAT_str.
       if g_cnt6 <> '0'.
        i_FCAT_str-col_pos = 15.
        i_FCAT_str-fieldname = 'LIFNR_ND6'.
        i_FCAT_str-tabname = 'I_FINAL_OUT1'.
       s_fieldcatalog-NO_OUT = 'X'.
        i_FCAT_str-scrtext_m = Text-022.
        append i_FCAT_str to i_FCAT.
        clear i_FCAT_str.
        i_FCAT_str-col_pos = 16.
        i_FCAT_str-fieldname = 'MISCH_VERH6'.
        i_FCAT_str-tabname = 'I_FINAL_OUT1'.
       s_fieldcatalog-NO_OUT = 'X'.
        i_FCAT_str-scrtext_m = Text-023.
        append i_FCAT_str to i_FCAT.
        clear i_FCAT_str.
      ENDIF.
    *if  not grid1 is Initial.
    If sy-SUBRC = 0.
      Call Method grid1->set_table_for_first_display
        CHANGING
          it_outtab                     = i_final_out1[]
          it_fieldcatalog               = I_FCAT
        EXCEPTIONS
          Invalid_parameter_combination = 1
          program_error                 = 2
          too_many_lines                = 3
          Others                        = 4.
      If sy-subrc <> 0.
      ENDIF.
    CALL METHOD G_DYNDOC_ID->INITIALIZE_DOCUMENT
        EXPORTING
        BACKGROUND_COLOR = CL_DD_AREA=>COL_TEXTAREA.
    Processing events <br />
      CALL METHOD GRID1->LIST_PROCESSING_EVENTS
        EXPORTING
        I_EVENT_NAME = 'TOP_OF_PAGE'
        I_DYNDOC_ID = G_DYNDOC_ID.
    Call Method grid2->set_table_for_first_display
       CHANGING
         it_outtab                     = i_final_out1[]
         it_fieldcatalog               = I_FCAT
       EXCEPTIONS
         Invalid_parameter_combination = 1
         program_error                 = 2
         too_many_lines                = 3
         Others                        = 4.
    If sy-subrc <> 0.
    ENDIF.
       ENDIF.
      ENDIF.
    Endform.                    "ALVGRID_OO_Display
    Form EVENT_TOP_OF_PAGE using  DG_DYNDOC_ID
                          TYPE REF TO CL_DD_DOCUMENT.
    DATA : DL_TEXT(255) TYPE C.
      CALL METHOD DG_DYNDOC_ID->ADD_TEXT
        EXPORTING
        TEXT = 'Flight Details'
        SAP_STYLE = CL_DD_AREA=>HEADING
        SAP_FONTSIZE = CL_DD_AREA=>LARGE
        SAP_COLOR = CL_DD_AREA=>LIST_HEADING_INT.
    Endform.
    *&      Module  STATUS_0101  OUTPUT
          text
    MODULE STATUS_0101 OUTPUT.
    SET PF-STATUS 'xxxxxxxx'.
    SET TITLEBAR 'xxx'.
    SET PF-STATUS 'STATUS'.
    SET TITLEBAR 'TITLE'.
      Create Object G_DYNDOC_ID
            EXPORTING STYLE = 'ALV_GRID'.
      if g_custom_container1 is initial .
        create object g_custom_container1
            Exporting
                Container_name = CCCONTAINER1
            Exceptions
                cntl_error = 1
                cntl_system_error = 2
                create_error = 3
                lifetime_error = 4
                Others = 5.
       Create Object G_SPLITTER
              Exporting PARENT = g_custom_container1.
      CALL METHOD G_SPLITTER->GET_CONTAINER
        EXPORTING
        ROW = 1
        COLUMN = 1
        RECEIVING
        CONTAINER = G_PARENT_TOP.
    *Assigning the Part 2 to GRID
      CALL METHOD G_SPLITTER->GET_CONTAINER
        EXPORTING
        ROW = 2
        COLUMN = 1
        RECEIVING
        CONTAINER = g_parent_grid.

    Hi,
    Check if any event is triggered from the event handler class, upon selection.
    Usually, the events are handled on double click or on hotspot etc.
    Regards,
    Satish Kanteti

  • Display only cell in ALV Grid in OO

    Hi Folks,
    Hope someone can help me with this little issue.  I have a series of columns in my ALV grid that are editable, but I need to a) make some of the cells on specific lines uneditable and b) display time based fields on this line as blank (presently they shoe 00:00:00). 
    For problem a) I have set the layout style frame as 'cellstyles' 
        es_layout-stylefname = 'CELLSTYLES'.
    I have also set the edit flag in the field catalog for the individual columns to 'X' eg     
         WHEN 'CUSTTS_DATE_N'.
              ls_fieldcat-edit = 'X'.
    And coded:
           gwa_stylerow-fieldname = 'CUSTTS_DATE_N'.
          gwa_stylerow-style = cl_gui_alv_grid=>mc_style_disabled.
          APPEND gwa_stylerow TO gt_stylerow.
          wa_delivery_list-cellstyle[] = gt_stylerow[].
          APPEND wa_delivery_list TO it_delivery_list.
    Yet, the ALV cells are still being displayed as editable.  Can't for the life of me figure out what's missing.  The only other thought I had around this is that the wa_delivery_list-cellstyle table is being set in the data extraction code, before the ALV grid is built, and that the cell formats are being overwritten/on not being called by the field catalog entries.  Any thoughts on how to make these fields/cells display only when the ALV is first displayed would be greatly appreciated.
    As for option b) I'm clueless, as the cell style commands are not being picked up (see problem a.).  Again any thoughts would be appreciated, and points will be rewarded for solutions/suggestions that lead to solutions.
    Cheers,
    Stephen Keam

    Hello Stephen
    I have created a simple report ZUS_SDN_ALV_EDITABLE_1B which shows how to use editability on cell level.
    The crucial parts of the coding for your requirements are shown below, followed by the entire report.
      READ TABLE gt_fcat INTO ls_fcat
           WITH KEY fieldname = 'UPTIM'.
      IF ( syst-subrc = 0 ).
        DELETE gt_fcat INDEX syst-tabix.
        ls_fcat-no_zero = abap_true.  " suppresses 00:00:00
        INSERT ls_fcat INTO gt_fcat INDEX 7.
      ENDIF.
    *&      Form  SET_CELL_EDITABLE
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM set_cell_editable .
    * define local data
      DATA: ld_idx      TYPE i,
            ls_outtab   TYPE ty_s_outtab,
            ls_style    TYPE lvc_s_styl.
      LOOP AT gt_outtab INTO ls_outtab.
        ld_idx = syst-tabix.
        REFRESH: ls_outtab-celltab.
        " NOTE: if you change the year of column ERDAT to 2008 then two columns will become non-editable
        IF ( ls_outtab-erdat+0(4) = '2008' ).
          CLEAR: ls_style.
          ls_style-fieldname = 'UPDAT'.
          ls_style-style     = cl_gui_alv_grid=>mc_style_disabled.
          INSERT ls_style INTO TABLE ls_outtab-celltab.
          CLEAR: ls_style.
          ls_style-fieldname = 'UPTIM'.
          ls_style-style     = cl_gui_alv_grid=>mc_style_disabled.
          INSERT ls_style INTO TABLE ls_outtab-celltab.
        ELSE.
        ENDIF.
        MODIFY gt_outtab FROM ls_outtab INDEX ld_idx
          TRANSPORTING celltab.
      ENDLOOP.
    ENDFORM.                    " SET_CELL_EDITABLE
    *& Report  ZUS_SDN_ALV_EDITABLE
    *& Thread: Display only cell in ALV Grid in OO
    *& <a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="765083"></a>
    * Flow logic of screen '100' (no elements, ok-code => gd_okcode ):
    **PROCESS BEFORE OUTPUT.
    **  MODULE STATUS_0100.
    **PROCESS AFTER INPUT.
    **  MODULE USER_COMMAND_0100.
    *& GUI-Status: ok-codes BACK, EXIT, CANC
    REPORT  zus_sdn_alv_editable_1b.
    TYPE-POOLS: abap.
    CONSTANTS:
      gc_tabname       TYPE tabname  VALUE 'KNB1'.
    TYPES: BEGIN OF ty_s_outtab.
    INCLUDE TYPE knb1 AS knb1.
    TYPES: celltab    TYPE lvc_t_styl.
    TYPES: END OF ty_s_outtab.
    TYPES: ty_t_outtab    TYPE STANDARD TABLE OF ty_s_outtab
                          WITH DEFAULT KEY.
    DATA:
      gd_okcode        TYPE ui_func,
      gd_repid         TYPE syst-repid,
      gt_fcat          TYPE lvc_t_fcat,
      gs_layout        TYPE lvc_s_layo,
      gs_variant       TYPE disvariant,
      go_docking       TYPE REF TO cl_gui_docking_container,
      go_grid          TYPE REF TO cl_gui_alv_grid.
    DATA:
      gs_outtab        TYPE ty_s_outtab,
      gt_outtab        TYPE ty_t_outtab,
      gt_outtab_pbo    TYPE ty_t_outtab.
    DATA:
      gd_answer        TYPE c.
    *       CLASS lcl_eventhandler DEFINITION
    CLASS lcl_eventhandler  DEFINITION.
      PUBLIC SECTION.
        CLASS-METHODS:
          handle_data_changed
             FOR EVENT data_changed OF cl_gui_alv_grid
                 IMPORTING er_data_changed.
    ENDCLASS.                    "lcl_eventhandler DEFINITION
    *       CLASS lcl_eventhandler IMPLEMENTATION
    CLASS lcl_eventhandler IMPLEMENTATION.
      METHOD handle_data_changed.
        " Just trigger PAI followed by PBO
        CALL METHOD cl_gui_cfw=>set_new_ok_code
          EXPORTING
            new_code = 'REFRESH'
    *        IMPORTING
    *          rc       =
      ENDMETHOD.                    "handle_data_changed
    ENDCLASS.                    "lcl_eventhandler IMPLEMENTATION
    START-OF-SELECTION.
      SELECT * FROM  (gc_tabname) INTO CORRESPONDING FIELDS
                                  OF TABLE gt_outtab UP TO 99 ROWS.
      gt_outtab_pbo = gt_outtab.  " set PBO data
      PERFORM init_controls.
    * ok-code field = GD_OKCODE
      CALL SCREEN '0100'.
    END-OF-SELECTION.
    *&      Form  INIT_CONTROLS
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM init_controls .
    * 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 ALV grid
      CREATE OBJECT go_grid
        EXPORTING
          i_parent = go_docking
        EXCEPTIONS
          OTHERS   = 5.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      " NOTE: not required
    *  set handler:
    *    lcl_eventhandler=>handle_data_changed for go_grid.
    * Build fieldcatalog and set hotspot for field KUNNR
      PERFORM build_fieldcatalog.
      PERFORM set_layout_and_variant.
      PERFORM set_cell_editable.
    *§3.Optionally register ENTER to raise event DATA_CHANGED.
    *   (Per default the user may check data by using the check icon).
      CALL METHOD go_grid->register_edit_event
        EXPORTING
          i_event_id = cl_gui_alv_grid=>mc_evt_enter.
      SET HANDLER: lcl_eventhandler=>handle_data_changed FOR go_grid.
    * Display data
      CALL METHOD go_grid->set_table_for_first_display
        EXPORTING
          is_layout       = gs_layout
          is_variant      = gs_variant
          i_save          = 'A'
        CHANGING
          it_outtab       = gt_outtab
          it_fieldcatalog = gt_fcat
        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:
    * Documenation of I_SAVE ("An Easy Reference for ALV Grid Control")
    *I_SAVE
    *Determines the options available to the user for saving a layout:
    *? 'X': global saving only
    *? 'U': user-specific saving only
    *? 'A': corresponds to 'X' and 'U'
    *? SPACE: no saving
    * Link the docking container to the target dynpro
      gd_repid = syst-repid.
      CALL METHOD go_docking->link
        EXPORTING
          repid                       = gd_repid
          dynnr                       = '0100'
    *      CONTAINER                   =
        EXCEPTIONS
          OTHERS                      = 4.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " INIT_CONTROLS
    *&      Module  STATUS_0100  OUTPUT
    *       text
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'STATUS_0100'.
    *  SET TITLEBAR 'xxx'.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
    *       text
    MODULE user_command_0100 INPUT.
      " NOTE: retrieve changed data from frontend (grid control) into
      "       the backend (itab in ABAP)
      go_grid->check_changed_data( ).
      CASE gd_okcode.
        WHEN 'BACK'  OR
             'EXIT'  OR
             'CANC'.
          SET SCREEN 0. LEAVE SCREEN.
        WHEN 'REFRESH'.
          PERFORM set_cell_editable.
          " NOTE: Refresh required
          CALL METHOD go_grid->refresh_table_display
    *        EXPORTING
    *          is_stable      =
    *          i_soft_refresh =
    *        EXCEPTIONS
    *          finished       = 1
    *          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.
        WHEN 'SAVE'.
          IF ( gt_outtab = gt_outtab_pbo ).
            MESSAGE 'No data changed' TYPE 'S'.
          ELSE.
            CLEAR: gd_answer.
            CALL FUNCTION 'POPUP_TO_CONFIRM'
              EXPORTING
    *             TITLEBAR                    = ' '
    *             DIAGNOSE_OBJECT             = ' '
                text_question               = 'Save data?'
    *             TEXT_BUTTON_1               = 'Ja'(001)
    *             ICON_BUTTON_1               = ' '
    *             TEXT_BUTTON_2               = 'Nein'(002)
    *             ICON_BUTTON_2               = ' '
    *             DEFAULT_BUTTON              = '1'
    *             DISPLAY_CANCEL_BUTTON       = 'X'
    *             USERDEFINED_F1_HELP         = ' '
    *             START_COLUMN                = 25
    *             START_ROW                   = 6
    *             POPUP_TYPE                  =
    *             IV_QUICKINFO_BUTTON_1       = ' '
    *             IV_QUICKINFO_BUTTON_2       = ' '
              IMPORTING
                answer                      = gd_answer
    *           TABLES
    *             PARAMETER                   =
              EXCEPTIONS
                text_not_found              = 1
                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.
            IF ( gd_answer = '1' ).  " yes
              MESSAGE 'Data successfully saved' TYPE 'S'.
              gt_outtab_pbo = gt_outtab.  " update PBO data !!!
            ELSE.
              MESSAGE 'Action cancelled by user'  TYPE 'S'.
            ENDIF.
          ENDIF.
        WHEN OTHERS.
      ENDCASE.
      CLEAR: gd_okcode.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Form  BUILD_FIELDCATALOG
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM build_fieldcatalog .
    * define local data
      DATA:
        ls_fcat        TYPE lvc_s_fcat.
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
    *     I_BUFFER_ACTIVE              =
          i_structure_name             = gc_tabname
    *     I_CLIENT_NEVER_DISPLAY       = 'X'
    *     I_BYPASSING_BUFFER           =
    *     I_INTERNAL_TABNAME           =
        CHANGING
          ct_fieldcat                  = gt_fcat
        EXCEPTIONS
          inconsistent_interface       = 1
          program_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.
      ls_fcat-edit = abap_true.
      MODIFY gt_fcat FROM ls_fcat
          TRANSPORTING edit
        WHERE ( key NE abap_true ).
      READ TABLE gt_fcat INTO ls_fcat
           WITH KEY fieldname = 'UPTIM'.
      IF ( syst-subrc = 0 ).
        DELETE gt_fcat INDEX syst-tabix.
        ls_fcat-no_zero = abap_true.  " suppresses 00:00:00
        INSERT ls_fcat INTO gt_fcat INDEX 7.
      ENDIF.
      READ TABLE gt_fcat INTO ls_fcat
       WITH KEY fieldname = 'UPDAT'.
      IF ( syst-subrc = 0 ).
        DELETE gt_fcat INDEX syst-tabix.
        INSERT ls_fcat INTO gt_fcat INDEX 7.
      ENDIF.
      LOOP AT gt_fcat INTO ls_fcat.
        ls_fcat-col_pos = syst-tabix.
        MODIFY gt_fcat FROM ls_fcat INDEX syst-tabix.
        IF ( syst-tabix > 10 ).
          DELETE gt_fcat INDEX syst-tabix.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    " BUILD_FIELDCATALOG
    *&      Form  SET_LAYOUT_AND_VARIANT
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM set_layout_and_variant .
      CLEAR: gs_layout,
             gs_variant.
      gs_layout-cwidth_opt = abap_true.
      gs_layout-zebra      = abap_true.
    *§3.Provide the fieldname of the celltab field by using field
    *   STYLEFNAME of the layout structure.
      gs_layout-stylefname = 'CELLTAB'.
      gs_variant-report = syst-repid.
      gs_variant-handle = 'GRID'.
    ENDFORM.                    " SET_LAYOUT_AND_VARIANT
    *&      Form  SET_CELL_EDITABLE
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM set_cell_editable .
    * define local data
      DATA: ld_idx      TYPE i,
            ls_outtab   TYPE ty_s_outtab,
            ls_style    TYPE lvc_s_styl.
      LOOP AT gt_outtab INTO ls_outtab.
        ld_idx = syst-tabix.
        REFRESH: ls_outtab-celltab.
        IF ( ls_outtab-erdat+0(4) = '2008' ).
          CLEAR: ls_style.
          ls_style-fieldname = 'UPDAT'.
          ls_style-style     = cl_gui_alv_grid=>mc_style_disabled.
          INSERT ls_style INTO TABLE ls_outtab-celltab.
          CLEAR: ls_style.
          ls_style-fieldname = 'UPTIM'.
          ls_style-style     = cl_gui_alv_grid=>mc_style_disabled.
          INSERT ls_style INTO TABLE ls_outtab-celltab.
        ELSE.
        ENDIF.
        MODIFY gt_outtab FROM ls_outtab INDEX ld_idx
          TRANSPORTING celltab.
      ENDLOOP.
    ENDFORM.                    " SET_CELL_EDITABLE
    Regards
      Uwe

  • ALV Grid: event for user return in ALV Grid Control

    Hi developers,
    i'm wanna do something after a user has pressed the return button in a alv grid control. For that i need probably a event. But i can not find a proper event in the documentation. Could one of you guys help me?
    Best regards christian

    Hi Christian
    ALV grid is an encapsulated object, so it seems there is no way, you ought to implement the data_changed event. So if you want to make bulk data input and after trigger the event by pressing the return key, you should make the ALV Grid get your changes after pressing the key but not after a cell change of a modified cell.
    To set this attribute:
    CALL METHOD gr_alvgrid->register_edit_event
         EXPORTING i_event_id = cl_gui_alv_grid=>mc_evt_enter .
    This way "data_changed" event will be triggered whenever you press the return key while editing.
    For some more information you can also refer to the tutorial <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/documents/a1-8-4/an%20easy%20reference%20for%20alv%20grid%20control.pdf">"An Easy Reference for ALV Grid Control"</a>.
    Regards
    *--Serdar <a href="https://www.sdn.sap.com:443http://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.sdn.businesscard.sdnbusinesscard?u=qbk%2bsag%2bjiw%3d">[ BC ]</a>

  • Where is the code for the collapse button in the default SAP iview layout?

    I need to eliminate the collapse/restore button displayed on each iView tray. I was looking at the default layout component (com.sap.portal.layouts.default) but I could not find the code for the tray.  The code for "FullWidth.jsp" (this file that implements the "FullWidth" component) is below:
    <%@ taglib uri="prt:taglib:com.sap.portal.reserved.layout.TagLibHtmlb" prefix="hbj" %>
    <%@ taglib uri="prt:taglib:com.sap.portal.reserved.layout.TagLibLayout" prefix="lyt" %>
    <lyt:template>
        <hbj:content id="myContext" >
            <hbj:page title="Portal Page">
                <lyt:container id="column1"  />
            </hbj:page>
        </hbj:content>
    </lyt:template>
    as you can see, there is no reference to the tray tags.
    note: I am familiar with how to create a new iView tray using the new Layout Tag Library (from blog below)
    EFP: Layout Tag Library
    , but I want am not interested in this approach... All I want is to modify the EXISTING tray.

    Hi,
    may be it's helpful for you.
    http://blog.flexexamples.com/2010/05/18/changing-the-background-color-of-a-disabled-spark- textarea-control-in-flex-4/
    Regards
    -Bechar

  • Streamlining the code for the button group with individual links and rollover imgs

    I am looking for a solution to streamline the code for the array of 20+  buttons located inside the scroll pane.
    I know I can make an array if all the buttons would have a unified code executable change, i.e. they would become larger and brighter.
    My problem is that each button represents an product image in the lights off stage, then of rollover it is a lights on stage so I have to import two images in the on and off stage and play around with the opacity.
    Additional problem is that each button has to ling to a different label.
    My question is: is it possible to unify the code if buttons have that much individuality or I have to make each one of them as in the example below.
    // makes a hand cursor appear over a mc acting as a button for all the buttons inside the scrollpnaeBckgrnd_mc.scrollpaneBckgrnd_btns_mc.
    MovieClip(mc_pane2.content).scrollpaneBckgrnd_mc.scrollpaneBckgrnd_btns_mc.buttonMode = true;
    MovieClip(mc_pane2.content).scrollpaneBckgrnd_mc.scrollpaneBckgrnd_btns_mc.useHandCursor = true;
    ///////////////INDIVIDUAL BUTTONS
              MovieClip(mc_pane2.content).scrollpaneBckgrnd_mc.scrollpaneBckgrnd_btns_mc.FloraLyte _btn.FloraLyte_ON.alpha = 0;
                        var  FloraLyte_btn_Tween:TweenLite = TweenLite.to(MovieClip(mc_pane2.content).scrollpaneBckgrnd_mc.scrollpaneBckgrnd_btns_mc.F loraLyte_btn.FloraLyte_ON, .5, {alpha:1, paused:true});
                        MovieClip(mc_pane2.content).scrollpaneBckgrnd_mc.scrollpaneBckgrnd_btns_mc.Flor aLyte_btn.addEventListener(MouseEvent.ROLL_OVER, overHandler_FloraLyte_btn);
                        MovieClip(mc_pane2.content).scrollpaneBckgrnd_mc.scrollpaneBckgrnd_btns_mc.Flor aLyte_btn.addEventListener(MouseEvent.ROLL_OUT, outHandler_FloraLyte_btn);
            MovieClip(mc_pane2.content).scrollpaneBckgrnd_mc.scrollpaneBckgrnd_btns_mc.FloraLyte_btn. addEventListener(MouseEvent.CLICK, onClick_floralytePopUp);
                      function onClick_floralytePopUp(event:MouseEvent) :void {
                                            gotoAndPlay("floralytepp");
    function overHandler_FloraLyte_btn(e:MouseEvent):void{
             FloraLyte_btn_Tween.play();
             trace("you rolled over me");
    function outHandler_FloraLyte_btn(e:MouseEvent):void{
             FloraLyte_btn_Tween.reverse();
             trace("you rolled off me");
    MovieClip(mc_pane2.content).scrollpaneBckgrnd_mc.scrollpaneBckgrnd_btns_mc.FloraLytell_btn .FloraLytell_ON.alpha = 0;
                        var  myTween:TweenLite = TweenLite.to(MovieClip(mc_pane2.content).scrollpaneBckgrnd_mc.scrollpaneBckgrnd_btns_mc.F loraLytell_btn.FloraLytell_ON, .5, {alpha:1, paused:true});
                        MovieClip(mc_pane2.content).scrollpaneBckgrnd_mc.scrollpaneBckgrnd_btns_mc.Flor aLytell_btn.addEventListener(MouseEvent.ROLL_OVER, overHandler);
                        MovieClip(mc_pane2.content).scrollpaneBckgrnd_mc.scrollpaneBckgrnd_btns_mc.Flor aLytell_btn.addEventListener(MouseEvent.ROLL_OUT, outHandler);
            MovieClip(mc_pane2.content).scrollpaneBckgrnd_mc.scrollpaneBckgrnd_btns_mc.FloraLytell_bt n.addEventListener(MouseEvent.CLICK, onClick_floralytellPopUp);
                      function onClick_floralytellPopUp(event:MouseEvent) :void {
                                            gotoAndPlay("floralyte2pp");
              function overHandler(e:MouseEvent):void{
             myTween.play();
             trace("you rolled over me");
              function outHandler(e:MouseEvent):void{
             myTween.reverse();
             trace("you rolled off me");

    as ned suggested, plan your flow and code into it. here is one example:
    var buttonArray = [someButton, someOtherButton, aDifferentButton];
    for(var i = 0; i < buttonArray.length; i++){
         //get reference to county movieclip
         var mc = buttonArray[i];
         //then add listeners
         mc.addEventListener(MouseEvent.ROLL_OVER, overMe);
    function overMe(e:MouseEvent){
         var mc = e.target;
         switch(mc){
              case: someButton:
                       someOtherButton:   doThis();
                                                     break;
              case: aDifferentButton:     doThat();
                                                     break;
              default:                            //do nothing;
                                                     break;
    function doThis(){
         trace("do this")
    function doThat(){
         trace("do that")

  • Changes of the ZIP Code for the sales organization

    Hi All,
    I have done the changes of the ZIP Code for the sales organization by using the t code ovx5  the change of zip code in adress but when i rechek the changes in the order acknowledgement output there i can see the old zip code only.
    Please help me how to make the change the zip code to SO, so that i can view that in output.
    need to update pls help..
    Thanks for help
    Raj.

    Hiii
    Check weather your developer hardcode the sales organization pin code: else check the logic weathe Sales org Pin Code is getting from following logic. Go to table TVKO and put ur sales org number in VKORG field  then execute
    Get the ADRNR number and pass the same in ADRC table and get the POST_CODE1 as pin code number (give same logic to your abaper)
    Regards
    Shambhu Sarkar

  • Content Query Web Part (CQWP) displaying ASCII code for the colon portion of a time

    I'm having an issue with a CQWP displaying &#58; for the colon portion of a time.  For example, instead of 6:30, the CQWP shows 6&#58;30. 
    I checked our encoding which is set to UTF-8.  We also have a custom style on the CQWP and I've made sure that our custom itemstyle.xsl file has the disable-output-escaping property set to yes. 
    When I look at the list I'm querying from, the ascii code is not showing in there; it's displaying properly as 6:30.  I tried to flip this by replacing the colon with the ascii symbol in the list but it still showed the ascii code on the CQWP.
    Any ideas?

    Hi Cameron,  thanks for your reply.  The solution in the blog would work for an area that is only for date or time.  Unfortunately, this particular section of my CQWP is more than just a time; it's the summary of a news article--
    which may or may not contain a time depending on what the news article is about. 
    In further testing I have also noticed, when viewing the source code, that the colon is represented as
    &amp;#58; which tells me that the ampersand of the ascii code for the colon is also being convertied to ascii (in a sort-of double
    conversion situation.)  This isn't something I've ever seen before.

  • Here the SSCCE code for the prvious problem posted by me.

    Following is the SSCCE code for the program of search which is having the problem i have asked before.
    here when you run it will show a form which have a search button on it and when you press it a panel will shown below which have a table( it is just a bounded area without any column or row as i have removed the database functionality and we dont have to do with it).
    the problem is the same that firstly i want to make the panel invisible.
    (the blue and yellow colors are just to seperate the panel and the container) Secondly i want to remove the extra large space added below the last table and thirdly i want that on each press of the search button the scrollbar will focus on the new table added.
    import javax.swing.*;
    import javax.swing.table.DefaultTableCellRenderer;
    import javax.swing.border.*;
    import java.awt.*;
    import java.awt.event.*;
    public class Temp extends JFrame implements ActionListener
         Container c;
         Toolkit tk;
         JLabel l1; int y=30;
         JPanel p1,p2,p3;     
         JRadioButton rbByName,rbBySirName,rbByID,rbByCity,rbByState;
         JButton btSearch,btView;
         ButtonGroup bgSearch;
         JTextField txtSearch; BoxLayout boxl;
         ImageIcon i1;JScrollPane sp1;JViewport vp;
         public Temp()
              super("Search-Address Management System");
              c=getContentPane();
              tk=Toolkit.getDefaultToolkit();
              setSize(1024,768);
              c.setBackground(Color.BLUE);c.setLayout(null);
              setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
              defineComponents();
              settingBounds();
              addListeners();
              addComponents();
              setVisible(true);
         public void defineComponents()
              p1=new JPanel();
              p1.setLayout(null);
              p1.setOpaque(false);
              p2=new JPanel();
              p2.setLayout(null);
              p2.setOpaque(false);
              p3=new JPanel();
              boxl=new BoxLayout(p3,BoxLayout.Y_AXIS);
              p3.setLayout(boxl);
              rbByName=new JRadioButton("First Name");
              rbByName.setOpaque(false);
              rbBySirName=new JRadioButton("Last Name");
              rbBySirName.setOpaque(false);
              rbByState=new JRadioButton("State");
              rbByState.setOpaque(false);
              rbByCity=new JRadioButton("City");
              rbByCity.setOpaque(false);
              rbByID=new JRadioButton("ID");
              rbByID.setOpaque(false);
              btSearch=new JButton("Search");
              bgSearch=new ButtonGroup();
              txtSearch=new JTextField();
              btSearch=new JButton("Search");
              TitledBorder tb=new TitledBorder("Search Criteria");
              TitledBorder tb1=new TitledBorder("Search");
              p1.setBorder(tb);
              p2.setBorder(tb1);
         public void settingBounds()
              rbByID.setBounds(20,30,50,20);
              rbByName.setBounds(120,30,100,20);
              rbByState.setBounds(20,70,80,20);
              rbByCity.setBounds(120,70,50,20);
              rbBySirName.setBounds(240,30,100,20);
              p1.setBounds(30,40,400,110);
              p2.setBounds(30,180,400,80);
              p3.setBackground(Color.ORANGE);
              txtSearch.setBounds(50,210,250,25);
              btSearch.setBounds(320,210,80,25);
              rbByID.setSelected(true);
         public void addListeners()
              btSearch.addActionListener(this);
         public void addComponents()
              p1.add(rbByName);
              p1.add(rbBySirName);
              p1.add(rbByState);
              p1.add(rbByCity);
              p1.add(rbByID);
              c.add(txtSearch);
              c.add(btSearch);
              c.add(p1);
              c.add(p2);
              bgSearch.add(rbByID);
              bgSearch.add(rbByName);
              bgSearch.add(rbBySirName);
              bgSearch.add(rbByCity);
              bgSearch.add(rbByState);
         public void drawtable()
              JTable t1=new JTable()
                  public Class getColumnClass(int column)
                    return getValueAt(0, column).getClass();
              if(y==30) //as temporay variable only to add the scrollpane once
                   sp1=new JScrollPane(p3,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
                   sp1.setBounds(30,300,660,380);
                   c.add(sp1); 
              JScrollPane sp=new JScrollPane(t1);
              sp1.getViewport().setOpaque(false); // to make the scrollpane transparent but not worked
              sp.setMaximumSize(new Dimension(600,100));
              p3.add(Box.createRigidArea(new Dimension(600,20)));//  invisible filler to add space between two tables
              p3.add(sp);
              p3.revalidate();
              y=y+110;
         public void actionPerformed(ActionEvent e)
              if(e.getSource()==btSearch)
              drawtable();
         public static void main(String args[])
              new Temp();
    }Please reply with the code required to be added.

    the problem is the same that firstly i want to make the panel invisible.If I remember you other postings I think you mean to say transparent, which means the background of its parent component will be painted. If you make the panel invisible, then all the component added to the panel will also be invisible.
    You have a structure something like this:
    main panel
        - scroll pane
            - viewport
                - table panel
                    - table1
                    - table 2As you where told in one of you many other posting on this topic, if you want the background of the main panel to show through then you need to make all the component on top of the pane non-opaque, not just the viewport. So, the scroll pane and table panel also need to be changed.
    And don't forget to reply to all your other postings on this topic stating that those postings are "closed" so people don't waste time answering in those postings. Keep the conversation in one posting so everybody knows what has been suggested.

  • Remote infrared codes for the Sony STR-DE675 receiver

    Where can I find the remote infrared codes for the Sony STR-DE675 receiver? They are not in the Owner's Manual, nor on the Sony.com website. Thanks.GBP

    If you were getting sound and no picture when you had the Wii hooked up to your surround sound receiver, your TV was probably on the wrong input.  You would have needed to use the source or input button on your TV's remote and changed the input to the component 1 choice, since that is the port you stated you plugged the Wii into on the TV.
    Your cable remote may not be programmed to work with the blu-ray player.  However, I think you're misunderstanding the function of the buttons at the top of your remote labeled TV, Sat/Cab, VCR, etc.  Your cable remote doesn't work like a Harmony remote.  Pushing those buttons at the top of your cable remote are not like pushing the Watch TV or Watch DVD functions on a Harmony (meaning pushing them doesn't change the TV's input automatically).  All those buttons at the top of the remote are for that you're describing are to tell the remote which components to control.  For example, you are watching cable TV and just used the remote to change the channel but now you want to adjust the volume.  You would have to hit the "TV" button on the cable remote to switch the remote from controlling the cable box to controlling the TV.  Otherwise, you'd hit the volume controls over and over and nothing would happen b/c the remote would still think it was controlling the cable box.  Only a Harmony remote (or similar universal remote) can change the TV's input with the click of a function button.
    And to explain why one must change the TV's input when switching components, I always compare the process to the way a tube TV used to work for those that are new to the flat screen TVs.  Think of the way your old TV probably worked - you had to have the TV on channel 3 for your VCR, 4 for cable, etc.  The input changing is practically the same thing with just a few more steps, if that helps to make things any clearer.  LOL
    Nothing I post is an official statment of Best Buy or Geek Squad, it is only a helpful opinion!

Maybe you are looking for