Field catlog

Hi All,
      i am developing a class which will populate the fieldcatlog automatically . so pass the internal table to my class it_table. now i want to create the field catlog for the same..i have written a code as below.. but it dumps at the ASSIGN it_table-> TO <t_dyntable>.*  it_table is of type any
Can any onehelp me out with this..
DATA: wa_fieldcat     TYPE lvc_s_fcat,
        it_fieldcat     TYPE lvc_t_fcat,
        it_tabdescr     TYPE abap_compdescr_tab,
        wa_tabdescr     TYPE abap_compdescr,
        ref_table_descr TYPE REF TO cl_abap_structdescr,
        p_table         TYPE char30 VALUE 'IT_TABLE'.
  DATA: dref TYPE REF TO data.
  DATA: newtable TYPE REF TO data.
  DATA: newline TYPE REF TO data.
FIELD-SYMBOLS: <t_dyntable> TYPE STANDARD TABLE,
               <fs_dyntable> TYPE any,
               <fs_fldval> type any.
  FIELD-SYMBOLS: <table> TYPE STANDARD TABLE,
               <line>  TYPE ANY.
ASSIGN it_table->* TO <t_dyntable>.
  CREATE DATA newline LIKE LINE OF <t_dyntable>.
ref_table_descr ?= cl_abap_typedescr=>describe_by_name( p_table ).
  it_tabdescr = ref_table_descr->components[].
  LOOP AT it_tabdescr INTO wa_tabdescr.
    CLEAR wa_fieldcat.
    wa_fieldcat-fieldname = wa_tabdescr-name .
    wa_fieldcat-datatype = wa_tabdescr-type_kind.
    wa_fieldcat-inttype = wa_tabdescr-type_kind.
    wa_fieldcat-intlen = wa_tabdescr-length.
    wa_fieldcat-decimals = wa_tabdescr-decimals.
    APPEND wa_fieldcat TO it_fieldcat.
  ENDLOOP.

Hi Neha,
Modified program as below:
CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
    EXPORTING
      IT_FIELDCATALOG = it_fieldcat
    IMPORTING
      EP_TABLE        = IT_NEWTABLE.
  ASSIGN IT_NEWTABLE->* TO <FS_T_DYNTABLE>
Create dynamic work area and assign to FS
  CREATE DATA IT_NEWLINE LIKE LINE OF <FS_T_DYNTABLE>.
  ASSIGN IT_NEWLINE->* TO <FS_DYNTABLE>.
Thanks
Mohit Khandelwal

Similar Messages

  • FBL3N - ALV Field Catlog

    I have modified the FBL3N standard Zprogram “RFITEMGL” to add some fields for display in the report. I have changed the input parameters for the Function Module ‘FI_ITEMS_DISPLAY’ in RFITEMGL like it_items = ‘My_table_item’ to display modified table values.  But when I try to append the field catlog ‘gt_fieldcat’ using the following code I am not able to see these fields in the report layout but I have it in My_table_item.
    gt_fieldcat-TABNAME = 'IT_POS1'.
    gt_fieldcat-FIELDNAME = 'NAME1'.
    gt_fieldcat-OUTPUTLEN = '20'.
    gt_fieldcat-SELTEXT_L = 'Vendor Name'.
    APPEND GT_FIELDCAT.
    gt_fieldcat-TABNAME = 'IT_POS1'.
    gt_fieldcat-FIELDNAME = 'MAKTX'.
    gt_fieldcat-OUTPUTLEN = '20'.
    gt_fieldcat-SELTEXT_L = 'Material Desc.'.
    APPEND GT_FIELDCAT.
    What Should I do? Kindly help me

    Hi,
    Just check your code in subroutines
    perform make_fieldcatalog
    perform make_fieldcatalog2
    There may be chance that it is getting deleted in another routine. Also this program used REUSE_ALV_FIELDCATLOG_MERGE
    check how it is populating values.
    Regards,
    Atish

  • Problem in ALV Field catlog

    Hi Experts,
    I have an internal table with 20 fields, i used that internal table in REUSE_ALV_FIELDCATALOG_MERGE.
    It's diplayed the output properly. But now i added a new field in the internal table, but its not displaying inthe output even its not comming in the field catlog itself. How to add this one field inthat field catlog list?
    FORM build_field_catalog TABLES   r_field_cat LIKE g_field_cat[].
      CLEAR r_field_cat[].
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
        EXPORTING
          i_program_name         = g_repid
          i_internal_tabname     = 'IT_DATA'
          i_client_never_display = 'X'
          i_bypassing_buffer     = 'X'
          i_inclname             = g_include
        CHANGING
          ct_fieldcat            = r_field_cat[].
    I used the above code..
    Can any one help this issue?
    Mohana.

    Can u pl tell me how u have declared this new field? If possible pl. paste ur code.
    If it is declared with TYPE statement then may be the REUSE_ALV_FIELDCATALOG_MERGE cannot process it. It should be declared with LIKE statement.
    Pl. check.
    Regards,
    Joy.

  • Query regarding in Field catlog of my oops report

    Hi Experts,
    i developed a program to maintain ZTABLE. When we excute the report i need all fields of table should be non-editable.I done this. but when choose CREATE NEW ENTRY icon all fields should be editable.
    How can i done this dynamical field catlog setting..
    Thanks in Advance...
    Siva.

    hi
    go through this code this is for editable alv
    *& Report  ZDEMO_ALVGRID_EDIT                                          *
    *& Example of a simple ALV Grid Report                                 *
    *& The basic ALV grid, Enhanced to display specific fields as          *
    *& editable depending on field value                                   *
    REPORT  ZDEMO_ALVGRID_EDIT                 .
    TABLES:     ekko.
    TYPE-POOLS: slis.                                 "ALV Declarations
    *Data Declaration
    TYPES: BEGIN OF t_ekko,
      ebeln TYPE ekpo-ebeln,
      ebelp TYPE ekpo-ebelp,
      statu TYPE ekpo-statu,
      aedat TYPE ekpo-aedat,
      matnr TYPE ekpo-matnr,
      menge TYPE ekpo-menge,
      meins TYPE ekpo-meins,
      netpr TYPE ekpo-netpr,
      peinh TYPE ekpo-peinh,
      field_style  TYPE lvc_t_styl, "FOR DISABLE
    END OF t_ekko.
    DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
          wa_ekko TYPE t_ekko.
    *ALV data declarations
    DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE.
    DATA: it_fieldcat TYPE lvc_t_fcat,     "slis_t_fieldcat_alv WITH HEADER LINE,
          wa_fieldcat TYPE lvc_s_fcat,
          gd_tab_group TYPE slis_t_sp_group_alv,
          gd_layout    TYPE lvc_s_layo,     "slis_layout_alv,
          gd_repid     LIKE sy-repid.
    *Start-of-selection.
    START-OF-SELECTION.
      PERFORM data_retrieval.
      PERFORM set_specific_field_attributes.
      PERFORM build_fieldcatalog.
      PERFORM build_layout.
      PERFORM display_alv_report.
    *&      Form  BUILD_FIELDCATALOG
          Build Fieldcatalog for ALV Report
    FORM build_fieldcatalog.
      wa_fieldcat-fieldname   = 'EBELN'.
      wa_fieldcat-scrtext_m   = 'Purchase Order'.
      wa_fieldcat-col_pos     = 0.
      wa_fieldcat-outputlen   = 10.
      wa_fieldcat-emphasize   = 'X'.
      wa_fieldcat-key         = 'X'.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname   = 'EBELP'.
      wa_fieldcat-scrtext_m   = 'PO Item'.
      wa_fieldcat-col_pos     = 1.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname   = 'STATU'.
      wa_fieldcat-scrtext_m   = 'Status'.
      wa_fieldcat-col_pos     = 2.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname   = 'AEDAT'.
      wa_fieldcat-scrtext_m   = 'Item change date'.
      wa_fieldcat-col_pos     = 3.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname   = 'MATNR'.
      wa_fieldcat-scrtext_m   = 'Material Number'.
      wa_fieldcat-col_pos     = 4.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname   = 'MENGE'.
      wa_fieldcat-scrtext_m   = 'PO quantity'.
      wa_fieldcat-col_pos     = 5.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname   = 'MEINS'.
      wa_fieldcat-scrtext_m   = 'Order Unit'.
      wa_fieldcat-col_pos     = 6.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname   = 'NETPR'.
      wa_fieldcat-scrtext_m   = 'Net Price'.
      wa_fieldcat-edit        = 'X'. "sets whole column to be editable
      wa_fieldcat-col_pos     = 7.
      wa_fieldcat-outputlen   = 15.
      wa_fieldcat-datatype     = 'CURR'.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname   = 'PEINH'.
      wa_fieldcat-scrtext_m   = 'Price Unit'.
      wa_fieldcat-col_pos     = 8.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
    ENDFORM.                    " BUILD_FIELDCATALOG
    *&      Form  BUILD_LAYOUT
          Build layout for ALV grid report
    FORM build_layout.
    Set layout field for field attributes(i.e. input/output)
      gd_layout-stylefname = 'FIELD_STYLE'.
      gd_layout-zebra             = 'X'.
    ENDFORM.                    " BUILD_LAYOUT
    *&      Form  DISPLAY_ALV_REPORT
          Display report using ALV grid
    FORM display_alv_report.
      gd_repid = sy-repid.
    call function 'REUSE_ALV_GRID_DISPLAY'
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
           EXPORTING
                i_callback_program      = gd_repid
               i_callback_user_command = 'USER_COMMAND'
                is_layout_lvc               = gd_layout
                it_fieldcat_lvc             = it_fieldcat
                i_save                  = 'X'
           TABLES
                t_outtab                = it_ekko
           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_ALV_REPORT
    *&      Form  DATA_RETRIEVAL
          Retrieve data form EKPO table and populate itab it_ekko
    FORM data_retrieval.
      SELECT ebeln ebelp statu aedat matnr menge meins netpr peinh
       UP TO 10 ROWS
        FROM ekpo
        INTO  CORRESPONDING FIELDS OF TABLE it_ekko.
    ENDFORM.                    " DATA_RETRIEVAL
    *&      Form  set_specific_field_attributes
          populate FIELD_STYLE table with specific field attributes
    form set_specific_field_attributes .
      DATA ls_stylerow TYPE lvc_s_styl .
      DATA lt_styletab TYPE lvc_t_styl .
    Populate style variable (FIELD_STYLE) with style properties
    The NETPR field/column has been set to editable in the fieldcatalog...
    The following code sets it to be disabled(display only) if 'NETPR'
    is gt than 10.
      LOOP AT it_ekko INTO wa_ekko.
        IF wa_ekko-netpr GT 10.
          ls_stylerow-fieldname = 'NETPR' .
          ls_stylerow-style = cl_gui_alv_grid=>mc_style_disabled.
                                                 "set field to disabled
          APPEND ls_stylerow  TO wa_ekko-field_style.
          MODIFY it_ekko FROM wa_ekko.
        ENDIF.
      ENDLOOP.
    endform.                    " set_specific_field_attributes
    regards
    anil chaudhary

  • Field catlog in V/03

    Hi,
    Can we add new field catlog in the list (V/03 - create table)?
    if yes how can we add?
    regards,
    Akshay

    Hi,
    For adding field into Field catalogue:
    For example if you want to use field PSTYV ('Sales document item category') that is included in structure KOMP ('Pricing Communication Item') as a key for a condition table.
    When you create a condition table (Transaction V/03), however, the system does not propose the field in the field catalog.
    Prerequisites:
    For technical reasons, field PSTYV was included in structure KOMP, however, not in structure KOMG ('Allowed Fields for Condition Structures').
    To solve the problem, proceed as follows:
    1. Call up the ABAP Dictionary (Transaction SE11) and create data type ZZPSTYV. Choose PSTYV as a domain.As a short text, you can use, for example, 'ZZ - sales document item category' and as a field label, you can use the field labels of PSTYV.Save, check and activate your entries.
    2. Call up structure KOMPAZ in the ABAP Dictionary (Transaction SE11) in the change mode and make the following entry:
    Component   Component type
    ZZPSTYV     ZZPSTYV
    Save, check and activate the change you made.
    3. Note:Because of the change in structure KOMPAZ, field ZZPSTYV is now known in structures KOMG and KOMP because structure KOMPAZ is included in both structures.
    4. Call up Transaction SPRO. Navigate to 'Sales and Distribution -> Basic Functions -> Pricing -> Pricing Control' and execute 'Define Condition Tables'. Choose 'Conditions: Allowed fields' and include ZZPSTYV as a new entry.
    5. Note:Now you can use field ZZPSTYV as a key field when you create a condition table Axxx.
    6. Supply the new field you defined by including the following source code line in USEREXIT_PRICING_PREPARE_TKOMP:
                  MOVE xxxx-PSTYV TO TKOMP-ZZPSTYV.
    In order processing you find the user exit in Include MV45AFZZ, and in billing document processing you find it in Include RV60AFZZ.
    Consider that you can also use this note as a help if you want to use other customer-specific fields as key fields in a condition table.For header fields, use structure
    KOMKAZ instead of structure KOMPAZ and USEREXIT_PRICING_PREPARE_TKOMK instead of USEREXIT_PRICING_PREPARE_TKOMP.
    For more information, see Transaction SPRO via the path 'Sales and Distribution -> System Modifications -> Create New Fields (Using Condition
    Technique) -> New Fields for Pricing' and Note 21040.
    Regards

  • What is field catlog...

    Hi all,
       anybody explain field catelog.
        how to use in reports,what is the use of field catlog.
    regards.
    krish

    Maintaining the Field Catalog
    Storing aspect fields in the field catalog
    The characteristics and basic key figures are stored in a field catalog when they are saved. This catalog can be seen as a EC-EIS/EC-BP-specific supplement to the ABAP Dictionary. Report-relevant attributes for the fields are also stored in the field catalog. The field catalog is aspect-independent. Once a field is contained in the field catalog, it may be copied to other aspects but may no longer be changed. This guarantees a uniform, cross-area use of evaluation groups and key figures.
    You can create field groups to structure the fields in the field catalog. A Field Group is a user-defined grouping of characteristics and basic key figures.
    Reorganization of the field catalog
    The field catalog and ABAP Dictionary information on the aspect data structures must be consistent with one another - each data structure field must also exist in the field catalog. If this is no longer the case, you should reorganize the field catalog in order to restore the consistency. When you do this, the system reads the aspect structure from the ABAP Dictionary and reconciles it with the field catalog.
    Deleting fields from the field catalog
    Characteristics and basic key figures, that are no longer used in any aspect, can be deleted from the field catalog. Any relevant master data, comments, generated ABAP Dictionary objects will be deleted at the same time.
    You can find more information on the field catalog in Customizing.
    We can implement Field catalog  by calling Function modules or classes..
    See the sample code
    REPORT  ALV_FM.
    TYPE-POOLS: SLIS.
    DATA:
      BEGIN OF FS_SPFLI,
        CARRID    TYPE SPFLI-CARRID,
        CONNID    TYPE SPFLI-CONNID,
        COUNTRYFR TYPE SPFLI-COUNTRYFR,
        CITYFROM  TYPE SPFLI-CITYFROM,
        AIRPFROM  TYPE SPFLI-AIRPFROM,
        COUNTRYTO TYPE SPFLI-COUNTRYTO,
        CITYTO    TYPE SPFLI-CITYTO,
        AIRPTO    TYPE SPFLI-AIRPTO,
        FLTIME    TYPE SPFLI-FLTIME,
        DEPTIME   TYPE SPFLI-DEPTIME,
        ARRTIME   TYPE SPFLI-ARRTIME,
        DISTANCE  TYPE SPFLI-DISTANCE,
        DISTID    TYPE SPFLI-DISTID,
        FLTYPE    TYPE SPFLI-FLTYPE,
        PERIOD    TYPE SPFLI-PERIOD,
      END OF FS_SPFLI.
    DATA:
      T_SPFLI LIKE STANDARD TABLE OF FS_SPFLI.
    SELECT * FROM SPFLI
      INTO CORRESPONDING FIELDS OF TABLE T_SPFLI.
    DATA: T_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
          FS_FIELDCAT LIKE LINE OF T_FIELDCAT.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
      I_CALLBACK_PROGRAM                = ' '
      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                  = 'SPFLI'
      I_BACKGROUND_ID                   = ' '
      I_GRID_TITLE                      =
      I_GRID_SETTINGS                   =
      IS_LAYOUT                         =
      IT_FIELDCAT                       = T_FIELDCAT
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         = 'X'
      I_SAVE                            = ' '
      IS_VARIANT                        =
      IT_EVENTS                         =
      IT_EVENT_EXIT                     =
      IS_PRINT                          =
      IS_REPREP_ID                      =
      I_SCREEN_START_COLUMN             = 0
      I_SCREEN_START_LINE               = 0
      I_SCREEN_END_COLUMN               = 0
      I_SCREEN_END_LINE                 = 0
      I_HTML_HEIGHT_TOP                 = 0
      I_HTML_HEIGHT_END                 = 0
      IT_ALV_GRAPHICS                   =
      IT_HYPERLINK                      =
      IT_ADD_FIELDCAT                   =
      IT_EXCEPT_QINFO                   =
      IR_SALV_FULLSCREEN_ADAPTER        =
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER           =
      ES_EXIT_CAUSED_BY_USER            =
      TABLES
        T_OUTTAB                          = T_SPFLI
    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.
    Regards,
    Pavan P.

  • WHAT IS DATE BANDLING  WHAT IS FIELD CATLOG IN ALV

    WHAT IS DATE BANDLING  WHAT IS FIELD CATLOG IN ALV
    Explain clearly

    i guess u mean date "Handling"
    What abt date handling?

  • VA05 - Addiional Fields and Field Catlog

    Hello All,
    I have added the few Z fields as per requirements in the ALV out put as per the OSS notes 350068.
    I need to change the Field catalog for these Z fields. I have one way to change by creating the Zdomain and assiging the same to those Zfields, but is there any other option other than this?
    Please let me know.
    Also I am having one more issue I have added Ship to party in the selection screen using Config. But when I use that in the section the data is not being picked for hte value enterered there.
    REgards
    Ramesh

    Hello,
    Modify the field catlog in the program.

  • Pricing field catlog

    hi,
    what ar the steps to be followed to add new field to pricing field catlog
    say KNBW-WITHT
    PL SUGGEST

    As said above, follow the menu path to reach the Field catalog for Condition tables-
    VOk0- from Menu Environment - Condition table- Maintian Field catalog,
    Here place the cursor,on one of the given filed & choose "F4"- you will observe the list of allowed for fields for pricing.
    if you find the ,desired field in this,selection, Now click on "New entries"- & maintain that fields' tech.name.
    or
    if you dont find the field, which means in Std SAP has nto provided , desired field, so you need to create/add this field in field catalog & move to Pricing structures.
    hope it adds info

  • Change field catlog after the first display

    Hello,
    I am trying to change field catlog after the first display.
    Problem I am facing is at runtime fild catlog is not changing. Could some one suggest where I might have gone wrong.
    Thanks in advance.
    Regards,
    Vimal.
    IF sy-ucomm = 'CATLOG'.
        CALL METHOD g_alv_grid->get_frontend_fieldcatalog
          IMPORTING
            et_fieldcatalog = it_fieldcat[].
        LOOP AT it_fieldcat INTO str_fcat .
          IF str_fcat-fieldname = 'EBELP' .
            str_fcat-hotspot = 'X' .
            MODIFY it_fieldcat FROM str_fcat .
          ENDIF .
        ENDLOOP .
        CALL METHOD g_alv_grid->set_frontend_fieldcatalog
          EXPORTING
            it_fieldcatalog = it_fieldcat[].
      ENDIF.

    In that You change the Field catalog and
    call this method..
      CALL METHOD G_GRID->REFRESH_TABLE_DISPLAY
        EXCEPTIONS
          FINISHED = 1
          OTHERS   = 2.
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                   WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    try this...

  • Field catlog Change

    HI all,
    I am working on Interactive ALV. I am going to add 1 field to secondary list.
    When ever i click on Any filed in the basic list, the added filed is appearing in every seconadry list. But my req is When i click on perticular filed only, the added filed has to appear.
    How can i change the field catlog?
    regards,Ram

    Hi,
    In the event handler, toggle the NO_OUT field ( with 'X' and space ) in the Fieldcatalog and refresh the table display (If needed).
    Regards,
    Basu.

  • Alv  field catlog

    1. why we use fieldcatlog in alv ? which purpose?and what is the defination of fieldcatlog?

    Hi
    Field catalog containing descriptions of the list output fields. You can use fields of the catalog to determine the number format and column properties of the list to be displayed.
    The field catalog contains more than 60 fields, some of which are only used internally. The field catalog is defined in the Data Dictionary through table type LVC_T_FCAT.
    We can get field description by calling function module REUSE_ALV_FIELDCATALOG_MERGE.
    REPORT  z_colour NO STANDARD PAGE HEADING  .
    TABLES :pa0002.
      TYPE-POOLS: slis.                 "ALV Declarations
    DATA : BEGIN OF it OCCURS 0,
          pernr LIKE pa0001-pernr,
          rufnm LIKE pa0002-rufnm,
          cell_colour TYPE lvc_t_scol,    "Cell colour
           END OF it.
    SELECTION-SCREEN BEGIN OF BLOCK main WITH FRAME.
    SELECT-OPTIONS :s_pnum  FOR pa0002-pernr .
    SELECTION-SCREEN END OF BLOCK main.
    *ALV data declarations
    DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH
    HEADER LINE,
          gd_layout    TYPE slis_layout_alv,
          gd_repid     LIKE sy-repid,
          gt_sort     TYPE slis_t_sortinfo_alv.
    To colour a cell.
      DATA ls_cellcolour TYPE lvc_s_scol.
    START-OF-SELECTION.
      PERFORM data_retrieval.
      PERFORM build_fieldcatalog.
      PERFORM build_layout.
      PERFORM display_alv_report.
    END-OF-SELECTION.
      FREE : it.
    FORM build_fieldcatalog .
      fieldcatalog-fieldname   = 'PERNR'.
      fieldcatalog-seltext_m   = 'Personnel No.'.
      fieldcatalog-col_pos     =  0.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'RUFNM'.
      fieldcatalog-seltext_m   = 'Name'.
      fieldcatalog-col_pos     =  0.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
    ENDFORM.
    FORM build_layout .
      gd_layout-no_input          = 'X'.
      gd_layout-colwidth_optimize = 'X'.
      gd_layout-totals_text       = 'Totals'(256).
      gd_layout-coltab_fieldname = 'CELL_COLOUR'.
    ENDFORM.                    " build_layout
    FORM display_alv_report .
      gd_repid = sy-repid.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program       = gd_repid
          is_layout                = gd_layout
          it_fieldcat              = fieldcatalog[]
          i_save                   = 'A'
        TABLES
          t_outtab                 = it
        EXCEPTIONS
          program_error            = 1
          OTHERS                   = 2.
      IF sy-subrc <> 0.
      ENDIF.
    ENDFORM.                    " display_alv_report
    FORM data_retrieval .
    select pernr rufnm from pa0002 into corresponding
    fields of table it where pernr in s_pnum.
      LOOP AT it.
    *Now based on the value of the field pernr we can
    change the cell colour of the field rufnm or pernr.
        IF it-pernr eq '10001' .
          ls_cellcolour-fname = 'RUFNM'.
          ls_cellcolour-color-col = '5'.
          ls_cellcolour-color-int = '1'.
          ls_cellcolour-color-inv = '0'.
          APPEND ls_cellcolour TO it-cell_colour.
          IF sy-subrc EQ 0.
            MODIFY it.
          ENDIF.
        ENDIF.
      ENDLOOP.
    ENDFORM.

  • Alv field catlog urgent

    how to generate fieldcatlog dynamically
    suppose if
    internal  table contain f1 f2 f3 fields
    if f3 does not contain data
    i should generate fieldcatlog for f1 and f2

    Hi Sunil,
    Try the below Code.
    data : wa_fcat type LVC_S_FCAT,
             it_fcat type LVC_T_FCAT.
    wa_fcat-FIELDNAME = 'F1'.
    wa_fcat-ROW_POS = '0'.
    wa_fcat-COL_POS = '0'.
    wa_fcat-SELTEXT = 'Field1'.
    wa_fcat-OUTPUTLEN = '40'.
    append wa_fcat into it_fcat.
    clear wa_fcat.
    wa_fcat-FIELDNAME = 'F2'.
    wa_fcat-ROW_POS = '0'.
    wa_fcat-COL_POS = '0'.
    wa_fcat-SELTEXT = 'Field2'.
    wa_fcat-OUTPUTLEN = '40'.
    append wa_fcat into it_fcat.
    clear wa_fcat.
    Refer the below links
    [http://www.sap-img.com/abap/abap-example-program-alv-grid-control.htm|http://www.sap-img.com/abap/abap-example-program-alv-grid-control.htm]
    [http://www.sapdev.co.uk/reporting/alvhome.htm]
    Reward if it is useful.
    Regards
    Boobalan S.

  • How can we remove the following zeros from quantity field ?

    Hi All.
    how can we remove the following zeros from quantity field while populating ALV by using FM REUSE_ALV_GRID_DISPLAY ?
    eg:getting output zqty = 2.000
    but i need           zqty = 2.
    help me to reslove this issue.
    Regards.
    jay

    Hi,
      While populating the field catlog do the following thing to   avoid zeros.
      wa_fieldcat-tabname = 'I_OUTPUT'.    " Curr
      wa_fieldcat-fieldname = 'FWAER'.
      wa_fieldcat-seltext_l = text-023.
      wa_fieldcat-no_zero = 'X'.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR  wa_fieldcat.
    Thanks,
    Khushbu.

  • Field doesnu0092t display in alv  , why  ?

    WHEN 'NETPR' .
          LS_FCAT-COLTEXT = TEXT-031 .
          LS_FCAT-COL_POS =  29.
          LS_FCAT-OUTPUTLEN = 15 .
        LS_FCAT-DATATYPE   = 'CURR' . "'QUAN'.
        LS_FCAT-rollname = 'NETPR'.
    when the report is display  , the field doesn't show up ?
    also if i reduce the number of Columns ( in the field catalog )
    for display there is no change
    all the other fields are display except the "NETPR"
    when i check the "layout change" he is there   ,
    also he is display if i reduce the number of columne for display ( by layout change)

    hi,
    see this.
    did u append the data to field catlog internal table also please check .
    fieldcatalog-fieldname   = 'NETPR'.
      fieldcatalog-seltext_m   = 'Net Price'.
      fieldcatalog-col_pos     = 7.
      fieldcatalog-outputlen   = 15. 
      fieldcatalog-do_sum      = 'X'        "Display column total
      fieldcatalog-datatype     = 'CURR'.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
    Regards
    Anver

Maybe you are looking for

  • How Can I Change One Page to Look Different From The Rest of My Pages?

    Hi, my website uses a CSS page with a dark background and white type. But I have one page I need to have a white background and light grey type on. I am not sure how to do this without it changing all of my site's look which I don't want to do. I onl

  • Wlse unknown fault

    does anyone familiar with this message on the wlse faults - "Inconsistent state found for query "interface.radio.config" thanks

  • A diff instance design

    Hey, I want to write a diff instance class. The DiffInstance will get two instances of the same class and will return a collection of difference between the instance. This is done because there are a lot of services that triger by changes in the mode

  • Which subscription ?

    Hello I am new to Netweaver Administration and  would like to enrich my knowledge in Adminsitration area more by having authentic information. So i am looking for some kind of subscription with which i can get information on how individual SAP system

  • Flip Video or Similar in FCP?

    Hi everyone, is there a way to edit video from these little flip cameras or similar formats in FCP? Which of these kinds of formats can you bring into an FCP timeline?