Problem refreshing fieldcatalog in ALV grid classic

Hi gurus,
I´m really having problems with the column titles that are display in my ALV report and I cannot figure out why. I want to be able to print the text either in Spanish or in English, depending on the company code in the selection criteria screen. I refresh and populate the fieldcatalog with EN texts and I can see that changes are taken and pass to FM REUSE_ALV_GRID_DISPLAY but when I execute it they still show the Spanish text.
Please help me with things. Points will be rewarded.
I show here part of the code.
FORM make_field_catalog.
  DATA: l_repid LIKE sy-repid.
  DATA: ls_fieldcat TYPE slis_fieldcat_alv.
  DATA: pos         TYPE i VALUE 1.
  l_repid   = sy-repid.
  CLEAR ls_fieldcat.
  REFRESH i_fieldcat.
  CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
   EXPORTING
      i_program_name     = l_repid
      i_internal_tabname = 'GT_OUTPUT'
      i_inclname         = l_repid
      i_bypassing_buffer = 'X'
   CHANGING
      ct_fieldcat        = i_fieldcat.
Fields to output in the ALV.
Show different languages, depending on the company code.
  IF is_es EQ 'X'.
    ls_fieldcat-col_pos        =   pos.
    ls_fieldcat-fieldname      =  'CUSTOMER'.
    ls_fieldcat-seltext_l      =  text-002.
    ls_fieldcat-ddictxt        =  'L'.
    ls_fieldcat-outputlen      =   10.
    ls_fieldcat-key            =  'X'.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    pos = pos + 1.
    ls_fieldcat-col_pos        =   pos.
    ls_fieldcat-fieldname      =  'DOC_NO'.
    ls_fieldcat-seltext_l      =  text-003.
    ls_fieldcat-ddictxt        =  'L'.
    ls_fieldcat-outputlen      =   10.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    pos = pos + 1.
    ls_fieldcat-col_pos        =   pos.
    ls_fieldcat-fieldname      =  'DOC_DATE'.
    ls_fieldcat-seltext_l      =  text-004.
    ls_fieldcat-ddictxt        =  'L'.
    ls_fieldcat-outputlen      =   10.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    pos = pos + 1.
    ls_fieldcat-col_pos        =   pos.
    ls_fieldcat-fieldname      =  'NET_AMOUNT'.
    ls_fieldcat-seltext_l      =  text-005.
    ls_fieldcat-ddictxt        =  'L'.
    ls_fieldcat-outputlen      =   15.
    ls_fieldcat-do_sum         =  'X'.
    ls_fieldcat-datatype       =  'QUAN'.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    pos = pos + 1.
  ELSE.
    ls_fieldcat-col_pos        =   pos.
    ls_fieldcat-fieldname      =  'CUSTOMER'.
    ls_fieldcat-seltext_l      =  text-012.
    ls_fieldcat-ddictxt        =  'L'.
    ls_fieldcat-outputlen      =   10.
    ls_fieldcat-key            =  ' '.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    pos = pos + 1.
    ls_fieldcat-col_pos        =   pos.
    ls_fieldcat-fieldname      =  'DOC_NO'.
    ls_fieldcat-seltext_l      =  text-013.
    ls_fieldcat-ddictxt        =  'L'.
    ls_fieldcat-outputlen      =   10.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    pos = pos + 1.
    ls_fieldcat-col_pos        =   pos.
    ls_fieldcat-fieldname      =  'DOC_DATE'.
    ls_fieldcat-seltext_l      =  text-014.
    ls_fieldcat-ddictxt        =  'L'.
    ls_fieldcat-outputlen      =   10.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    pos = pos + 1.
    ls_fieldcat-col_pos        =   pos.
    ls_fieldcat-fieldname      =  'NET_AMOUNT'.
    ls_fieldcat-seltext_l      =  text-015.
    ls_fieldcat-ddictxt        =  'L'.
    ls_fieldcat-outputlen      =   15.
    ls_fieldcat-do_sum         =  'X'.
    ls_fieldcat-datatype       =  'QUAN'.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    pos = pos + 1.
  ENDIF.
ENDFORM.
And later i make the call like follows:
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
            i_buffer_active       = g_alv_buffer
            i_callback_program    = l_repid
           i_callback_top_of_page = 'TOP_OF_PAGE'
           i_callback_html_top_of_page = 'TOP_OF_PAGE'
            is_layout             = g_layout
            it_fieldcat           = i_fieldcat
            it_special_groups     = g_fieldgroups_tab[]
            it_sort               = g_sortfields_tab[]
            i_default             = c_n
            i_save                = c_a
            is_variant            = g_variant
            it_events             = g_events_tab[]
            it_event_exit         = g_event_exit_tab[]
            is_print              = g_print
            i_screen_start_column = g_screen_start_column
            i_screen_start_line   = g_screen_start_line
            i_screen_end_column   = g_screen_end_column
            i_screen_end_line     = g_screen_end_line
       TABLES
            t_outtab              = gt_output
       EXCEPTIONS
            program_error         = 1
            OTHERS                = 2.
Does anybody knows what am I missing?
Thanks! Elena

hi ..
Ensure Field catalog is Refreshed every time before it is buid.
Code:
<b>REFRESH i_fieldcat.</b>
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = l_repid
i_internal_tabname = 'GT_OUTPUT'
i_inclname = l_repid
i_bypassing_buffer = 'X'
CHANGING
ct_fieldcat = i_fieldcat.
<b>Reward if Helpful.</b>

Similar Messages

  • Problems with checkbox in ALV-GRID OO

    Hi,
    i have Problems by listing an editable checkbox
    in ALV GRID OO and handle the itab with
    the marked fields.
    Here my Code extract. Has anybody an idea or a short example.
    TYPES: BEGIN OF ALV_TAB,
            SGTXT  LIKE RK23B-SGTXT,
            CHECK(1),
          END   OF ALV_TAB.
    DATA: ITAB    TYPE TABLE OF ALV_TAB.
    Is this Declaration correct??
    <b>  GS_FIELDCAT-FIELDNAME  = 'CHECK'.
      GS_FIELDCAT-CHECKBOX   = 'X'.
      APPEND GS_FIELDCAT TO GT_FIELDCAT.
      GS_LAYOUT-EDIT         = 'X'.
      GS_LAYOUT-BOX_FNAME    = 'CHECK'.</b>
      CALL METHOD GR_ALVGRID->SET_TABLE_FOR_FIRST_DISPLAY
        EXPORTING
          IT_TOOLBAR_EXCLUDING = PT_EXCLUDE
          IS_LAYOUT            = GS_LAYOUT
        CHANGING
          IT_FIELDCATALOG      = GT_FIELDCAT
          IT_OUTTAB            = ITAB.
    FORM HANDLE_USER_COMMAND USING E_UCOMM.
      CASE E_UCOMM.
        WHEN 'REFR'.
    <b>      Here i will have the itab with the marked checkbox.
          how can i refresh?</b>*
        WHEN 'EXCEL'.
          MESSAGE I010 WITH E_UCOMM.
      ENDCASE.
    ENDFORM.                    "HANDLE_USER_COMMAND
    Regards, Dieter

    Hi, in reference to....
    ASE E_UCOMM.
    WHEN 'REFR'.
    Here i will have the itab with the marked checkbox.
    how can i refresh?*
    Do you want to get rid of the checks in any checkbox?
    If so,  just loop at modify.
    ASE E_UCOMM.
    WHEN 'REFR'.
    <b>   Loop at itab where check = 'X'.
            itab-check = space.
            modify itab.
       endloop.</b>
    Regards,
    Rich Heilman

  • Excel File Format Problem while downloading in ALV Grid

    Hi All,
    My program gives an ALV Grid Output which contains the file download button , when I choose spread sheet as the file format , the actual data starts only from 4th line and the lines above it contain date, heading etc and the rest are blank. Is it possible that I can download only the records in the grid output with the column names and not the unnecessary log?
    Also the format is not proper excel format, this same file will be used for upload into another program using the Function Module 'TEXT_CONVERT_XLS_TO_SAP'. When I load the file saved in the above format, this Function Module always fails.
    Please let me know any solution for this problem
    Thanks in Advance.

    Hi
    try this code----
    *&      Form  DOWNLOAD_EXCEL_TEMPLATE
          text
    -->  p1        text
    <--  p2        text
    FORM download_excel_template .
      TYPES: BEGIN OF lt_data,
                field1(20),
                field2(30),
                field3(20),
                field4(20),
                field5(20),
                field6(30),
                field7(15),
                field8(10),
                field9(10),
                field10(20),
                field11(20),
                field12(10),
                field13(20),
                field14(20),
              END OF lt_data.
      DATA: lv_file TYPE rlgrap-filename,
            li_data TYPE STANDARD TABLE OF lt_data,
            wa_data TYPE lt_data,
            lv_pathcheck type c,
            lv_file1 type string.
      wa_data-field1 = ''.
      APPEND wa_data TO li_data.
      REFRESH gi_header.
      wa_header-name = 'Company Code'.
      APPEND wa_header TO gi_header.
      wa_header-name = 'Main Asset Number'.
      APPEND wa_header TO gi_header.
      wa_header-name = 'Asset Sub Number'.
      APPEND wa_header TO gi_header.
      wa_header-name = 'Document Date'.
      APPEND wa_header TO gi_header.
      wa_header-name = 'Posting Date'.
      APPEND wa_header TO gi_header.
      wa_header-name = 'Asset Value Date'.
      APPEND wa_header TO gi_header.
      wa_header-name = 'Item Text'.
      APPEND wa_header TO gi_header.
      wa_header-name = 'Reference'.
      APPEND wa_header TO gi_header.
      wa_header-name = 'Allocation'.
      APPEND wa_header TO gi_header.
      wa_header-name = 'Amount Posted'.
      APPEND wa_header TO gi_header.
      wa_header-name = 'Percentage Rate'.
      APPEND wa_header TO gi_header.
      wa_header-name = 'Quantity'.
      APPEND wa_header TO gi_header.
      wa_header-name = 'Prior-Yr Quantity'.
      APPEND wa_header TO gi_header.
      wa_header-name = 'Curr-Yr Quantity'.
      APPEND wa_header TO gi_header.
      lv_file = gv_file.
      lv_file1 = gv_file.
      CALL METHOD cl_gui_frontend_services=>directory_exist
        EXPORTING
          directory            = lv_file1
        RECEIVING
          result               = lv_pathcheck
        EXCEPTIONS
          cntl_error           = 1
          error_no_gui         = 2
          wrong_parameter      = 3
          not_supported_by_gui = 4
          OTHERS               = 5.
       FIND '.xls' IN lv_file IGNORING CASE.
      IF sy-subrc = 0.
        REPLACE '.XLS' IN lv_file WITH ' ' IGNORING CASE.
      ENDIF.
      FIND '.TXT' IN lv_file IGNORING CASE.
      IF sy-subrc = 0.
        REPLACE '.TXT' IN lv_file WITH ' ' IGNORING CASE.
      ENDIF.
      CALL FUNCTION 'MS_EXCEL_OLE_STANDARD_DAT'
        EXPORTING
          file_name                 = lv_file
          data_sheet_name           = 'DATA'
        TABLES
          data_tab                  = li_data
          fieldnames                = gi_header
        EXCEPTIONS
          file_not_exist            = 1
          filename_expected         = 2
          communication_error       = 3
          ole_object_method_error   = 4
          ole_object_property_error = 5
          invalid_pivot_fields      = 6
          download_problem          = 7
          OTHERS                    = 8.
      IF sy-subrc <> 0.
        MESSAGE ID gv_msgid TYPE 'E' NUMBER 002.
      ENDIF.
    ENDFORM.                    " DOWNLOAD_EXCEL_TEMPLATE
    regards,
    Prashant

  • REFRESH FUNCTIONALITy in ALV GRID

    Hi Experts,
    I have added two custom buttons (CO40 and REFRESH) in ALV GRID .
    WHEN CO40 button is clicked it will go the CO40 transaction.
    here the problem is when clicking the REFRESH , the REFRESH fuctionality is not working.
    (here i went to CO40 transaction by clicking CO40 button and deleted one planned order and come back and clicked REFRESH button but the planned order still showing in the output but the planned oreder is deleted in the table ) please help me rgarding this
    pls see my code and pls send me the code with modifications
    Thanks
    Nagendra
    REPORT  zpp_plannedorder_conv LINE-SIZE 200.
    TYPE-POOLS: slis.
    TABLES: plaf, vbak.
    PLANNED ORDER TABLE
    CONSTANTS: c_e TYPE c LENGTH 01 VALUE 'E'.
    TYPES: BEGIN OF ty_plaf,
           kdauf     TYPE kdauf,
           kdpos     TYPE kdpos,
           plnum TYPE plnum,     
           dispo TYPE dispo,
           matnr     TYPE matnr,
           maktx     TYPE maktx,
           pwwrk     TYPE pwwrk,
           paart     TYPE paart,
           beskz     TYPE beskz,
           gsmng     TYPE gsmng,
           END OF ty_plaf.
    SALES FIELDS
    TYPES: BEGIN OF ty_vbak,
           vbeln TYPE vbeln,
           posnr TYPE posnr,
           kunnr     TYPE kunnr,
           grkor     TYPE grkor,
           autlf     TYPE autlf,
           mvgr2     TYPE mvgr2,
           fixmg     TYPE  fixmg,
           bstdk     TYPE bstdk,
           edatu     TYPE edatu,
           posex  TYPE posex,
           END OF ty_vbak.
    output table.
    TYPES: BEGIN OF ty_out,
           plnum TYPE plnum,     
           dispo TYPE dispo,
           matnr     TYPE matnr,
           maktx     TYPE maktx,
           pwwrk     TYPE pwwrk,
           paart     TYPE paart,
           beskz     TYPE beskz,
           gsmng     TYPE gsmng,
           kdauf     TYPE kdauf,
           kdpos     TYPE kdpos,
           kunnr     TYPE kunnr,
           grkor     TYPE grkor,
           autlf     TYPE autlf,
           mvgr2     TYPE mvgr2,
           fixmg     TYPE  fixmg,
           bstdk     TYPE bstdk,
           edatu     TYPE edatu,
           posex  TYPE posex,
           END OF ty_out.
    DATA: tb_plaf TYPE STANDARD TABLE OF ty_plaf,
          tb_vbak TYPE STANDARD TABLE OF ty_vbak,
          tb_out  TYPE STANDARD TABLE OF ty_out.
    DATA: lv_plaf TYPE ty_plaf,
          lv_vbak TYPE ty_vbak,
          lv_out  TYPE ty_out.
    TYPES: BEGIN OF ty_vbep,
        vbeln TYPE vbeln,
        posnr TYPE posnr,
        etenr TYPE etenr,
        edatu TYPE edatu,
       END OF ty_vbep.
    DATA: tb_vbep TYPE STANDARD TABLE OF ty_vbep.
    DATA: lv_flag(1) TYPE c.
    **Start changes RFS: SANN - 0856
    DATA:  w_repid            TYPE sy-repid.
    DATA:  it_fieldcat        TYPE slis_t_fieldcat_alv, "field catalog table
           gs_layout          TYPE slis_layout_alv, "struct data type
           it_sort            TYPE slis_t_sortinfo_alv,
           it_events          TYPE slis_t_event,
           gt_event_exit          TYPE slis_t_event_exit.
    **End changes RFS: SANN - 0856
    SELECT OPTIONS.
    SELECTION-SCREEN BEGIN OF BLOCK a1 WITH FRAME TITLE text-t01.
    SELECT-OPTIONS: sel_pln FOR plaf-plnum,
                    sel_pww FOR plaf-pwwrk OBLIGATORY,
                    sel_dis FOR plaf-dispo,
                    sel_kun FOR vbak-kunnr,
                    sel_paa FOR plaf-paart,
                    sel_kda FOR plaf-kdauf.
    SELECTION-SCREEN END OF BLOCK a1.
    START-OF-SELECTION.
      REFRESH: tb_plaf ,tb_vbak.
      SELECT pkdauf pkdpos pplnum pdispo pmatnr mmaktx
              ppwwrk ppaart pbeskz pgsmng INTO TABLE tb_plaf
              FROM plaf AS p JOIN makt AS m
                ON pmatnr EQ mmatnr
                WHERE p~plnum IN sel_pln
                  AND p~pwwrk IN sel_pww
                  AND p~dispo IN sel_dis
                  AND p~paart IN sel_paa
                  AND p~kdauf IN sel_kda
                  AND m~spras EQ c_e.
      IF NOT  tb_plaf[] IS INITIAL.
        SORT tb_plaf BY kdauf DESCENDING.
        SELECT  kvbeln pposnr kkunnr pgrkor kautlf pmvgr2 p~fixmg     
                kbstdk vedatu p~posex INTO TABLE tb_vbak
                 FROM vbak AS k JOIN vbap AS p
                   ON kvbeln EQ pvbeln
                      INNER JOIN vbep AS v
                         ON pvbeln EQ vvbeln
                        AND pposnr EQ vposnr
        FOR ALL ENTRIES IN tb_plaf
            WHERE k~vbeln EQ tb_plaf-kdauf
              AND p~posnr EQ tb_plaf-kdpos
              AND k~kunnr IN sel_kun
              AND v~etenr EQ '0001'.
        IF NOT  tb_vbak[] IS INITIAL.
          LOOP AT tb_plaf INTO lv_plaf.
            CLEAR lv_out.
            MOVE-CORRESPONDING lv_plaf TO lv_out.
            IF NOT lv_plaf-kdauf IS INITIAL.
              READ TABLE tb_vbak INTO lv_vbak WITH KEY vbeln = lv_plaf-kdauf
                                                       posnr = lv_plaf-kdpos.
              MOVE-CORRESPONDING lv_vbak TO lv_out.
            ENDIF.
            APPEND lv_out TO tb_out.
          ENDLOOP.
        ENDIF.
      ENDIF.
    END-OF-SELECTION.
      PERFORM f_build_fcat.
      PERFORM f_get_display.
    *&      Form  F_BUILD_FCAT
    FORM f_build_fcat .
      CLEAR: w_repid.
      PERFORM fill_fieldcat " TABLES it_fieldcat
            USING:
                   text-f01 'TB_OUT'  text-k01  text-k01 '10' ,
                   text-f02 'TB_OUT'  text-k02  text-k02 '10' ,
                   text-f03 'TB_OUT'  text-k03  text-k03 '06' ,
                   text-f04 'TB_OUT'  text-k04  text-k04 '18' ,
                   text-f05 'TB_OUT'  text-k05  text-k05 '06' ,
                   text-f06 'TB_OUT'  text-k06  text-k06 '08' ,
                   text-f07 'TB_OUT'  text-k07  text-k07 '05' ,
                   text-f08 'TB_OUT'  text-k08  text-k08 '05' ,
                   text-f09 'TB_OUT'  text-k09  text-k09 '15' ,
                   text-f10 'TB_OUT'  text-k10  text-k10 '05' ,
                   text-f11 'TB_OUT'  text-k11  text-k11 '05' ,
                   text-f12 'TB_OUT'  text-k12  text-k12 '10' ,
                   text-f13 'TB_OUT'  text-k13  text-k13 '10' ,
                   text-f14 'TB_OUT'  text-k14  text-k14 '10' ,
                   text-f15 'TB_OUT'  text-t15  text-k15 '10' ,
                   text-f16 'TB_OUT'  text-k16  text-k16 '10' ,
                   text-f17 'TB_OUT'  text-k17  text-k17 '10' .
    ENDFORM.                    " F_BUILD_FCAT
    *&      Form  fill_fieldcat
    FORM  fill_fieldcat  " TABLES  l_catalog TYPE slis_t_fieldcat_alv       "#EC *
                       USING    p_field                         "#EC *
                                p_table                         "#EC *
                                p_desc                          "#EC *
                                p_desc_l                        "#EC *
                                p_len.                          "#EC *
      DATA: ls_fieldcat   TYPE slis_fieldcat_alv.
      ls_fieldcat-fieldname       = p_field.
      ls_fieldcat-tabname         = p_table.
      ls_fieldcat-seltext_l       = p_desc_l.
      ls_fieldcat-reptext_ddic    = p_desc.
      ls_fieldcat-outputlen       = p_len.
      APPEND ls_fieldcat TO it_fieldcat.
      CLEAR ls_fieldcat.
    ENDFORM.                    " fill_fieldcat
    *&     FORM F_GET_DISPLAY
          text
    FORM f_get_display .
      CLEAR w_repid.
      MOVE sy-repid TO w_repid.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program       = w_repid
          i_callback_pf_status_set = 'PF_STATUS'
          i_callback_user_command  = 'USER_COMMAND'
          is_layout                = gs_layout
          it_fieldcat              = it_fieldcat
          it_sort                  = it_sort
          i_save                   = 'X'
        TABLES
          t_outtab                 = tb_out
        EXCEPTIONS
          program_error            = 1
          OTHERS                   = 2.
      IF sy-subrc EQ 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " F_GET_DISPLAY
    *&      Form  PF_STATUS
          text
    FORM pf_status USING rt_extab TYPE slis_t_extab.
      DATA: wa_extab LIKE LINE OF rt_extab.
      REFRESH: rt_extab.
      wa_extab-fcode = '&REFRESH'.
      APPEND wa_extab TO rt_extab.
      SET PF-STATUS '0001' EXCLUDING rt_extab.
    ENDFORM.                    "PF_STATUS
         -->COMMAND    text
         -->SELFIELD   text
    FORM user_command USING command LIKE sy-ucomm selfield TYPE slis_selfield."#EC CALLED
      CLEAR : lv_out-plnum,lv_out-kdauf,lv_out-paart,lv_out-kdauf.
      CASE command.
        WHEN '&IC1'.                       "doubleclick
          CASE selfield-fieldname.
            WHEN 'PLNUM'.
              READ TABLE tb_out INTO lv_out INDEX selfield-tabindex.
              IF sy-subrc EQ 0.
                SET PARAMETER ID 'PAF'  FIELD lv_out-plnum.
                CALL TRANSACTION 'MD12' AND SKIP FIRST SCREEN.
              ENDIF.
            WHEN 'KDAUF'.
              READ TABLE tb_out INTO lv_out INDEX selfield-tabindex.
              IF sy-subrc EQ 0.
                SET PARAMETER ID 'AUN'  FIELD lv_out-kdauf.
                CALL TRANSACTION 'VA02' AND SKIP FIRST SCREEN.
              ENDIF.
          ENDCASE.
        WHEN 'CO40'.
          READ TABLE tb_out INTO lv_out INDEX selfield-tabindex.
          IF sy-subrc EQ 0.
            SET PARAMETER ID 'PAF'  FIELD lv_out-plnum.
            CALL TRANSACTION 'CO40' AND SKIP FIRST SCREEN.
          ENDIF.
        WHEN 'REFRESH'.
          PERFORM select_data.
      ENDCASE.
    ENDFORM.                    "user_command
    *End changes RFS: SANN - 0856
    *&      Form  SELECT_DATA
          text
    -->  p1        text
    <--  p2        text
    FORM select_data .
      commit work and wait.
      REFRESH:tb_plaf[],tb_vbak[],tb_out[].
      SELECT pkdauf pkdpos pplnum pdispo pmatnr mmaktx
              ppwwrk ppaart pbeskz pgsmng INTO TABLE tb_plaf
              FROM plaf AS p JOIN makt AS m
                ON pmatnr EQ mmatnr
                WHERE p~plnum IN sel_pln
                  AND p~pwwrk IN sel_pww
                  AND p~dispo IN sel_dis
                  AND p~paart IN sel_paa
                  AND p~kdauf IN sel_kda
                  AND m~spras EQ c_e.
      IF NOT  tb_plaf[] IS INITIAL.
        SORT tb_plaf BY kdauf DESCENDING.
        SELECT  kvbeln pposnr kkunnr pgrkor kautlf pmvgr2 p~fixmg     
                kbstdk vedatu p~posex INTO TABLE tb_vbak
                 FROM vbak AS k JOIN vbap AS p
                   ON kvbeln EQ pvbeln
                      INNER JOIN vbep AS v
                         ON pvbeln EQ vvbeln
                        AND pposnr EQ vposnr
        FOR ALL ENTRIES IN tb_plaf
            WHERE k~vbeln EQ tb_plaf-kdauf
              AND p~posnr EQ tb_plaf-kdpos
              AND k~kunnr IN sel_kun
              AND v~etenr EQ '0001'.
        IF NOT  tb_vbak[] IS INITIAL.
          LOOP AT tb_plaf INTO lv_plaf.
            CLEAR lv_out.
            MOVE-CORRESPONDING lv_plaf TO lv_out.
            IF NOT lv_plaf-kdauf IS INITIAL.
              READ TABLE tb_vbak INTO lv_vbak WITH KEY vbeln = lv_plaf-kdauf
                                                       posnr = lv_plaf-kdpos.
              MOVE-CORRESPONDING lv_vbak TO lv_out.
            ENDIF.
            APPEND lv_out TO tb_out.
          ENDLOOP.
        ENDIF.
      ENDIF.
    ENDFORM.                    " SELECT_DATA

    Hi,
    Gothrough the following link,
    Handle Refresh button on ALV
    Regards,
    Harish

  • Problem with sub totals ALV Grid

    Hi experts,
       I got one requirement, I am using ALV GRID function modules technique. My requirement is, I want to display one value at subtotal line(i.e. like header value). How to display the table values in the subtotal line.
    Please give any solution for this.
    Thanks in advance.
    Sandya.

    Hi Sandhya,
                       i will send a sample code for ur problem.And also i will send a entire program about subtotals.Check it once ok..Copy the below prog and execute it and debug it..
    *SubTotal on the Field NETWR
        wa_fieldcat-tabname       = 'IT_SALESORDER'. "Internal
      wa_fieldcat-fieldname     = 'NETWR'.         "Field Name
      wa_fieldcat-do_sum        = 'X'.             "Sum
       APPEND wa_fieldcat TO gt_fieldcat.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
        i_callback_program                = sy-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                         =
        it_fieldcat                       = gt_fieldcat
    SAMPLE PROGRAM:
    *& Report  YSALESORDER_ALV_SUBTOTALS                                   *
    *& DEVELOPER  : KIRAN KUMAR.G                                          *
    *& PURPOSE    : DISPLAYING SUBTOTALS FOR A PARTICULAR SALES DOC NO     *
    *& CREATION DT: 26/11/2007                                             *
    *&  REQUEST   : ERPK900035                                             *
    REPORT  ysalesorder_alv_subtotals.
    Type Pools
    TYPE-POOLS:slis.
    Tables
    TABLES: vbak,  "Sales Document: Header Data
            vbap.  "Sales Document: Item Data
    Global Structures
    DATA:gt_fieldcat TYPE slis_t_fieldcat_alv,
         wa_fieldcat TYPE slis_fieldcat_alv,
         gt_sortcat TYPE slis_t_sortinfo_alv,
         wa_sortcat  LIKE LINE OF gt_sortcat.
    Internal Table
    DATA: BEGIN OF gt_salesorder OCCURS 0,
            vbeln LIKE vbak-vbeln,    " Sales Document Number
            posnr LIKE vbap-posnr,    " Sales Doc Item
            netwr LIKE vbap-netwr,    " Net Value
          END OF gt_salesorder.
    SELECT OPTIONS
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS: s_vbeln FOR vbak-vbeln.   " Sales Document Number.
    SELECTION-SCREEN END OF BLOCK b1.
    Initialization
    INITIALIZATION.
      PERFORM initialization.
    Start Of Selection
    START-OF-SELECTION.
      PERFORM field_catalog.   "For Structure Creation
      PERFORM fetch_data.      "Get the Data From DB Table
      PERFORM sorting USING gt_sortcat.
    End Of Selection
    END-OF-SELECTION.
      PERFORM display_data.
    *&      Form  initialization
          text
    -->  p1        text
    <--  p2        text
    FORM initialization .
      s_vbeln-sign   = 'I'.
      s_vbeln-option = 'BT'.
      s_vbeln-low    = '4969'.
      s_vbeln-high   = '5000'.
      APPEND s_vbeln.
    ENDFORM.                    " initialization
    *&      Form  field_catalog
          text
    -->  p1        text
    <--  p2        text
    FORM field_catalog .
      REFRESH : gt_fieldcat.
      CLEAR   : wa_fieldcat.
      wa_fieldcat-col_pos       = '1'.             "Column Position
      wa_fieldcat-tabname       = 'IT_SALESORDER'. "Internal Table
      wa_fieldcat-fieldname     = 'VBELN'.         "Field Name
      wa_fieldcat-key           = 'X'.             "Blue Color
      wa_fieldcat-seltext_m     = 'Sales Doc No'.  "Display Text In Screen
      APPEND wa_fieldcat TO gt_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-col_pos       = '2'.             "Column Position
      wa_fieldcat-tabname       = 'IT_SALESORDER'. "Internal Table Name
      wa_fieldcat-fieldname     = 'POSNR'.         "Field Name
      wa_fieldcat-seltext_m     = 'Sales Doc Item'."Display Text In Screen
      APPEND wa_fieldcat TO gt_fieldcat.
      CLEAR wa_fieldcat.
    *SubTotal on the Field NETWR
      wa_fieldcat-col_pos       = '3'.             "Column Position
      wa_fieldcat-tabname       = 'IT_SALESORDER'. "Internal Table
      wa_fieldcat-fieldname     = 'NETWR'.         "Field Name
      wa_fieldcat-do_sum        = 'X'.             "Sum
      wa_fieldcat-seltext_m     = 'Net Value'.     "Display Text In Screen
      APPEND wa_fieldcat TO gt_fieldcat.
      CLEAR wa_fieldcat.
    ENDFORM.                    " field_catalog
    *&      Form  sorting
          text
         -->P_IT_SORTCAT  text
    FORM sorting USING p_it_sortcat TYPE slis_t_sortinfo_alv.
      CLEAR wa_sortcat.
      wa_sortcat-fieldname = 'VBELN'.
      wa_sortcat-up        ='X'.
      wa_sortcat-subtot    = 'X'.
      APPEND wa_sortcat TO p_it_sortcat.
    ENDFORM.                    " sorting
    *&      Form  display_data
          text
    -->  p1        text
    <--  p2        text
    FORM display_data .
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
        i_callback_program                = sy-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                         =
        it_fieldcat                       = gt_fieldcat
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
        it_sort                           = gt_sortcat
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         = 'X'
      I_SAVE                            = ' '
      IS_VARIANT                        =
      IT_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
      IT_ALV_GRAPHICS                   =
      IT_HYPERLINK                      =
      IT_ADD_FIELDCAT                   =
      IT_EXCEPT_QINFO                   =
      I_HTML_HEIGHT_TOP                 =
      I_HTML_HEIGHT_END                 =
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER           =
      ES_EXIT_CAUSED_BY_USER            =
        TABLES
        t_outtab                          = gt_salesorder
       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.                    " display_data
    *&      Form  fetch_data
          text
    -->  p1        text
    <--  p2        text
    FORM fetch_data .
      REFRESH : gt_salesorder.
      CLEAR   : gt_salesorder.
      SELECT a~vbeln
             posnr
             b~netwr
        FROM vbak AS a
       INNER JOIN vbap AS b ON  avbeln = bvbeln
        INTO TABLE gt_salesorder
        WHERE a~vbeln IN s_vbeln.
    ENDFORM.                    " fetch_data
    Reward points if helpful.
    Kiran Kumar.G.A
            Have a Nice Day..

  • Refreshing contents of ALV grid

    I am displaying 2 ALV grids in a splitter container on screen 100. There is an option for refresh on this screen to refresh the entries in both the grids (if any change). This refresh works fine using method REFRESH_TABLE_DISPLAY for both top and bottom grid contents.
    After processing the contents in screen 100, the user can navigate to screen 200 to view results of the current run. This screen also holds an ALV grid display of results on a custom container. When returning to screen 100 from 200, the results in top grid of screen 100 are fixed. The refresh option now only works with the grid on bottom container and not the top. I have tried using both REFRESH_TABLE_DISPLAY and SET_TABLE_FOR_FIRST_DISPLAY options and neither worked.
    How do I refresh the ALV to use the contents from the new dataset?
    Regards,
    Suri.

    Are you used refresh in PBO of 100 ?
    Like
        call method g_grid->refresh_table_display.   " Top grid
        call method g_grid1->refresh_table_display. " bottom grid

  • Problems with do_sum in ALV-GRID OO

    Hi,
    i want to sum in ALV-GRID OO, but the sum-line are not displayed.
    Here my short extrac.
      GS_FIELDCAT-REF_TABLE  = 'COEP'.
      GS_FIELDCAT-REF_FIELD  = 'WKGBTR'.
      GS_FIELDCAT-FIELDNAME  = 'WKGBTR'.
      GS_FIELDCAT-DO_SUM     = 'X'.
      APPEND GS_FIELDCAT TO GT_FIELDCAT.
      CALL METHOD GR_ALVGRID->SET_TABLE_FOR_FIRST_DISPLAY
       EXPORTING
                 IT_TOOLBAR_EXCLUDING = GT_EXCLUDE
                 IS_LAYOUT            = GS_LAYOUT
                 IS_VARIANT           = GS_VARIANT
                 I_SAVE               = 'X'
       CHANGING
                 IT_FIELDCATALOG      = GT_FIELDCAT
                 IT_OUTTAB            = ITAB.
    Any idea want i'm doing wrong??
    Regards, Dieter

    IF that don't work try this little program to find what is missing
    report z_what.
    TYPE-POOLS slis.
    DATA: ct_fieldcat TYPE slis_t_fieldcat_alv,
          zt_fieldcat LIKE LINE OF ct_fieldcat.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
         EXPORTING
              i_structure_name = 'COEP'
         CHANGING
              ct_fieldcat      = ct_fieldcat.
    READ TABLE ct_fieldcat INTO zt_fieldcat
      WITH KEY fieldname = 'WKGBTR'.
    BREAK-POINT.
    Regards

  • REFRESH BUTTON OF ALV GRID

    Hi Experts,
          In ALV report i have to apply custom functionality when user clicks on 'REFRESH' button.Please suggest me how to catch
    this event.I have used the event 'AFTER_REFRESH' OF CLASS CL_GUI_ALV_GRID.But it is not the right event.Please sugget me.
    regards,
    pavan t.

    hi,
    I'm currently not able to test, but have you tried teh events user_command and after_usercommand?
    regards,
    Hans Hohenfeld

  • Problem in conversion from alv grid to excel

    Hi all,
             I have alv report output, when i am converting it to excel format sometimes it shows each column names twice and sometimes column names are not arranged in proper order....
    any solution to this type of problem???
    thnx.

    there are different options to export to excel which all behave differently, if you go for the menu ->export it differs from the export button from the alv buttonbar.
    try the different export to excel options perhaps there is one that behaves the way you want
    kind regards
    arthur de smidt

  • ALV Grid Problem in WebGUI

    Hi All,
    We've created an ALV grid using classes in R3 and we're testing it in WebGUI.  All of those scenarios are working fine in R3 however the behavior in WebGUI is different.  We're encountering a problem wherein the cellstyles are not being reflected (eg. a particular cell for a particular row should be grayed out if a particular field has this value).  Furthermore, if we enter a value in this field, it should automatically populate values for other fields (eg. column name - PERNR.  Once pernr is entered; column name - NAME should have a value automatically).  Another thing is, the Refresh button is  missing in WebGUI.  One more problem is that the error message for that particular column was not shown.  We're using the add_protocol_entry method, so it should generate a pop-up screen.
    Any solution for all these problems?  Are these problems limitations of the ALV Grid in WebGUI? 
    We'll appreciate all your responses.  Thanks a lot.

    Have a look at example code: BCALV_GRID_01, where they suppress the error by catching it...
    If you are using the ABAP Grid Control (OO object), you can still create the ALV list as a spool listing for the background job.
    The easiest way to do this is to put all the create object statements and method calls for the custom container and ALV grid object inside a subroutine (for example, present_grid).
    All that is required is a simple check of the sy-batch variable to determine if the program is being executed in the foreground or background.
    e.g. if sy-batch is initial.
    call screen 0100.
    else.
    perform present_grid.
    endif.
    In a PBO module of screen 0100, the subroutine present_grid is also performed.
    The set_table_for_first_display method will be invoked in the routine present_grid, however, due to the job being executed in the background, the ALV list output will be written as spool output for the background job.

  • ALV GRID - REFESH PROBLEM

    Hi,
    i've a problem:
    i call the ALV GRID , after, i double click on a record calling an other screen......
    when i back to the alv i want to keep selected the record that before i had clicked.
    All this keeping  the refresh active.
    Is it possible???
    'cause when i back the alv is on the first paga with the first record on the top.
    Without refresh i have the record selected ma the table is not re-generated.
    THXXXXXX
    Igor

    Yes....
    if i make a double click on a record on ALV grid calling an other screen, when i move back to alv
    the record i have selected in the last page of ALV is not selected and the alv is on the first page.
    I want that alv remain on the record that i have selected with double click.
    Thxxxx

  • Problem creating an excel with ALV GRID

    Hi all,
    this is my problem:
    i have an ALV GRID in which I display several columns in a proper order, es : A B C D E F G
    when i create an excel from this display i obtain a different order of the columns!
    in particular the 3 columns which represent numeric values (es C D E) are the last 3 colums in the excel, instead in the alv grid this 3 comuns stay in the middle!
    so in the excel i obtain : A B F G C D E!!!!
    please can anyone help me to fix this problem?

    hi,
    if you do a debugging it will go into the function module alv_xxl_call.
    in this we can find  the code as below.
    catch system-exceptions import_mismatch_errors = 1.
        import l_xxl_toggle_date from database ltdx(XL) id
                                    'bcalv_xxl_toggle_date'.
      endcatch.
    here place a break point and check what value is it coming for this variable l_xxl_toggle_date.
    if it is coming as X. then this problem will arrive.
    here manually change the variable to space and check , the output will be coming perfectly.
    if value is coming as X.
    THEN WE CAN DO ONE THING.
    HERE we are having a report bcalv_toggle_date which MUST EXECUTED ONCE ONLY.
    WHEN IT IS EXECUTED IT DOES NOT DISPLAY ANYTHING.
    after executing once the variable will be changed from X TO SPACE.
    but we must run this report as other program excel sheet download order  might get disturbed.
    my might suggestion copy thwe standard gui  to custom one and right a code for that excel icon in your code as shown below.
    we need to copy the function module alv_xxl_call and comment the code
    catch system-exceptions import_mismatch_errors = 1.
        import l_xxl_toggle_date from database ltdx(XL) id
                                    'bcalv_xxl_toggle_date'.
      endcatch.
      if l_xxl_toggle_date is initial.
      and endif of the above if.
    WHEN 'XXL'.
          DATA : v_fieldcat TYPE STANDARD TABLE OF kkblo_fieldcat.
          DATA : wa_fieldcat TYPE kkblo_fieldcat.
          DATA : w_fieldcat LIKE LINE OF gt_fieldcat.
          DATA : g_sort TYPE slis_t_sortinfo_alv.
          DATA : g_filter TYPE slis_t_filter_alv.
          DATA : a_fieldcat TYPE slis_t_fieldcat_alv.
          CALL FUNCTION 'REUSE_ALV_GRID_LAYOUT_INFO_GET'
            IMPORTING
              es_layout   = gs_layout
              et_fieldcat = a_fieldcat[]
              et_sort     = g_sort
              et_filter   = g_filter
              es_variant  = gs_variant.
          DELETE a_fieldcat WHERE no_out = 'X'.
          LOOP AT a_fieldcat INTO w_fieldcat.
            MOVE-CORRESPONDING w_fieldcat TO wa_fieldcat.
            APPEND wa_fieldcat TO v_fieldcat.
          ENDLOOP.
          CALL FUNCTION 'ZALV_XXL_CALL'
            EXPORTING
              i_tabname                    = 'IT_FINAL'
            IS_LAYOUT                    =
              it_fieldcat                  = v_fieldcat[]
            I_CALLBACK_TOP_OF_PAGE       =
            I_TITLE                      =
            I_MODE                       =
            TABLES
              it_outtab                    = it_final
           EXCEPTIONS
             FATAL_ERROR                  = 1
             NO_DISPLAY_POSSIBLE          = 2
             OTHERS                       = 3.

  • Alv Grid ctrl + y problem

    hi all, I have a problem with an editable alv grid, if I copy multiple lines with ctrl + y and paste them in the last line the program creates new rows...but i don't want the creation of new rows.
    Any suggestion?
    Many thanks,
    Luca

    So how do you see it? You want to fit couple rows in one empty line? It's not too logical, is it? Ensure you have enough number of rows below the line you are trying to paste your copied lines. So if you copy 3 lines, you will have to start pasting from 3rd line  from the bottom at most (not below that one).
    Regards
    Marcin

  • ALV Grid in Edit mode

    Dear all,
    I would like to do a refresh of the ALV GRID table display in event "handle_data_changed_finished".
    "refresh_table_display" is NOT working.
    I obviously need to go through PAI & PBO to refresh the table display.
    Is there something to syncronize the data?
    There must be an easy solution...
    bye
    Niko
    Niko Prindesis
    Itelligence AG

    Dear Andreas,
    thank you!
    If I call "SAPGUI_SET_FUNCTIONCODE" in "handle_data_changed_finished", I can trigger the PAI/PBO.
    So this solves my problem!
    But ...
    ... isn't there a solution without going through PAI/PBO???
    I want to stay in the ALVGrid control!
    bye
    Niko

  • Sending the rows in an ALV grid chosen by the user  to another report

    Hello Experts!
    I am facing a problem with respect to ALV grid using OOABAP.
    I am displaying an ALV grid. The user selects a few rows from this grid and clicks on a button called "Update" which i have incorporated into the grid.
    Once the user clicks on update, i should call another report passing only the rows selected by the user. I am using the method "get_selected_rows" do get the indices of the rows selected. But, i am unable to proceed from here. How do i incorporate this logic in my code? Can anyone give me some sample code?
    Thanks and Regards,
    Smitha

    Hi Smitha
    Get the rows of the ALV into an internal table . You are right in using the method GET_SELECTED_ROWS.
    Suppose li_tab is the internal table in which you have the rows of ALV.
    Write this statement in the report from which you are transporting.
    EXPORT li_tab TO MEMORY ID sy-repid.
    Write this statement in the report to which you are transporting.
    IMPORT sel_tab = li_tab FROM MEMORY ID 'Z_Report_Name'.
    hope it works.
    Reward points if helpful.

Maybe you are looking for

  • HP laserjet p1102 not recognized after installati​on on windows 7 - 32bit

    Hello I need help with my hp laserjet p1102 installation, it's not working after installation. I get a message say's(usb device not recognized) can any one here get me a hint please??

  • How to Transport all activities in CMS.

    Hi Friends, I have one doubt on Transportation in NWDI. I was released  my All activities in Transport View Table. Now I am import to .epa file into QA System. Now I am checking my iViews in QA. I am  got this Error. javax.naming.NamingException: Fai

  • How, where, and other questions about BC 2.1

    I was in MacOS 10.5.2 and ran software update. It did not tell me of the "new" Bootcamp 2.1 that will make SP3 work on the intel-Mac. So I started up in XP mode and ran Apple Software update, still no mention of the 2.1 update. So then I went to the

  • BW7.0 Delta question

    Hi Everybody, I am going to try to find an answer to my problem in this forum... the NW2004s one has few activity at the time... It is possible to actualize from a PSA to a dataTarget in with a delta modus? or a need to implement (add) an ODS object

  • Has Anyone Used the WD My Book External Drives for Time Machine?

    I'm thinking of getting the Western Digitial 1 or 2 TB My Book (Pro Edition 2 or Studio Edition) External Drives for use with 2 MacPros. Has anyone used these and could I use them with Time Machine? Would I have to reformat them for Time Machine? Tha