Alv grid f4 help populating fieldcatalog field from f4 chosen field

Suggest help to do f4 help on alv oo-object .
when i click f4 for field it should call screen 200 their i have button search which need to extract data from for particular table on chosen from f4 help . Double click on value it should populate that value in screen 100 . note calling screen 200 dynamically field catalog get populated with f4 chosen from screen 100.
can u suggest me the how to do this double click on the screen need to populate that value in f4 screen.
CLASS lcl_application_f4 IMPLEMENTATION.
method on_f4.
f4_params-c_fieldname = e_fieldname.
f4_params-cs_row_no = es_row_no.
f4_params-cr_event_data = er_event_data.
f4_params-ct_bad_cells = et_bad_cells.
f4_params-c_display = e_display

Hai Manoj
Try with the following Code
  DATA: BEGIN OF LI_FABGRP OCCURS 0,
        FABGRP LIKE ZAPO_FABGRP-FABGRP,
        BEGDA LIKE ZAPO_FABGRP-BEGDA,
     END OF LI_FABGRP.
  DATA : T_RETURN TYPE STANDARD TABLE OF DDSHRETVAL WITH HEADER LINE,
         L_RETFIELD TYPE DFIES-FIELDNAME.
parameters : S_FABGR like ZAPO_FABGRP-FABGRP.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_FABGR.
  SELECT FABGRP BEGDA FROM ZAPO_FABGRP INTO table LI_FABGRP.
  SORT LI_FABGRP BY FABGRP ASCENDING  BEGDA DESCENDING.
Henter de mulige fabriksgrupper med nyeste BEGDA *indenfor hver
  DELETE ADJACENT DUPLICATES FROM LI_FABGRP COMPARING FABGRP.
L_RETFIELD = 'FABGRP'.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
  EXPORTING
    RETFIELD               = L_RETFIELD
    DYNPPROG               = SY-REPID
    DYNPNR                 = '1000'
    DYNPROFIELD            = 'S_FABGR'
    VALUE_ORG              = 'S'
    MULTIPLE_CHOICE        = ' '
  TABLES
    VALUE_TAB              = LI_FABGRP
    RETURN_TAB             = T_RETURN
EXCEPTIONS
   PARAMETER_ERROR        = 1
   NO_VALUES_FOUND        = 2
   OTHERS                 = 3.
Thanks & regards
Sreenivasulu P

Similar Messages

  • Hi all  F4 in alv grid with restricted value  -- no solution from forum

    hi all
    i have developed report using alv grid using FM (important).
    i have a field xyz which is input/output enabled in alv grid output. this field is attached with f4 help.
    my requirement is to get or read the row in alv grid when user press f4 on that field so that restricted value should come in f4 help i.e. i have to read current line when user presses f4 i.e. the single line data in alv grid.
    so how to get or read the current row when user press f4 i.e user will choose any row in alv grid and this output is on alv grid and there are multiple records.
    or in other word is it possible to read current row in alv grid when user presses F4, if yes how???.
    i hope u understood the query.

    Hai,
    Check the code it may help u.
    For F4 Values on Screen:
    PROCESS ON VALUE_REQUEST
    using module call starting with FIELD i.e FIELD field MODULE module
    There are number of function modules that can be used for the purpose, but these
    can fullfill the task easily or combination of them.
    DYNP_VALUE_READ
    F4IF_FIELD_VALUE_REQUEST
    F4IF_INT_TABLE_VALUE_REQUEST
    POPUP_WITH_TABLE_DISPLAY
    DYNP_VALUE_READ
    This function module is used to read values in the screen fields. Use of this
    FM causes forced transfer of data from screen fields to ABAP fields.
    There are 3 exporting parameters
    DYNAME = program name = SY-CPROG
    DYNUMB = Screen number = SY-DYNNR
    TRANSLATE_TO_UPPER = 'X'
    and one importing TABLE parameter
    DYNPFIELDS = Table of TYPE DYNPREAD
    The DYNPFIELDS parameter is used to pass internal table of type DYNPREAD
    to this FM and the values read from the screen will be stored in this table.This
    table consists of two fields:
    FIELDNAME : Used to pass the name of screen field for which the value is to
    be read.
    FIELDVALUE : Used to read the value of the field in the screen.
    e.g.
    DATA: SCREEN_VALUES TYPE TABLE OF DYNPREAD ,
    SCREEN_VALUE LIKE LINE OF SCREEN_VALUES.
    SCREEN_VALUE-FIELDNAME = 'KUNNR' . * Field to be read
    APPEND SCREEN_VALUE TO SCREEN_VALUES. * Fill the table
    CALL FUNCTION 'DYNP_VALUES_READ'
    EXPORTING
    DYNAME = SY-CPROG
    DYNUMB = SY-DYNNR
    TRANSLATE_TO_UPPER = 'X'
    TABLES
    DYNPFIELDS = SCREEN_VALUES.
    READ TABLE SCREEN_VALUES INDEX 1 INTO SCREEN_VALUE.Now the screen value for field KUNNR is in the SCREEN_VALUE-FIELDVALUE and can be used for further processing like using it to fill the internal table to be used as parameter in F4IF_INT_TABLE_VALUE_REQUEST ETC.
    F4IF_FIELD_VALUE_REQUEST
    This FM is used to display value help or input from ABAP dictionary.We have to pass the name of the structure or table(TABNAME) along with the field name(FIELDNAME) . The selection can be returned to the specified screen field if three
    parameters DYNPNR,DYNPPROG,DYNPROFIELD are also specified or to a table if RETRN_TAB is specified.
    CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'
    EXPORTING
    TABNAME = table/structure
    FIELDNAME = 'field name'
    DYNPPROG = SY-CPROG
    DYNPNR = SY-DYNR
    DYNPROFIELD = 'screen field'
    IMPORTING
    RETURN_TAB = table of type DYNPREAD
    F4IF_INT_TABLE_VALUE_REQUEST
    This FM is used to dsiplay values stored in an internal table as input
    help.This FM is used to program our own custom help if no such input help
    exists in ABAP dictionary for a particular field. The parameter VALUE_TAB is used to pass the internal table containing input values.The parameter RETFIELD
    is used to specify the internal table field whose value will be returned to the screen field or RETURN_TAB.
    If DYNPNR,DYNPPROG and DYNPROFIELD are specified than the user selection is passed to the screen field specified in the DYNPROFIELD. If RETURN_TAB is specified the selectionis returned in a table.
    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
    RETFIELD = field from int table whose value will be returned
    DYNPPROG = SY-CPROG
    DYNPNR = SY-DYNNR
    DYNPROFIELD = 'screen field'
    VALUE_ORG = 'S'
    TABLES
    VALUE_TAB = internal table whose values will be shown.
    RETURN_TAB = internal table of type DDSHRETVAL
    EXCEPTIONS
    parameter_error = 1
    no_values_found = 2
    others = 3.
    POPUP_WITH_TABLE_DISPLAY
    This FM is used to display the contents of an internal table in a popup window.The user can select a row and the index of that is returned in the CHOISE
    parameter.The VALUETAB is used to pass the internal table.
    A suitable title can be set using TITLETEXT parameter. The starting and end position of the popup can be specified by the parameters STARTPOS_COL / ROW and ENDPOS_ROW / COL .
    CALL FUNCTION 'POPUP_WITH_TABLE_DISPLAY'
    EXPORTING
    ENDPOS_COL =
    ENDPOS_ROW =
    STARTPOS_COL =
    STARTPOS_ROW =
    TITLETEXT = 'title text'
    IMPORTING
    CHOISE =
    TABLES
    VALUETAB =
    EXCEPTIONS
    BREAK_OFF = 1
    OTHERS = 2.
    e.g.
    DATA: w_choice TYPE SY-TABIX.
    DATA: BEGIN OF i_values OCCURS 0 WITH HEADER LINE,
    values TYPE I,
    END OF i_values.
    PARAMETRS : id TYPE I.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR id
    i_values-values = '0001'.
    APPEND i_values.
    i_values-values = '0002'.
    APPEND i_values.
    i_values-values = '0003'.
    APPEND i_values.
    i_values-values = '0004'.
    APPEND i_values.
    CALL FUNCTION 'POPUP_WITH_TABLE_DISPLAY'
    EXPORTING
    ENDPOS_COL = 40
    ENDPOS_ROW = 12
    STARTPOS_COL = 20
    STARTPOS_ROW = 5
    TITLETEXT = 'Select an ID'
    IMPORTING
    CHOISE = w_choice
    TABLES
    VALUETAB = i_values
    EXCEPTIONS
    BREAK_OFF = 1
    OTHERS = 2.
    CHECK w_choice > 0.
    READ TABLE i_values INDEX w_choice....now we can process the selection as it is contained
    ...in the structure i_values.
    Other FM that may be used to provide input help is HELP_START .
    check this also.
    See the following ex:
    TYPES: BEGIN OF TY_MBLNR,
    MBLNR LIKE MKPF-MBLNR,
    END OF TY_MBLNR.
    DATA: IT_MBLNR TYPE STANDARD TABLE OF TY_MBLNR WITH HEADER LINE.
    data: it_ret like ddshretval occurs 0 with header line.
    At selection-screen on value-request for s_mat-low.
    Select MBLNR from mkpf into table it_mblnr.
    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
    DDIC_STRUCTURE = ' '
    RETFIELD = 'MBLNR'
    PVALKEY = ' '
    DYNPPROG = ' '
    DYNPNR = ' '
    DYNPROFIELD = ' '
    STEPL = 0
    WINDOW_TITLE =
    VALUE = ' '
    VALUE_ORG = 'S'
    MULTIPLE_CHOICE = ' '
    DISPLAY = ' '
    CALLBACK_PROGRAM = ' '
    CALLBACK_FORM = ' '
    MARK_TAB =
    IMPORTING
    USER_RESET =
    TABLES
    VALUE_TAB = IT_MBLNR
    FIELD_TAB =
    RETURN_TAB = IT_RET
    DYNPFLD_MAPPING =
    EXCEPTIONS
    PARAMETER_ERROR = 1
    NO_VALUES_FOUND = 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.
    IF SY-SUBRC = 0.
    read table it_ret index 1.
    move it_ret-fieldval to S_mat-low.
    ENDIF.
    Go through the test program.
    REPORT Ztest_HELP .
    TABLES : MARA.
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    PARAMETERS : P_MATNR(10) TYPE C.
    SELECTION-SCREEN END OF BLOCK B1.
    DATA : BEGIN OF ITAB OCCURS 0,
    MATNR TYPE MATNR,
    END OF ITAB.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_MATNR.
    SELECT MATNR
    FROM MARA
    INTO TABLE ITAB
    UP TO 10 ROWS.
    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
    RETFIELD = 'MATERIAL NUMBER'
    DYNPPROG = SY-REPID
    DYNPNR = SY-DYNNR
    DYNPROFIELD = 'P_MATNR'
    VALUE_ORG = 'S'
    TABLES
    VALUE_TAB = ITAB
    EXCEPTIONS
    PARAMETER_ERROR = 1
    NO_VALUES_FOUND = 2
    OTHERS = 3. 
    regards.
    sowjanya.b.

  • Urgent : Problem with Editable  ALV Grid  for Quantity and Currency Fields

    Hi All,
    I am using Editable ALV Grid display and have quantity and value as editable fields in the display.
    When user changes these values these values are not changing properly .
    For the quantity field the domain is MENG13 with 3 deciamal places and here  if we enter 500 it takes it as 0.500   .
    The same problem is for the currency field. Here the Domain is WERT7 with 3 decimal places.
    Here also it takes last 2 digits after decimal places by default.
    Please advice how to get proper values in this case from ALV editable fields.
    Thanks and Regards
    Harshad
    Edited by: Harshad Rahirkar on Dec 25, 2007 7:39 AM

    for all the currency field , it will display like that only.
    u have to manipulate uin program before displaying.
    if they are giving 500, in program multiply with 100 and move it to table.
    when u are getting from table, divinde and display.
    this is what I am doing.
    Reward if helpfull.

  • ALV grid Editable based on a Field value

    Hi,
    I need to make a ALV Grid Row editable based on a particular field of that row.
    For example
    if fields are   A   B   C  D
    and if there are three rows of data
    I must make the Field B editable in all the rows which have D value as X else it must be non Editable.
    I searched in SDN but could not find a suitable answer.
    Hope I am clear with my issue.
    Regards

    this sample code makes the NETPR field editable based on a desired condition.
    this is the solution to your problem.
    * TABLES:     ekko.
    * TYPE-POOLS: slis.
    * TYPES: BEGIN OF t_ekko,
    *  ebeln TYPE ekpo-ebeln,
    *  ebelp TYPE ekpo-ebelp,
    *  netpr TYPE ekpo-netpr,
    *  field_style  TYPE lvc_t_styl,
    * END OF t_ekko.
    *DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
    *      wa_ekko TYPE t_ekko.
    *DATA: it_fieldcat TYPE lvc_t_fcat,    
    *      wa_fieldcat TYPE lvc_s_fcat,
    *      gd_tab_group TYPE slis_t_sp_group_alv,
    *      gd_layout    TYPE lvc_s_layo,  
    *      gd_repid     LIKE sy-repid.
    *START-OF-SELECTION.
    *SELECT ebeln ebelp netpr
    *   UP TO 10 ROWS
    *    FROM ekpo
    *    INTO  CORRESPONDING FIELDS OF TABLE it_ekko.
    *  DATA ls_stylerow TYPE lvc_s_styl .
    *  DATA lt_styletab TYPE lvc_t_styl .
    ** 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.
    *      APPEND ls_stylerow  TO wa_ekko-field_style.
    *      MODIFY it_ekko FROM wa_ekko.
    *    ENDIF.
    *  ENDLOOP.
    *  wa_fieldcat-fieldname   = 'EBELN'.
    *  wa_fieldcat-scrtext_m   = 'Purchase Order'.
    *  wa_fieldcat-col_pos     = 1.
    *  APPEND wa_fieldcat TO it_fieldcat.
    *  CLEAR  wa_fieldcat.
    *  wa_fieldcat-fieldname   = 'EBELP'.
    *  wa_fieldcat-scrtext_m   = 'PO Item'.
    *  wa_fieldcat-col_pos     = 2.
    *  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     = 3.
    *  wa_fieldcat-datatype     = 'CURR'.
    *  APPEND wa_fieldcat TO it_fieldcat.
    *  CLEAR  wa_fieldcat.
    *  gd_layout-stylefname = 'FIELD_STYLE'.
    *  gd_layout-zebra             = 'X'.
    *  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
    *       EXPORTING
    *            i_callback_program       = sy-repid
    *            is_layout_lvc            = gd_layout
    *            it_fieldcat_lvc          = it_fieldcat
    *            i_save                   = 'X'
    *       TABLES
    *            t_outtab                = it_ekko

  • ALV grid refresh problem when I return from list-processing

    hi,
    I have made alv grid with f4 help features and i'm using row select feature.
    When i click on a button in Application toolbar, the program leaves to list processing and then return to alv gridscreen.
    Now the problem arises.
    (1)Even if i select rows and press F8, the program does not identify the rows selected and does not give me desired output.
    (2)Also, when i press F4, the selected value does not appear in the text field.
    Both the cases are working fine, if i dont press button and go to list processing.
    Please help!!

    You can use the function module as stated below -
    FORM user_command USING r_ucomm TYPE sy-ucomm
                            rs_selfield TYPE slis_selfield.
      CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
      IMPORTING
    ET_EXCLUDING =
    E_FLG_NO_HTML =
    E_CALLBACK_PROGRAM =
    E_REPID =
      e_grid = ref1
    ES_LAYOUT_KKBLO =
    ES_SEL_HIDE =
      CALL METHOD ref1->check_changed_data.
    This helps to get the data in the internal table refreshed as well as that on the screen so that both are in sync.
    this is generally used on some event, you can also use it otherwise.
    <b>
    Reward if useful.</b>
    Regards,
    Pritha

  • ALV grid is not displaying few fields of final internal table of type DMBTR

    hello frnds,
    i am displaying 10 fields in ALV grid using field catalog.
    among them five fields are currency fields on which i doing some arithematic operations. but all these fields are not getting displayed in alv grid.
    here is my code....
    declaring final strucutre to generate report
    TYPES:BEGIN OF ty_final,
              gjahr   TYPE gjahr,       " Year
              wwert   TYPE wwert_d,     " Traslation date
              bukrs   TYPE bukrs,       " company code
              hkont   TYPE hkont,       " General ledger account
              txt20   TYPE txt20_skat,  " Account name
              belnr   TYPE belnr_d,     " Purchase order number
              shkzg   TYPE shkzg,       " Dt/Cr indicator
              dmbtr1   TYPE dmbtr,       " Ammount in local currency
              v_alc   TYPE dmbtr,       " Ammount in local currency
              wrbtr   TYPE wrbtr,       " Ammount in foreign currency
              ebeln   TYPE ebeln,       " Purchase order number
              ebelp   TYPE ebelp,       " Item number
              matnr   TYPE matnr,       " Material number
              menge   TYPE menge_d,     " Qunatity
              meins   TYPE meins,       " Unit of measure
              stprs   TYPE stprs,       " Std material master
              v_iv    TYPE dmbtr,       " Invoice value
              pswsl   TYPE pswsl,       " Currency
              v_erc   TYPE dmbtr,       " Exchange rate calculated
              v_op    TYPE dmbtr,       " Order price
              v_uos   TYPE dmbtr,       " Unit order to stock
              v_io    TYPE dmbtr,       " Invoice to order
              v_uv    TYPE dmbtr,       " Unit value
              v_t     TYPE dmbtr,       " Total
              v_d     TYPE dmbtr,       " Differecne
              netpr   TYPE bprei,       " Net price in purchasing document
              v_total TYPE dmbtr,       " Total
              v_os    TYPE dmbtr,       " Order to stock
              v_ito   TYPE dmbtr,       " Invoice to order
              saknr   TYPE saknr,       " G/L account number
           END OF ty_final.
    FORM move_data.
      IF NOT i_bseg[] IS INITIAL.
        LOOP AT i_bseg INTO wa_bseg.
          wa_final-gjahr  = wa_bseg-gjahr.
          wa_final-bukrs  = wa_bseg-bukrs.
          wa_final-hkont  = wa_bseg-hkont.
          wa_final-belnr  = wa_bseg-belnr.
          wa_final-shkzg  = wa_bseg-shkzg.
          wa_final-wrbtr  = wa_bseg-wrbtr.
          wa_final-ebeln  = wa_bseg-ebeln.
          wa_final-ebelp  = wa_bseg-ebelp.
          wa_final-matnr  = wa_bseg-matnr.
          wa_final-menge  = wa_bseg-menge.
          wa_final-meins  = wa_bseg-meins.
          wa_final-pswsl  = wa_bseg-pswsl.
          wa_final-dmbtr1  = wa_bseg-dmbtr.
          wa_final-saknr  = wa_bseg-saknr.
          wa_final-v_total = wa_bseg-dmbtr.
          READ TABLE i_bkpf INTO wa_bkpf WITH KEY bukrs = wa_bseg-bukrs.
          IF sy-subrc = 0.
            wa_final-wwert = wa_bkpf-wwert.
          ENDIF.
         CLEAR wa_bkpf.
          READ TABLE i_mbew INTO wa_mbew WITH KEY matnr = wa_bseg-matnr.
          IF sy-subrc = 0.
            wa_final-stprs = wa_mbew-stprs.
          ENDIF.
         CLEAR wa_mbew.
          READ TABLE i_ekpo INTO wa_ekpo WITH KEY ebeln = wa_bseg-ebeln.
          IF sy-subrc = 0.
            wa_final-netpr = wa_ekpo-netpr.
          ENDIF.
         CLEAR wa_ekpo.
          READ TABLE i_skat INTO wa_skat WITH KEY saknr = wa_bseg-saknr.
          IF sy-subrc = 0.
            wa_final-txt20 = wa_skat-txt20.
          ENDIF.
    calculating output values
          IF wa_bseg-shkzg = 'H'.
            wa_final-v_alc = -1 * wa_bseg-dmbtr.
          ELSEIF wa_bseg-shkzg = 'S'.
            wa_final-v_alc = 1 * wa_bseg-dmbtr.
          ENDIF.
         DATA : l_c_v_alc TYPE p DECIMALS 2,
         l_c_v_iv TYPE p DECIMALS 2.
         l_c_v_alc = wa_final-v_alc.
          IF wa_bseg-menge NE 0.
            wa_final-v_iv = wa_bseg-dmbtr / wa_bseg-menge.
          ENDIF.
          IF wa_bseg-dmbtr NE 0.
            wa_final-v_erc  = wa_bseg-wrbtr   / wa_final-dmbtr1.
          ENDIF.
          IF wa_final-v_erc NE 0.
            wa_final-v_op   = wa_ekpo-netpr   / wa_final-v_erc.
          ENDIF.
          wa_final-v_uos  = wa_mbew-stprs   - wa_final-v_op.
          wa_final-v_io   = wa_final-v_iv   + wa_final-v_uos.
          wa_final-v_uv   = wa_final-v_uos  + wa_final-v_io.
          wa_final-v_t    = wa_final-v_uv   + wa_bseg-menge.
          wa_final-v_d    = wa_final-v_t    - wa_final-v_alc.
          wa_final-v_os   = wa_final-v_uos  * wa_bseg-menge.
          wa_final-v_ito  = wa_final-v_io   * wa_bseg-menge.
          CLEAR wa_bseg.
          APPEND wa_final TO i_final.
          CLEAR wa_final.
        ENDLOOP.
      ENDIF.
    ENDFORM.                    "data_retrieval
    *&      Form  build_fieldcat
          text
    -->  p1        text
    <--  p2        text
    FORM build_fieldcat.
      CLEAR wa_fieldcat.
    *  TYPES : v_alc TYPE dmbtr. "curr. " decimal 2.
    DATA: l_c_v_alc TYPE p DECIMALS 2,
    l_c_v_iv TYPE p DECIMALS 2 .
    l_c_v_alc = v_alc.
    l_c_v_iv = v_iv.
    Constant Declarations.
      CONSTANTS:
                l_c_gjahr(5)   TYPE c VALUE 'GJAHR',      " Year
                l_c_wwert(5)   TYPE c VALUE 'WWERT',      " Traslation date
                l_c_bukrs(5)   TYPE c VALUE 'BUKRS',      " company code
                l_c_hkont(5)   TYPE c VALUE 'HKONT',      " General ledger account
                l_c_txt20(10)  TYPE c VALUE 'TXT20',      " Account name
                l_c_belnr(5)   TYPE c VALUE 'BELNR',      " Doc number
                l_c_shkzg(5)   TYPE c VALUE 'SHKZG',      " Dt/Cr indicator
                l_c_dmbtr(5)   TYPE c VALUE 'DMBTR1',      " Ammount in local currency
               " l_c_v_alc      TYPE c VALUE 'V_ALC',      " Ammount in local currency
                l_c_wrbtr(5)   TYPE c VALUE 'WRBTR',      " Ammount in foreign currency
                l_c_ebeln(5)   TYPE c VALUE 'EBELN',      " Purchase order number
                l_c_ebelp(5)   TYPE c VALUE 'EBELP',      " Item number
                l_c_matnr(5)   TYPE c VALUE 'MATNR',      " Material number
                l_c_menge(7)   TYPE c VALUE 'MENGE',      " Qunatity
                l_c_meins(5)   TYPE c VALUE 'MEINS',      " Unit of measure
                l_c_stprs(5)   TYPE c VALUE 'STPRS',      " Std material master
               " l_c_v_iv(4)    TYPE c VALUE 'V_IV',           " Invoice value
                l_c_pswsl(5)   TYPE c VALUE 'PSWSL',      " Currency
                l_c_v_erc(5)   TYPE c VALUE 'V_ERC',      " Exchange rate calculated
                l_c_v_op(4)    TYPE c VALUE 'V_OP',       " Order price
                l_c_v_uos(5)   TYPE c VALUE 'V_UOS',      " Unit order to stock
                l_c_v_io(4)    TYPE c VALUE 'V_IO',       " Invoice to order
                l_c_v_uv(4)    TYPE c VALUE 'V_UV',       " Unit value
                l_c_v_t(3)     TYPE c VALUE 'V_T',        " Total
                l_c_v_d(3)     TYPE c VALUE 'V_D',        " Differecne
                l_c_netpr(5)   TYPE c VALUE 'NETPR',      " Net price in purchasing document
                l_c_v_total(7) TYPE c VALUE 'V_TOTAL',    " Total
                l_c_v_os(4)    TYPE c VALUE 'V_OS',      " Order to stock
                l_c_v_ito(5)   TYPE c VALUE 'V_ITO',      " Invoice to order
                l_c_saknr(5)   TYPE c VALUE 'SAKNR',      " G/L account number
                l_c_i_final(7) TYPE c VALUE 'I_FINAL'.    " Final internal table
    Fieldcat for fiscal year
      wa_fieldcat-col_pos   =  1.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_gjahr.
      wa_fieldcat-seltext_m = text-007.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Translation date
      wa_fieldcat-col_pos   =  2.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_wwert.
      wa_fieldcat-seltext_m = text-008.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Company code
      wa_fieldcat-col_pos   =  3.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_bukrs.
      wa_fieldcat-seltext_m = text-009.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for General ledger account
      wa_fieldcat-col_pos   =  4.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_hkont.
      wa_fieldcat-seltext_m = text-010.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Account name
      wa_fieldcat-col_pos   =  5.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_txt20.
      wa_fieldcat-seltext_m = text-011.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Doc number
      wa_fieldcat-col_pos   =  6.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_belnr.
      wa_fieldcat-seltext_m = text-012.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Dt/Cr indicator
      wa_fieldcat-col_pos   =  7.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_shkzg.
      wa_fieldcat-seltext_m = text-013.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Ammount in local currency
      wa_fieldcat-col_pos   =  8.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = 'DMBTR1'.
      wa_fieldcat-seltext_m = text-014.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Ammount in local currency
      wa_fieldcat-col_pos   =  9.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = 'V_ALC'.
      wa_fieldcat-seltext_m = text-015.
      wa_fieldcat-ref_fieldname = 'DMBTR'.
    wa_fieldcat-no_sign   = 'X'.
    wa_fieldcat-do_sum    =  c_x.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Ammount in foreign currency
      wa_fieldcat-col_pos   =  10.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_wrbtr.
      wa_fieldcat-seltext_m = text-016.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Purchse order number
      wa_fieldcat-col_pos   =  11.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_ebeln.
      wa_fieldcat-seltext_m = text-017.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Item No
      wa_fieldcat-col_pos   =  12.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_ebelp.
      wa_fieldcat-seltext_m = text-018.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Material number
      wa_fieldcat-col_pos   =  13.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_matnr.
      wa_fieldcat-seltext_m = text-019.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Qunatity
      wa_fieldcat-col_pos   =  14.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_menge.
      wa_fieldcat-seltext_m = text-020.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Unit of measure
      wa_fieldcat-col_pos   =  15.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_meins.
      wa_fieldcat-seltext_m = text-021.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Std material master
      wa_fieldcat-col_pos   =  16.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_stprs.
      wa_fieldcat-seltext_m = text-022.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Invoice value,
      wa_fieldcat-col_pos   =  17.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = 'V_IV'.
      wa_fieldcat-seltext_m = text-023.
      wa_fieldcat-ref_fieldname = 'DMBTR'.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Currency
      wa_fieldcat-col_pos   =  18.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_pswsl.
      wa_fieldcat-seltext_m = text-024.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Exchange rate calculated
      wa_fieldcat-col_pos   =  19.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = 'V_ERC'.
      wa_fieldcat-seltext_m = text-025.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Order price
      wa_fieldcat-col_pos   =  20.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_v_op.
      wa_fieldcat-seltext_m = text-026.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Unit order to stock
      wa_fieldcat-col_pos   =  21.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_v_uos.
      wa_fieldcat-seltext_m = text-027.
      wa_fieldcat-do_sum    = c_x.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Invoice to order
      wa_fieldcat-col_pos   =  22.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_v_io.
      wa_fieldcat-seltext_m = text-028.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Unit value
      wa_fieldcat-col_pos   =  23.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_v_uv.
      wa_fieldcat-seltext_m = text-029.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Total
      wa_fieldcat-col_pos   =  24.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_v_t.
      wa_fieldcat-seltext_m = text-030.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Difference
      wa_fieldcat-col_pos   =  25.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_v_d.
      wa_fieldcat-seltext_m = text-031.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Net Price in Purchasing Document
      wa_fieldcat-col_pos   =  26.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_netpr.
      wa_fieldcat-seltext_m = text-032.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Total
      wa_fieldcat-col_pos   =  27.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_v_total.
      wa_fieldcat-seltext_m = text-033.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Order to stock
      wa_fieldcat-col_pos   =  28.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_v_os.
      wa_fieldcat-seltext_m = text-034.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Fieldcat for Invoice to order
      wa_fieldcat-col_pos   =  29.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_v_ito.
      wa_fieldcat-seltext_m = text-035.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    fieldcat for invoice to order
      wa_fieldcat-col_pos   =  30.
      wa_fieldcat-tabname   = l_c_i_final.
      wa_fieldcat-fieldname = l_c_saknr.
      wa_fieldcat-seltext_m = text-035.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    ENDFORM.                    "build_fieldcat

    Hi romanch,
    defining the field catalog you must reference all currency fields to the respective currency key field (type CUKY).
    <alv_fieldcat>-cfieldname         = 'HWAER'.
    This is sample for alv output of a currency field. The alv structure has a field HWAER which carries the currency key, e.g. USD or so.
    Obviously you do not provide a cutrrency key for your values. If they are initial (zero), ALV will not display them as 0,00 but leave the field empty if the reference too currency key is not established.
    If you define a DDIC structure for the ALV output this refernce is enforced. You can pass the DDIC structure name to the ALV and don not have to create the field catalog manually.
    Regards,
    Clemens

  • ALV GRID: Sub Total of a field

    Hi All,
    Currently I am getting O/P in the following format:
    CURRENCY    QUANTITY    VALUE
        GBP                 1               10
        GBP                 2               15
         INR                 1                12
    I want the output to be:  
    CURRENCY    QUANTITY    VALUE
        GBP                 1               10
        GBP                 2               15
        GBP                                     25
        INR                 1                12
        INR                                       12
    I have already tried with:
    wa_fieldcatalog-fieldname  = 'VALUE'.
    wa_fieldcatalog-do_sum = 'X'.
    and,
    clear wa_sort.
    wa_sort-spos      = 1.
    wa_sort-fieldname = 'VALUE'.
    wa_sort-expa = 'X'.
    wa_sort-subtot = 'X'.
    wa_sort-up = 'X'.
    append wa_sort to t_sort
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program = sy-repid
          is_layout       = t_layout
          it_fieldcat      = wa_fieldcatalog[]
          it_sort           = t_sort[]
          i_save           = 'A'
          it_events       = t_events[]
        TABLES
          t_outtab        = ts_final_output[]
        EXCEPTIONS
          program_error      = 1
          OTHERS             = 2.
    It's still not working. Request u all to plz help
    Edited by: Ajoy Chakraborty on Jan 23, 2009 11:43 AM

    Hello Ajoy,
    You can do like this..
      wa_field-fieldname = 'MENGE'.
      wa_field-tabname = 'IT_TAB'.
      wa_field-outputlen = 20.
      wa_field-seltext_l ='Quantity'.
      wa_field-input = ' '.
      wa_field-edit = ' '.
      wa_field-col_pos = '4'.
      wa_field-hotspot = 'X'.
      wa_field-do_sum = 'X'.   " In the field catalog suppose you want the subtotal of this field
      APPEND wa_field TO it_field.
    CLEAR wa_field.
      wa_field-fieldname = 'WERKS'.
      wa_field-tabname = 'IT_TAB'.
      wa_field-outputlen = 20.
      wa_field-col_pos = '5'.
      wa_field-seltext_l ='Plant'.
    wa_field-input = 'X'.
      wa_field-edit = 'X'.
    APPEND wa_field TO it_field.
    CLEAR wa_field.
    *Manintainig internal table for sorting
    wa_sort-spos = 1.
      wa_sort-fieldname = 'EBELP'.
      wa_sort-tabname = 'IT_tab'.
      wa_sort-up = 'X'.
      wa_sort-subtot = 'X'.   " this works like an T New for this field that is on every new value of this field ,  Subtotal will get calculated through above field catalog.
      APPEND wa_sort TO itab_sort.
      CLEAR wa_sort.
    Hope it helps you
    Regards
    Mansi

  • Need to choose fields from alv grid output and send mail

    Hi,
    I need to choose few orders from alv grid output and send mail as PDF for chosen orders.
    Suggest if possible and how.

    Moderator message - Please do not post your requirements and ask the forum to do your work for you - post locked
    Rob

  • Quantity field in ALV Grid

    I am using KWMENG data element in my ALV grid which is a quantity field. In normal dialog programming this field does not allows entering characters in editable cells. But in ALV grid I am not able to restrict it from entering characters.
    Eg: In VA01 if we try to enter any character "ABC...Z" then it wouldn't be typed in the screen. But when using the same data element in ALV grid iot allows to enter alphanumeric values. Since it's a quantity field so character value gives a short dump. I know I can restrict the dump by using "NA" in comparing string but I want to knw is there a way by which I restrict character field entry in alv grid, the same way this field works in VA01. I checked with a simple dialog prog and in that also it doesn not allows character typing in editable fields.

    simple solution
    mention the ref_fieldname and ref_tablename in the fieldcatalog for that column.
    ex:
    fieldcat-ref_fieldname = 'KWMENG'.
    fieldcat-ref_tablename = 'VBAP'.

  • Issue on sorting the fields in ALV Grid

    I have created a report in ALV Grid I have sorted the fields using slis_sortinfo_alv to avoid the duplicates . I could display the output in sorted fashion, but when I export it to a file it is displaying in the same fashion as it is in the database that is in the allowing duplicates.. I cant use DELETE ADJACENT DUPLICATES as it will delete the adjacent records . i need help from you guys please help me...

    Hi,
    As you have data in your internal table that is to be displayed in the alv grid display.
    So, instead you can sort the internal table on that field and then can delete the duplicate records comparing that very field.
    Use code:-
    sort <itab> by <field_name>. "to sort
    delete adjacent duplicates from <itab> comparing <field_name>. "to delete duplicate entries
    This will delete all the duplicates records for the column.
    Now you can use this internal table to display the data in the ALV grid.
    Or if you dont wish to delete the data from the initial internal table, then you can use a temporary internal table of same structure and use:-
    it_temp = itab.
    sort it_temp by <field_name>. "to sort
    delete adjacent duplicates from it_temp comparing <field_name>. "to delete duplicate entries
    Now you can use this internal table to be displayed as alv output.
    Hope this helps you.
    Thanks & Regards,
    Tarun

  • Adding custom fields to notifications-approval tab alv grid

    Transaction IW21 - Create PM Notifications.
    on the Approval Tab - there is an ALV grid that contains lots of fields. I know that i can click on the upper right hand corner and modifiy the layout by hidding fields. I want to add some custom fields to this grid.
    I added my fields to view QMSM and now when I look at the database table using SE16 - i can see my new fields.
    But how do I add them to this ALV grid?
    Please and Thank you,
    Julia Ramos
    Orange County Public Schools.

    I have read SAP OSS NOTE:  586523 Customer-defined fields in list editing. This note helped me add these same fields to many of the standard reporting transactions. IQS8, IW28, IW29, IW38, IW39
    I added my fields to
    QMEL - Quality Notification
    RIHQMEL_LIST - Display structure reporting for QMEL
    RQMQMEL - Quality notification - header data
    RQMQMSM - Quality notification - measures (reporting)
    Then i ran SAP program BALVBUFDEL. This program refreshs the alv buffer. This was very cool in that it allows us to access and report on all of my custom fields thru the standard reporting transactions!
    I thought this same logic might work for transaction IW21. I found the structure used by the approval tab alv program, QMSM,  and created an append structure, ZAQMSM with my fields - ran the balvbufdel program to refresh the alv buffers - but i still can not see my fields in the approval tab. I believe that there must be a way to do this - i will keep trying different things and read thru move OSS notes. If you have any sugestions or ideas - they would be greatly appreciated.
    Thanks

  • ALV-Grid and update dynpro fields

    Hi!
    I've created a dynpro with an ALV-Grid for Data-Overview and fields on the dynpro to change additional data.
    My ALV has one editable column, when this value change I calculate other value for  a field dynrpo, but I canu2019t see this change in my field dynpro.
    How can I update my data filed dynpro when changing the selected row at the ALV.
    I use the method handle_data_changed to obtain changes in ALV-Grid and it works fine, but I canu2019t update my fileds on the dynpro, when changing value in ALV.
    Thanks for any hints!
    Lili.

    This error occurs becuase when you change anything on the ALV, control is not triggering the PAI and PBO of your dynpro. Hence your values are not getting updated in the dynpro field.
    You should call the CL_GUI_CFW=>DISPATCH in PAI module to trigger the PAI also after the event has been triggered in the ALV.
      CALL METHOD CL_GUI_CFW=>DISPATCH
        importing return_code = return_code.
    * a control event occured => exit PAI
      if return_code <> cl_gui_cfw=>rc_noevent.
        clear g_ok_code.
        exit.
      endif.
    Regards,
    Naimesh Patel

  • How to focus a cell on ALV grid display

    hi,
    I need to set the focus to the first cell on the first row in the ALV grid.I am using object oriented ALV grid control.Can anyone help me out in this regard.
    Regards,
    Anil.

    Re: simple Grid display
    Have a look at below links. It contains sample code for alv grid.
    http://www.erpgenie.com/abap/controls/alvgrid.htm#Complete%20code%20for%20the%20ALV%20grid%20example
    http://www.sap-img.com/abap/sample-programs-on-alv-grid.htm
    http://sap.niraj.tripod.com/id64.html
    Also have a look at below for OO alv grid:
    http://help.sap.com/saphelp_erp2004/helpdata/en/0a/b5533cd30911d2b467006094192fe3/frameset.htm
    -->
    ABAP List Viewer
    The common features of report are column alignment, sorting, filtering, subtotals, totals etc. To implement these, a lot of coding and logic is to be put. To avoid that we can use a concept called ABAP List Viewer (ALV).
    This helps us to implement all the features mentioned very effectively.
    Using ALV, We can have three types of reports:
    1. Simple Report
    2. Block Report
    3. Hierarchical Sequential Report
    There are some function modules which will enable to produce the above reports without much effort.
    All the definitions of internal tables, structures and constants are declared in a type-pool called SLIS.
    1. SIMPLE REPORT.
    The important function modules are
    a. Reuse_alv_list_display
    b. Reuse_alv_fieldcatalog_merge
    c. Reuse_alv_events_get
    d. Reuse_alv_commentary_write
    e. Reuse_alv_grid_display
    A. REUSE_ALV_LIST_DISPLAY : This is the function module which prints the data.
    The important parameters are :
    I. Export :
    i. I_callback_program : report id
    ii. I_callback_pf_status_set : routine where a user can set his own pf status or change the functionality of the existing pf status iii. I_callback_user_command : routine where the function codes are handled iv. I_structure name : name of the dictionary table v. Is_layout : structure to set the layout of the report vi. It_fieldcat : internal table with the list of all fields and their attributes which are to be printed (this table can be populated automatically by the function module REUSE_ALV_FIELDCATALOG_MERGE vii. It_events : internal table with a list of all possible events of ALV and their corresponding form names.
    II. Tables :
    i. t_outtab : internal table with the data to be output
    B. REUSE_ALV_FIELDCATALOG_MERGE : This function module is used to populate a fieldcatalog which is essential to display the data in ALV. If the output data is from a single dictionary table and all the columns are selected, then we need not exclusively create the field catalog. Its enough to mention the table name as a parameter(I_structure name) in the REUSE_ALV_LIST_DISPLAY. But in other cases we need to create it.
    The Important Parameters are :
    I. Export :
    i. I_program_name : report id
    ii. I_internal_tabname : the internal output table iii. I_inclname : include or the report name where all the dynamic forms are handled.
    II Changing
    ct_fieldcat : an internal table with the type SLIS_T_FIELDCAT_ALV which is declared in the type pool SLIS.
    C. REUSE_ALV_EVENTS_GET : Returns table of possible events for a list type
    Parameters :
    I. Import :
    Et_Events : The event table is returned with all possible CALLBACK events for the specified list type (column 'NAME'). For events to be processed by Callback, their 'FORM' field must be filled. If the field is initialized, the event is ignored. The entry can be read from the event table, the field 'FORM' filled and the entry modified using constants from the type pool SALV.
    II. Export :
    I_List_type :
    0 = simple list REUSE_ALV_LIST_DISPLAY
    1 = hierarchcal-sequential list REUSE_ALV_HIERSEQ_LIST_DISPLAY
    2 = simple block list REUSE_ALV_BLOCK_LIST_APPEND
    3 = hierarchical-sequential block list
    REUSE_ALV_BLOCK_LIST_HS_APPEND
    D. REUSE_ALV_COMMENTARY_WRITE : This is used in the Top-of-page event to print the headings and other comments for the list.
    Parameters :
    I. it_list_commentary : internal table with the headings of the type slis_t_listheader.
    This internal table has three fields :
    Typ : ‘H’ – header, ‘S’ – selection , ‘A’ - action Key : only when typ is ‘S’.
    Info : the text to be printed
    E. REUSE_ALV_GRID_DISPLAY : A new function in 4.6 version, to display the results in grid rather than as a preview.
    Parameters : same as reuse_alv_list_display
    This is an example for simple list.
    2. BLOCK REPORT
    This is used to have multiple lists continuously.
    The important functions used in this report are:
    A. REUSE_ALV_BLOCK_LIST_INIT
    B. REUSE_ALV_BLOCK_LIST_APPEND
    C. REUSE_ALV_BLOCK_LIST_HS_APPEND
    D. REUSE_ALV_BLOCK_LIST_DISPLAY
    A. REUSE_ALV_BLOCK_LIST_INIT
    Parameters:
    I. I_CALLBACK_PROGRAM
    II. I_CALLBACK_PF_STATUS_SET
    III. I_CALLBACK_USER_COMMAND
    This function module is used to set the default gui status etc.
    B. REUSE_ALV_BLOCK_LIST_APPEND
    Parameters :
    Export :
    I. is_layout : layout settings for block II. it_fieldcat : field catalog III. i_tabname : internal table name with output data IV. it_events : internal table with all possible events
    Tables :
    i. t_outtab : internal table with output data.
    This function module adds the data to the block.
    Repeat this function for all the different blocks to be displayed one after the other.
    C. REUSE_ALV_BLOCK_LIST_HS_APPEND
    This function module is used for hierarchical sequential blocks.
    D. REUSE_ALV_BLOCK_LIST_DISPLAY
    Parameters : All the parameters are optional.
    This function module display the list with data appended by the above function.
    Here the functions REUSE_ALV_FIELDCATALOG_MERGE, REUSE_ALV_EVENTS_GET, REUSE_ALV_COMMENTARY_WRITE can be used.
    3. Hierarchical reports :
    Hierarchical sequential list output.
    The function module is
    A. REUSE_ALV_HIERSEQ_LIST_DISPLAY
    Parameters:
    I. Export:
    i. I_CALLBACK_PROGRAM
    ii. I_CALLBACK_PF_STATUS_SET
    iii. I_CALLBACK_USER_COMMAND
    iv. IS_LAYOUT
    v. IT_FIELDCAT
    vi. IT_EVENTS
    vii. i_tabname_header : Name of the internal table in the program containing the output data of the highest hierarchy level.
    viii. i_tabname_item : Name of the internal table in the program containing the output data of the lowest hierarchy level.
    ix. is_keyinfo : This structure contains the header and item table field names which link the two tables (shared key).
    II. Tables
    i. t_outtab_header : Header table with data to be output ii. t_outtab_item : Name of the internal table in the program containing the output data of the lowest hierarchy level.
    slis_t_fieldcat_alv : This internal table contains the field attributes. This internal table can be populated automatically by using ‘REUSE_ALV_FIELDCATALOG_MERGE’.
    Important Attributes :
    A. col_pos : position of the column
    B. fieldname : internal fieldname
    C. tabname : internal table name
    D. ref_fieldname : fieldname (dictionary) E. ref_tabname : table (dictionary) F. key(1) : column with key-color G. icon(1) : icon H. symbol(1) : symbol I. checkbox(1) : checkbox J. just(1) : (R)ight (L)eft (C)ent.
    K. do_sum(1) : sum up
    L. no_out(1) : (O)blig.(X)no out
    M. outputlen : output length
    N. seltext_l : long key word
    O. seltext_m : middle key word
    P. seltext_s : short key word
    Q. reptext_ddic : heading (ddic)
    R. ddictxt(1) : (S)hort (M)iddle (L)ong
    S. datatype : datatype
    T. hotspot(1) : hotspot
    Simple ALV report
    http://www.sapgenie.com/abap/controls/alvgrid.htm
    http://wiki.ittoolbox.com/index.php/Code:Ultimate_ALV_table_toolbox
    ALV
    1. Please give me general info on ALV.
    http://www.sapfans.com/forums/viewtopic.php?t=58286
    http://www.sapfans.com/forums/viewtopic.php?t=76490
    http://www.sapfans.com/forums/viewtopic.php?t=20591
    http://www.sapfans.com/forums/viewtopic.php?t=66305 - this one discusses which way should you use - ABAP Objects calls or simple function modules.
    2. How do I program double click in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=11601
    http://www.sapfans.com/forums/viewtopic.php?t=23010
    3. How do I add subtotals (I have problem to add them)...
    http://www.sapfans.com/forums/viewtopic.php?t=20386
    http://www.sapfans.com/forums/viewtopic.php?t=85191
    http://www.sapfans.com/forums/viewtopic.php?t=88401
    http://www.sapfans.com/forums/viewtopic.php?t=17335
    4. How to add list heading like top-of-page in ABAP lists?
    http://www.sapfans.com/forums/viewtopic.php?t=58775
    http://www.sapfans.com/forums/viewtopic.php?t=60550
    http://www.sapfans.com/forums/viewtopic.php?t=16629
    5. How to print page number / total number of pages X/XX in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=29597 (no direct solution)
    6. ALV printing problems. The favourite is: The first page shows the number of records selected but I don't need this.
    http://www.sapfans.com/forums/viewtopic.php?t=64320
    http://www.sapfans.com/forums/viewtopic.php?t=44477
    7. How can I set the cell color in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=52107
    8. How do I print a logo/graphics in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=81149
    http://www.sapfans.com/forums/viewtopic.php?t=35498
    http://www.sapfans.com/forums/viewtopic.php?t=5013
    9. How do I create and use input-enabled fields in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=84933
    http://www.sapfans.com/forums/viewtopic.php?t=69878
    10. How can I use ALV for reports that are going to be run in background?
    http://www.sapfans.com/forums/viewtopic.php?t=83243
    http://www.sapfans.com/forums/viewtopic.php?t=19224
    11. How can I display an icon in ALV? (Common requirement is traffic light icon).
    http://www.sapfans.com/forums/viewtopic.php?t=79424
    http://www.sapfans.com/forums/viewtopic.php?t=24512
    12. How can I display a checkbox in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=88376
    http://www.sapfans.com/forums/viewtopic.php?t=40968
    http://www.sapfans.com/forums/viewtopic.php?t=6919
    Go thru these programs they may help u to try on some hands on
    ALV Demo program
    BCALV_DEMO_HTML
    BCALV_FULLSCREEN_DEMO ALV Demo: Fullscreen Mode BCALV_FULLSCREEN_DEMO_CLASSIC ALV demo: Fullscreen mode BCALV_GRID_DEMO Simple ALV Control Call Demo Program BCALV_TREE_DEMO Demo for ALV tree control BCALV_TREE_SIMPLE_DEMO BC_ALV_DEMO_HTML_D0100
    Reward If useful

  • 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.

  • ALV GRID DISPLAY and a Parameter entry in the same screen how ?

    Hi,
    I am newbie to ABAP and I am trying to figure out ways to display an ALV grid along with the parameter field into which the user enters his/ her values in the same screen.To be clear,  when I have a parameter type specified, my screen just lets me display that one field into which the user is asked to enter a value but I want to display the table as well as the user input field in the same screen.
    Any help would be appreciated.
    Thanks a lot. I appreciate that.
    -V

    Hi,
    I think the easiest way to do that is by means of docking container . I will assume you are using selection-screen, but you can also achieve that with normal screen.
    - first you need to place your field in selection screen which I believe you already have
    - now during AT SELECTION-SCREEN OUTPUT you check if something is entred to that field
    - if so you create instance of docking container (docking it at left hand side) then inside you place you alv with selected data for that field value
    So the code which fulfils that would be
    PARAMETERS pa_carr TYPE scarr-carrid.
    DATA: gr_dock_cont TYPE REF TO cl_gui_docking_container,
          gr_alv       TYPE REF TO cl_gui_alv_grid.
    DATA: it_spfli     TYPE TABLE OF spfli.
    AT SELECTION-SCREEN OUTPUT.
      IF pa_carr IS NOT INITIAL.
        SELECT * FROM spfli INTO TABLE it_spfli UP TO 10 ROWS
                                                WHERE carrid = pa_carr .
        IF gr_dock_cont IS NOT BOUND.
          CREATE OBJECT gr_dock_cont
            EXPORTING
              side                        = cl_gui_docking_container=>dock_at_left
              extension                   = 500.
          CREATE OBJECT gr_alv
            EXPORTING
              i_parent          = gr_dock_cont.
          CALL METHOD gr_alv->set_table_for_first_display
            EXPORTING
              i_structure_name = 'SPFLI'
            CHANGING
              it_outtab        = it_spfli.
        ELSE.
          CALL METHOD gr_alv->refresh_table_display.
        ENDIF.
      ENDIF.
    Regards
    Marcin

Maybe you are looking for

  • New Firefox version will no longer connect to my college's internet It NEVER had a problem with connecting before.

    Since I changed my laptop to the new version of Firefox it crashes EVERY time the college internet tries to sign on for authorization. It never did this with the previous version. What is supposed to happen is it opens a page that asks me to click "I

  • Apple mobile device support failling itunes install

    how do i get the mobile device support to install because it make itunes failing because i went to show package contents on the itunes 9.2 dmg which i downloaded from the apple site and i clicked on apple mobile device support i get this Jul 15 00:27

  • HP LaserJet 1536 - grey background when printing pdf files

    HP LaserJet M1536dnf MFP, Windows 7 32-bit Firmware data 20140123 The latest drivers from official site (HP Universal peinting PCL and Universal printing PS v 5.8.0) When printing pdf files from Acrobat Reader, Adobe Acrobat or FoxIt the grey backgro

  • Itune library backup question

    OK, I am a novice and still learning. I have an external harddrive and I have backed up my iTunes library to it. Question. Do I need to keep my library on my C drive also??

  • Can I install a usb2 card?

    I have a 1.25ghz g4 tower at work and we do back up with an external hd (small company). The hd is only usb. So can I go get a usb 2 card and install it and get the improvement in speed of usb 2? Thanks in advance Imac g4, 12 powerbook 1ghz   Mac OS