ALV Display - Error in field catalog

Hi ,
I am facing a problem in ALV... Field catalot is not getting populated... I am getting a message field catalog not found...
Can anyone please help me....... <URGENT DOES NOT EXIST HERE>...
I am enclosing my code also.. please go thourh it and help it....
REPORT ZINVENTORY
      LINE-SIZE  120
       LINE-COUNT 64.
      MESSAGE-ID Z2
      NO STANDARD PAGE HEADING..
type-pools : slis.
Tables                                                               *
tables: zasset,
        anla,
        itob,
        equi.
data: v_repid LIKE sy-repid.
Selection Screen                                                     *
SELECTION-SCREEN : BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001 .
SELECT-OPTIONS : S_bukrs FOR anla-bukrs OBLIGATORY ,
                 S_kostl FOR itob-kostl .
SELECTION-SCREEN : END OF BLOCK B1 .
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-t02.
PARAMETERS: p_screen RADIOBUTTON GROUP gr1,
            p_list RADIOBUTTON GROUP gr1 DEFAULT 'X'.
SELECTION-SCREEN END OF BLOCK b2.
Internal Tables                                                      *
types: BEGIN OF ty_zasset, " occurs 0,
         equnr  like zasset-equnr,
         ANLN1 LIKE zasset-ANLN1, " Asset number
         ANLN2 LIKE zasset-ANLN2, " Sub Asset number
         BUKRS LIKE zasset-BUKRS, " Company Code
         KOSTL  like zasset-kostl,
         SCANNEDBY type zasset-scannedby,
         SCANNINGDATE type zasset-SCANNINGDATE,
         SCANNINGTIME type zasset-scanningtime,
         UPDATEDATE   type zasset-updatedate,
         UPDATETIME type zasset-updatetime,
       END OF ty_zasset.
DATA: wa_zasset   TYPE ty_zasset.
DATA: it_zasset TYPE TABLE OF ty_zasset with header line..
types: BEGIN OF ty_zasset1, " occurs 0,
        equnr  TYPE equi-equnr,
         ANLN1 LIKE anla-ANLN1, " Asset number
         ANLN2 LIKE anla-ANLN2, " Sub Asset number
         BUKRS LIKE anla-BUKRS, " Company Code
         ernam like anla-ernam,
         erdat like anla-erdat,
        KOSTL  like anlz-kostl,
        SCANNEDBY type zasset-scannedby,
        SCANNINGDATE type zasset-SCANNINGDATE,
        SCANNINGTIME type zasset-scanningtime,
        UPDATEDATE   type zasset-updatedate,
        UPDATETIME type zasset-updatetime,
       END OF ty_zasset1.
DATA: wa_zasset1   TYPE ty_zasset1.
DATA: it_zasset1 TYPE TABLE OF ty_zasset1 with header line..
types: BEGIN OF ty_zasset2, " occurs 0,
         equnr  like itob-equnr,
         ANLNr LIKE itob-ANLNr, " Asset number
         ANLuN LIKE itob-ANLuN, " Sub Asset number
         BUKRS LIKE itob-BUKRS, " Company Code
         timbi like itob-timbi,
         kostl like itob-kostl,
        KOSTL  like anlz-kostl,
        SCANNEDBY type zasset-scannedby,
        SCANNINGDATE type zasset-SCANNINGDATE,
        SCANNINGTIME type zasset-scanningtime,
        UPDATEDATE   type zasset-updatedate,
        UPDATETIME type zasset-updatetime,
       END OF ty_zasset2.
DATA: wa_zasset2   TYPE ty_zasset2.
DATA: it_zasset2 TYPE TABLE OF ty_zasset2 with header line..
types: begin of ty_final , "occurs 0,
        equnr like itob-equnr,
        anln1 like anla-anln1,
        anln2 like anla-anln2,
        bukrs like anla-bukrs,
       ernam
       erdat
        kostl like itob-kostl,
        end of ty_final.
DATA: wa_final   TYPE ty_final.
DATA: it_final TYPE TABLE OF ty_final with header line..
*DATA: it_zasset TYPE TABLE OF ty_zasset.
*data: it_zasset1 type table of ty_zasset1.
*data:wa_zasset type ty_zasset.
*data:wa_zasset1 type ty_zasset1.
Flags and Variables                                                 *
DATA : F_ERROR.                   " Flag for No Data
*pop field cat for f7
data: V_SYREPID LIKE SY-REPID,
      IT_FLDCAT type slis_t_fieldcat_alv , "with header line,
      wa_fldcat   type slis_fieldcat_alv.
*DATA : IT_FLDCATS TYPE SLIS_T_FIELDCAT_ALV.
data: itab_events type slis_t_event,
      wa_events   type slis_alv_event.
*data: wa_layout type slis_layout_alv.
DATA : IT_COMMENTS TYPE SLIS_T_LISTHEADER,
       WA_COMMENTS TYPE SLIS_LISTHEADER.
DATA : IT_SORTINFO TYPE SLIS_T_SORTINFO_ALV,
       WA_SORTINFO TYPE SLIS_SORTINFO_ALV.
Initialization                                                       *
initialization.
  SY-REPID = V_REPID.
At Selection Screen                                                  *
AT SELECTION-SCREEN.
  PERFORM validation.
Start Of Selection                                                   *
start-of-selection.
perform select_data.
IF P_LIST = 'X'.
perform get_field_catalog.
PERFORM MODIFYFIELDCAT.
perform get_events.
perform write_comments.
perform grid_display.
*perform list_display.
ENDIF.
IF sy-subrc = 0.
   IF p_list = 'X'.
   loop at it_final.
   perform get_events.
   endloop.
   endif.
   endloop.
   else.
*endif.
End Of Selection                                                     *
END-OF-SELECTION.
*perform display_Recorsds.
*loop at zasset.
*&      Form  validation
      text
-->  p1        text
<--  p2        text
FORM validation.
*Local variables.
  DATA:
        lv_bukrs type anla-bukrs,
        lv_kostl type itob-kostl,
        lv_anln1 TYPE anla-anln1,        "MAterial Number
        lv_anln2 TYPE anla-anln2.
*Validation for company code
  if not s_bukrs is initial.
    select single bukrs from anla
           into lv_bukrs
           where bukrs in s_bukrs.
    if sy-subrc <> 0.
*Message used : Invalid company code.
    endif.
  endif    .
Validation for cost center
  if not s_kostl is initial.
    select single kostl from itob
           into lv_kostl
           where kostl in s_kostl.
    if sy-subrc <> 0.
*Message used : Invalid company code.
    endif.
  endif  .
ENDFORM.                    " validation
*&      Form  display
      text
-->  p1        text
<--  p2        text
FORM display.
  write :/15 it_final-anln1,
  it_final-anln2,
            sy-vline.
*-bukrs,
       it_zasset-anln1.
ENDFORM.                    " display
*&      Form  get_field_catalog
      text
-->  p1        text
<--  p2        text
FORM get_field_catalog.
*REFRESH IT_FLDCAT.
*CLEAR IT_FLDCAT.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
   I_PROGRAM_NAME               = V_REPID
   I_INTERNAL_TABNAME           = 'IT_FINAL'
   I_INCLNAME                   = V_REPID
  I_BYPASSING_BUFFER           =
  I_BUFFER_ACTIVE              =
  CHANGING
    CT_FIELDCAT                  = IT_FLDCAT
EXCEPTIONS
   INCONSISTENT_INTERFACE       = 1
   PROGRAM_ERROR                = 2
   OTHERS                       = 3
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM.                    " get_field_catalog
*&      Form  get_events
      text
-->  p1        text
<--  p2        text
FORM get_events.
  WA_COMMENTS-TYP = 'H'.
  WA_COMMENTS-KEY = 'THIS IS THE HEADING.'.
  WA_COMMENTS-INFO = 'LIST OF SALES ORDERS'.
  APPEND WA_COMMENTS TO IT_COMMENTS.
ENDFORM.                    " get_events
*&      Form  grid_display
      text
-->  p1        text
<--  p2        text
FORM grid_display.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
  I_INTERFACE_CHECK                 = ' '
  I_BYPASSING_BUFFER                =
  I_BUFFER_ACTIVE                   = ' '
   I_CALLBACK_PROGRAM                = v_repid
  I_CALLBACK_PF_STATUS_SET          = ' '
  I_CALLBACK_USER_COMMAND           = ' '
   I_CALLBACK_TOP_OF_PAGE            = 'FIRST PAGE'
  I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
  I_CALLBACK_HTML_END_OF_LIST       = ' '
  I_STRUCTURE_NAME                  =
  I_BACKGROUND_ID                   = ' '
   I_GRID_TITLE                      =  'LIST OF FLIGHT DETAILS'
  I_GRID_SETTINGS                   =
  IS_LAYOUT                         =
   IT_FIELDCAT                       =  it_fldcat
  IT_EXCLUDING                      =
  IT_SPECIAL_GROUPS                 =
  IT_SORT                           =
  IT_FILTER                         =
  IS_SEL_HIDE                       =
  I_DEFAULT                         = 'X'
  I_SAVE                            = ' '
  IS_VARIANT                        =
  IT_EVENTS                         =  itab_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_ADD_FIELDCAT                   =
  IT_HYPERLINK                      =
  I_HTML_HEIGHT_TOP                 =
  I_HTML_HEIGHT_END                 =
  IT_EXCEPT_QINFO                   =
IMPORTING
  E_EXIT_CAUSED_BY_CALLER           =
  ES_EXIT_CAUSED_BY_USER            =
  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.
ENDFORM.                    " grid_display
*&      Form  write_comments
      text
-->  p1        text
<--  p2        text
FORM write_comments.
  WA_COMMENTS-TYP = 'H'.
  WA_COMMENTS-KEY = 'THIS IS THE HEADING.'.
  WA_COMMENTS-INFO = 'LIST OF SALES ORDERS'.
  APPEND WA_COMMENTS TO IT_COMMENTS.
ENDFORM.                    " write_comments
*&      Form  select_data
      text
-->  p1        text
<--  p2        text
FORM select_data.
  clear: it_zasset, it_zasset[].
  select  equnr "bukrs
          anln1
          anln2
          bukrs
          KOSTL
          SCANNEDBY
          SCANNINGDATE
          SCANNINGTIME
          UPDATEDATE
          UPDATETIME
          into table it_zasset "(g_anln1,g_anln2)
          from zasset
          where bukrs = zasset-bukrs..
      and   kostl = zasset-kostl.
  if sy-subrc = 0.
    sort it_zasset by anln1 anln2.
  endif.
append it_zasset.
  clear it_zasset1.
  select
         equnr
          anln1
          anln2
          bukrs
          ernam
          erdat
         bukrs
         KOSTL
         SCANNEDBY
         SCANNINGDATE
         SCANNINGTIME
         UPDATEDATE
         UPDATETIME
          into table it_zasset1 "(g_anln1,g_anln2)
          from  anla
         where bukrs = it_zasset-bukrs.
  WHERE BUKRS IN S_BUKRS.
and   kostl = anla-kostl.
  if sy-subrc = 0.
    select equnr
           anlnr
           anlun
           bukrs
           timbi
           kostl
           into table it_zasset2
           from itob
           for all entries in it_zasset1
          where bukrs = it_zasset1-bukrs
           WHERE   anlnr = it_zasset1-anln1.
  endif.
  APPEND IT_ZASSET1.
  IF SY-SUBRC = 0.
*loop at it_zasset1 into wa_zasset1.
loop at it_ZASSET1 into wa_zasset1.
move wa_zasset1-bukrs to wa_final-bukrs.
    move wa_zasset1-anln1 to wa_final-anln1.
    move wa_zasset1-anln2 to wa_final-anln2.
append wa_final to it_final.
endloop.
ENDIF.
sort it_final.
*LOOP AT IT_FINAL.
*ENDLOOP.
*ENDIF.
*if sy-subrc = 0.
*loop at it_zasset into wa_asset.
*read table it_zasset into wa_asset with key anln2 = wa_asset-anln2
*binary search.
*read table it_final into wa_final with key anln2 = wa_final-anln2
*binary search.
*if wa_asset-anln2 = wa_final-anln2.
*write : / 'error'.
*endif.
If sy-subrc <> 0.
   f_error = 'X'.
   write :  'No data Exists for the given selection in FA table'.
else.
   loop at it_final.
     perform display.
   endloop.
records exits in anla table also.
endif.
ENDFORM.                    " select_data
*&      Form  MODIFYFIELDCAT
      text
-->  p1        text
<--  p2        text
FORM MODIFYFIELDCAT.
  LOOP AT IT_FLDCAT INTO WA_FLDCAT.
     CASE WA_FLDCAT-FIELDNAME.
        WHEN 'EQUNR'.
WA_FLDCAT-COL_POS = 1.
          WA_FLDCAT-SELTEXT_L = 'aSSET'.
        WHEN 'ANLN1'.
        wa_FLDCAT-KEY = 'X'.
          WA_FLDCAT-COL_POS = 5.
          WA_FLDCAT-SELTEXT_L = 'aSSET'.
        WHEN 'ANLN2'.
          WA_FLDCAT-KEY = 'X'.
          WA_FLDCAT-COL_POS = 6.
        wa_FLDCAT-HOTSPOT = 'X'.
        WHEN 'BUKRS'.
          WA_FLDCAT-CURRENCY = 'INR'.
         WA_FLDCAT-SYMBOL = 'X'.
      ENDCASE.
    MODIFY IT_FLDCAT FROM WA_FLDCAT.
*IT_FLDCAT-fieldname   = 'EQUNR'.
IT_FLDCAT-seltext_m   = 'DOCUM_TYPE'.
IT_FLDCAT-col_pos     = 1.
IT_FLDCAT-outputlen   = 10.
IT_FLDCAT-emphasize   = 'X'.
IT_FLDCAT-key         = 'X'.
fieldcatalog-do_sum      = 'X'.
fieldcatalog-no_zero     = 'X'.
append IT_FLDCAT TO IT_FLDCAT.
IT_FLDCAT-fieldname   = 'ANLN1'.
IT_FLDCAT-seltext_m   = 'DOCUM_TYPE'.
IT_FLDCAT-col_pos     = 1.
IT_FLDCAT-outputlen   = 10.
IT_FLDCAT-emphasize   = 'X'.
IT_FLDCAT-key         = 'X'.
fieldcatalog-do_sum      = 'X'.
fieldcatalog-no_zero     = 'X'.
append IT_FLDCAT TO IT_FLDCAT.
  ENDLOOP.
ENDFORM.                    " MODIFYFIELDCAT
*&      Form  list_display
      text
-->  p1        text
<--  p2        text
*FORM list_display.
*CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
  I_INTERFACE_CHECK              = ' '
  I_BUFFER_ACTIVE                = ' '
  I_CALLBACK_PROGRAM             = V_SYREPID
  I_CALLBACK_PF_STATUS_SET       = ' '
  I_CALLBACK_USER_COMMAND        = 'FRM_USER_COMMAND'
  I_STRUCTURE_NAME               =
  IS_LAYOUT                      = wa_layout
  IT_FIELDCAT                    = IT_FLDCAT
  IT_EXCLUDING                   =
  IT_SPECIAL_GROUPS              =
  IT_SORT                        =
  IT_FILTER                      =
  IS_SEL_HIDE                    =
  I_DEFAULT                      = 'X'
  I_SAVE                         = 'A'
  IS_VARIANT                     =
  IT_EVENTS                      = ITAB_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
IMPORTING
  E_EXIT_CAUSED_BY_CALLER        =
  ES_EXIT_CAUSED_BY_USER         =
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.
*ENDFORM.                    " list_display
Edited by: Craig Cmehil on Jul 18, 2008 10:01 AM

The problem is with this...
types: begin of ty_final , "occurs 0,
equnr like itob-equnr,
anln1 like anla-anln1,
anln2 like anla-anln2,
bukrs like anla-bukrs,
ernam
erdat
kostl like itob-kostl,
end of ty_final.
DATA: wa_final TYPE ty_final.
DATA: it_final TYPE TABLE OF ty_final with header line.
when you are using Fieldcatalog merge you have to avoid using the TYPES Declaration of the internal table.
Instead of that you can do this
data: begin of it_final occurs 0,
equnr like itob-equnr,
anln1 like anla-anln1,
anln2 like anla-anln2,
bukrs like anla-bukrs,
ernam
erdat
kostl like itob-kostl,
        end of it_final.

Similar Messages

  • ALV display using dynamic field catalog and dynamic internal table

    hi ,
    please guide me for ALV display using dynamic field catalog and dynamic internal table.
    Thank you.

    Hi Rahul,
    maybe thread dynamic program for alv is helpful for you. More information about the [SAP List Viewer (ALV)|http://help.sap.com/saphelp_nw70/helpdata/EN/5e/88d440e14f8431e10000000a1550b0/frameset.htm]. Also have a look into the example programs SALV_DEMO_TABLE*.
    Regards Rudi

  • How to display the fields in ALV Output without using Field catalog?

    How to display the fields in ALV Output without using Field catalog?
    Could you pls tell me the coding?
    Akshitha.

    Hi,
    u mean without building field catalog. is it? I that case, we can use the FM REUSE_ALV_FIELDCATALOG_MERGE.
    data: itab type table of mara.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
    i_program_name = sy-repid
    i_structure_name = itab
    CHANGING
    ct_fieldcat = lt_fieldcat[]
    EXCEPTIONS
    inconsistent_interface = 1
    program_error = 2
    OTHERS = 3.
    *Pass that field catalog into the fillowing FM
    call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                i_callback_program      = gd_repid
                i_grid_title            = 'REPORTING'
                is_layout              = gt_layout
                it_fieldcat             = lt_fieldcat[]
           tables
                t_outtab                = itab.

  • ALV report using the field catalog

    which is the quickest way to generate an ALV report using the field catalog merge.  without needing to build the field catalog manually .
    is it easier to create a structure and passe it in the field catalog merge .  if yes can i have an example plzzzz

    hI
    Supports the creation of the field catalog for the ALV function modules
    based either on a structure or table defined in the ABAP Data
    Dictionary, or a program-internal table.
    The program-internal table must either be in a TOP Include or its
    Include must be specified explicitly in the interface.
    The variant based on a program-internal table should only be used for
    rapid prototyping since the following restrictions apply:
    o Performance is affected since the code of the table definition must
    always be read and interpreted at runtime.
    o Dictionary references are only considered if the keywords LIKE or
    INCLUDE STRUCTURE (not TYPE) are used.
    If the field catalog contains more than 90 fields, the first 90 fields
    are output in the list by default whereas the remaining fields are only
    available in the field selection.
    If the field catalog is passed with values, they are merged with the
    'automatically' found information.
    Below is an example ABAP program which will populate a simple internal table(it_ekpo) with data and
    display it using the basic ALV grid functionality(including column total). The example details the main
    sections of coding required to implement the ALV grid functionality:
                             Data declaration
                             Data retrieval
                             Build fieldcatalog
                             Build layout setup
    *& Report  ZDEMO_ALVGRID                                               *
    *& Example of a simple ALV Grid Report                                 *
    *& The basic requirement for this demo is to display a number of       *
    *& fields from the EKKO table.                                         *
    REPORT  zdemo_alvgrid                 .
    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,
    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,
          gd_tab_group type slis_t_sp_group_alv,
          gd_layout    type slis_layout_alv,
          gd_repid     like sy-repid.
    *Start-of-selection.
    START-OF-SELECTION.
    perform data_retrieval.
    perform build_fieldcatalog.
    perform build_layout.
    perform display_alv_report.
    *&      Form  BUILD_FIELDCATALOG
    *       Build Fieldcatalog for ALV Report
    form build_fieldcatalog.
    * There are a number of ways to create a fieldcat.
    * For the purpose of this example i will build the fieldcatalog manualy
    * by populating the internal table fields individually and then
    * appending the rows. This method can be the most time consuming but can
    * also allow you  more control of the final product.
    * Beware though, you need to ensure that all fields required are
    * populated. When using some of functionality available via ALV, such as
    * total. You may need to provide more information than if you were
    * simply displaying the result
    *               I.e. Field type may be required in-order for
    *                    the 'TOTAL' function to work.
      fieldcatalog-fieldname   = 'EBELN'.
      fieldcatalog-seltext_m   = 'Purchase Order'.
      fieldcatalog-col_pos     = 0.
      fieldcatalog-outputlen   = 10.
      fieldcatalog-emphasize   = 'X'.
      fieldcatalog-key         = 'X'.
    *  fieldcatalog-do_sum      = 'X'.
    *  fieldcatalog-no_zero     = 'X'.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'EBELP'.
      fieldcatalog-seltext_m   = 'PO Item'.
      fieldcatalog-col_pos     = 1.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'STATU'.
      fieldcatalog-seltext_m   = 'Status'.
      fieldcatalog-col_pos     = 2.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'AEDAT'.
      fieldcatalog-seltext_m   = 'Item change date'.
      fieldcatalog-col_pos     = 3.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MATNR'.
      fieldcatalog-seltext_m   = 'Material Number'.
      fieldcatalog-col_pos     = 4.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MENGE'.
      fieldcatalog-seltext_m   = 'PO quantity'.
      fieldcatalog-col_pos     = 5.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MEINS'.
      fieldcatalog-seltext_m   = 'Order Unit'.
      fieldcatalog-col_pos     = 6.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      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.
      fieldcatalog-fieldname   = 'PEINH'.
      fieldcatalog-seltext_m   = 'Price Unit'.
      fieldcatalog-col_pos     = 8.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
    endform.                    " BUILD_FIELDCATALOG
    *&      Form  BUILD_LAYOUT
    *       Build layout for ALV grid report
    form build_layout.
      gd_layout-no_input          = 'X'.
      gd_layout-colwidth_optimize = 'X'.
      gd_layout-totals_text       = 'Totals'(201).
    *  gd_layout-totals_only        = 'X'.
    *  gd_layout-f2code            = 'DISP'.  "Sets fcode for when double
    *                                         "click(press f2)
    *  gd_layout-zebra             = 'X'.
    *  gd_layout-group_change_edit = 'X'.
    *  gd_layout-header_text       = 'helllllo'.
    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'
           exporting
                i_callback_program      = gd_repid
    *            i_callback_top_of_page   = 'TOP-OF-PAGE'  "see FORM
    *            i_callback_user_command = 'USER_COMMAND'
    *            i_grid_title           = outtext
                is_layout               = gd_layout
                it_fieldcat             = fieldcatalog[]
    *            it_special_groups       = gd_tabgroup
    *            IT_EVENTS                = GT_XEVENTS
                i_save                  = 'X'
    *            is_variant              = z_template
           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 table it_ekko.
    endform.                    " DATA_RETRIEVAL

  • How to download alv grid output(with field catalog) into excel file format

    Hi all,
    How to download alv grid output(with field catalogs) into excel file format and same file has to download to application server.
    Please help.
    Regards,
    Satya.

    Hi,
    On list where alv is displayed, select export icon( green color -> ),select spread sheet.
    This will display records in Excel sheet.

  • Error in field catalog in ALV grid display using classes at do_sum = "X'.

    Hi,
    I'm using classes in ALV Grid display.
    the code for the field catalog is going to dump because of the statement in the field catalog for field 'netwr',do_sum = 'X'.
    that do_sum = 'X' is not working and going to dump when executed.with out that do_sum it is working fine. the error in dump analysys is showing sap standard incude LSLVCF01.
        assign component
               <ls_fieldcat>-fieldname of structure rt_data to <g_field>.
        if sy-subrc ne 0.
          message x000(0k).
        endif.
    sy-subrc is 4 when the program is being executed.
    CODE:
    FORM prepare_field_catalog CHANGING pt_fieldcat TYPE lvc_t_fcat.
      DATA ls_fcat TYPE lvc_s_fcat.
      ls_fcat-fieldname = 'VBELN1'.
      ls_fcat-ref_field = 'VBELN'.
      ls_fcat-ref_table = 'VBRK'.
      ls_fcat-coltext = 'Invoice No'.
      ls_fcat-seltext = 'Invoice No'.
      APPEND ls_fcat TO pt_fieldcat.
      CLEAR ls_fcat.
      ls_fcat-fieldname = 'BUDAT'.
      ls_fcat-ref_table = 'BKPF'.
      ls_fcat-coltext = 'Invoice Date'.
      ls_fcat-seltext = 'Invoice Date'.
      APPEND ls_fcat TO pt_fieldcat.
      CLEAR ls_fcat.
    ls_fcat-fieldname = 'NETWR'.
      ls_fcat-ref_field = 'NETWR'.
      ls_fcat-ref_table = 'VBRK'.
      ls_fcat-coltext = 'Value of Invoice'.
      ls_fcat-seltext = 'Value of Invoice'.
      ls_fcat-datatype = 'CURR'.
      ls_fcat-do_sum = 'X'.
      APPEND ls_fcat TO pt_fieldcat.
      CLEAR ls_fcat.
    ENDFORM.
    can u please look in the code and rectify the error,
    would appeciate ur response.
    regards,
    veera.

    Hi,
    try this..
    ls_fcat-fieldname = 'NETWR'.
    ls_fcat-ref_field = 'NETWR'.
    ls_fcat-ref_table = 'VBRK'.
    ls_fcat-coltext = 'Value of Invoice'.
    ls_fcat-seltext = 'Value of Invoice'.
    ls_fcat-datatype = 'CURR'.
    ls_fcat-do_sum = 'X'.
    <b>ls_fcat-cfieldname = 'WAERS'.</b>
    APPEND ls_fcat TO pt_fieldcat.
    CLEAR ls_fcat.
    Regards
    vijay

  • Runtime error in Field catalog creation

    when i try to create the field catalog using the following code.
    am getting *'Field Symbol Is not assigned' Runtime error.*
    Please give me idea how to resolve this issue.
    data: wa_field type slis_fieldcat_alv,
            t_field type slis_t_fieldcat_alv.
    LOOP AT t_role INTO wa_role.
        wa_field-col_pos = count1.
        wa_field-fieldname = wa_role-agr_name.
        wa_field-datatype = 'CHAR'.
        wa_field-ref_fieldname = 'AGR_NAME'.
        wa_field-ref_tabname = 'AGR_1251'.
        APPEND wa_field TO t_field.
        count1 = count1 + 1.
      ENDLOOP.
    Suitable  Answers rewarded with maximum points....
    it's Urgent...
    Give me Quick Reply.

    Error is having following short text.
    Field symbol has not yet been assigned.
    Error analysis                                                            
        You attempted to access an unassigned field symbol                    
        (data segment 92).                                                                               
    This error may occur for any of the following reasons:                
        - You address a typed field symbol before it is set using ASSIGN      
        - You address a field symbol that points to a line in an internal table
          that has been deleted                                               
        - You address a field symbol that had previously been reset using     
          UNASSIGN, or that pointed to a local field that no longer exists    
        - You address a global function interface parameter, even             
          though the relevant function module is not active,                  
          that is it is not in the list of active calls. You can get the list 
          of active calls from the this short dump.                           
    Please tell me how to correct this error.
    It is very Urgent..

  • Error "No field catalog available"

    hi
    im using REUSE_ALV_GRID_DISPLAY wni try to excute my program
    im getting the error as
    " No field catalog available"
    can any one help me in this issue?

    hi
    below is my code
    call function 'REUSE_ALV_GRID_DISPLAY'
          exporting
            I_CALLBACK_PROGRAM      = SY-REPID
            IS_LAYOUT               = GS_LAYOUT
            IT_FIELDCAT             = I_FCAT
            I_DEFAULT               = 'X'
            I_SAVE                  = 'A'
    *      it_sort                 = gs_sort
            IS_PRINT                = LS_PRINT
          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.

  • ALV Display for Quantity Field

    Hi All,
    I am working on ALV classes.
    I have a quantity field which needs to be displayed without decimals.
    When I declare the data type as type p decimals 0,It is displayed correctly but when I change the field with a value using the method handle_data_changed it gives a value multiplied by 10 always. i.e., when the new value is 5 it gives the value as 50.
    I tried referencing the Unit value but it doesn't work.
    Any views on suppressing the decimal values without getting the value multiplied by 10 is highly appreciated.
    Thank you in advance.
    Regards,
    K.S.

    Hello Kandasamy,
                                 Change the reference field that points to the ALV display field to a non decimal field and then use the Integer variable assignment for  removing the decimals  during teh BAPi or database fetch.
    Hope this answers your question.
    Thanks,
    Greetson

  • ALV display: Default setting field in grey mode

    Hi
    In SE16 or SE11 when we are checking the table (any table, say MARA, RESB etc) with ALV option, we are getting the "save layout" with default setting field in grey mode. So whatever layout is created it is not a default layout, the user has to select the layout. However when I check with another friend in another project there the ALV setting is coming with editable option.
    So how shall I get that the field in change mode. Pls suggest.
    Regds

    Hi BNR,
    for reasons that may be discussed elsewhere, the layout saved in SE16 is applied to all tables displayed using SE16. Thus a default layout does not make too much sense. In the layout the columns displayed are stored. If you have a default layout you will see only the columns that have all displayed columns in common.
    By the way, in my system I can store a default layout but only user-specific. I can not save standard (non-user-specific) layouts in SE16/SE11.
    In SE16N I can store both general (non-user-specific) and Default layouts. Here the layout is table-specific.
    If you users want a special layout (and they are allowed to use SE16!!!) , you should switch to SE16N.
    Regards,
    Clemens

  • ALV DISPLAY- hiding a field

    Hi,
    I am using one of the fields for sorting and summing up in alv,but I don't want that field to appear on the display. Is it possible?
    Thanks.

    Hi,
    you can use
    fieldcat-no_out = 'X'. for that field while filling the fieldcat.
    but you can bring it back to display.
    but when you use
    <b>fieldcat-TECH = 'X'.</b> then it will not display, and there is no chance to get that back to display.
    its up to you to choose which one you want
    Regards
    vijay

  • ALV int report using field catalog  merge

    Hi folks,
    Can anyone here please provide me an alv interactive report?
    K.Kiran.

    report  zialv_edit_simple1            .
    include <icon>.
    Definition of Grid event-handler class
    class lcl_grid_event_receiver definition.
      public section.
        methods:
          toolbar              for event toolbar
                                of cl_gui_alv_grid
                                importing e_object
                                          e_interactive
        ,user_command         for event user_command
                                of cl_gui_alv_grid
                                importing e_ucomm
    .  " Period
    endclass.
    *mplementation of Grid event-handler class
    class lcl_grid_event_receiver implementation.
    Method for handling all creation/modification calls to the toolbar
      method toolbar.
        data : ls_toolbar type stb_button.
    Define Custom Button in the toolbar
        clear ls_toolbar.
        move 0 to ls_toolbar-butn_type.
        move 'EDIT' to ls_toolbar-function.
        move space to ls_toolbar-disabled.
        move 'EDIT' to ls_toolbar-text.
        move icon_change_text to ls_toolbar-icon.
        move 'Click2Edit' to ls_toolbar-quickinfo.
        append ls_toolbar to e_object->mt_toolbar.
        clear ls_toolbar.
        move 0 to ls_toolbar-butn_type.
        move 'UPDA' to ls_toolbar-function.
        move space to ls_toolbar-disabled.
        move 'UPDATE' to ls_toolbar-text.
        move icon_system_save to ls_toolbar-icon.
        move 'Click2Update' to ls_toolbar-quickinfo.
        append ls_toolbar to e_object->mt_toolbar.
        clear ls_toolbar.
        move 0 to ls_toolbar-butn_type.
        move 'EXIT' to ls_toolbar-function.
        move space to ls_toolbar-disabled.
        move 'EXIT' to ls_toolbar-text.
        move icon_system_end to ls_toolbar-icon.
        move 'Click2Exit' to ls_toolbar-quickinfo.
        append ls_toolbar to e_object->mt_toolbar.
      endmethod.
    Method to handle user commands from toolbar
      method user_command.
        case e_ucomm .
          when 'EDIT'.
            perform set_input.
          when 'UPDA'.
            perform refresh_disp.
            perform update_table.
          when 'EXIT'.
            leave program.
        endcase.
      endmethod.
    endclass.
           Declarations
    parameters:
      p_intab type dfies-tabname default 'SAPLANE'.
    data :
      dref type ref to data,
      it_grid_fcat type lvc_t_fcat,
      struct_grid_lset type lvc_s_layo,
      tab_info like table of dfies.
    field-symbols :
      <fs_tab> like line of tab_info,
    Output Structure****
      <it_disptab> type table.
    data :
        ok_code like sy-ucomm
       ,save_ok like sy-ucomm
    Container Object [grid_container]
      ,grid_container type ref to cl_gui_custom_container
    Control Object [grid]
      ,grid type ref to cl_gui_alv_grid
    Event-Handler Object [grid_handler]
    ,grid_handler type ref to lcl_grid_event_receiver
      . " period
    Begin of process logic
    start-of-selection.
      call screen '0100'.
    *&      Module  STATUS_0100  OUTPUT
         PBO module ...Displays the Grid
    module status_0100 output.
    A L V    G R I D
      if grid_container is initial.
        create object grid_container
            exporting
              container_name = 'CCONTAINER1'.
        create object grid
            exporting
               i_appl_events = 'X'
               i_parent = grid_container.
        create object grid_handler.
        set handler:
           grid_handler->user_command for grid,
           grid_handler->toolbar for grid .
    *Assigning the input value to <fs_tab>-tabname
        assign p_intab to <fs_tab>-tabname .
        call function 'LVC_FIELDCATALOG_MERGE'
             exporting
                  i_structure_name = <fs_tab>-tabname
             changing
                  ct_fieldcat      = it_grid_fcat.
    *Creating internal table
        call method cl_alv_table_create=>create_dynamic_table
           exporting
               it_fieldcatalog           = it_grid_fcat
           importing
               ep_table                  = dref.
        assign  dref->* to <it_disptab>.
        perform populate_grid_data .
        call method grid->set_ready_for_input
            exporting
              i_ready_for_input = 0.
    *Enabling the grid to edit mode,
    *setting table name as title of the grid
        struct_grid_lset-edit = 'X'. "To enable editing in ALV
        struct_grid_lset-grid_title  = p_intab.
        call method grid->set_table_for_first_display
          exporting
            is_layout           = struct_grid_lset
          changing
            it_outtab             =  <it_disptab>
            it_fieldcatalog       =  it_grid_fcat
        .      " Period
      endif.
    endmodule.
    *&      Module  USER_COMMAND_0100  INPUT
    module user_command_0100 input.
    ****User Commands are handled as events in method user_command.
    endmodule.                 " USER_COMMAND_0100  INPUT
    *&      Form  EXIT_PROGRAM
    form exit_program.
      call method grid_container->free.
      call method cl_gui_cfw=>flush.
      leave program.
    endform.                  " EXIT_PROGRAM
    *&      Form  populate_grid_data
    form populate_grid_data.
    select * from (p_intab) into corresponding fields of table <it_disptab>.
    endform.                     " populate_grid_data
          FORM refresh_disp                                             *
    form refresh_disp.
      call method grid->refresh_table_display.
    endform.
          FORM update_table                                             *
    form update_table.
      modify (p_intab) from table <it_disptab>.
      call method grid->set_ready_for_input
          exporting
              i_ready_for_input = 0.
    endform.
          FORM set_input                                                *
    form set_input.
      call method grid->set_ready_for_input
         exporting
           i_ready_for_input = 1.
    endform.
    Screen Logic :
    process before output.
      module status_0100.
    process after input.
      module user_command_0100.

  • ALV Display Error

    I am using FM <b>REUSE_ALV_GRID_DISPLAY</b>. When I execute my report, in the output screen, I get question marks - <b>??????????????</b> in the top menu instead of the menu name.
    I believe this has something to do with the system since the same code has worked for me before.
    Please advise.
    Message was edited by: Sam

    Hi
    The Problem would be that some part of the stanrard GUIs or progream related to the standard display screen would not be activated properly.
    Just go to
    System -> status and then double click on the GUI
    Once the GUI program is opened Reactive the Program and all its sub components by opening the object browser for it.
    Now come back to your Program and Execute it now. I had a same problem with Menu bar and my problem was solved by doing this.
    Hopefully it does solve yours
    Regards
    Santosh

  • No field catalog found error

    in alv grid display ,cant we use REUSE_ALV_FIELDCATALOG_MERGE if the o/p internal table is formed by joining 2 or more tables.

    Hi
    U can use REUSE_ALV_FIELDCATALOG_MERGE  for any internal table.
    If u r gettin the error 'no field catalog found' try passing the program name in the exporting parameter INCLUDE_NAME.
    Refer the foll code:
    *& Report  ZALV                                                 *
    REPORT  zalv                              .
    TYPE-POOLS SLIS.
    TABLES: vbrk,
            vbrp,
            likp,
            lips,
            vbak,
            vbap.
    DATA: FIELDCAT TYPE  SLIS_T_FIELDCAT_ALV.
    DATA: BEGIN OF tbl_inv OCCURS 10,
             vbeln LIKE vbrk-vbeln,
             erdat LIKE vbrk-erdat,
             kunnr LIKE vbrk-kunrg,
             sfakn LIKE vbrk-sfakn,
             xblnr LIKE vbrk-xblnr,
             posnr LIKE vbrp-posnr,
             vgbel LIKE vbrp-vgbel,
             vgpos LIKE vbrp-vgpos,
             aubel LIKE vbrp-aubel,
             aupos LIKE vbrp-aupos,
             matnr LIKE vbrp-matnr,
             arktx LIKE vbrp-arktx,
             werks LIKE vbrp-werks,
          END OF tbl_inv,
          BEGIN OF tbl_sales OCCURS 10,
             vbeln LIKE vbak-vbeln,
             erdat LIKE vbak-erdat,
             kunnr LIKE vbak-kunnr,
             posnr LIKE vbap-posnr,
             kwmeng LIKE vbap-kwmeng,
          END OF tbl_sales,
          BEGIN OF tbl_lips OCCURS 10,
             vbeln LIKE lips-vbeln,
             posnr LIKE lips-posnr,
             lfimg LIKE lips-lfimg,
             meins LIKE lips-meins,
          END OF tbl_lips.
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS   s_werks FOR vbrp-werks OBLIGATORY.
    PARAMETERS p_vkorg LIKE vbrk-vkorg OBLIGATORY.       "Sales Organisation
    SELECT-OPTIONS : s_vtweg FOR vbrk-vtweg,
    "Distribution channel
                     s_spart FOR vbrk-spart,             "Division
                     s_erdat FOR vbrk-erdat OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK b1.
    IF s_vtweg IS INITIAL AND s_spart IS INITIAL.
      SELECT p~vbeln
             p~erdat
             p~kunrg
             p~sfakn
             p~xblnr
             q~posnr
             q~vgbel
             q~vgpos
             q~aubel
             q~aupos
             q~matnr
             q~arktx
             q~werks
             iNTO TABLE tbl_inv
             FROM vbrk AS p
             JOIN vbrp AS q
             ON pvbeln = qvbeln
             WHERE p~erdat IN s_erdat
             AND p~vkorg   = p_vkorg.
    ELSEIF s_vtweg IS INITIAL.
      SELECT   p~vbeln
               p~erdat
               p~kunrg
               p~sfakn
               p~xblnr
               q~posnr
               q~vgbel
               q~vgpos
               q~aubel
               q~aupos
               q~matnr
               q~arktx
               q~werks
               INTO TABLE tbl_inv
               FROM vbrk AS p
               JOIN vbrp AS q
               ON pvbeln = qvbeln
               WHERE p~erdat IN s_erdat
               AND p~vkorg   = p_vkorg
               AND p~spart IN s_spart.
    ELSEIF s_spart IS INITIAL.
      SELECT   p~vbeln
               p~erdat
               p~kunrg
               p~sfakn
               p~xblnr
               q~posnr
               q~vgbel
               q~vgpos
               q~aubel
               q~aupos
               q~matnr
               q~arktx
               q~werks
               INTO TABLE tbl_inv
               FROM vbrk AS p
               JOIN vbrp AS q
               ON pvbeln = qvbeln
               WHERE p~erdat IN s_erdat
               AND p~vkorg   = p_vkorg
               AND p~vtweg IN s_vtweg.
    ELSE.
      SELECT   p~vbeln
               p~erdat
               p~kunrg
               p~sfakn
               p~xblnr
               q~posnr
               q~vgbel
               q~vgpos
               q~aubel
               q~aupos
               q~matnr
               q~arktx
               q~werks
               INTO TABLE tbl_inv
               FROM vbrk AS p
               JOIN vbrp AS q
               ON pvbeln = qvbeln
               WHERE p~erdat IN s_erdat
               AND p~vkorg   = p_vkorg
               AND p~vtweg IN s_vtweg
               AND p~spart IN s_spart.
    ENDIF.
    WRITE 'Number of entries:'.
    DESCRIBE TABLE tbl_lips LINES sy-tfill.
    WRITE sy-tfill.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
        I_PROGRAM_NAME               = 'ZALV'
        I_INTERNAL_TABNAME           = 'TBL_INV'
      I_STRUCTURE_NAME             =
      I_CLIENT_NEVER_DISPLAY       = 'X'
        I_INCLNAME                   = 'ZALV'
      I_BYPASSING_BUFFER           =
      I_BUFFER_ACTIVE              =
    CHANGING
        ct_fieldcat                  = FIELDCAT
    EXCEPTIONS
       INCONSISTENT_INTERFACE       = 1
       PROGRAM_ERROR                = 2
       OTHERS                       = 3
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
        I_CALLBACK_PROGRAM                = 'ZALV_68416'
    TABLES
        t_outtab                          = tbl_inv
    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.
    Message was edited by:
            Vasudha L

  • Simple way to create field catalogs in ALV Reports using subroutine

         In ALV Reports When creating field catalog, instead of giving field catalog for every field seperatly we can use following simple method to create field catalog.
         This method makes your code very easy to read as well as to understand. I am going to show code only to prepare field catalog to make this method easy to understand. Their also contains code for fetching data from requires table and calling function module for ALV . I am not including it in this program but it should be their in program -
    REPORT ZALV_INTERACTIVE_REPORT.
    TYPE-POOLS SLIS.
    TYPES : BEGIN OF TY_MARA,
         MATNR TYPE MATNR,
         MTART TYPE MTART,
         MBRSH TYPE MBRSH,
         MEINS TYPE MEINS,
    END OF TY_MARA.
    DATA IT_MARA TYPE STANDARD TABLE OF TY_MARA.
    DATA WA_MARA TYPE TY_MARA.
    " Internal table and work area for Field Catalog
    DATA IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
    DATA WA_FIELDCAT LIKE LINE OF IT_FIELDCAT.
    START-OF-SELECTION.
    * PERFORM FETCH_DATA .
    " FIELDS IN FIELD CATALOG (PASSED IN SUBROUTINE):-
    "     'FIELDNAME'<SPACE> 'SELTEXT_M' <SPACE>'KEY'<SPACE> 'HOTSPOT'
    PERFORM PREP_CATALOG USING : 'MATNR' 'MATERIAL NO.' 'X' 'X' ,
                                                           'MTART' 'MATERIAL TYPE' ' ' ' ' ,
                                                           'MBRSH' 'IND SECTOR' ' ' ' ' ,
                                                           'MEINS' 'UOM' ' ' ' ' .
    * PERFORM CALL_ALV_FM .
    " Subroutine to create field catalog
    FORM PREP_CATALOG USING VALUE(P_FIELDNM)
                                                                  VALUE(P_SELTEXT)
                                                                  VALUE(P_KEY)
                                                                  VALUE(P_HOTSPOT) .
    WA_FIELDCAT-FIELDNAME = P_FIELDNM .
    WA_FIELDCAT-SELTEXT_M = P_SELTEXT .
    WA_FIELDCAT-KEY = P_KEY .
    WA_FIELDCAT-HOTSPOT = P_HOTSPOT .
    APPEND WA_FIELDCAT TO IT_FIELDCAT .
    ENDFORM .
              Above code will repeat the execution of subroutine PREP_CATALOG for every set of values passed to subroutine because we used
    USING : (chain operator) to pass value to subroutine.
              Subroutine will assign passed values to corresponding field and simply appends those values in ITAB created for field catalog(IT_FIELDCAT). It repeates this process until all the passed values are appended into ITAB.
              This method will reduce complexity of the code as well as time required to write code for every field's field catalog seperatly. It does lots of work in very few lines of codes.

    Scott,
    I don't think there is a way to divide all numbers by a million in one shot, but you could divide the numbers by million by writing code for each amount field as needed: <?FIELD1 div 1000000?> and the use the round function <?xdoxslt:round(2.777,2)?>
    combined function: <?xdoxslt:round((12345605.6 div 1000000),2)?>
    Thanks,
    Bipuser

Maybe you are looking for