How to fill field with test data in alv grid display

hi all,
i m adding field TEXT to the structure for displaying grid.
i m modifying program like this
DATA: ALV_OUTPUT  LIKE HRPDV_EXPIRED_Q OCCURS 0 WITH HEADER LINE.
TYPES : BEGIN OF FS_OUTPUT .
      TEXT(20) TYPE C.
        INCLUDE STRUCTURE HRPDV_EXPIRED_Q.
TYPES       TEXT(20) TYPE C.
TYPES    END OF FS_OUTPUT.
DATA: fs_output like table of alv_output.
CLEAR WA_FIELDCAT.
  WA_FIELDCAT-FIELDNAME = 'TEXT'.
  WA_FIELDCAT-seltext_l = 'Abteilungs Struktur'.
  wa_fieldcat-tabname   = 'ALV_OUTPUT'.
  WA_FIELDCAT-COL_POS  = '13'.
  APPEND WA_FIELDCAT TO P_GT_FIELDCAT.
this is what i have write for diapalying field. but my question is how to fill test data with field TEXT.I m writing like this but not executed in the aboove grid dispaly statement.
loop at alv_output.
*alv_output-text(20)  = 'abcdefgh'.
*modify alv_output.
*endloop.
plz tell me how to fill test data

hI..,
Your table declaration has to be like this..
TYPES : BEGIN OF FS_OUTPUT .
INCLUDE STRUCTURE HRPDV_EXPIRED_Q.
TYPES TEXT(20) TYPE C.
TYPES END OF FS_OUTPUT.
DATA: ALV_OUTPUT LIKE standard table of fs_output initial size 0.
loop at alv_output <b>into fs_output</b>.
<b>fs</b>_output-text(20) = 'abcdefgh'.
<b>modify alv_output index sy-tabix from fs_output transporting text.</b>
endloop.
Now give this table alv_output to the GRID_DISPLAY function module..
you will get the required output !!
Plz do remember to close the thread when ur problem is solved !!
reward all helpful answers !!
regards,
sai ramesh

Similar Messages

  • How to merge rows with similar values in alv grid display in webdynpro

    Hi experts,
                   i want to know about how to merge rows with similar values in alv grid display of webdynpro.grouping rows is possible in table display in webdynpro but i am not able to do row grouping in the alv grid display in webdynpro.
    kindly suggest.
    thanks ,
    Anita.

    Hi Anita,
    did you find a solution for this? I have opened a Thread, if you know the answer maybe you could help me out:
    Is there an ALV function similar to the TABLE Row grouping?
    Thanx in advanced!!!
    Kind Regards,
    Gerardo J

  • Leading Zeros Missing - When exporting data from ALV grid display to Excel

    Hi,
    Am exporting the data from ALV GRID DISPLAY to Excel sheet using standard toolbar icon 'Local file'
    the leading zeros displayed in the ALV output is missing in the EXCEL sheet.
    (eg)  in ALV o/p - 0029. 
            in Excel - Only 29 is appearing.
    As per the requiement i have to show the leading zeros in excel also.
    Pls help on this issue.
    Thanks in advance..

    Hi ,
      Please set the property  :
      wa_fieldcat-lzero = 'X' .
    when you are creating field catalog for display alv data .
    your prob will solved .
    Regards ,
    Nilesh Jain

  • Problem with check box in ALV Grid Display

    I am Displaying Material Master Data in ALV Grid Display with Check Box for each record and if i checked check box then i am processing Update operation in Database,  my question is after perform update operation check box should be clear.
    Kindly help me!!!!

    Hello Raj
    Given the fact that you do not tell us the most important piece of information (namely whether you are using OO-based ALV or not) I assume you are using fm-based ALV lists.
    In this case you probably have defined a USER_COMMAND routine as described in the documentation of the fm.
    FORM user_command  USING r_ucomm LIKE sy-ucomm
                             rs_selfield TYPE slis_selfield.
    * define local data
      DATA: ls_outtab  LIKE LINE OF gt_outtab,
                ld_idx       TYPE i.
      LOOP AT gt_outtab INTO ls_outtab
                     WHERE ( chkbox = 'X' ).
        ld_idx = syst-tabix.
        " Call your update function / method / perform
       ls_outtab-chkbox = space.
       MODIFY gt_outtab FROM ls_outtab INDEX ld_Idx
          TRANSPORTING chkbox.
      ENDLOOP.
    " And now trigger refresh of the ALV display:
      rs_selfield-refresh = 'X'.  " <<< !!!
    ENDFORM.
    Regards
      Uwe

  • How we can get an interactive report  in alv grid display?

    Hi experts
    Plz tell me how we can get an interactive report in alv grid disply pls send me one sample code to understand this
    thanks in advance

    hi,
    check this one
    *& Report  ZALV_FIELD_GRID1
    REPORT  ZALV_FIELD_GRID1
            NO STANDARD PAGE HEADING.
    TABLES MARA.
    type-pools :slis.
    TYPES : BEGIN OF TMARA ,
            MATNR LIKE MARA-MATNR,
            MEINS LIKE MARA-MEINS,
            ERSDA LIKE MARA-ERSDA,
            color(4) type c,
            SEL type c,
            LIGHT TYPE C,
            END OF TMARA.
    TYPES: BEGIN OF TMAKT,
           MATNR LIKE MAKT-MATNR,
           MAKTX LIKE MAKT-MAKTX,
           MAKTG LIKE MAKT-MAKTG,
           SEL TYPE C,
           COLOR(4),
           END OF TMAKT.
    DATA:  ITAB TYPE TMARA OCCURS 0 WITH HEADER LINE,
           ITAB1 TYPE TMAKT OCCURS 0 WITH HEADER LINE,
           wa_fieldcat type slis_fieldcat_alv,
           fieldcat type slis_fieldcat_alv occurs 0,
           i_layout type slis_layout_alv,
           WA_LISTHEADER TYPE SLIS_LISTHEADER,
           i_LISTHEADER TYPE SLIS_LISTHEADER OCCURS 0,
           V_EVENTS TYPE SLIS_T_EVENT ,
           WA_EVENT TYPE SLIS_ALV_EVENT,
           I_TITLE_MARA TYPE LVC_TITLE VALUE 'FIRST LIST DISPLAYED',
           I_TITLE_MAKT TYPE LVC_TITLE VALUE 'SECONDRY LIST DISPLAYED',
           SORT TYPE slis_t_sortinfo_alv WITH HEADER LINE,
           PRINT_CONT type slis_print_alv.
    SELECTION SCREE
    selection-screen  begin of block screen1  with frame title TEXT-001.
    SELECTION-SCREEN SKIP.
    SELECTION-SCREEN COMMENT /32(35) COMM1.
    SELECTION-SCREEN ULINE /27(35).
    SELECTION-SCREEN SKIP.
    SELECT-OPTIONS MATNR FOR MARA-MATNR.
    SELECTION-SCREEN SKIP.
    SELECTION-SCREEN ULINE.
    SELECTION-SCREEN COMMENT /30(50) COMM2.
    SELECTION-SCREEN ULINE /27(40).
    SELECTION-SCREEN SKIP.
    SELECT-OPTIONS ERSDA FOR MARA-ERSDA.
    SELECTION-SCREEN SKIP.
    selection-screen  end of block screen1.
        INITIALIZATION
    INITIALIZATION.
      MATNR-low = '23'.
      MATNR-high = '1000'.
      MATNR-option = 'BT'.
      MATNR-sign = 'I'.
      APPEND MATNR.
      ERSDA-low = '20030124'.
      ERSDA-high = '20050302' .
      APPEND ERSDA.
      PERFORM FILLFIELD.
      PERFORM FILLLAYOUT.
      PERFORM build_print_params.
      PERFORM FILL_SORT.
      PERFORM EVENT_CALL.
      PERFORM POPULATE_EVENT.
            SELECTION-SCREEN OUTPUT
    AT SELECTION-SCREEN OUTPUT.
      comm1 ='SELECT MATERIAL NUMBER  RANGE'.
      comm2 ='SELECT MATERIAL CREATION DATE'.
               START-OF-SELECTION
    START-OF-SELECTION.
      PERFORM READDATA.
      PERFORM POPDATA.
    *&      Form  READDATA
          text
    FORM READDATA .
      CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
        EXPORTING
          INPUT  = MATNR-LOW
        IMPORTING
          OUTPUT = MATNR-LOW.
      CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
        EXPORTING
          INPUT  = MATNR-HIGH
        IMPORTING
          OUTPUT = MATNR-HIGH.
      SELECT MATNR
             ERSDA
             MEINS
             FROM MARA
             INTO CORRESPONDING FIELDS OF
            TABLE ITAB
            WHERE MATNR IN MATNR AND ERSDA IN ERSDA.
      LOOP AT ITAB.
        data id_color type i VALUE 1.
        data id_colors(2) type c.
        IF ITAB-MATNR < '000000000000000100'.
          ITAB-LIGHT = '1'.
        ELSEIF ITAB-MATNR < '000000000000000150' AND ITAB-MATNR >
       '000000000000000100' .
          ITAB-LIGHT = '2'.
        ELSE.
          ITAB-LIGHT = '3'.
        ENDIF.
        id_color = id_color + 1.
        if id_color > 7.
          id_color = 1.
        endif.
        id_colors = id_color.
        concatenate 'C' id_colors '10' into itab-color.
        modify itab.
        CLEAR ITAB.
      endloop.
    ENDFORM.                    " READDATA
         Form  FILLFIELD
    FORM FILLFIELD .
      WA_FIELDCAT-FIELDNAME = 'MATNR'.
      WA_FIELDCAT-KEY = 'X'.
      WA_FIELDCAT-COL_POS = '1'.
      WA_FIELDCAT-outputlen   = 20.
      WA_FIELDCAT-HOTSPOT = 'X'.
      wa_fieldcat-seltext_m = 'MATERIAL NUMBER'.
    *WA_FIELDCAT-EMPHASIZE = 'C210'.
      APPEND WA_FIELDCAT TO FIELDCAT.
      clear wa_fieldcat.
      WA_FIELDCAT-FIELDNAME = 'MEINS'.
      WA_FIELDCAT-COL_POS = '2'.
    *WA_FIELDCAT-EMPHASIZE = 'C510'.
      WA_FIELDCAT-outputlen   = 10.
      wa_fieldcat-seltext_m = 'UNIT'.
      APPEND WA_FIELDCAT TO FIELDCAT.
      clear wa_fieldcat.
      WA_FIELDCAT-FIELDNAME = 'ERSDA'.
      WA_FIELDCAT-COL_POS = '3'.
      WA_FIELDCAT-outputlen   = 15.
    *WA_FIELDCAT-EDIT_MASK  = 'DD.MM.YYYY'.
    *WA_FIELDCAT-EMPHASIZE = 'C710'.
      wa_fieldcat-seltext_m = 'CREAT DATE'.
      APPEND WA_FIELDCAT TO FIELDCAT.
      clear wa_fieldcat.
    ENDFORM.                    "FILLFIELD
          Setup print parameters
    form build_print_params.
      PRINT_CONT-reserve_lines = '3'.   "Lines reserved for footer
      PRINT_CONT-no_coverpage = 'X'.
    endform.                    " BUILD_PRINT_PARAMS
         Form  POPDATA
    FORM POPDATA .
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
         I_CALLBACK_PROGRAM                 =  sy-repid
      I_CALLBACK_PF_STATUS_SET          = ' '
         I_CALLBACK_USER_COMMAND            = 'USER-COMMAND'
         I_CALLBACK_TOP_OF_PAGE             = 'TOPPAGE'
      I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
      I_CALLBACK_HTML_END_OF_LIST       = ' '
      I_STRUCTURE_NAME                  =
      I_BACKGROUND_ID                   = ' '
         I_GRID_TITLE                       = I_TITLE_MARA
      I_GRID_SETTINGS                   =
         IS_LAYOUT                          = I_LAYOUT
         IT_FIELDCAT                        = fieldcat
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
        IT_SORT                           =  SORT[]
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         = 'X'
      I_SAVE                            = ' '
      IS_VARIANT                        =
         IT_EVENTS                          = V_EVENTS
      IT_EVENT_EXIT                     =
       IS_PRINT                          = PRINT_CONT
        TABLES
          T_OUTTAB                          = ITAB
    EXCEPTIONS
       PROGRAM_ERROR                     = 1
       OTHERS                            = 2
    ENDFORM.                    " POPDATA
         Form  TOPPAGE
    FORM TOPPAGE.
      REFRESH I_LISTHEADER.
      DATA: ld_lines type i,
            ld_linesc(10) type c,
            I_DATE(10) TYPE C,
            I_INFO LIKE WA_LISTHEADER-INFO.
      WA_LISTHEADER-TYP = 'H'.
      WA_LISTHEADER-INFO = 'MATERIAL DETAIL'.
      APPEND WA_LISTHEADER TO I_LISTHEADER.
      CLEAR WA_LISTHEADER.
      WA_LISTHEADER-TYP = 'S'.
      WA_LISTHEADER-KEY = 'DATE :'.
      CONCATENATE SY-DATUM+6(2) '.'
                           SY-DATUM+4(2) '.'
                           SY-DATUM(4) INTO I_DATE.
      WA_LISTHEADER-INFO = I_datE.
      APPEND WA_LISTHEADER TO I_LISTHEADER.
      CLEAR WA_LISTHEADER.
      describe table ITAB lines ld_lines.
      ld_linesc = ld_lines.
      concatenate 'TOTAL NUMBER OF RECORD SELECTED: ' ld_linesc
                        into I_INFO separated by space.
      WA_LISTHEADER-TYP  = 'A'.
      WA_LISTHEADER-INFO = I_INFO.
      append WA_LISTHEADER to I_LISTHEADER.
      clear: WA_LISTHEADER , I_INFO.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          IT_LIST_COMMENTARY = I_LISTHEADER
          I_LOGO             = 'ENJOYSAP_LOGO'.
    ENDFORM.                    "TOPPAGE
         Form  FILLLAYOUT
    FORM FILLLAYOUT .
      i_layout-zebra = 'X'.
      i_layout-info_fieldname = 'COLOR'.
      i_layout-box_fieldname = 'SEL'.
      I_LAYOUT-lights_fieldname = 'LIGHT'.
      I_LAYOUT-EDIT ='X'.
      I_LAYOUT-colwidth_optimize = 'X'.
      I_LAYOUT-window_titlebar = 'EXAMPLE FOR ALV GRID'.
      I_LAYOUT-no_totalline = 'X'.
    ENDFORM.                    "FILLLAYOUT
        Form  FILL_SORT
    FORM FILL_SORT .
      SORT-DOWN = 'X'.
      SORT-SPOS = 1.
      SORT-FIELDNAME = 'MATNR'.
      SORT-tabname = 'MARA'.
      APPEND SORT.
    ENDFORM.                    " FILL_SORT
         Form  EVENT_CALL
    FORM EVENT_CALL .
      DATA: I_EVENT LIKE V_EVENTS.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          I_LIST_TYPE = 0
        IMPORTING
          ET_EVENTS   = V_EVENTS.
      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.                    " EVENT_CALL
        Form  POPULATE_EVENT
    FORM POPULATE_EVENT .
      READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'USER_COMMAND'.
      IF SY-SUBRC EQ 0.
        WA_EVENT-FORM = 'USER_COMMAND'.
        MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
        WA_EVENT-NAME.
    READ TABLE V_EVENTS WITH KEY NAME = SLIS_EV_END_OF_PAGE
                                          INTO WA_EVENT.
    IF SY-SUBRC = 0.
       move 'END_OF_PAGE' to WA_EVENT-FORM.
       MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
       WA_EVENT-NAME.
      endif.
      ENDIF.
    ENDFORM.                    "POPULATE_EVENT
    FORM END_OF_PAGE.
      write: sy-uline(50).
      skip.
      write:/40 'Page:', sy-pagno .
    ENDFORM.
    *&      Form  USER_COMMAND
    FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
    RS_SELFIELD TYPE SLIS_SELFIELD.
      CASE R_UCOMM.
        WHEN '&IC1'.
          CASE RS_SELFIELD-FIELDNAME.
            when 'MATNR'.
              read table itab with key matnr = RS_SELFIELD-VALUE.
              if sy-subrc = 0.
                PERFORM DATA_RETRIEVAL_MAKT USING RS_SELFIELD-VALUE.
                PERFORM BUILD_FIELDCATLOG_MAKT.
                PERFORM FILLLAYOUT_MAKT.
                PERFORM DISPLAY_ALV_MAKT.
                CLEAR RS_SELFIELD.
              ENDIF.
          ENDCASE.
      ENDCASE.
    ENDFORM.                    "user_command
         Form  DATA_RETRIEVAL_MAKT
    FORM DATA_RETRIEVAL_MAKT USING TMATNR .
      SELECT MATNR
             MAKTX
             MAKTG
             UP TO 100 ROWS
             FROM MAKT
             INTO TABLE ITAB1
             WHERE SPRAS = 'EN' AND MATNR = TMATNR.
      LOOP AT ITAB1.
        data id_color type i VALUE 1.
        data id_colors(2) type c.
        id_color = id_color + 1.
        if id_color > 7.
          id_color = 1.
        endif.
        id_colors = id_color.
        concatenate 'C' id_colors '10' into itab1-color.
        modify itab1.
        CLEAR ITAB1.
      ENDLOOP.
    ENDFORM.                    "DATA_RETRIEVAL_MAKT
         Form  FILLLAYOUT_MAKT
    FORM FILLLAYOUT_MAKT .
      CLEAR I_LAYOUT.
      i_layout-zebra = 'X'.
      i_layout-info_fieldname = 'COLOR'.
      i_layout-box_fieldname = 'SEL'.
      I_LAYOUT-EDIT ='X'.
      I_LAYOUT-colwidth_optimize = 'X'.
      I_LAYOUT-window_titlebar = 'EXAMPLE FOR ALV GRID'.
    ENDFORM.                    " LAYOUT_MAKT
        Form  BUILD_FIELDCATLOG_MAKT
    FORM BUILD_FIELDCATLOG_MAKT .
      REFRESH FIELDCAT.
      WA_FIELDCAT-FIELDNAME = 'MATNR'.
      WA_FIELDCAT-KEY = 'X'.
      WA_FIELDCAT-COL_POS = '1'.
    *WA_FIELDCAT-EDIT_MASK  = 'DD.MM.YYYY'.
      WA_FIELDCAT-EMPHASIZE = 'C510'.
      wa_fieldcat-seltext_m = 'MATERIAL NUMBER'.
      APPEND WA_FIELDCAT TO FIELDCAT.
      clear wa_fieldcat.
      WA_FIELDCAT-FIELDNAME = 'MAKTX'.
      WA_FIELDCAT-COL_POS = '2'.
      WA_FIELDCAT-EMPHASIZE = 'C710'.
      wa_fieldcat-seltext_m = 'MATERIAL DESCRIPTION'.
      APPEND WA_FIELDCAT TO FIELDCAT.
      clear wa_fieldcat.
      WA_FIELDCAT-FIELDNAME = 'MAKTG'.
      WA_FIELDCAT-COL_POS = '3'.
      WA_FIELDCAT-EMPHASIZE = 'C210'.
      wa_fieldcat-seltext_m = 'MATERIAL DESCRIPTION'.
      APPEND WA_FIELDCAT TO FIELDCAT.
      clear wa_fieldcat.
    ENDFORM.                    " BUILD_FIELDCATLOG_MAKT
         Form  DISPLAY_ALV_MAKT
    FORM TOP-OF-PAGE.
      REFRESH I_LISTHEADER.
      DATA: ld_lines type i,
            ld_linesc(10) type c,
            I_DATE(10) TYPE C,
            I_INFO LIKE WA_LISTHEADER-INFO.
      WA_LISTHEADER-TYP = 'H'.
      WA_LISTHEADER-INFO = 'MATERIAL DESCRIPTION FOR SELECTED NUMBER'.
      APPEND WA_LISTHEADER TO I_LISTHEADER.
      CLEAR WA_LISTHEADER.
      WA_LISTHEADER-TYP = 'S'.
      WA_LISTHEADER-KEY = 'DATE :'.
      CONCATENATE SY-DATUM+6(2) '.'
                           SY-DATUM+4(2) '.'
                           SY-DATUM(4) INTO I_DATE.
      WA_LISTHEADER-INFO = I_datE.
      APPEND WA_LISTHEADER TO I_LISTHEADER.
      CLEAR WA_LISTHEADER.
      describe table ITAB1 lines ld_lines.
      ld_linesc = ld_lines.
      concatenate 'TOTAL NUMBER OF RECORD SELECTED: ' ld_linesc
                        into I_INFO separated by space.
      WA_LISTHEADER-TYP  = 'A'.
      WA_LISTHEADER-INFO = I_INFO.
      append WA_LISTHEADER to I_LISTHEADER.
      clear: WA_LISTHEADER , I_INFO.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          IT_LIST_COMMENTARY = I_LISTHEADER
          I_LOGO             = 'ENJOYSAP_LOGO'.
      I_END_OF_LIST_GRID       =
      I_ALV_FORM               =
    ENDFORM.                    "TOP-OF-PAGE
    *&      Form  DISPLAY_ALV_MAKT
          text
    FORM DISPLAY_ALV_MAKT .
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          I_CALLBACK_PROGRAM     = SY-REPID
          I_CALLBACK_TOP_OF_PAGE = 'TOP-OF-PAGE'
          I_GRID_TITLE           = I_TITLE_MAKT
          IS_LAYOUT              = I_LAYOUT
          IT_FIELDCAT                       = fieldcat
        TABLES
          T_OUTTAB               = ITAB1
        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_MAKT
    Rewards points

  • How to devide the top of page in alv grid display

    hi all
    in the alv grid display am getting the page number and total number of pages in the left hand side
    but what i need is i need in the right hand side
    how to get that

    Hi,
    PLease refer to the code below:
    *& 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,
          gt_events     type slis_t_event,
          gd_prntparams type slis_print_alv.
    *Start-of-selection.
    START-OF-SELECTION.
    perform data_retrieval.
    perform build_fieldcatalog.
    perform build_layout.
    perform build_events.
    perform build_print_params.
    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'.
      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_events
                is_print                = gd_prntparams
                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
    * Form  TOP-OF-PAGE                                                 *
    * ALV Report Header                                                 *
    Form top-of-page.
    *ALV Header declarations
    data: t_header type slis_t_listheader,
          wa_header type slis_listheader,
          t_line like wa_header-info,
          ld_lines type i,
          ld_linesc(10) type c.
    * Title
      wa_header-typ  = 'H'.
      wa_header-info = 'EKKO Table Report'.
      append wa_header to t_header.
      clear wa_header.
    * Date
      wa_header-typ  = 'S'.
      wa_header-key = 'Date: '.
      CONCATENATE  sy-datum+6(2) '.'
                   sy-datum+4(2) '.'
                   sy-datum(4) INTO wa_header-info.   "todays date
      append wa_header to t_header.
      clear: wa_header.
    * Total No. of Records Selected
      describe table it_ekko lines ld_lines.
      ld_linesc = ld_lines.
      concatenate 'Total No. of Records Selected: ' ld_linesc
                        into t_line separated by space.
      wa_header-typ  = 'A'.
      wa_header-info = t_line.
      append wa_header to t_header.
      clear: wa_header, t_line.
      call function 'REUSE_ALV_COMMENTARY_WRITE'
           exporting
                it_list_commentary = t_header.
    *            i_logo             = 'Z_LOGO'.
    endform.
    *       FORM USER_COMMAND                                          *
    *       --> R_UCOMM                                                *
    *       --> RS_SELFIELD                                            *
    FORM user_command USING r_ucomm LIKE sy-ucomm
                      rs_selfield TYPE slis_selfield.
    * Check function code
      CASE r_ucomm.
        WHEN '&IC1'.
    *   Check field clicked on within ALVgrid report
        IF rs_selfield-fieldname = 'EBELN'.
    *     Read data table, using index of row user clicked on
          READ TABLE it_ekko INTO wa_ekko INDEX rs_selfield-tabindex.
    *     Set parameter ID for transaction screen field
          SET PARAMETER ID 'BES' FIELD wa_ekko-ebeln.
    *     Sxecute transaction ME23N, and skip initial data entry screen
          CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
        ENDIF.
      ENDCASE.
    ENDFORM.
    *&      Form  BUILD_EVENTS
    *       Build events table
    form build_events.
      data: ls_event type slis_alv_event.
      call function 'REUSE_ALV_EVENTS_GET'
           exporting
                i_list_type = 0
           importing
                et_events   = gt_events[].
      read table gt_events with key name =  slis_ev_end_of_page
                               into ls_event.
      if sy-subrc = 0.
        move 'END_OF_PAGE' to ls_event-form.
        append ls_event to gt_events.
      endif.
        read table gt_events with key name =  slis_ev_end_of_list
                               into ls_event.
      if sy-subrc = 0.
        move 'END_OF_LIST' to ls_event-form.
        append ls_event to gt_events.
      endif.
    endform.                    " BUILD_EVENTS
    *&      Form  BUILD_PRINT_PARAMS
    *       Setup print parameters
    form build_print_params.
      gd_prntparams-reserve_lines = '3'.   "Lines reserved for footer
      gd_prntparams-no_coverpage = 'X'.
    endform.                    " BUILD_PRINT_PARAMS
    *&      Form  END_OF_PAGE
    form END_OF_PAGE.
      data: listwidth type i,
            ld_pagepos(10) type c,
            ld_page(10)    type c.
      write: sy-uline(50).
      skip.
      write:/40 'Page:', sy-pagno .
    endform.
    *&      Form  END_OF_LIST
    form END_OF_LIST.
      data: listwidth type i,
            ld_pagepos(10) type c,
            ld_page(10)    type c.
      skip.
      write:/40 'Page:', sy-pagno .
    endform.
    Thanks,
    Sriram Ponna.

  • Fill fields with actual date / timestamp with button

    Hello,
    I did not find an answer for my following problem.
    I want to put a button my adobe form that fills automactically three fields with data from the PC which are:
    actual time (of the PC and of course timezone info), date and username, so the User has to press one button to fill all these data for convenience. 
    So I think it is necessary to program this in JavaScript as an "on-click" action. Since I'am not too much familiar with this, it would be great if someone can post a little sample coding for this (or has some other tipp).
    regards and happy xmas
    Jörg

    you must have target fields for your Date, Time and Username, for example you have a structure in your data view called "ZINFO" with the fields "EDATE", "ETIME","ENAME"
    in your layout you need a button where you click on
    in the click event you can fill your fields (formcalc)
    xfa.resolveNode("xfa.record.ZINFO.EDATE").value = Num2Date(Date(), "DD/MM/YYYY");  
    xfa.resolveNode("xfa.record.ZINFO.ETIME").value = Num2Time(Time(), "HH:MM:SS", "de_DE");
    so you always get time/date when clicking
    but how do you know who has opened the form?? did you realize some password protection??
    br norbert

  • How to set only one row selection  in ALV GRID DISPLAY

    How to set single row selection in grid display
    not multiselection.

    Hi,
    In the USER COMMAND, build the code to check the REFRESHED Data & then check the number of records with SEL  = 'X'.
    If more than single entry found, then raise an error message.
    Best regards,
    Prashant

  • How to provide Menu Options like BACK in ALV Grid display?

    Hi Guys,
              My problem is after displaying Multiple ALV grids using OO .I was not able to provide Back option and all those are Deactivated onj the Menu bar.So,How to provide those options.?We have a GreenButton with Symbol Correct on that Menu Bar.I was not able to see Back button and it is Deactivated.How to activate that Button.so that after displaying i can click on Back button and go to selection options.
    Thanks,
    Gopi.

    Hi Rich,
             I changed likie what u told.But still not working.I was not able to go to the Selection screen even after clicking F3 or F5 or back button.
    Standard Toolbar
    Icon Function Key                   Function Code        Function Text
         F3                             F3                   Back
         Alt-Arrow <                    F3                   Back
    Function Key Setting
    Function Key                   Icon Function Code        Function Text
    F5                                  F3                   Back
    Ctrl-N                              F3                   Back
               These are all the things which i kept in se41 tr code.
    Thanks,
    gopi.

  • How to group data in ALV grid display

    Hello Experts,
    I am using REUSE_ALV_GRID_DISPLAY to display my data.
    here, I am using SLIS_T_FIELDCAT_ALV to create field catalog.
    My requirement is data of 1 field/column in ALV had to be displayed by grouping.
    Is there any field any fieldcatalog which I can set so that data will be displayed as after grouping.
    I had searched a lot but found solution for OO ALV but not for function modules.
    Edited by: shubh_ag on Sep 2, 2011 4:38 PM

    Hi shubh,
    try this,
    * Declarations related to ALV Display
    TYPE-POOLS : slis.
    DATA : gt_fcat TYPE slis_t_fieldcat_alv ,
           gs_fcat TYPE slis_fieldcat_alv,
           list_gt_fcat TYPE slis_t_fieldcat_alv ,
           list_gs_fcat TYPE slis_fieldcat_alv,
           gt_listheader TYPE slis_t_listheader,
           gs_listheader TYPE slis_listheader,
           gs_layout TYPE slis_layout_alv,
           list_gs_layout TYPE slis_layout_alv,
           gs_wvar TYPE i VALUE 1.
    DATA: gt_events           TYPE slis_t_event,
          gs_events           LIKE LINE OF gt_events,
          gt_sort             TYPE  slis_t_sortinfo_alv,
          gs_sort             TYPE slis_sortinfo_alv.
    DATA:gs_ovar TYPE disvariant.
    FORM alv_display .
      PERFORM field_catalog.
      PERFORM display_data.
    ENDFORM.                    " ALV_DISPLAY
    *&      Form  FIELD_CATALOG
          text
    -->  p1        text
    <--  p2        text
    FORM field_catalog .
      gs_fcat-col_pos   = gs_wvar.
      gs_fcat-tabname   = 'GT_FINAL'.
      gs_fcat-fieldname = 'MATERIAL'.
      gs_fcat-do_sum    = 'X'.
      gs_fcat-seltext_m = text-001.
      gs_fcat-emphasize = 'C510'.
      gs_fcat-fix_column = 'X'.
      APPEND gs_fcat TO gt_fcat.
      CLEAR gs_fcat.
      ADD 1 TO gs_wvar.
      gs_fcat-col_pos = gs_wvar.
      gs_fcat-tabname = 'GT_FINAL'.
      gs_fcat-fieldname = 'DESCRIPTION'.
      gs_fcat-seltext_m = text-011.
      gs_fcat-emphasize = 'C510'.
      gs_fcat-fix_column = 'X'.
      APPEND gs_fcat TO gt_fcat.
      CLEAR gs_fcat.
      ADD 1 TO gs_wvar.
      gs_fcat-col_pos = gs_wvar.
      gs_fcat-tabname = 'GT_FINAL'.
      gs_fcat-fieldname = 'TYPE'.
      gs_fcat-seltext_m = text-002.
      gs_fcat-emphasize = 'C510'.
      gs_fcat-fix_column = 'X'.
      APPEND gs_fcat TO gt_fcat.
      CLEAR gs_fcat.
      ADD 1 TO gs_wvar.
      gs_fcat-col_pos = gs_wvar.
      gs_fcat-tabname = 'GT_FINAL'.
      gs_fcat-fieldname = 'UOM'.
      gs_fcat-seltext_m = text-003.
      gs_fcat-emphasize = 'C510'.
      gs_fcat-fix_column = 'X'.
      APPEND gs_fcat TO gt_fcat.
      CLEAR gs_fcat.
      ADD 1 TO gs_wvar.
      gs_fcat-col_pos = gs_wvar.
      gs_fcat-tabname = 'GT_FINAL'.
      gs_fcat-fieldname = 'PLANT'.
      gs_fcat-do_sum    = 'X'.
      gs_fcat-seltext_m = text-004.
      gs_fcat-emphasize = 'C510'.
      gs_fcat-fix_column = 'X'.
      APPEND gs_fcat TO gt_fcat.
      CLEAR gs_fcat.
      ADD 1 TO gs_wvar.
      gs_fcat-col_pos = gs_wvar.
      gs_fcat-tabname = 'GT_FINAL'.
      gs_fcat-fieldname = 'PURCHASING_GROUP'.
      gs_fcat-seltext_m = text-005.
      gs_fcat-emphasize = 'C510'.
      gs_fcat-fix_column = 'X'.
      APPEND gs_fcat TO gt_fcat.
      CLEAR gs_fcat.
      ADD 1 TO gs_wvar.
      gs_fcat-col_pos = gs_wvar.
      gs_fcat-tabname = 'GT_FINAL'.
      gs_fcat-fieldname = 'MRP_TYPE'.
      gs_fcat-seltext_m = text-006.
      gs_fcat-emphasize = 'C510'.
      gs_fcat-fix_column = 'X'.
      APPEND gs_fcat TO gt_fcat.
      CLEAR gs_fcat.
      ADD 1 TO gs_wvar.
      gs_fcat-col_pos = gs_wvar.
      gs_fcat-tabname = 'GT_FINAL'.
      gs_fcat-fieldname = 'MRP_CONTROLLER'.
      gs_fcat-seltext_m = text-007.
      gs_fcat-emphasize = 'C510'.
      gs_fcat-fix_column = 'X'.
      APPEND gs_fcat TO gt_fcat.
      CLEAR gs_fcat.
      ADD 1 TO gs_wvar.
      gs_fcat-col_pos = gs_wvar.
      gs_fcat-tabname = 'GT_FINAL'.
      gs_fcat-fieldname = 'SPECIAL_PRO '.
      gs_fcat-seltext_m = text-008.
      gs_fcat-emphasize = 'C510'.
      gs_fcat-fix_column = 'X'.
      APPEND gs_fcat TO gt_fcat.
      CLEAR gs_fcat.
      ADD 1 TO gs_wvar.
      gs_fcat-col_pos = gs_wvar.
      gs_fcat-tabname = 'GT_FINAL'.
      gs_fcat-fieldname = 'STORAGE_LOCATION'.
      gs_fcat-seltext_m = text-009.
      gs_fcat-emphasize = 'C510'.
      gs_fcat-fix_column = 'X'.
      APPEND gs_fcat TO gt_fcat.
      CLEAR gs_fcat.
      ADD 1 TO gs_wvar.
      gs_fcat-col_pos   = gs_wvar.
      gs_fcat-tabname   = 'GT_FINAL'.
      gs_fcat-fieldname = 'UNRESTRCITED_STOCK'.
      gs_fcat-do_sum    = 'X'.
      gs_fcat-seltext_m = text-010.
      gs_fcat-emphasize = 'C510'.
      gs_fcat-fix_column = 'X'.
      APPEND gs_fcat TO gt_fcat.
      CLEAR gs_fcat.
      ADD 1 TO gs_wvar.
      gs_sort-fieldname = 'MATERIAL'.
      gs_sort-tabname = 'GT_FINAL'.
      gs_sort-subtot = 'X'.
      APPEND gs_sort TO gt_sort.
      gs_sort-fieldname = 'PLANT'.
      gs_sort-tabname = 'GT_FINAL'.
      gs_sort-subtot = 'X'.
      APPEND gs_sort TO gt_sort.
    ENDFORM.                    " FIELD_CATALOG
    *&      Form  DISPLAY_DATA
          text
    -->  p1        text
    <--  p2        text
    FORM display_data .
      DATA:c_top  TYPE slis_formname.
      c_top  = 'TOP'.
    " For avoiding EPC warnings
    CLEAR sy-index.
    IF sy-index EQ 1.
      PERFORM top.
    ENDIF.
      gs_layout-zebra = 'X'.
      gs_layout-colwidth_optimize = 'X'.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program      = sy-cprog
          i_callback_user_command = 'USER_COMMAND'
          i_callback_top_of_page  = c_top
          is_layout               = gs_layout
          it_fieldcat             = gt_fcat[]
          it_sort                 = gt_sort
          i_default               = 'X'
          i_save                  = 'U'
          is_variant              = gs_ovar
        TABLES
          t_outtab                = gt_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.                    " DISPLAY_DATA
    Regards,
    Abhisek

  • Reg displaying a Field as Drop Down in ALV Grid Display

    Hi All,
    I have developed an ALV report program with one editable field using FM "REUSE_ALV_GRID_DISPLAY_LVC". My requirement is to make that editable field as dropdown box so that user can choose from the options. If i press SAVE all those will gets saved in a Ztable. Everything is working fine. But no values are getting populated in dropdown box.
    Kindly do the needful.
    Thanks in advance.

    Hi,
    Check out follwing subroutines in below programs.
    perform build_fieldcat changing pt_fieldcat.
    perform set_drdn_table.
    BCALV_EDIT_06
    BCALV_EDIT_07

  • How to get the SAVE Layout  ICON on ALV Grid display report

    Hi,
      I am using the standard ALV Layout, and I do not get the SAVE LAYOUT Icon on the Menubar, where I could save the report Layout.I am using the layout routine as,
    FORM layout_build USING   u_lf_layout TYPE slis_layout_alv.
      u_lf_layout-box_fieldname       = 'SELK'.  " Checkbox
      u_lf_layout-zebra               =  'X'.
      u_lf_layout-colwidth_optimize   =  'X'.
      u_lf_layout-confirmation_prompt =  'X'.
      u_lf_layout-get_selinfos        =  'X'.
      u_lf_layout-f2code              =  '&ETA' .
      u_lf_layout-detail_titlebar     =  'Delivery Due List'.
      u_lf_layout-key_hotspot         =  'X'.
      u_lf_layout-info_fieldname      =  'COL'.
    ENDFORM.                    " layout_build
    Is there anything that I am missing. Please suggest.Many thanks for your help.
    Regards,
    Mira

    Hi,
    i think you've forgotten param. <b>i_save</b>
      x_save = 'X'.
      gs_variant-report     = sy-repid.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
           EXPORTING
                I_STRUCTURE_NAME = 'ZTAB01'
                IS_VARIANT       = gs_variant
                IS_layout        = lay
                I_SAVE           = x_save
           TABLES
                T_OUTTAB         = gridtab
           EXCEPTIONS
                OTHERS           = 1.
    regards Andreas

  • Filling bc travel data model with test data

    Hey i read somewhere that there is a app to fill the bc travel data model with test data.I been searching but havent found one in the preview version.Please help me if anyone knows how to get it done.Filling it manually is taking a whole lot of time.

    Go to the ABAP Editor (SE38) and execute the SAPBC_DATA_GENERATOR program. This program generates suitable sample data in the tables of the flight data application.

  • Sample report for filling the database table with test data .

    Hi ,
    Can anyone provide me sample report for filling the database table with test data ?
    Thanks ,
    Abhi.

    hi
    the code
    data : itab type table of Z6731_DEPTDETAIL,
           wa type Z6731_DEPTDETAIL.
    wa-DEPT_ID = 'z897hkjh'.
    wa-DESCRIPTION = 'computer'.
    append wa to itab.
    wa-DEPT_ID = 'z897hkjhd'.
    wa-DESCRIPTION = 'computer'.
    append wa to itab.
    loop at itab into wa.
    insert z6731_DEPTDETAIL from wa.
    endloop.
    rewards if helpful

  • How do I continue with running dates in numbers?

    How do I continue with running dates in numbers?  Using numbers with dates and need to have them autofill across instead of my typing them in manually.

    Hi jonles,
    Type a date then press enter. Click once on that cell and hover the cursor over the right hand side of the cell. This will show the Fill handle (yellow dot). Drag it to the right.
    That will fill by adding a day to each cell.
    To create a series, enter two dates (e.g. 1 Jan then 8 Jan). Select both and drag right to create a weekly series.
    Regards,
    Ian.

Maybe you are looking for