ALV Grid Field catalog

Hi,
     I am trying to display data from two different tables, say 3 fields from one table and 3 fields from other table. in alv grid format using classes and using method CALL METHOD go_grid->set_table_for_first_display
how can we build the field catalog for the internal table which consists of 6 fields from two different tables
thanks in advance

Hello,
Please check,it is similar case.
FORM set_grid.
  IF g_r_grid IS INITIAL.
    CREATE OBJECT g_r_cont
                 EXPORTING container_name = 'CUST1'.
    CREATE OBJECT g_r_grid
                 EXPORTING i_parent = g_r_cont.
    g_r_variant = sy-repid.
  Build Field Catalog
    PERFORM build_field_catalog.
  Exclude process options from ALV
    PERFORM alv_excl.
  setting ALV Grid layout
    PERFORM alv_layo.
    CALL METHOD g_r_grid->set_table_for_first_display
       EXPORTING
         is_layout                     = g_r_layo
         is_variant                    = g_r_variant
         it_toolbar_excluding          = g_r_excl
         i_save                        = 'X'
       CHANGING
         it_outtab                     = g_t_alv[]
         it_fieldcatalog               = g_t_fieldcat.
  ENDIF.
ENDFORM.                    " set_grid
*Form Routine ID    : build_field_catalog
*Form Routine Name  : TO Build Field Catalog
*Outline            : Subroutine for building the field catalog
*Argument           : None
*Return Value       : None
FORM build_field_catalog.
  DATA : l_f_n TYPE i.
  REFRESH g_t_fieldcat.
  l_f_n  = 0.
Add properties values to ALV Catalog
  l_f_n = l_f_n + 1.
  PERFORM add_catalog USING 'MATNR' 'CHAR' l_f_n
                            text-001 'X' space ' ' 18 ' '  .
  l_f_n = l_f_n + 1.
  PERFORM add_catalog USING 'TXZ01' 'CHAR' l_f_n
                            text-002 'X' space 'X' 40 ' ' .
  l_f_n = l_f_n + 1.
  PERFORM add_catalog USING 'MFRPN' 'CHAR' l_f_n
                            text-003 ' ' space ' ' 40 ' ' .
  l_f_n = l_f_n + 1.
  PERFORM add_catalog USING 'EBELN' 'CHAR' l_f_n
                             text-004 space space ' ' 10 ' ' .
  l_f_n = l_f_n + 1.
  PERFORM add_catalog USING 'EBELP' 'NUMC' l_f_n
                             text-005 space space ' ' 5 ' '.
  l_f_n = l_f_n + 1.
  PERFORM add_catalog USING 'EINDT' 'DATS' l_f_n
                             text-006 space space ' ' 10 ' '.
  l_f_n = l_f_n + 1.
  PERFORM add_catalog USING 'MENGE' 'QUAN' l_f_n
                             text-007 space space ' ' 13 ' '.
  l_f_n = l_f_n + 1.
  PERFORM add_catalog USING 'MEINS' 'UNIT' l_f_n
                             text-008 space space ' ' 3 ' '.
  l_f_n = l_f_n + 1.
  PERFORM add_catalog USING 'MENGE1' 'QUAN' l_f_n
                             text-009 space space ' ' 13 ' '.
  l_f_n = l_f_n + 1.
  PERFORM add_catalog USING 'MEINS1' 'UNIT' l_f_n
                             text-010 space space ' ' 3 ' '.
  l_f_n = l_f_n + 1.
  PERFORM add_catalog USING 'LIFNR' 'CHAR' l_f_n
                             text-011 space space ' ' 10 'ALPHA'.
  l_f_n = l_f_n + 1.
  PERFORM add_catalog USING 'NAME1' 'CHAR' l_f_n
                             text-012 space space 'X' 35 ' '.
  l_f_n = l_f_n + 1.
  PERFORM add_catalog USING 'BSART' 'CHAR' l_f_n
                             text-013 space space ' ' 4 ' '.
  l_f_n = l_f_n + 1.
  PERFORM add_catalog USING 'BEDAT' 'DATS' l_f_n
                             text-014 space space ' ' 10 ' '.
  l_f_n = l_f_n + 1.
  PERFORM add_catalog USING 'AEDAT' 'DATS' l_f_n
                             text-015 space space ' ' 10 ' '.
  l_f_n = l_f_n + 1.
  PERFORM add_catalog USING 'INSMK' 'CHAR' l_f_n
                             text-016 space space ' ' 1 ' '.
  l_f_n = l_f_n + 1.
  PERFORM add_catalog USING 'WERKS' 'CHAR' l_f_n
                             text-017 space space ' ' 4 ' '.
  l_f_n = l_f_n + 1.
  PERFORM add_catalog USING 'LGORT' 'CHAR' l_f_n
                             text-018 space space ' ' 4 ' '.
  l_f_n = l_f_n + 1.
  PERFORM add_catalog USING 'EKGRP' 'CHAR' l_f_n
                             text-019 space space ' ' 3 ' '.
  l_f_n = l_f_n + 1.
  PERFORM add_catalog USING 'PSTYP' 'CHAR' l_f_n
                             text-020 space space ' ' 1 ' '.
  l_f_n = l_f_n + 1.
  PERFORM add_catalog USING 'LOEKZ' 'CHAR' l_f_n
                             text-021 space space ' ' 1 ' '.
  l_f_n = l_f_n + 1.
  PERFORM add_catalog USING 'DISPO' 'CHAR' l_f_n
                             text-022 space space ' ' 3 ' '.
  l_f_n = l_f_n + 1.
  PERFORM add_catalog USING 'PO_TEXT' 'CHAR' l_f_n
                             text-023 space space 'X' 10 ' '.
  l_f_n = l_f_n + 1.
  PERFORM add_catalog USING 'BSGRU' 'CHAR' l_f_n
                             text-024 space space ' ' 3 ' '.
  l_f_n = l_f_n + 1.
  PERFORM add_catalog USING 'PRDHA1' 'CHAR' l_f_n
                             text-025 space space ' ' 18 ' '.
  l_f_n = l_f_n + 1.
  PERFORM add_catalog USING 'VTEXT1' 'CHAR' l_f_n
                             text-026 space space 'X' 40 ' '.
  l_f_n = l_f_n + 1.
  PERFORM add_catalog USING 'PRDHA2' 'CHAR' l_f_n
                             text-027 space space ' ' 18 ' '.
  l_f_n = l_f_n + 1.
  PERFORM add_catalog USING 'VTEXT2' 'CHAR' l_f_n
                             text-028 space space 'X' 40 ' '.
  l_f_n = l_f_n + 1.
  PERFORM add_catalog USING 'PRDHA3' 'CHAR' l_f_n
                             text-029 space space ' ' 18 ' '.
  l_f_n = l_f_n + 1.
  PERFORM add_catalog USING 'VTEXT3' 'CHAR' l_f_n
                             text-030 space space 'X' 40 ' '.
ENDFORM.                    " build_field_catalog
*Form Routine ID    : add_catalog
*Form Routine Name  : To Add the Catalog for the ALV
*Outline            : Subroutine to add properties values to ALV Catalog
*Argument           : p_fname        "Field Name
                    p_inttype      "Intenal Type
                    p_col_pos      "Column Position
                    p_coltext      "Column Text
                    p_key          "Key Field
                    p_hotspot      "Hotspot Enabled
                    p_outlen       "Internal Length
                    p_convexit     "conversion exit name
*Return Value       : g_t_fieldcat   "Field Catalog Table
FORM add_catalog USING   p_fname
                         p_inttype
                         p_col_pos
                         p_col_text
                         p_key
                         p_hotspot
                         p_lowercase
                         p_outlen
                         p_convexit.
  CLEAR g_r_fieldcat.
  g_r_fieldcat-fieldname = p_fname.
  g_r_fieldcat-inttype   = p_inttype.
  g_r_fieldcat-col_pos   = p_col_pos.
  g_r_fieldcat-coltext   = p_col_text.
  g_r_fieldcat-hotspot   = p_hotspot.
  g_r_fieldcat-lowercase = p_lowercase.
  g_r_fieldcat-outputlen = p_outlen.
  g_r_fieldcat-key       = p_key.
  g_r_fieldcat-convexit  = p_convexit.
  APPEND g_r_fieldcat TO g_t_fieldcat.
ENDFORM.                    " add_catalog
*Form Routine ID    : alv_excl
*Form Routine Name  : ALV Exclude List
*Outline            : Subroutine to exclude process options from ALV
*Argument           : None
*Return Value       : None
FORM alv_excl.
  APPEND cl_gui_alv_grid=>mc_mb_sum          TO g_r_excl.
  APPEND cl_gui_alv_grid=>mc_mb_subtot       TO g_r_excl.
  APPEND cl_gui_alv_grid=>mc_fc_graph        TO g_r_excl.
  APPEND cl_gui_alv_grid=>mc_fc_info         TO g_r_excl.
  APPEND cl_gui_alv_grid=>mc_fc_print_back   TO g_r_excl.
ENDFORM.                    " alv_excl
*Form Routine ID    : alv_layo
*Form Routine Name  : alv_layo
*Outline            : Subroutine to set alv layout
*Argument           : None
*Return Value       : None
FORM alv_layo.
  g_r_layo-grid_title = text-100.
  g_r_layo-cwidth_opt = g_c_mark.
  g_r_layo-zebra      = g_c_mark.
  g_r_layo-no_rowmark = space.
  g_r_layo-sel_mode   = g_c_selmode.
ENDFORM.                 
Regards

Similar Messages

  • How to control edit checks on alv grid fields

    I have set up an alv grid that allows for user input. 
    The fields are defined from the data dictionary. 
    Edit checks are happening on all fields, but I would like to turn that off for some fields. 
    How is that controlled?
    Regards!

    u need to define ur own field catalog for this purpose, for the fields for which u want to set check box, add property like this
      X_FIELDCAT-FIELDNAME = 'LIFNR'.
      X_FIELDCAT-TABNAME = 'IT_FINAL'.
      X_FIELDCAT-SELTEXT_L  = 'VENDOR'.
      X_FIELDCAT-NO_ZERO    = 'X'.
      X_FIELDCAT-OUTPUTLEN  = 10.
      X_FIELDCAT-COL_POS    = 1.
      APPEND X_FIELDCAT TO IT_FIELDCAT.
      CLEAR X_FIELDCAT.
      X_FIELDCAT-FIELDNAME = 'BUKRS'.
      X_FIELDCAT-TABNAME = 'IT_FINAL'.
      X_FIELDCAT-CHECKBOX = 'X'.
      X_FIELDCAT-SELTEXT_L  = 'COMPANY'.
      X_FIELDCAT-NO_ZERO    = 'X'.
      X_FIELDCAT-OUTPUTLEN  = 4.
      X_FIELDCAT-COL_POS    = 2.
      APPEND X_FIELDCAT TO IT_FIELDCAT.
      CLEAR X_FIELDCAT.
        CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
          EXPORTING
            I_PROGRAM_NAME         = SY-REPID
            I_INTERNAL_TABNAME     = 'IT_FINAL'
            I_INCLNAME             = SY-REPID
          CHANGING
            CT_FIELDCAT            = IT_FIELDCAT
          EXCEPTIONS
            INCONSISTENT_INTERFACE = 1
            PROGRAM_ERROR          = 2
            OTHERS                 = 3.
        CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
          EXPORTING
            I_CALLBACK_PROGRAM = SY-REPID
            IS_LAYOUT          = L_LAYOUT
            IT_FIELDCAT        = IT_FIELDCAT
          TABLES
            T_OUTTAB           = IT_FINAL
          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.
    u can even check program BCALV_EDIT_05, award points if found helpful

  • Hierarchical alv list field catalog

    hi, i am diplaying a hierarchical list through ooalv.
    i am using the cl_salv_hierseq_table=>factory method.
    CALL METHOD cl_salv_hierseq_table=>factory
      EXPORTING
        t_binding_level1_level2 = lt_binding
      IMPORTING
        r_hierseq               = gr_table
      CHANGING
        t_table_level1          = T_HEADER
        t_table_level2          = T_ITEM.
    Could anyone please tell me how do i pass a FIELD CATALOG in the above function.
    I checked the parameters of the above function and it has only 4 parameters
    as used above.

    When you create the ALV using the SALV OM, system creates the Field Catalog and some default setting based on the table columns. So, change any of the column properties, you have to get the Column object and process the column.
    Check the program SALV_DEMO_HIERSEQ_COLUMN.
    Regards,
    Naimesh Patel

  • F4 help in ALV grid field

    Hello Experts,
    I am using cl_salv_table=>factory to display ALV grid.
    Now I also want to attach f4 help in one of the field of ALV grid.
    I am unable to locate any event or method.
    Please help.

    Hello,
    @Marcin: The aim to display values in search help is not to select values for editable field in alv grid but to display some additional information based on value in that field.
       If search help is not possible, then dropdown can also work for me or pls provide any other solution to this.
    I had tried implementing dropdown, for that I am using class "cl_salv_column_list" method "set_dropdown_entry".
    From this I am able to see dropdown icon for my field but not able to populate values in dropdown.
    Pls help in populating values in dropdown.
    My logic is:-
    Based on the values in the field in alv grid I have to calculate value dynamically to be displayed in search help or drop down list.

  • ALV List -  Field Catalog - Change Column width

    Hi Friends,
    I am using Alv list to display the output of a report program. I have generated the field catalog using REUSE_ALV_FIELDCATALOG_MERGE function and to display the alv REUSE_ALV_LIST_DISPLAY.
    My Internal table has few fields like "text1 type string". So after generating the Fieldcatalog from internal table i have changed the field description, but i don't know how to change the column output display width. I have tried by changing OUTPUTLEN parameter to 50 but in the output it is taking only 10 characters instead of 50 characters.
      How can i change the field length(FOR STRING TYPE) for output display ??
    Which parameter do i need to change in field catalog for String type fields..
    Regards,
    Raju.
    Message was edited by: Narayana Raju Sampathirao

    Hi narayana,
    1. the STRING type is causing the problem.
    2. what u can do is,
      (i suppose u are modifying the alv field catalogue)
       One workaround is :
       and it works fantastic !
    3.  BOLD is important.
        (this will take care of the length)
    LOOP AT alvfc INTO alvwa.
      IF alvwa-fieldname = 'A'.
        alvwa-outputlen = '100'.
    <b>    alvwa-inttype = 'CHAR'.</b>
        MODIFY alvfc FROM alvwa.
      ENDIF.
    ENDLOOP.
    4. To get a TASTE of what i m saying,
       just copy paste in new program :
    REPORT abc.
    TYPE-POOLS : slis.
    Data
    DATA : BEGIN OF itab OCCURS 0,
           a TYPE string.
            INCLUDE STRUCTURE t001.
    DATA :  END OF itab.
    DATA : alvfc TYPE slis_t_fieldcat_alv.
    DATA : alvwa TYPE slis_fieldcat_alv.
    Select
    SELECT * FROM t001 INTO CORRESPONDING FIELDS OF TABLE itab.
    LOOP AT itab.
      itab-a = 'pppppppppppppppppppppp'.
      MODIFY itab.
    ENDLOOP.
    *-------  Field Catalogue
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
      EXPORTING
        i_program_name         = sy-repid
        i_internal_tabname     = 'ITAB'
        i_inclname             = sy-repid
      CHANGING
        ct_fieldcat            = alvfc
      EXCEPTIONS
        inconsistent_interface = 1
        program_error          = 2
        OTHERS                 = 3.
    LOOP AT alvfc INTO alvwa.
      IF alvwa-fieldname = 'A'.
        alvwa-outputlen = '100'.
        alvwa-inttype = 'CHAR'.
        MODIFY alvfc FROM alvwa.
      ENDIF.
    ENDLOOP.
    Display
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
      EXPORTING
        it_fieldcat             = alvfc
      TABLES
        t_outtab                = itab
      EXCEPTIONS
        program_error           = 1
        OTHERS                  = 2.
    regards,
    amit m.

  • Help search in alv grid field

    Hello.
    How to assign a help search to a field of an alv grid control?
    I would like to use another help search different form the field reference.
    Thanks!!!
    Alberto

    Check the sample code:
        handle_on_f4             FOR EVENT onf4 OF cl_gui_alv_grid
                                 IMPORTING sender e_fieldname e_fieldvalue
                                           es_row_no er_event_data
                                           et_bad_cells e_display.
      METHOD handle_on_f4.
        IF e_fieldname = text-027. "Date
          PERFORM f4_date USING sender e_fieldname e_fieldvalue es_row_no
                                       er_event_data et_bad_cells e_display.
        ENDIF.
      ENDMETHOD.                    "handle_On_f4
    ENDCLASS.                    "lcl_event_receiver IMPLEMENTATION
    *&      Form  F4_contact_id
          F4 for Contact ID
    FORM f4_date  USING    sender        TYPE REF TO cl_gui_alv_grid
                           e_fieldname   TYPE lvc_fname
                           e_fieldvalue  TYPE lvc_value
                           es_row_no     TYPE lvc_s_roid
                           er_event_data TYPE REF TO cl_alv_event_data
                           et_bad_cells  TYPE lvc_t_modi
                           e_display     TYPE c.
      DATA: lv_anlage TYPE anlage.
      FIELD-SYMBOLS: <itab> TYPE lvc_t_modi.
      DATA: ls_modi TYPE lvc_s_modi.
      DATA : wa_field_tab TYPE  dfies,
             lws_date TYPE scal-date.
      DATA: lws_row_id TYPE lvc_s_roid,
            lws_tabix TYPE sy-tabix.
      DATA: li_ret_tab LIKE  ddshretval OCCURS 0 WITH HEADER LINE.
      CLEAR: ls_modi, lv_anlage, li_ret_tab, wa_final, wa_field_tab,
             lws_date, lws_row_id, lws_tabix.
      REFRESH: li_ret_tab.
      IF NOT er_event_data->m_event_handled = c_x.
        ws_f4_handle = c_x.
        MOVE es_row_no-row_id TO lws_tabix.
        READ TABLE i_final INTO wa_final INDEX lws_tabix.
        CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'
          EXPORTING
            tabname           = text-012              "I_FINAL
            fieldname         = text-027              "DATE
            searchhelp        = text-038              "BU_DATE_CHAR
          TABLES
            return_tab        = li_ret_tab
          EXCEPTIONS
            field_not_found   = 1
            no_help_for_field = 2
            inconsistent_help = 3
            no_values_found   = 4
            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.
        ASSIGN er_event_data->m_data->* TO <itab>.
        CONCATENATE li_ret_tab-fieldval+6(4)
                    li_ret_tab-fieldval+3(2)
                    li_ret_tab-fieldval+0(2) INTO lws_date.
        IF lws_date NE ''.
          IF lws_date > sy-datum.
            IF wa_final-zzmod_eff_code EQ c_03 OR
               wa_final-zzmod_eff_code EQ c_04 OR
               wa_final-zzmod_eff_code EQ c_05.
              wa_final-date = lws_date.
              MODIFY i_final FROM wa_final INDEX lws_tabix.
              PERFORM no_edit_for_date TABLES i_final.
              PERFORM alv_refresh.
            ENDIF.
          ELSE.
            wa_final-date = ''.
            MODIFY i_final FROM wa_final INDEX lws_tabix.
            PERFORM no_edit_for_date TABLES i_final.
            PERFORM alv_refresh.
            MESSAGE s001(zesspa) WITH text-037.
            EXIT.
          ENDIF.
        ENDIF.
        er_event_data->m_event_handled = c_x.
      ENDIF.
    ENDFORM.                                                    " f4_date
    Check the standard program <b>BCALV_EDIT_08</b>
    Regards,
    Prakash.

  • ALV grid field editable/non editable at runtime

    Hi All,
    I am working on alv grid using containers. I have to make few cells in grid to editable and few othres to non editable which I did using styles by defining table type lvc_t_styl and updating my main internal table. Now once grid is displayed for first time (using set_table_for_first_display) it has required fields in editable and non editable as required. But now on triggering of data_changed event I have to change the editable cells to non editable and the non editable cells to editable. I tried doing this as same way as I have done before calling set_table_for_first_display method i.e. by  defining table of type lvc_t_styl in data_changed event and modifying my main internal table but this time the editable fields are changed to non editable and again becomes editable. Same problem with non editable cells also. They become editable and again becomes non ediatble of there own. Can anyone suggest any solution.
    <b>Note: Points awarded for helpful answers</b>
    null

    Hi,
    Check this link.I am explaining the steps for this.
    Kindly reward points by clicking the star on the left of reply,if it helps.<a href="https://wiki.sdn.sap.com/wiki/display/Snippets/ALV-Editingandsavingtheeditedvaluesin+Database(OOPS)">Editing OOPS ALV</a>

  • ALV Grid fields from editable to non-editable mode

    Hi,
    I am displaying my data through ALV Grid. In my grid the non-key fields are in editable mode.
    When I edit any of the editable fields and place the cursor on other field the field which I have edited should become disable(non-editable). Again if I want to edit the same field which is now in non-editable mode should again change to editable mode when the cursor is placed on it.
    Thanks & Regards,
    Adithya M.

    Hi Adithya,
    I am confused by your statement "place the cursor on other field the field which I have edited should become disable" -- are you stating that this is the requirement or what is currently happening with your program.  The way the edit fields should work by default is they are editable at all times unless you tell it otherwise. 
    If you are saying your requirement is to change the field to disabled once the field is edited (runtime change), first you want to handle the event on data changed then within your method of handling on data changed, you can disable the field from being edited by using cell styles and changing the value to disabled. 
    If you look at program BCALV_GRID_EDIT,
    You will find code where it disables the field for edit using Cell Style -- this will give you an idea how Cell Style controls editable fields and display fields:
            ls_cell-style  = cl_gui_alv_grid=>mc_style_enabled.
            ls_cell-maxlen = 4.
            ls_cell-fieldname = 'CARRNAME'.
            append ls_cell to gt_sflight-cell.
    This specific code will set the field disabled when the program is first exectued, in your case if you need to do this at run time, after someone edits the field, you need to implement handling the event on data changed, in the same program you will find:
    method handle_data_changed.                 
       perform data_changed using er_data_changed.
    endmethod.                     
    It is within this method that you can disable a field for editing.
    However, once it is disabled you will not get back into the handle_data_changed method.  I'm not sure I understand your statement "Again if I want to edit the same field which is now in non-editable mode should again change to editable mode when the cursor is placed on it."  Why would you want the user to be able to edit something, then show it disabled, then let them click on it and edit it again?  Why not just leave it in edit mode?  Maybe if I understand the requirement better, I can answer this portion of the question. 
    If this is based on security or changing from edit to display for the entire grid, you can run the same program mentioned above and click on the Change/Display button in the top left to see how it enables and disables the entire grid for editing.
    Cheers,
    Bonnie

  • New ALV Grid Field not Displaying?

    I revised a report to have a new column. So I added this new field to the code.
    I see the field and the value when I call
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    Bbut the field I added does not display.
    Thank-you.

    Hi,
    Please ensure that you added the related logic in the FIELD CATALOG of the ALV.
    Regards,
    Nirmal

  • F1 Documentation for ALV grid Field

    Hi All,
    I am working on ALV grid.I am able to dispaly the ALV grid.
    It is working perfectly.
    But client needs if i click on the 'F1' on field he needs the documentation of that field.
    I have field documentaion.But i am not able to display.
    Anybody please let me know how to make it.
    Thanks,
    Swapna.
    Edited by: tarangini katta on Mar 12, 2009 12:43 PM

    Hi,
    Refer:
    f1 help in alv grid
    Re: Display F1 help in ALV
    Hope this helps you.
    Regards,
    Tarun

  • AlV!  Field Catalog Merge!

    Hi!
       What is Field catalog merge in ALV

    Hi,
    YOU HAVE TWO WAYS TO BUILD A FIELD CATALOG
    1) FIRST METHOD
    data w_fieldcat type slis_fieldcat_alv.
    type-pools : slis.
    tables : sflight.
    data : i_fieldcat type slis_T_fieldcat_alv.
    data v_repid like sy-repid.
    data : begin of i_sflight occurs 0,
           carrid like sflight-carrid,
           connid like sflight-connid,
           fldate like sflight-fldate,
            end of i_sflight.
    w_fieldcat-tabname = 'I_SFLIGHT'.
    w_fieldcat-fieldname = 'CARRID'.
    w_fieldcat-outputlen = '10'.
    w_fieldcat-col_pos = '1'.
    w_fieldcat-row_pos = '1'.
    w_fieldcat-seltext_l = 'Carrie ID'.
    w_fieldcat-seltext_M = 'Carrie ID'.
    w_fieldcat-seltext_S = 'Carrie ID'.
    w_fieldcat-HOTSPOT = 'X'.
    append w_fieldcat to i_fieldcat.
    clear w_fieldcat.
    w_fieldcat-tabname = 'I_SFLIGHT'.
    w_fieldcat-fieldname = 'CONNID'.
    w_fieldcat-outputlen = '10'.
    w_fieldcat-col_pos = '1'.
    w_fieldcat-row_pos = '1'.
    w_fieldcat-seltext_l = 'CONNI ID'.
    w_fieldcat-seltext_M = 'CONNI ID'.
    w_fieldcat-seltext_S = 'CONNIID'.
    w_fieldcat-HOTSPOT = 'X'.
    append w_fieldcat to i_fieldcat.
    clear w_fieldcat.
    w_fieldcat-tabname = 'I_SFLIGHT'.
    w_fieldcat-fieldname = 'FLDATE'.
    w_fieldcat-outputlen = '10'.
    w_fieldcat-col_pos = '1'.
    w_fieldcat-row_pos = '1'.
    w_fieldcat-seltext_l = 'FLDATE.
    w_fieldcat-seltext_M = 'FLDATE'.
    w_fieldcat-seltext_S = 'FLDATE'.
    w_fieldcat-HOTSPOT = 'X'.
    append w_fieldcat to i_fieldcat.
    clear w_fieldcat.
    2)  SECOND METHOD
    data w_fieldcat type slis_fieldcat_alv.
    type-pools : slis.
    tables : sflight.
    data : i_fieldcat type slis_T_fieldcat_alv.
    data v_repid like sy-repid.
    data : begin of i_sflight occurs 0,
           carrid like sflight-carrid,
           connid like sflight-connid,
           fldate like sflight-fldate,
            end of i_sflight.
    call function 'REUSE_ALV_FIELDCATALOG_MERGE'
           exporting
                i_program_name     = v_repid
                i_internal_tabname = 'I_SFLIGHT'
                i_inclname         = v_repid
           changing
                ct_fieldcat        = I_fieldcatalog_TYPE.
    Reward points if helpful
    THANKS
    Venki

  • ALV Control - Field Catalog Dump.

    Dear All
    I have a local structure st_duty(prepared from 2 tables) and internal table it_duty.
    When I am preparing the Field catalog for this it is giving Dump.
    Code given:
    DATA: it_fcat1 TYPE TABLE OF lvc_s_fcat,
          wa_fcat1 TYPE lvc_s_fcat.
                       clear wa_fcat1.
                       wa_fcat1-coltext = 'Duty code'.
                      wa_fcat1-REF_FIELD   = 'DUTCODE'.
                      wa_fcat1-REF_TABLE   = '/OBIZ/ZMB_BEDUT'.
                      wa_fcat1-FIELDNAME = 'DUTCODE'.
                      wa_fcat1-col_pos = 1.
                      MODIFY it_fcat1 FROM wa_fcat1.
                     clear wa_fcat1.                   "At this Point it is giving short dump"
                     wa_fcat1-coltext = 'Description'.
                     wa_fcat1-REF_FIELD   = 'CODDESC'.
                     wa_fcat1-REF_TABLE   = '/OBIZ/ZCM_CODMAS'.
                      wa_fcat1-FIELDNAME = 'CODDESC'.
                      wa_fcat1-col_pos = 2.
                      MODIFY it_fcat1 FROM wa_fcat1.
    Short Dump Message as given below :
    Error analysis:
        You attempted to change, delete or create a line in the internal table "\PROGRAM=SAPMZ_BOE_DETAILS_OBIZ\DATA=IT_FCAT1", but no valid
         cursor exists for the table.
        Possible reasons:
        1. The relevent ABAP/4 statement does not include the addition
           "...INDEX...", although the statement is not
           inside a "LOOP...ENDLOOP" loop processing this table.
        2. The relevent ABAP/4 statement was called from within a
           "LOOP...ENDLOOP" loop after a DELETE
         "\PROGRAM=SAPMZ_BOE_DETAILS_OBIZ\DATA=IT_FCAT1".
    If anyone knows the reason then please help....
    Regards
    Sajid

    HI,
    I dont understand why are you modifying the fieldscatalogue..
    Use APPEND Field catalog..
    append wa_fcat into it_fcat,
    rewards if I am not wrong
    regards,
    nazeer

  • ALV GRID Field Resizing

    I am using REUSE_ALV_LIST_DISPLAY FM to display the Data in ALV Report here how can i use the Condnse or How to reduse the unwanted sapce in the data field.
    my code is like this
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          i_callback_program      = v_repid
          i_callback_user_command = text-004               "'USER_COMMAND'
          is_layout               = t_layo
          i_default               = 'X'
          i_save                  = c_a
          it_fieldcat             = i_fcat[]
          it_events               = i_fevents[]
        TABLES
          t_outtab                = i_final[].

    Hello Friend,
    Its there in the layout paramater )
    DATA: t_layo TYPE slis_layout_alv.
    t_layo-colwidth_optimize = 'X'.
    Hope this helps.
    BR,
    Suhas
    Edited by: Suhas Saha on Mar 3, 2009 12:22 PM

  • Error in ALV grid

    Hi ALV masters,
    Plz help me ..
    I have an ALV grid report where i have the data in my final table t_final.
    now i'm trying to populate the fieldcat using FM reuse_alv_fieldcatalog_merge but its not at all getting populated.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
        EXPORTING
          I_PROGRAM_NAME         = l_repid
          I_INTERNAL_TABNAME     = 'T_Final'
          I_INCLNAME             = l_repid
        CHANGING
          CT_FIELDCAT            = T_FIELDCAT[]
        EXCEPTIONS
          INCONSISTENT_INTERFACE = 1
          PROGRAM_ERROR          = 2
          OTHERS                 = 3.
    Please help me and if possibl try to send som sample code also.
    Thanks in advance..

    Hi Mukesh,
    this is my code.
    plz tell where i'm going rong..
    *& Report  ZMMR_CHANGES                                                *
    Title       : Material Master: Display Changes                       *
    Description : This ABAP report will collectively list all material   *
                  master changes to the fields specified in the selection*
                  criteria.                                              *
    Request No  : SRDK922644                                             *
    Author      : Praveen Reddy                                          *
    Created on  : 14-FEB-2007                                            *
    REPORT  ZMMR_CHANGES
            NO STANDARD PAGE HEADING
            message-id ZSPR.
    TYPE-POOLS : SLIS.
    TABLES : CDHDR ,           " Change document header
             CDPOS ,           " Change document item
             MARAV ,           " View Table for Logical DB MGM
             MARC  ,           " Plant Data for Material
             MVKE  .           " Sales Data for Material
    SELECTION-SCREEN BEGIN OF BLOCK A WITH FRAME TITLE TEXT-001.
    SELECTION-SCREEN BEGIN OF BLOCK GENERAL WITH FRAME TITLE TEXT-002.
    SELECT-OPTIONS :
             S_OBJCLS  FOR CDHDR-OBJECTCLAS           ,
             S_MATNR   FOR CDHDR-OBJECTID            ,
             S_WERKS   FOR MARC-WERKS                ,
             S_VKORG   FOR MVKE-VKORG                ,
             S_VTWEG   FOR MVKE-VTWEG                ,
             S_TABNAM  FOR CDPOS-TABNAME             ,
             S_FNAME   FOR CDPOS-FNAME               ,
             S_CHGIND  FOR CDPOS-CHNGIND             ,
             S_DATE    FOR CDHDR-UDATE               ,
             S_USER    FOR CDHDR-USERNAME            .
    SELECTION-SCREEN END OF BLOCK GENERAL.
    SELECTION-SCREEN END OF BLOCK A.
    *Data  : G_WERKS LIKE MARC-WERKS                 ,
           G_VKORG LIKE MVKE-VKORG                 ,
           G_VTWEG LIKE MVKE-VTWEG                 ,
           G_DESC  LIKE MARAV-MAKTX                .
    TYPES  : BEGIN           OF   TY_FOR_DISP        ,
             OBJCLASS        LIKE CDHDR-OBJECTCLAS   ,
             OBJID           LIKE CDHDR-OBJECTID     ,
             WERKS           LIKE MARC-WERKS           ,
             VKORG           LIKE MVKE-VKORG         ,
             VTWEG           LIKE MVKE-VTWEG         ,                
             DESC            LIKE MARAV-MAKTX        ,
             TABNAME         LIKE CDPOS-TABNAME      ,
             FNAME           LIKE CDPOS-FNAME        ,
             CHNGIND         LIKE CDPOS-CHNGIND      ,
             UDATE           LIKE CDHDR-UDATE        ,
             USERNAME        LIKE CDHDR-USERNAME     ,
             VALUE_OLD       LIKE CDPOS-VALUE_OLD    ,
             VALUE_NEW       LIKE CDPOS-VALUE_NEW    ,
             END             OF   TY_FOR_DISP        .
    TYPES  : BEGIN           OF   TY_CDHDR,
             OBJCLASS        LIKE CDHDR-OBJECTCLAS   ,
             OBJID           LIKE CDHDR-OBJECTID     ,
           CHNGIND         LIKE CDPOS-CHNGIND      ,
             CHANGENR        LIKE CDHDR-CHANGENR     ,
             UDATE           LIKE CDHDR-UDATE        ,
             USERNAME        LIKE CDHDR-USERNAME     ,
           VALUE_OLD       LIKE CDPOS-VALUE_OLD    ,
           VALUE_NEW       LIKE CDPOS-VALUE_NEW    ,
             END             OF   TY_CDHDR           .
    TYPES  : BEGIN           OF   TY_CDPOS,
             TABNAME         LIKE CDPOS-TABNAME      ,
             FNAME           LIKE CDPOS-FNAME        ,
             CHANGENR        LIKE CDHDR-CHANGENR     ,
             CHNGIND         LIKE CDPOS-CHNGIND      ,
             TABKEY          LIKE CDPOS-TABKEY       ,
             FIELDTEXT       LIKE DFIES-FIELDTEXT,
           UDATE           LIKE CDPOS-UDATE        ,
           USERNAME        LIKE CDPOS-USERNAME     ,
             VALUE_OLD       LIKE CDPOS-VALUE_OLD    ,
             VALUE_NEW       LIKE CDPOS-VALUE_NEW    ,
             END             OF   TY_CDPOS           .
    DATA   : T_FOR_DISP      TYPE STANDARD TABLE OF TY_FOR_DISP
                             WITH HEADER LINE        ,
             T_CDHDR         TYPE STANDARD TABLE OF TY_CDHDR
                             WITH HEADER LINE        ,
             T_CDPOS         TYPE STANDARD TABLE OF TY_CDPOS
                              WITH HEADER LINE       .
    DATA   : G_LANGU LIKE SY-LANGU,
             G_TABIX LIKE SY-TABIX,
             G_DATE  LIKE SY-DATUM.
    DATA   : G_WERKS LIKE MARC-WERKS  ,
             G_VKORG LIKE MVKE-VKORG  ,
             G_VTWEG LIKE MVKE-VTWEG  ,
             G_DESC  LIKE MARAV-MAKTX .
    *------ALV Grid Field Catalog Fields
    DATA: T_FIELDCAT   TYPE SLIS_T_FIELDCAT_ALV,
          T_FIELDCAT_H LIKE T_FIELDCAT WITH HEADER LINE.
    *------End
    CONSTANTS : C_MATERIAL(10)    VALUE 'MATERIAL'   ,
                C_OBJCLASS(10)    VALUE 'OBJCLASS'   ,
                C_OBJECTID(8)     VALUE 'OBJID'      ,
                C_WERKS(5)        VALUE 'WERKS'      ,
                C_VKORG(5)        VALUE 'VKORG'      ,
                C_VTWEG(5)        VALUE 'VTWEG'      ,                
                C_DESC(4)         VALUE 'DESC'       ,
                C_TABNAME(7)      VALUE 'TABNAME'    ,
                C_FNAME(5)        VALUE 'FNAME'      ,
                C_CHNGIND(7)      VALUE 'CHNGIND'    ,
                C_UDATE(5)        VALUE 'UDATE'      ,
                C_USERNAME(8)     VALUE 'USERNAME'   ,
                C_VALUE_OLD(9)    VALUE 'VALUE_OLD'  ,
                C_VALUE_NEW(9)    VALUE 'VALUE_NEW'  .
    *CONSTANTS: C_TABNAM_FOR_ALV_FM TYPE SLIS_TABNAME VALUE 'T_FOR_DISP'.
      INITIALIZATION   *****************
    INITIALIZATION.
      CLEAR:  T_CDHDR,
              T_CDPOS,
              T_FIELDCAT,
              T_FIELDCAT_H,
              T_FOR_DISP.
      REFRESH:T_CDHDR,
              T_CDPOS.
    CLEAR :  CDHDR,           " Change document header
              CDPOS.           " Change document items
    ****START-OF-SELECTION.
    START-OF-SELECTION.
    *-FETCHING DETAILS of Changes done
      PERFORM SUB_GET_DETAILS.
    Get the field description.
    PERFORM SUB_CALL_DDIF_FIELDINFO_GET.
    ****END-OF-SELECTION.
    END-OF-SELECTION.
    *--DISPLAYING DATA IN ALV
      PERFORM SUB_DISPLAY_ALV.
    *&      Form  SUB_GET_DETAILS
       This subrouting is used to get Final output which will shown in
       ALV Grid From Table CDPOS.
    FORM SUB_GET_DETAILS.
    SELECT OBJECTCLAS
            OBJECTID
            CHANGENR
            UDATE
            USERNAME
            INTO TABLE T_CDHDR
            FROM CDHDR
    WHERE  OBJECTCLAS IN S_OBJCLS
       AND  OBJECTID   IN S_MATNR
    AND  TABNAME    IN S_TABNAM
    AND  FNAME      IN S_FNAME
    AND  CHNGIND    IN S_CHGIND
    AND  UDATE      IN S_DATE
       AND  UDATE      IN S_DATE
       AND  USERNAME   IN S_USER  .
    IF SY-SUBRC <> 0.
    WRITE:/ TEXT-003.
    ENDIF.
      LOOP AT T_CDHDR.
        CLEAR T_FOR_DISP.
      IF T_CDHDR-OBJCLASS = C_MATERIAL.
       SELECT SINGLE MAKTX
       INTO G_DESC
       FROM MARAV
       WHERE MATNR = T_CDHDR-OBJID+0(18)
         AND SPRAS = SY-LANGU.
      ENDIF.
        T_FOR_DISP-DESC = G_DESC.
        CLEAR G_DESC.
       CLEAR T_FOR_DISP.
        T_FOR_DISP-OBJCLASS = T_CDHDR-OBJCLASS   .
        T_FOR_DISP-OBJID    = T_CDHDR-OBJID      .
        T_FOR_DISP-UDATE    = T_CDHDR-UDATE      .
        T_FOR_DISP-USERNAME = T_CDHDR-USERNAME   .
    *ENDIF.
       APPEND T_FOR_DISP.
    ENDLOOP.
    *ENDIF.
    SELECT
           TABNAME
           FNAME
           CHANGENR
           CHNGIND
           TABKEY
         UDATE
         USERNAME
           VALUE_OLD
           VALUE_NEW
           FROM CDPOS
           INTO TABLE T_CDPOS
           FOR ALL ENTRIES IN T_CDHDR
         CDHDRCHANGENR = CDPOSCHANGENR
    WHERE
           CHANGENR EQ T_CDHDR-CHANGENR
       AND TABNAME  IN S_TABNAM
       AND FNAME    IN S_FNAME
       AND CHNGIND  IN S_CHGIND         .
    AND UDATE    IN S_DATE.
    AND OBJECTID IN S_DATE
    AND USERNAME IN S_USER           .
    IF SY-SUBRC <> 0.
    WRITE:/ TEXT-003.
    ENDIF.
    *CLEAR T_FOR_DISP.
    READ TABLE T_CDPOS
          WITH KEY CHANGENR = T_CDHDR-CHANGENR.
    CLEAR : G_WERKS,
             G_VKORG,
             G_VTWEG.
           G_DESC .
    IF T_CDPOS-TABNAME  = 'MARC'.
                 G_WERKS = T_CDPOS-TABKEY+21(4).
    ENDIF.
          CHECK G_WERKS IN S_WERKS.
    IF SY-SUBRC = 0.
      T_FOR_DISP-WERKS = G_WERKS.
    ENDIF.
    IF T_CDPOS-TABNAME  = 'MVKE'.
          G_VKORG = T_CDPOS-TABKEY+21(4).
    ENDIF.
          CHECK G_VKORG IN S_VKORG.
        T_FOR_DISP-VKORG = G_VKORG.
          G_VTWEG = T_CDPOS-TABKEY+25(2).
          CHECK G_VTWEG IN S_VTWEG.
         T_FOR_DISP-VTWEG = G_VTWEG.
       T_FOR_DISP-TABNAME   = T_CDPOS-TABNAME.
       T_FOR_DISP-FNAME     = T_CDPOS-FNAME.
       T_FOR_DISP-CHNGIND   = T_CDPOS-CHNGIND.
       T_FOR_DISP-VALUE_OLD = T_CDPOS-VALUE_OLD.
       T_FOR_DISP-VALUE_NEW = T_CDPOS-VALUE_NEW.
      APPEND T_FOR_DISP.
    ENDLOOP.
    ENDLOOP.
    CLEAR T_FOR_DISP.
    ENDFORM.                    " SUB_GET_DETAILS
    *&      Form  SUB_DISPLAY_ALV
    This Subroutine is used to display data to ALV Grid from internal    *
    tables T_CDHDR & T_CDPOS. which is filled in subroutine              *
    SUB_GET_DETAILS                                                      *
    FORM SUB_DISPLAY_ALV .
    BREAK-POINT.
      DATA: l_layout     type slis_layout_alv,
            l_title      type lvc_title,
            l_repid      like sy-repid.
      l_repid = sy-repid.
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
        EXPORTING
          I_PROGRAM_NAME         = l_repid
          I_INTERNAL_TABNAME     = 'TY_FOR_DISP'
          I_INCLNAME             = l_repid
        CHANGING
          CT_FIELDCAT            = T_FIELDCAT[]
        EXCEPTIONS
          INCONSISTENT_INTERFACE = 1
          PROGRAM_ERROR          = 2
          OTHERS                 = 3.
      IF SY-SUBRC <> 0.
      WRITE:/ 'ERROR IN CALLING ALV FM'.
      ENDIF.
    *----Change Field Heading We move All field data from T_FIELDCAT To
    *----another Internal table with header line namely T_FIELDCAT_H
    *CLEAR T_FIELDCAT_H[].
    REFRESH T_FIELDCAT_H[].
    BREAK-POINT.
      MOVE T_FIELDCAT[] TO T_FIELDCAT_H[].
    CLEAR G_TABIX.
    LOOP AT T_FIELDCAT_H.
    G_TABIX = SY-TABIX.
        CASE T_FIELDCAT_H-FIELDNAME.
          WHEN C_OBJCLASS.
            T_FIELDCAT_H-SELTEXT_L = TEXT-004.
            T_FIELDCAT_H-SELTEXT_M = TEXT-004.
            T_FIELDCAT_H-SELTEXT_S = TEXT-004.
           T_FIELDCAT_H-OUTPUTLEN = 15.
          WHEN C_OBJECTID.
            T_FIELDCAT_H-SELTEXT_L = TEXT-005.
            T_FIELDCAT_H-SELTEXT_M = TEXT-005.
            T_FIELDCAT_H-SELTEXT_S = TEXT-005.
           T_FIELDCAT_H-OUTPUTLEN = 20.
          WHEN C_DESC.
            T_FIELDCAT_H-SELTEXT_L = TEXT-006.
            T_FIELDCAT_H-SELTEXT_M = TEXT-006.
            T_FIELDCAT_H-SELTEXT_S = TEXT-006.
           T_FIELDCAT_H-OUTPUTLEN = 20.
          WHEN C_WERKS.
            T_FIELDCAT_H-SELTEXT_L = TEXT-007.
            T_FIELDCAT_H-SELTEXT_M = TEXT-007.
            T_FIELDCAT_H-SELTEXT_S = TEXT-007.
           T_FIELDCAT_H-OUTPUTLEN = 20.
          WHEN C_VKORG.
            T_FIELDCAT_H-SELTEXT_L = TEXT-008.
            T_FIELDCAT_H-SELTEXT_M = TEXT-008.
            T_FIELDCAT_H-SELTEXT_S = TEXT-008.
           T_FIELDCAT_H-OUTPUTLEN = 20.
          WHEN C_VTWEG.
            T_FIELDCAT_H-SELTEXT_L = TEXT-009.
            T_FIELDCAT_H-SELTEXT_M = TEXT-009.
            T_FIELDCAT_H-SELTEXT_S = TEXT-009.
           T_FIELDCAT_H-OUTPUTLEN = 20.
          WHEN C_TABNAME.
            T_FIELDCAT_H-SELTEXT_L = TEXT-010.
            T_FIELDCAT_H-SELTEXT_M = TEXT-010.
            T_FIELDCAT_H-SELTEXT_S = TEXT-010.
           T_FIELDCAT_H-OUTPUTLEN = 20.
          WHEN C_FNAME.
            T_FIELDCAT_H-SELTEXT_L = TEXT-011.
            T_FIELDCAT_H-SELTEXT_M = TEXT-011.
            T_FIELDCAT_H-SELTEXT_S = TEXT-011.
           T_FIELDCAT_H-OUTPUTLEN = 20.
          WHEN C_CHNGIND.
            T_FIELDCAT_H-SELTEXT_L = TEXT-012.
            T_FIELDCAT_H-SELTEXT_M = TEXT-012.
            T_FIELDCAT_H-SELTEXT_S = TEXT-012.
           T_FIELDCAT_H-OUTPUTLEN = 20.
          WHEN C_UDATE.
            T_FIELDCAT_H-SELTEXT_L = TEXT-013.
            T_FIELDCAT_H-SELTEXT_M = TEXT-013.
            T_FIELDCAT_H-SELTEXT_S = TEXT-013.
           T_FIELDCAT_H-OUTPUTLEN = 20.
          WHEN C_USERNAME.
            T_FIELDCAT_H-SELTEXT_L = TEXT-014.
            T_FIELDCAT_H-SELTEXT_M = TEXT-014.
            T_FIELDCAT_H-SELTEXT_S = TEXT-014.
           T_FIELDCAT_H-OUTPUTLEN = 20.
          WHEN C_VALUE_OLD.
            T_FIELDCAT_H-SELTEXT_L = TEXT-015.
            T_FIELDCAT_H-SELTEXT_M = TEXT-015.
            T_FIELDCAT_H-SELTEXT_S = TEXT-015.
           T_FIELDCAT_H-OUTPUTLEN = 20.
          WHEN C_VALUE_NEW.
            T_FIELDCAT_H-SELTEXT_L = TEXT-016.
            T_FIELDCAT_H-SELTEXT_M = TEXT-016.
            T_FIELDCAT_H-SELTEXT_S = TEXT-016.
           T_FIELDCAT_H-OUTPUTLEN = 20.
          WHEN OTHERS.
        CONTINUE.
        ENDCASE.
        MODIFY T_FIELDCAT_H.
       CLEAR  T_FIELDCAT_H.
      ENDLOOP.
    *BREAK-POINT.
      MOVE T_FIELDCAT_H[] TO T_FIELDCAT[].
    *----End
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           exporting
                i_callback_program       = l_repid
              i_callback_pf_status_set = 'SET_STATUS'
              i_callback_user_command  = 'USER_COMMAND'
               i_callback_top_of_page   = 'TOP_OF_PAGE'
               i_grid_title             = l_title
               is_layout                = l_layout
                 it_fieldcat              = t_fieldcat
               i_save                   = 'A'
           tables
                t_outtab                 = T_FOR_DISP[]
           exceptions
                program_error            = 1
                others                   = 2.
    IF SY-SUBRC <> 0.
       WRITE:/ TEXT-017.
    ENDIF.
    ENDFORM.                    " SUB_DISPLAY_ALV
    *&      Form  TOP_OF_PAGE
       This subrouting is used to show heading to ALV Grid. This
       subrouting is called from subrouting 'SUB_DISPLAY_ALV', Function
      'REUSE_ALV_GRID_DISPLAY' & export param 'i_callback_top_of_page'
    *Form TOP_OF_PAGE.
    DATA :  L_HEADER   TYPE SLIS_T_LISTHEADER,
             L_HEADER_H TYPE SLIS_LISTHEADER.
    DATA :   L_FROMDAT(10) TYPE C,
              L_TODATE(10)  TYPE C.
    *CONSTANTS : C_DOT(1) TYPE C     VALUE '.',
               C_L_HEADER_H_TYP(1) VALUE 'H'.   "---ALV Grid Header Type
    CLEAR : L_HEADER.
    **--To Manage Date Format
    CONCATENATE S_DATE-LOW+6(2)
                 C_DOT
                 S_DATE-LOW+4(2)
                 C_DOT
                 S_DATE-LOW+0(4)
            INTO L_FROMDAT.
    CONCATENATE S_DATE-HIGH+6(2)
                 C_DOT
                 S_DATE-HIGH+4(2)
                 C_DOT
                 S_DATE-HIGH+0(4)
            INTO L_TODATE.
    **---End
    IF L_TODATE <> '00.00.0000'.
       CONCATENATE 'Purchase Org:'(014)
                   S_VKORG-LOW
                   'PO changes from'(015)
                   L_FROMDAT
                   'To'(013)
                   L_TODATE
                   INTO L_HEADER_H-INFO SEPARATED BY SPACE.
    ELSE.
        G_DATE = SY-DATUM.
       CONCATENATE 'CHANGES: '
                    G_DATE
                   INTO L_HEADER_H-INFO SEPARATED BY SPACE.
    ENDIF.
    Main report header
    L_HEADER_H-TYP = C_L_HEADER_H_TYP.
    APPEND L_HEADER_H TO L_HEADER.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
       EXPORTING
         IT_LIST_COMMENTARY = L_HEADER
         I_LOGO             = ''.
    *ENDFORM.                    "TOP_OF_PAGE
    Plz look into this and suggest me ..thanks a lot.

  • Foreign Key check in ALV Grid

    Hi all.
    I'm trying to have data automatically validated using Foreign Keys in an (editable) ALV Grid.  I managed to get the proper values in a dropdown on F4, but i want the manual entries validated without coding every field individually.
    The field in question is LFA1-REGIO.  This field has a Foreign Key in T005S.  I'm using F.M. DDIF_TABL_GET to populate my Field Catalog.  This gives me all Foreign Key fields for my fields.
    If the user enters 'ZZ' as a Region(LFA1-REGIO), the auto-validation of CL_GUI_ALV_GRID does not recognize that this value is invalid.
    I've debugged the class methods that handle the validation, but it seems the problem is in the way i'm setting up my Foreign Key info.
    Could someone tell me how to set this up properly?  i also have access to the dependant field LAND1, and would like to integrate it in the Validation, but this is a second priority.  Thanks in advance.

    Hi Jester,
      In your ALV Grid Field Catalog (LVC_S_LAYO), for REGIO check whether field <b>checktable</b> has value T005S and <b>ref_field</b> has REGIO and <b>ref_table</b> has LFA1.
      If the above entries are fine and still the validation does not occur then try changing the ref_table to T005S and see..
      Hope this helps..
    Sri

Maybe you are looking for

  • MDM Data Manager Assignments using Dates

    Hello. I am trying to create some assignments that default to a certain date and my expressions are getting the error message when I execute them. I am currently trying to create an Assignment for the Look-up table: Valid To (which belongs to the QT:

  • If I duplicate a page in pages, it adds an unwanted blank page in between

    Can anyone help? I need to duplicate page 1.  If I show the thumbnails view - duplicate page, instead of just adding an identical page 2 - it adds a blank page 2 and then identical page 3.  Then on the thumbnail view, both page 1 and 2 have the yello

  • J2me database connection

    hey i am new to j2me wireless havent even started coding anything from my project I wanted to know whether j2me supports SQL connectivity. I yes, how should i connect it to the database. If No please provide some other way through which i can store a

  • Database taking too much size of disk

    Hi all, I am using Oracle AS 10g and ITs database is using too much size of the disk. Because there is no space on the disk. Can anyone help me out to resolve this problem. Saqib

  • Error building formula

    I am trying to build formulas involving cells in another table on the same sheet. I click on the cell I want to reference, and sometimes it works, sometimes it doesn't. When it works, the cell I click becomes coloured, and the formula includes a refe