Row Adding Problem In ALV Gird (OO)

Hi Gurus,
I am working on an OO ALV Grid , here when I am adding a row to the grid by clicking the append row button and when I am pressing F4 for input search help, the newly appended row is getting deleted and the grid remains with only the first row.
Can anybody please tell me why this is happening or in what cases this can happen
Thanks

Hi Rahul ,
   Just debug the program and see that when you press F4 after the required processing is done , does it go to the module where you call SET_TABLE_FOR_FIRST_DISPLAY method , please check this.
Actually once this method has been called use the method REFRESH_TABLE_DISPLAY.
Regards
Arun

Similar Messages

  • Matrix multiple rows adding problem

    Hi all,
    In a SDK developed form, have a button "Add Row". When press Add Row a new row has to be added in the matrix.
    I' ve written the set of codes as
    Private Sub SBO_Application_ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles SBO_Application.ItemEvent
            Dim oitem As SAPbouiCOM.Item
            Try
                If (FormUID = "Frm_itemsupplier") Then
                    If (pVal.Before_Action = False) Then
                        'Add Row
                        If (pVal.ItemUID = "AddRow") And (pVal.EventType = SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED) Then
                            Dim f As SAPbouiCOM.Form
                            Dim oMatrix As SAPbouiCOM.Matrix
                            f = SBO_Application.Forms.Item(FormUID)
                            oMatrix = f.Items.Item("mat1").Specific
                            f.DataSources.DBDataSources.Item(1).Clear()
                            oMatrix.AddRow(1)
                        End If
    But at run time, when press Add row button first time this will add one row.  Then I cancel the form, open the same form then press add row Button, 1+1 rows are adding in the matrix. If I do the above(cancel and open the form again), keep on increasing rows additionally on every time.
    Let me get a solution how to solve the issue and I will be appreciated.
    Thanks & regards,
    Venkatesan g.

    try it as
    Private Sub SBO_Application_ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles SBO_Application.ItemEvent
    Dim oitem As SAPbouiCOM.Item
    Try
    If (FormUID = "Frm_itemsupplier") Then
    If (pVal.Before_Action = False) Then
    'Add Row
    If (pVal.ItemUID = "AddRow") And (pVal.EventType = SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED) Then
    Dim f As SAPbouiCOM.Form
    Dim oMatrix As SAPbouiCOM.Matrix
    f = SBO_Application.Forms.Item(FormUID)
    oMatrix = f.Items.Item("mat1").Specific
    f.DataSources.DBDataSources.Item(1).Clear()
                        Dim cell As SAPbouiCOM.Cell
                        Dim col As SAPbouiCOM.Column
                        Dim ed As SAPbouiCOM.EditText
                        col = omatrix1.Columns.Item(1)
                        cell = col.Cells.Item(1)
                        ed = cell.Specific
                        if ed.String <> "" then
    oMatrix.AddRow(1,0)
    end if
    End If
    this will test before addrow if there exist blank first row and in case that no, it will add new row. The sample test for column index 1 and first row.
    Hope it`s what you need.

  • Problem with ALV gird

    hi
    i have an ALV grid in my screen
    in that one of my field (quantity field )is editable
    when user changes that quantity value and say he will press enter button
    i need my control of the program in my PAI.
    but this is not happening, if  any one knows the way to take the control to PAI
    please help.

    u've to register the edit event with the Enter key, something like this
    call method gr_grid_d0100->register_edit_event
          exporting
            i_event_id = cl_gui_alv_grid=>mc_evt_enter.
    checkt the sample program   BCALV_TEST_GRID_EVENTS for more info

  • ALV Grid default values for new rows added with Add/Insert buttons

    Hi!
    Help, please,  to find a way how to set default values for new rows added with Add/Insert buttons in
    ALV Grid.

    I have found salution:
    ALV Grid u2013 Insert row function
    Sometimes we need to assign some default values when we create a new row in a grid using standard ALV Append row button. In our scenario we will see how to assign default values to Airline Code (CARRID), Flight Connection Number (CONNID) and Flight date (FLDATE) when a new row is created. To do that we need to handle DATA_CHANGED event in the program like mentioned below.
    Definition of a class:
    Code:
          CLASS lcl_event_receiver DEFINITION
    CLASS LCL_EVENT_RECEIVER DEFINITION.
      PUBLIC SECTION.
    METHODS:
         handle_data_changed
         FOR EVENT data_changed OF cl_gui_alv_grid
         IMPORTING er_data_changed
                           e_ucomm.
    ENDCLASS.                    "lcl_event_receiver DEFINITION
    Implementation of a class:
    Code:
    CLASS LCL_EVENT_RECEIVER IMPLEMENTATION.
      METHOD HANDLE_DATA_CHANGED.
        DATA: dl_ins_row TYPE lvc_s_moce.   " Insert Row
          FIELD-SYMBOLS: <fs> TYPE table.    " Output table
    Loop at the inserted rows table and assign default values
        LOOP AT er_data_changed->mt_inserted_rows INTO dl_ins_row.
          ASSIGN er_data_changed->mp_mod_rows->* TO <fs>.
          loop at <fs> into ls_outtab.
            ls_outtab-carrid  = 'LH'.
            ls_outtab-connid  = '400'.
            ls_outtab-fldate  = sy-datum.
            MODIFY <fs> FROM ls_outtab INDEX sy-tabix.
          endloop.
        endloop.
      ENDMETHOD.                    "handle_data_changed
    ENDCLASS.                    "lcl_event_receiver IMPLEMENTATION
    Register the events to trigger DATA_CHANGED event when a new row is created.
    Code:
        CALL METHOD OBJ_GRID->REGISTER_EDIT_EVENT
          EXPORTING
            I_EVENT_ID = CL_GUI_ALV_GRID=>MC_EVT_ENTER.
        CALL METHOD OBJ_GRID->REGISTER_EDIT_EVENT
          EXPORTING
            I_EVENT_ID = CL_GUI_ALV_GRID=>MC_EVT_MODIFIED.

  • Problem with ALV filter functionality when filtered for multiple values

    Hi,
    I am facing a problem with ALV filter functionality.
    I have displayed an ALV with some columns col_A, col_B and col_C
    col_A---- col_B -
    col_C
    1----
    a -
    abc
    2----
    b -
    pqr
    3----
    c -
    lmn
    4----
    d -
    xyz
    5----
    f -
    stu
    From the settings link I am applying filter on column col_C and selected multiple values say 'pqr', 'xyz' and 'lmn'.
    Now the ALV is showing rows only for last selection i.e . results are fetched only for value 'lmn'.
    i.e. after applying the filter the ALV table looks as below:
    col_A---- col_B -
    col_C
    3----
    c -
    lmn
    But ideally it should be:
    col_A---- col_B -
    col_C
    2----
    b -
    pqr
    3----
    c -
    lmn
    4----
    d -
    xyz
    I could not find any OSS note related to this issue.
    Please help me resolve this issue.
    Thanks,
    Feroz

    Hi,
    I am facing a problem with ALV filter functionality.
    I have displayed an ALV with some columns col_A, col_B and col_C
    col_A---- col_B -
    col_C
    1----
    a -
    abc
    2----
    b -
    pqr
    3----
    c -
    lmn
    4----
    d -
    xyz
    5----
    f -
    stu
    From the settings link I am applying filter on column col_C and selected multiple values say 'pqr', 'xyz' and 'lmn'.
    Now the ALV is showing rows only for last selection i.e . results are fetched only for value 'lmn'.
    i.e. after applying the filter the ALV table looks as below:
    col_A---- col_B -
    col_C
    3----
    c -
    lmn
    But ideally it should be:
    col_A---- col_B -
    col_C
    2----
    b -
    pqr
    3----
    c -
    lmn
    4----
    d -
    xyz
    I could not find any OSS note related to this issue.
    Please help me resolve this issue.
    Thanks,
    Feroz

  • Some problems about ALV

    hi everyone:
      I have a problem about ALV. The question is I want to show two headers in the gt_item .(Hierachy)
    I want to use these  in the event "change_fieldcatlog"
    LOOP AT I_FIELDCAT.
    CASE I_FIELDCAT-FIELDNAME
        WHEN 'MESSWERT'.
         I_FIELDCAT-ROW_POS = 1.
         I_FIELDCAT-SEL_L = '1111'.
         I_FIELDCAT-SEL_M = '1111'.
         I_FIELDCAT-SEL_S = '1111'.
        APPEND I_FIELDCAT.
    so I want to add another label in the next row. but I write like this below , it doesn't work .
         I_FIELDCAT-ROW_POS = 2
         I_FIELDCAT-SEL_L = text-004.
         I_FIELDCAT-SEL_M = text-004.
         I_FIELDCAT-SEL_S = text-004.
        APPEND I_FIELDCAT
    ENDCASE.
    ENDLOOP.
    So who can help me ?
    thank you in advacne .
    Regards
    Nick

    Hii Nick, in your program I found that you have created only one fieldcat structure, actually we need 2 structures one is for workarea and one for body.
    like this
    It_Fieldcat type SLIS_T_FIELDCAT_ALV
    Is_Fieldcat type SLIS_FIELDCAT_ALV
    now you can write the code
    LOOP AT It_FIELDCAT into Is_Fieldcat.
    CASE Is_FIELDCAT-FIELDNAME
    WHEN 'MESSWERT'.
    Is_FIELDCAT-ROW_POS = 1.
    Is_FIELDCAT-SEL_L = '1111'.
    Is_FIELDCAT-SEL_M = '1111'.
    Is_FIELDCAT-SEL_S = '1111'.
    APPEND Is_FIELDCAT to It_Fieldcat.
    clear Is_Fieldcat.
    Is_FIELDCAT-ROW_POS = 2
    Is_FIELDCAT-SEL_L = text-004.
    Is_FIELDCAT-SEL_M = text-004.
    Is_FIELDCAT-SEL_S = text-004.
    APPEND Is_FIELDCAT to It_Fieldcat.
    Clear Is_Fieldcat.
    Hope it will works.
    Reward points if helpful.

  • How to set the focus on the new added line in ALV list (OO)

    Dear Friends,
    I have an ALV list based on OO(using alv_grid->set_table_for_first_display), when I click the 'new' button to add a new line, the mouse arrow is always pointing to the first line - not the new created line for user to input!!.
    So how to set the focus (mouse arrow) on the new added line in ALV list for user to input it friendly?
    Thanks a lot!!

    Hello,
    To get the selected line row first we have get all the rows in the internal table.
    When u click on the button when it is creating the new line we have to pass the row number to the call method
    CALL METHOD <ref.var. to CL_GUI_ALV_GRID > ->get_selected_rows
       IMPORTING
          ET_INDEX_ROWS  =   <internal table of type LVC_T_ROW > (obsolete)
          ET_ROW_NO      =   <internal table of type LVC_T_ROID > .
    CALL METHOD<ref.var. to CL_GUI_ALV_GRID>->set_selected_rows
       EXPORTING
          IT_ROW_NO  =  <internal table of type LVC_T_ROID>
       or alternatively
       IT_INDEX_ROWS  =  <internal table of type LVC_T_ROW>
          IS_KEEP_OTHER_SELECTIONS  =  <type CHAR01>.
    http://help.sap.com/saphelp_erp2004/helpdata/EN/22/a3f5ecd2fe11d2b467006094192fe3/content.htm

  • Valueset problem in alv

    hi guys,
    I made a value set for a dropdown in a certain column in alv and have several questions:
    1. I have the value set as an attribute of the node (cardinality 0...n) which contains the shown data in alv which is bound to the alv data node.
        So each row in alv (or element of this node) gets in this column the same value set bound...thats not optimal because each row shows the same value set in its dropdown...so I tried to make a second node in context for the value set with cardinality 1..1 and wanted to bind it additionally to alv but this was not possible...how   can I avoid holding the same value set several times for each element in context?
    2. In my alv I want to insert new elements with the alv standard functionality "insert row"...I think have to react in the on_data_check event (see blog from thomas jung) when 1 row is insert and have to bind the value set to the column of the editable row in this eventhandler...but the dropdown is empty at runtime...
    how can I achieve that I can insert a new element with standard function "insert row" at runtime with the dropdown and value set in it? do I have to use the set_data method in the eventhandler when 1 row should be inserted? at the moment I bound the data at designtime to alv.
    regards
    thorsten

    Hi,
    For your second problem, instead of using the standard Add row property in the ALV , create your own function.
    lr_function = l_alv_model->if_salv_wd_function_settings~create_function( id = 'INSERT' ).
    lr_function->set_function_std( if_salv_wd_c_std_functions=>edit_append_row ).
    Then create  a method INSERT for ON_DATA_CHECK function and write your code ib this handler.
    Regards,
    Shruthi R

  • Unable to select any row(s) in table/ALV

    Hi ,
    I am having a problem while selecting a row in a table/ALV.
    I am displaying data in a table which is NOT set to 'Initialize lead selection' in the context.When it is displayed and I try to select a row the row does not get selected(highlighted) in the view.
    However,I am able to perform tasks on 'Onselect' event on the rows.Just that its not getting highlighted neither in table nor in ALV.
    What could be the reason for this ? I do not want the context element to be set as 'Initialize lead selection' as that would highlight the first line of the table when the view is rendered first time.
    Thanks for your help,
    Sandip.

    hi sandip,
    Try this method
    lo_table_sett  TYPE REF TO if_salv_wd_table_settings.
    lo_config_tab TYPE REF TO cl_salv_wd_config_table.
    lo_config_tab = lo_ref_interface_controller->get_model( ).
    lo_table_sett   ?= lo_config_tab.
    lo_table_sett ->SET_SELECTION_MODE( value ).
    value- '00' for auto
             '02' for single
             '04' for multi
             '06' for none
             '07'  for singleNolead
             '08' for multi Nolead
    Regards,
    janakiram

  • Problem in ALV report

    Hi Friends,
    I have the following 2 problems in ALV report
    1) Logo is not getting displayed in the report.
    2) When i click on the Purchase order number in the report  the interactive report is not working,i am not able to see report of First interactive level.
    can you help it out friends.
    Thanks and regards
    Dinesh
    REPORT  YSDBALV1
    tables: ekko , ekpo .
    type-pools: slis .
    Table for Display Header
    data:i_header type slis_t_listheader with header line.
    *Fieldcat Declaration
    data:fieldcatalog type slis_T_fieldcat_alv  WITH HEADER LINE.
    *Table of Events
    data:i_event type slis_t_event with header line .
    For Layout
    data:i_layout type slis_layout_alv .
    data: text(30) .
    *Internal Table Declaration
    data: begin of it_final occurs 0 ,
          ebeln like ekko-ebeln ,           "Purchasing Document No.
          bedat like ekko-bedat ,           "Purchasing Document Date
          matnr like ekpo-matnr ,           "Material No.
          netwr like ekpo-netwr ,         "Net Order Value in PO Currancy
          meins like ekpo-meins ,           "UOM
          chk(1) ,
          light(1) ,
          change like ekpo-menge ,
          end of it_final .
    **select option Declaration
    selection-screen begin of block block.
    select-options: s_ebeln for ekko-ebeln  .
    selection-screen end of block block .
    selection-screen begin of block block1 .
    parameters:grid radiobutton group r .
    parameters:list radiobutton group r .
    selection-screen end of block block1 .
    at selection screen
    at selection-screen .
    select single * from ekko where ebeln in s_ebeln .
    if sy-subrc <> 0 .
       message e000(8I) WITH 'No Data Exists' .
    endif .
    start-of-selection .
    if grid = 'X' .
    perform get_data .
    perform event using i_event[] .
    perform field using fieldcatalog[] .
    perform layout using i_layout .
    perform grid_display .
    endif .
    *&      Form  get_data
          text
    -->  p1        text
    <--  p2        text
    form get_data .
    *DATA Retrieval from tables
    SELECT EKKO~EBELN
           EKKO~BEDAT
           EKPO~EBELP
           EKPO~MATNR
           EKPO~NETWR
           EKPO~MEINS
           EKPO~MENGE
           EKPO~BPRME
           INTO CORRESPONDING FIELDS OF  table IT_FINAL
           FROM EKKO INNER JOIN EKPO ON EKKOEBELN = EKPOEBELN
           WHERE EKKO~EBELN IN S_EBELN.
           APPEND IT_FINAL.
    endform.                    " get_data
    *Getting the Event for Top of Page display.
    *&      Form  event
          text
         -->P_I_event[]  text
    form event  using    p_i_event type slis_t_event.
      clear p_i_event .
      refresh p_i_event .
    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
    EXPORTING
       I_LIST_TYPE           = 0
       IMPORTING
         ET_EVENTS             = p_i_event
    EXCEPTIONS
       LIST_TYPE_WRONG       = 1
       OTHERS                = 2
    read table p_i_event with key name = slis_ev_top_of_page into i_event.
          if sy-subrc = 0.
                 move 'TOP_OF_PAGE_PO' to i_event-form.
                 modify p_i_event from i_event index sy-tabix transporting form.
          endif.
          clear i_event.
    endform.                    " event
    *Display Top-of –Page Details and Logo
    form top_of_page_po .
           clear i_header .
           refresh i_header .
           write sy-datum to text.
           i_header-typ = 'H'.
           i_header-info = 'PURCHASE OREDER DETAILS'.
           append i_header.
          *Logo Display
          CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
                 EXPORTING
                     it_list_commentary       = i_header[]
                     I_LOGO                   = 'ENJOYSAPLOGO'.
    endform .
    *Field Catalog Append
    *&      Form  field
          text
         -->P_fieldCATALOG[]  text
    form field using  p_fieldcatalog type slis_t_fieldcat_alv.
         clear fieldcatalog.
          fieldcatalog-fieldname   = 'EBELN'.
          fieldcatalog-seltext_m   = 'Purchase Order No'.
          fieldcatalog-col_pos     = 1.
          append fieldcatalog .
          clear fieldcatalog.
          fieldcatalog-fieldname   = 'BEDAT'.
          fieldcatalog-seltext_m   = 'PO Date'.
          fieldcatalog-col_pos     = 2.
          append fieldcatalog .
          clear fieldcatalog.
          fieldcatalog-fieldname   = 'MATNR'.
          fieldcatalog-seltext_m   = 'Material No'.
          fieldcatalog-col_pos     = 4.
          fieldcatalog-outputlen   = 20.
          append fieldcatalog .
          clear fieldcatalog.
          fieldcatalog-fieldname   = 'NETWR'.
          fieldcatalog-seltext_m   = 'Net Value '.
          fieldcatalog-col_pos     = 5.
          fieldcatalog-outputlen   = 20.
          fieldcatalog-do_sum = 'X'.
          append fieldcatalog .
          clear fieldcatalog.
          fieldcatalog-fieldname   = 'MEINS'.
          fieldcatalog-seltext_m   = 'Units'.
          fieldcatalog-col_pos     = 6.
          fieldcatalog-outputlen   = 4.
          append fieldcatalog .
          clear fieldcatalog.
    endform.                    " field
    *&      Form  layout
          text
    form layout  using    p_i_layout TYPE SLIS_LAYOUT_ALV .
    i_layout-zebra  = 'X'.
        i_layout-lights_fieldname = 'LIGHT'.
        i_layout-lights_tabname = 'IT_FINAL'.
        i_layout-box_fieldname = 'CHK'.
        i_layout-box_tabname  = 'IT_FINAL'.
        i_layout-edit = ' '.
    endform.
    *To display Buttons in the MENU BAR if needed
    FORM SET_PO_PF_STATUS USING  P_I_EXTAB TYPE
                     SLIS_T_EXTAB.
                     SET PF-STATUS 'MENUPO'.
      ENDFORM.
    *Event for Interactive display of ALV report
    form USER_COMMAND  using r_ucomm like sy-ucomm
                             rs_selfield type slis_selfield .
      if r_ucomm = '&IC1'.
      READ TABLE IT_FINAL  index   rs_selfield-tabindex.
      write:/ IT_FINAL-ebeln.
      endif.
    endform .
    *Parameters of FM  REUSE_ALV_GRID_DISPLAY
    *&      Form  grid_display
          text
    -->  p1        text
    <--  p2        text
    form grid_display .
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
        I_CALLBACK_PROGRAM                = SY-REPID
       I_CALLBACK_PF_STATUS_SET          = 'SET_PO_PF_STATUS'
        I_CALLBACK_USER_COMMAND           = 'USER_COMMAND'
        IS_LAYOUT                         = I_LAYOUT
        IT_FIELDCAT                       = FIELDCATALOG[]
        IT_EVENTS                         = I_EVENT[]
      TABLES
        t_outtab                          = IT_FINAL.
    endform.                    " grid_display

    *& Report  YSDBALV1
    REPORT  YSDBALV1.
    tables: ekko , ekpo .
    type-pools: slis .
    Table for Display Header
    data:i_header type slis_t_listheader with header line.
    *Fieldcat Declaration
    data:fieldcatalog type slis_T_fieldcat_alv WITH HEADER LINE.
    *Table of Events
    data:i_event type slis_t_event with header line ,
         wa_event type line of slis_t_event.
    For Layout
    data:i_layout type slis_layout_alv .
    data: text(30) .
    *Internal Table Declaration
    data: begin of it_final occurs 0 ,
    ebeln like ekko-ebeln , "Purchasing Document No.
    bedat like ekko-bedat , "Purchasing Document Date
    matnr like ekpo-matnr , "Material No.
    netwr like ekpo-netwr , "Net Order Value in PO Currancy
    meins like ekpo-meins , "UOM
    chk(1) ,
    light(1) ,
    change like ekpo-menge ,
    end of it_final .
    **select option Declaration
    selection-screen begin of block block.
    select-options: s_ebeln for ekko-ebeln .
    selection-screen end of block block .
    selection-screen begin of block block1 .
    parameters:grid radiobutton group r .
    parameters:list radiobutton group r .
    selection-screen end of block block1 .
    at selection screen
    at selection-screen .
    select single * from ekko where ebeln in s_ebeln .
    if sy-subrc <> 0 .
    message e000(8I) WITH 'No Data Exists' .
    endif .
    start-of-selection .
    if grid = 'X' .
    perform get_data .
    perform event using i_event[] .
    perform field using fieldcatalog[] .
    perform layout using i_layout .
    perform grid_display .
    endif .
    *& Form get_data
    text
    --> p1 text
    <-- p2 text
    form get_data .
    *DATA Retrieval from tables
    SELECT EKKO~EBELN
    EKKO~BEDAT
    EKPO~EBELP
    EKPO~MATNR
    EKPO~NETWR
    EKPO~MEINS
    EKPO~MENGE
    EKPO~BPRME
    INTO CORRESPONDING FIELDS OF table IT_FINAL
    FROM EKKO INNER JOIN EKPO ON EKKOEBELN = EKPOEBELN
    WHERE EKKO~EBELN IN S_EBELN.
    APPEND IT_FINAL.
    endform. " get_data
    *Getting the Event for Top of Page display.
    *& Form event
    text
    -->P_I_event[] text
    form event using p_i_event type slis_t_event.
    clear p_i_event .
    refresh p_i_event .
    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
    EXPORTING
    I_LIST_TYPE = 0
    IMPORTING
    ET_EVENTS = p_i_event.
    EXCEPTIONS
    LIST_TYPE_WRONG = 1
    OTHERS = 2.
    read table p_i_event with key name = slis_ev_top_of_page into wa_event.
    if sy-subrc = 0.
    move 'TOP_OF_PAGE_PO' to i_event-form.
    modify p_i_event from i_event index sy-tabix transporting form.
    endif.
    clear i_event.
    endform. " event
    *Display Top-of –Page Details and Logo
    form top_of_page_po .
    clear i_header .
    refresh i_header .
    write sy-datum to text.
    i_header-typ = 'H'.
    i_header-info = 'PURCHASE OREDER DETAILS'.
    append i_header.
    *Logo Display
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
    it_list_commentary = i_header[]
    I_LOGO = 'ENJOYSAP_LOGO'.
    endform .
    *Field Catalog Append
    *& Form field
    text
    -->P_fieldCATALOG[] text
    form field using p_fieldcatalog type slis_t_fieldcat_alv.
    clear fieldcatalog.
    fieldcatalog-fieldname = 'EBELN'.
    fieldcatalog-seltext_m = 'Purchase Order No'.
    fieldcatalog-col_pos = 1.
    append fieldcatalog .
    clear fieldcatalog.
    fieldcatalog-fieldname = 'BEDAT'.
    fieldcatalog-seltext_m = 'PO Date'.
    fieldcatalog-col_pos = 2.
    append fieldcatalog .
    clear fieldcatalog.
    fieldcatalog-fieldname = 'MATNR'.
    fieldcatalog-seltext_m = 'Material No'.
    fieldcatalog-col_pos = 4.
    fieldcatalog-outputlen = 20.
    append fieldcatalog .
    clear fieldcatalog.
    fieldcatalog-fieldname = 'NETWR'.
    fieldcatalog-seltext_m = 'Net Value '.
    fieldcatalog-col_pos = 5.
    fieldcatalog-outputlen = 20.
    fieldcatalog-do_sum = 'X'.
    append fieldcatalog .
    clear fieldcatalog.
    fieldcatalog-fieldname = 'MEINS'.
    fieldcatalog-seltext_m = 'Units'.
    fieldcatalog-col_pos = 6.
    fieldcatalog-outputlen = 4.
    append fieldcatalog .
    clear fieldcatalog.
    endform. " field
    *& Form layout
    text
    form layout using p_i_layout TYPE SLIS_LAYOUT_ALV .
    i_layout-zebra = 'X'.
    i_layout-lights_fieldname = 'LIGHT'.
    i_layout-lights_tabname = 'IT_FINAL'.
    i_layout-box_fieldname = 'CHK'.
    i_layout-box_tabname = 'IT_FINAL'.
    i_layout-edit = ' '.
    endform.
    *To display Buttons in the MENU BAR if needed
    FORM SET_PO_PF_STATUS USING P_I_EXTAB TYPE
    SLIS_T_EXTAB.
    SET PF-STATUS 'MENUPO'.
    ENDFORM.
    *Event for Interactive display of ALV report
    form USER_COMMAND using r_ucomm like sy-ucomm
    rs_selfield type slis_selfield .
    if r_ucomm = '&IC1'.
    READ TABLE IT_FINAL index rs_selfield-tabindex.
    set parameter id 'VL1' field it_final-ebeln.
    call transaction 'ME23N'.
    endif.
    endform .
    *Parameters of FM REUSE_ALV_GRID_DISPLAY
    *& Form grid_display
    text
    --> p1 text
    <-- p2 text
    form grid_display .
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    I_CALLBACK_PROGRAM = SY-REPID
    I_CALLBACK_PF_STATUS_SET = 'SET_PO_PF_STATUS'
    I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
    IS_LAYOUT = I_LAYOUT
    IT_FIELDCAT = FIELDCATALOG[]
    IT_EVENTS = I_EVENT[]
    TABLES
    t_outtab = IT_FINAL.
    endform. " grid_display
    Regards,
    Rusidar S.

  • Problem in alv program

    hi all,
    the following code is for an alv grid. The program is working fine. But after execution when the report is displayed the code is going for a dump when the back button is clicked. Could anyone tell as to whats going wrong. And when the highlighted part in the code is commented it is not giving a dump. The highligted part was used to include the row selection in the alv because
    <b>s_layout-sel_mode = 'A'</b>.
    was not working.
    *& Report  ZFI_9KE0
    REPORT  zfi_9ke0.
    *TYPE-POOLS
    TYPE-POOLS : slis.
    *DATA
    DATA: BEGIN OF wa,
           blart LIKE bsis-blart,
           hkont LIKE bsis-hkont,
           budat LIKE bsis-budat,
           wrbtr LIKE bsis-wrbtr,
           prctr LIKE bsis-prctr,
           pprct LIKE bsis-pprct,
           sgtxt LIKE bsis-sgtxt,
         END OF wa.
    DATA: v_counter TYPE i.
    *ALV SPECIFIC DECLARATIONS
    DATA : t_events TYPE slis_t_event.
    DATA : t_fieldcat TYPE slis_t_fieldcat_alv.
    DATA : t_list TYPE slis_t_listheader.
    DATA : v_repid TYPE sy-repid.
    DATA : v_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE'.
    DATA : v_user_command TYPE slis_formname VALUE 'USER_COMMAND'.
    DATA : s_getinfo TYPE slis_keyinfo_alv.
    DATA : s_layout TYPE slis_layout_alv.
    *&INTERNAL TABLE
    DATA: itab LIKE STANDARD TABLE OF wa WITH HEADER LINE.
    *&SELECTION SCREEN
    *SELECTION-SCREEN : BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
    *PARAMETER: p_acc type bsis-hkont.
    *SELECTION-SCREEN : END OF BLOCK blk1.
    *&INITIALIZATION.
    INITIALIZATION.
      PERFORM init.
    *&START-OF-SELECTION.
    START-OF-SELECTION.
      PERFORM get_data.
    *&END-OF-SELECTION.
    END-OF-SELECTION.
      PERFORM sub_comment_write.
      PERFORM sub_layout.
      PERFORM sub_call_alv.
    *&      Form  billing_init
          text
    -->  p1        text
    <--  p2        text
    FORM init .
      v_repid = sy-repid.
      PERFORM sub_events.
      PERFORM sub_fieldcat.
    ENDFORM.                    " BILLING_INIT
    *&      Form  SUB_EVENTS
          text
    FORM sub_events .
      DATA : wa_event TYPE slis_alv_event.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          i_list_type = 0
        IMPORTING
          et_events   = t_events.
      SORT t_events.
      READ TABLE t_events WITH KEY name = slis_ev_top_of_page BINARY SEARCH
                          INTO wa_event.
      MOVE v_top_of_page TO wa_event-form.
      IF sy-subrc EQ 0.
        APPEND wa_event TO t_events.
      ENDIF.
      SORT t_events.
    READ TABLE t_events WITH KEY name = slis_ev_user_command BINARY SEARCH
                         INTO wa_event.
    MOVE v_user_command TO wa_event-form.
    IF sy-subrc EQ 0.
       APPEND wa_event TO t_events.
    ENDIF.
    ENDFORM.                    " SUB_EVENTS
    *&      Form  SUB_FIELDCAT
          text
    FORM sub_fieldcat .
      PERFORM insert_field USING :
      'BLART'      'DOCUMENT TYPE'                     'X'      20 ,
      'HKONT'      'GL DOCUMENT'                       space    20 ,
      'BUDAT'      'DOCUMENT DATE'                     space    20 ,
      'WRBTR'      'PROFIT AMOUNT'                     space    20 ,
      'PRCTR'      'MATERIAL RECIEVED PROFIT CENTER'   space    40 ,
      'PPRCTR'     'MATERIAL SEND PROFIT CENTER'       space    40 ,
      'SGTXT'      'TEXT'                              space    40.
    ENDFORM.                    " SUB_FIELDCAT
    *&      Form  INSERT_FIELD
          text
    FORM insert_field  USING    value(p_fname)
                                value(p_tname)
                                value(p_key)
                                value(p_length).
      DATA : wa_fieldcat TYPE slis_fieldcat_alv.
      v_counter = v_counter + 1.
      wa_fieldcat-col_pos = v_counter.
      wa_fieldcat-fieldname = p_fname.
      wa_fieldcat-seltext_m = p_tname.
      wa_fieldcat-key = p_key.
      wa_fieldcat-outputlen = p_length.
      IF wa_fieldcat-col_pos = 6.
        wa_fieldcat-do_sum = 'X'.
      ENDIF.
      APPEND wa_fieldcat TO t_fieldcat.
    ENDFORM.                    " INSERT_FIELD
    *&      Form  GET_DATA
          text
    FORM get_data .
      CLEAR: itab.
      SELECT blart
             hkont
             budat
             wrbtr
             prctr
             pprct
             sgtxt
        FROM bsis
        INTO TABLE itab
       WHERE blart = 'WA'.
        AND hkont EQ p_acc.
        OR  hkont EQ '277500000'.
    ENDFORM.                    " GET_DATA
    *&      Form  SUB_COMMENT_WRITE
          text
    FORM sub_comment_write .
      DATA : wa_list TYPE slis_listheader.
      wa_list-typ = 'H'.
      wa_list-info = 'FI DOCUMENT POSTING '.
      APPEND wa_list TO t_list.
    ENDFORM.                    " SUB_COMMENT_WRITE
    *&      Form  SUB_LAYOUT
          text
    FORM sub_layout .
      s_layout-detail_popup = 'X'.
    s_layout-sel_mode = 'A'.
      s_layout-zebra = 'X'.
      s_layout-colwidth_optimize = 'X'.
    <b>  s_layout-box_fieldname = 'SELECT'.
      s_layout-box_tabname = 'itab'.</b>
    ENDFORM.                    " SUB_LAYOUT
    *&      Form  SUB_CALL_ALV
          text
    FORM sub_call_alv .
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
         i_callback_program                = v_repid
      I_CALLBACK_PF_STATUS_SET          = ' '
      I_CALLBACK_USER_COMMAND           = ' '
      I_CALLBACK_TOP_OF_PAGE            = ' '
      I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
      I_CALLBACK_HTML_END_OF_LIST       = ' '
      I_STRUCTURE_NAME                  =
      I_BACKGROUND_ID                   = ' '
      I_GRID_TITLE                      =
      I_GRID_SETTINGS                   =
         is_layout                         = s_layout
         it_fieldcat                       = t_fieldcat[]
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      it_sort                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         = 'X'
      I_SAVE                            = ' '
      IS_VARIANT                        =
         it_events                         = t_events[]
      IT_EVENT_EXIT                     =
      IS_PRINT                          =
      IS_REPREP_ID                      =
      I_SCREEN_START_COLUMN             = 0
      I_SCREEN_START_LINE               = 0
      I_SCREEN_END_COLUMN               = 0
      I_SCREEN_END_LINE                 = 0
      I_HTML_HEIGHT_TOP                 = 0
      I_HTML_HEIGHT_END                 = 0
      IT_ALV_GRAPHICS                   =
      IT_HYPERLINK                      =
      IT_ADD_FIELDCAT                   =
      IT_EXCEPT_QINFO                   =
      IR_SALV_FULLSCREEN_ADAPTER        =
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER           =
      ES_EXIT_CAUSED_BY_USER            =
        TABLES
          t_outtab                          = itab
    EXCEPTIONS
      PROGRAM_ERROR                     = 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.
    ENDFORM.                    " SUB_CALL_ALV
    *&      Form  TOP_OF_PAGE
          text
    FORM top_of_page .
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary = t_list
          i_logo             = 'ENJOYSAP_LOGO'.
    ENDFORM.                    "top_of_page

    JUST ADD THIS
    DATA: BEGIN OF wa,
    <b>SELECT,</b>
    blart LIKE bsis-blart,
    hkont LIKE bsis-hkont,
    budat LIKE bsis-budat,
    wrbtr LIKE bsis-wrbtr,
    prctr LIKE bsis-prctr,
    pprct LIKE bsis-pprct,
    sgtxt LIKE bsis-sgtxt,
    END OF wa.
    IN
    s_layout-box_fieldname = 'SELECT'.
    *s_layout-box_tabname = 'ITAB'.
    ADD THE BOX FIELD  IN WA
    REGARDS
    SHIBA DUTTA

  • Blank row added after cancel button on create page

    Hi All,
    I have a create item page where I insert items into the item table in the database.
    On press of the cancel button on this create page, the control reaches a itemlist page with my old search criteria and result but with a new blank row added to it.
    Anybody know what's wrong?

    Sorry, I misunderstood your previous question. When the cancel button is pressed. I am using pageContext.forwardImmediately with parameters to forward back to my search page. Then in the search page controller I call the AM initQuery method to run the query. My initQuery method has the following code,
    StringBuffer whereClause = new StringBuffer(200);
    Vector parameters = new Vector(3);
    int clauseCount = 0;
    int bindCount = 0;
    setWhereClauseParams(null);
    if ((Program != null) && (!("".equals(Program.trim()))))
    whereClause.append("PROGRAM = :");
    whereClause.append(++bindCount);
    parameters.addElement(Program);
    clauseCount++;
    if ((PId != null) && (!("".equals(PId.trim()))))
    Number PIdNum = null;
    try
    PIdNum = new Number(PId);
    catch(Exception e)
    throw new OAException("AK", "FWK_TBX_INVALID_EMP_NUMBER");
    if (bindCount > 0)
    whereClause.append(" AND (P_ID = :");
    else
    whereClause.append(" (P_ID = :");
    whereClause.append(++bindCount);
    whereClause.append(")");
    parameters.addElement(PIdNum);
    clauseCount++;
    setWhereClause(whereClause.toString());
    if (bindCount > 0)
    Object[] params = new Object[bindCount];
    parameters.copyInto(params);
    setWhereClauseParams(params);
    executeQuery();

  • I have a problem with ALV Grid User Command?

    Hi Experts,
    I have a problem with ALV GRID User Command.
    I am calling TCODE IW33 (Order Display) from the ALV output at first time by selecting an order. But, User command is calling IW33 Initial screen with blank value of order. Even I checked in debugging the value what I selected is passing properly, but once that screen (IW33 Initial) displays, value doesn't appear. Then, Manually, I  created another session and gone to TCODE IW33 and displayed an order. After that I came out from that order. Then again run my ALV program and selected another order, now order is displaying, but not what I selected current order instead of displaying previous order what I just displayed manually. If I selected any other order, system will display the same order what I dislayed manually.
    Here is my code.
    FORM user_command_alv  USING u_ucomm TYPE sy-ucomm
                           us_self_field TYPE slis_selfield.
    CASE u_ucomm.
    WHEN '&IC1'.
    READ TABLE it_final INDEX us_self_field-tabindex INTO wa_final.
            WHEN 'ORDER'.
              IF NOT wa_final-order IS INITIAL.
                SET PARAMETER ID 'COK' FIELD wa_final-order.
                CALL TRANSACTION 'IW33' AND SKIP FIRST SCREEN.
              ENDIF.
    endform.
    PARAMETER ID 'COK'  also the standard one.
    Could you please help me out, Where I did wrong?
    If I select any order, that order only should display.
    Thanks in advance.
    Regards,
    Sarayu.
    Code Formatted by: Alvaro Tejada Galindo on Jan 8, 2009 2:33 PM

    hi,
    Please check it once the Paramater ID is 'ANR' for IW33 order number.
    Hope this may help.
    Regards,
    Sravanthi

  • Problem with ALV grid in edit mode

    Hello, gurus!
    I have a problem with ALV-grid. Sometimes when I call F4 help for a cell, data is inserted in a different cell.  And when I call check_changed_data method, my internal table (passed to ALV-control in set_table_for_first_display) does not updates properly. In what can be a problem?
    Thanks,
    Mikhail

    Hi Prabhu,
    MODULE pbo_100 OUTPUT.
      SET PF-STATUS 'MAIN100'.
      title_of_report = text-010.
      SET TITLEBAR '0100' WITH title_of_report.
      DATA: g_event_receiver TYPE REF TO lcl_event_handler.
      IF z_custom_container IS INITIAL .
        CREATE OBJECT z_custom_container
          EXPORTING
            container_name = 'ALV_ZAC'.
        CREATE OBJECT alv_grid
          EXPORTING
            i_parent = z_custom_container.
        g_repid = sy-repid.
        gs_variant-report = g_repid.
        x_save = 'A'.
        PERFORM check_alv_grid_fields.
        ps_layout-cwidth_opt = 'X'.
        ps_layout-edit = 'X'.
        CALL METHOD alv_grid->set_ready_for_input
          EXPORTING
            i_ready_for_input = '1'.
    *    CALL METHOD alv_grid->register_edit_event
    *      EXPORTING
    *        i_event_id = cl_gui_alv_grid=>mc_evt_enter.
        APPEND   s_list_rec   to it_list_rec.
        CALL METHOD alv_grid->set_table_for_first_display
          EXPORTING
            is_layout       = ps_layout
            is_variant      = gs_variant
            i_save          = x_save
          CHANGING
            it_fieldcatalog = pt_fieldcat
            it_outtab       = it_list_rec[].
        CALL METHOD alv_grid->register_edit_event
          EXPORTING
            i_event_id = cl_gui_alv_grid=>mc_evt_enter.
        CALL METHOD alv_grid->register_edit_event
          EXPORTING
            i_event_id = cl_gui_alv_grid=>mc_evt_modified.
    ENDIF.
    FORM check_alv_grid_fields .
      DATA: ls_fcat LIKE LINE OF pt_fieldcat.
    REFRESH pt_fieldcat .
    CLEAR: ps_layout, ls_fcat.
      ls_fcat-fieldname = 'VBELN'.
      ls_fcat-ref_field = 'VBELN'. ls_fcat-ref_table =  'LIPS'. " .
      ls_fcat-outputlen = 9.
    *  ls_fcat-datatype   = 'CHAR'.
    *  ls_fcat-inttype    = 'C'.
      APPEND  ls_fcat TO pt_fieldcat.
      CLEAR: ls_fcat.
      ls_fcat-fieldname = 'ERDAT'.
      ls_fcat-ref_field = 'ERDAT'. ls_fcat-ref_table = 'LIPS'.
      ls_fcat-outputlen = 9.
    *  ls_fcat-f4availabl = 'X' .
    *  ls_fcat-datatype   = 'DATS'.
    *  ls_fcat-inttype    = 'D'.
      APPEND ls_fcat TO pt_fieldcat.
      CLEAR: ls_fcat.
    ENDFORM.                    " check_alv_grid_fields
    FORM save_p .
      CLEAR l_valid.
      CALL METHOD alv_grid->check_changed_data
        IMPORTING
          e_valid = l_valid.
      IF l_valid IS INITIAL.
        CALL FUNCTION 'POPUP_TO_INFORM'
          EXPORTING
            titel = text-i01
            txt1  = text-i02
            txt2  = text-i03
            txt3  = text-i04.
      ELSE.
        i_dat_reg = zrumm_prr-cdprr.
        CLEAR is_temp_otc.
        freshit i_prrpus_fax.
        freshit i_list2_ot.
        LOOP AT it_list_rec INTO s_list_rec.
          MOVE-CORRESPONDING s_list_rec TO i_list2_ot.
          i_list2_ot-fgrup = 'RECE'.
          i_list2_ot-prrnu = i_num_prr.
          APPEND i_list2_ot.
          MOVE-CORRESPONDING s_list_rec TO i_prrpus_fax.
          APPEND i_prrpus_fax.
        ENDLOOP.
      ENDIF.
    Edited by: Mikhail Sarychev on Mar 16, 2011 6:41 AM
    Edited by: Mikhail Sarychev on Mar 16, 2011 6:49 AM
    Edited by: Mikhail Sarychev on Mar 16, 2011 6:49 AM

  • Background task problem with alv grid display

    Hello !
    I have a problem when executing my program in background.
    In foreground I have no problem, my ALV appears. In the background I have a dump.
    The current ABAP program "SAPLKKBL" had to be terminated because one of the statements could not be executed.
    I use the function module 'REUSE_ALV_GRID_DISPLAY'
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
         EXPORTING
            i_callback_program      = gd_repid
            i_callback_user_command = 'F533_USER_COMMAND'
            is_layout               = gd_layout
            it_fieldcat             = fieldcatalog[]
            it_special_groups       = i_fgroup[]
            i_save                  = 'X'
            it_sort                 = gd_sort
            i_buffer_active         = ' '
            i_callback_pf_status_set = 'F534_SET_PF_STATUS'
         TABLES
            t_outtab                = mytab
         EXCEPTIONS
            program_error           = 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.
    I don't understand where the problem is. Please help me.
    Thank you.

    I love replying to old threads:
    Try this link
    http://scn.sap.com/people/prashant.patil12/blog/2007/02/20/displaying-alv-grid-in-background-job

Maybe you are looking for