IDOC with ALV report

Hi All,
i written a program for IDOC its generating idoc succesfully,
now my requirement is to create an IDOC with ALV report.
this is new to me, so pls kindly give some sample code to generate an IDOC with ALV report.
regards,
Msrinu.

Hi ,
this is my outpt internal table, from this i want idoc no,cust no,cust name,EAN,net price,guebg,currrency thsese fields i want to produce as ALV report. this is i written in se38 as standlone program for generating an idoc.
BEGIN OF gt_output,
        idoc       LIKE edidc-docnum,           "M01
        kunnr(10)        TYPE c, "Customer Number 1
        addrnumber(10)   TYPE c, " Address No
        name1(40)        TYPE c, " Customer Name
        name2(40)        TYPE c, " Customer Name
        street(60)       TYPE c, " Street
        str_suppl2(40)   TYPE c, " Address
        str_suppl3(40)   TYPE c, " Address
        city1(40)        TYPE c, " City
        post_code1(10)   TYPE c, " Postal Code
        region(3)        TYPE c, " Code identifying County
        country(3)       TYPE c, " Code identifying County
        tel_number(30)   TYPE c, " Telephone
        matnr(18)        TYPE c, " Material no.
        werks(4)         TYPE c, " Werks
        netpr(11)        TYPE c, " Net price
        waerk(5)         TYPE c, " Document Currency
        vbeln(10)        TYPE c, " Sales Document No
        knumh(10)        TYPE c, " Condition record number
        kopos(2)         TYPE c, " Sequential number of the condition
        konwa(5)         TYPE c, " Rate unit (currency or percentage)
        kbetr(11)        TYPE c, " Rate
        kpein(5)         TYPE c, " Condition pricing unit
        kmein(3)         TYPE c, " Condition unit
        ean11(18)        TYPE c, " International Article Number (EAN/UPC)
        kdmat(35)        TYPE c, " Material Number Used by Customer
        kappl(2)         TYPE c, " Application
        kschl(4)         TYPE c, " Condition  type
        datbi(8)         TYPE c, " Validity end date of the condition record
        datab(8)         TYPE c, " Validity start date of the condition record
        guebg(8)         TYPE c, " Valid-from date
        gueen(8)         TYPE c, " ValiD-to date
        eikto(12)        TYPE c, " Supplier number
        cunit(5)         TYPE c, " Consumer unit
     END OF gt_output,
regards,
msrinu.

Similar Messages

  • How to Print Selection-Screen along with ALV Report output

    Hi,
    I have a requirement wherein i need to also print the Selection Screen of a report when I print the ALV report output.
    Basically i need to print the ALV output along with selection screen.
    Could you plz suggest me the way.
    Regards,
    Nitin

    Hi,
    My selection Screen is a very big one. It contains around 30 select-options.
    So is their any standard method in which you can choose whether you want to take the output printout with or without Selection screen.
    Regards,
    Nitin

  • Problem with ALV Report Column

    Hi
    I have ALV report that got tons of columns and most of them are showing correctly. But there are two or three where i have a do sum checked got a small problem. The HEADING of the columns says NUMBER instead of its column name...
    Look at my code:
      ls_fieldcat-fieldname      =      'ETIME'.
      ls_fieldcat-ref_tabname    =      'REC'.
      ls_fieldcat-ref_fieldname  =      'ETIME'.
      ls_fieldcat-seltext_s      =      'ET      '.
      ls_fieldcat-seltext_m      =      'Et Tm           '.
      ls_fieldcat-seltext_l      =   'End Time             '.
      append ls_fieldcat to pt_fieldcat.
      ls_fieldcat-fieldname      =                'HOURS'.
      ls_fieldcat-ref_tabname    =                'PC2BF'.
      ls_fieldcat-ref_fieldname  =                'ANZHL'.
      ls_fieldcat-seltext_s      =                'Hrs    '.
      ls_fieldcat-seltext_m      =                'Hors '.
      ls_fieldcat-seltext_l      =                'Hours'.
      ls_fieldcat-decimals_out = 2.
      ls_fieldcat-no_zero = 'X'.
      ls_fieldcat-datatype = 'DEC'.
      ls_fieldcat-do_sum = 'X'.
      append ls_fieldcat to pt_fieldcat.
      ls_fieldcat-no_zero = ''.
      ls_fieldcat-datatype = ''.
      ls_fieldcat-outputlen = ''.
      ls_fieldcat-do_sum = ''.
      ls_fieldcat-decimals_out = ''.
      ls_fieldcat-fieldname = ''.
      ls_fieldcat-fieldname      =                'PNUMB'.
      ls_fieldcat-ref_tabname    =                'PC20E'.
      ls_fieldcat-ref_fieldname  =                'PRAKN'.
      ls_fieldcat-seltext_s      =                'P#     '.
      ls_fieldcat-seltext_m      =     'Pre #       '.
      ls_fieldcat-seltext_l      =   'Premium #           '.
      ls_fieldcat-datatype       =                'NUMC'.
      append ls_fieldcat to pt_fieldcat.
      ls_fieldcat-datatype       = ''.
    The column with Hours is showing NUMBER with the total sum but the column before and after that shows correctly.
    I have tried taken out the
    <b> ls_fieldcat-do_sum = 'X'.</b>
    Then its shows correctly but i need it to do the sum.
    Is there anything i need to do in order to show the columns correctly?
    Please help. <b><REMOVED BY MODERATOR></b>. thanks
    Message was edited by:
            Anwarul Kabir
    Message was edited by:
            Anwarul Kabir
    Message was edited by:
            Alvaro Tejada Galindo

    here is the whole program. you can upload this run it for your self if that helps in any way...
    *& Report  ZHEADCOUNT       *
    REPORT  ZHEADCOUNT no standard page
    heading message-id zw line-size 255.
    *       Dictionary tables/structures
    tables: teven,
            ZSHIFTS,
            ZHEADCT.
    * Global ALV Data Declarations
    type-pools slis.
    include: rpcxB200, RPTBAL01.
    DATA: BEGIN OF REC OCCURS 0,
      PERNR LIKE TEVEN-PERNR,
      LDATE LIKE TEVEN-LDATE,
      LTIME LIKE TEVEN-LTIME,
      SATZA LIKE TEVEN-SATZA,
      TERID LIKE TEVEN-TERID,
      PLANS LIKE TEVEN-PLANS.
    DATA: END OF REC.
    data:
      begin of x_sortinfo_alv occurs 0,
          spos                  like alvdynp-sortpos,
          fieldname             type slis_fieldname,
          tabname               type slis_fieldname,
          up                    like alvdynp-sortup,
          down                  like alvdynp-sortdown,
          group                 like alvdynp-grouplevel,
          subtot                like alvdynp-subtotals,
          comp(1)               type c,
          expa(1)               type c,
          obligatory(1)         type c,
        end   of x_sortinfo_alv,
        d                like scal-indicator,  
        v_variant        like disvariant,
        v_repid          like sy-repid,
        v_save(1)        type c,
        lv_sortseq       type i,
        s_title(20),    
        fieldcat         type slis_t_fieldcat_alv,
        ls_line          type slis_listheader,
        gd_layout        type slis_layout_alv,
        gt_sp_group      type slis_t_sp_group_alv,
        gt_sort          type slis_t_sortinfo_alv,
        ls_sort          type slis_sortinfo_alv,
        events           type slis_t_event,
        list_top_of_page type slis_t_listheader,
        top_of_page      type slis_formname value 'TOP_OF_PAGE',
        v_exit(1)        type c,
        v_pdsnr like assob-pdsnr,
        ls_fieldcat type slis_t_fieldcat_alv.
    constants:
      alv_slis_formname       type slis_formname value 'ALV_USER_COMMAND',
      c_yes                   like space value 'X',
      c_no                    like space value space,
      c_dev LIKE  sy-sysid VALUE 'DEV',
      c_device(4) TYPE c   VALUE 'LOCL'.
    * define selection screen
    selection-screen begin of block elmo with frame title text-001.
    selection-screen begin of line.
    selection-screen comment 1(30) text-002.
    select-options  p_terid for TEVEN-TERID.
    selection-screen end of line.
    selection-screen begin of line.
    selection-screen comment 1(30) text-003.
    select-options p_shift for ZSHIFTS-DWS.
    selection-screen end of line.
    selection-screen end of block elmo.
    selection-screen begin of block blk2 with frame title text-004.
    PARAMETERS: p_vari like disvariant-variant.
    selection-screen end   of block blk2.
    *  Form  Initialization
    initialization.
      v_repid = sy-repid.
      v_save = 'A'.
      clear v_variant.
      v_variant-report = v_repid.
    * Get default variant
      alv_variant = v_variant.
      call function 'REUSE_ALV_VARIANT_DEFAULT_GET'
        EXPORTING
          i_save     = v_save
        CHANGING
          cs_variant = alv_variant
        EXCEPTIONS
          not_found  = 2.
      if sy-subrc = 0.
        p_vari = alv_variant-variant.
      endif.
    *  At Selection-Screen event (value help)
    at selection-screen on value-request for p_vari.
      perform f4_for_variant.
    *  At Selection-Screen event (check input data)
    at selection-screen on p_vari.
      if p_vari <> space.
        v_variant-report  = v_repid.
        v_variant-variant = p_vari.
        call function 'REUSE_ALV_VARIANT_SELECT'
          EXPORTING
            i_dialog            = c_no
            it_default_fieldcat = field_tab[]
            i_layout            = gs_layout
          CHANGING
            cs_variant          = v_variant.
        if sy-subrc <> 0.
          call function 'REUSE_ALV_VARIANT_SELECT'
            EXPORTING
              i_dialog            = c_yes
              it_default_fieldcat = field_tab[]
              i_layout            = gs_layout
            CHANGING
              cs_variant          = v_variant.
        endif.
      endif.
    *                       main logic
    TOP-OF-PAGE.
    START-OF-SELECTION.
    GET PERNR.
      RP-PROVIDE-FROM-LAST P0001 SPACE PNPBEGDA PNPENDDA.
    * process the data according to the payroll area
      IF PERNR-WERKS EQ P0001-WERKS AND PERNR-BTRTL EQ P0001-BTRTL
         AND PERNR-KOSTL EQ P0001-KOSTL AND PERNR-BUKRS EQ P0001-BUKRS
         AND PERNR-ABKRS EQ P0001-ABKRS AND PERNR-KOKRS EQ P0001-KOKRS.
        PERFORM RETRIEVE_Time.
      ENDIF.
    END-OF-SELECTION.
      Perform call_alv.
    *==================================*
    *=================================*
    FORM RETRIEVE_Time.
    Clear: REC.
           Select * from teven where PERNR EQ PERNR-PERNR
                                 AND TERID IN p_terid
                                 AND LDATE >= PNPBEGDA
                                 AND LDATE <= PNPENDDA.
                MOVE:
                     TEVEN-PERNR TO REC-PERNR,
                     TEVEN-LDATE TO REC-LDATE,
                     TEVEN-LTIME TO REC-LTIME,
                     TEVEN-SATZA TO REC-SATZA,
                     TEVEN-TERID TO REC-TERID,
                     TEVEN-PLANS TO REC-PLANS.
                APPEND REC.
           endselect.
    ENDFORM.                            " RETRIEVE_PAYROLL
    *  CALL_ALV
    form call_alv.
      perform build_field_catalog using field_tab[].
      perform build_eventtab      using events[].
      perform comment_build       using header_alv[].
      perform build_sorttab       using gt_sort[].
      perform build_layout.
    * Call ABAP List Viewer
      call function 'REUSE_ALV_GRID_DISPLAY'
        exporting
          i_callback_program      = v_repid
          i_callback_user_command = 'ALV_USER_COMMAND'
          i_structure_name        = 'REC'
          it_fieldcat             = field_tab
          it_special_groups       = gt_sp_group
          it_sort                 = gt_sort
          i_save                  = v_save
          is_variant              = v_variant
          it_events               = events
          is_layout               = gd_layout
        tables
          t_outtab                 = REC
        exceptions
          program_error            = 1
          others                   = 2.
    endform.                    "call_alv
    * BUILD_FIELD_CATALOG
    form build_field_catalog USING pt_fieldcat type
                                   slis_t_fieldcat_alv.
    *  data:  ls_fieldcat type slis_fieldcat_alv.
      clear: fieldcat, pt_fieldcat[].
      data : l_tabname type slis_tabname. " Table Name
       l_tabname = 'REC'.
      call function 'REUSE_ALV_FIELDCATALOG_MERGE'
        exporting
          i_program_name = v_repid
          i_internal_tabname = l_tabname
          i_inclname = v_repid
        changing
          ct_fieldcat = ls_fieldcat
        exceptions
          inconsistent_interface = 1
          program_error = 2
          others = 3.
      if sy-subrc <> 0.
        message id sy-msgid type sy-msgty number sy-msgno
        with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      else.
    *    append ls_fieldcat to pt_fieldcat.
      endif.
    endform.                    "build_field_catalog
    * BUILD_EVENTTAB
    form build_eventtab using events type slis_t_event.
    * Registration of events to happen during list display
      data: tmp_event type slis_alv_event.
      call function 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          i_list_type = 0
        IMPORTING
          et_events   = events.
      read table events with key name = slis_ev_top_of_page into tmp_event.
      if sy-subrc = 0.
        move top_of_page to tmp_event-form.
        append tmp_event to events.
      endif.
    endform.                    "build_eventtab
    * COMMENT_BUILD
    form comment_build using pt_top_of_page type slis_t_listheader.
      data: v_head_string(255) value space, d1(2), m1(2), y1(2), d2(2), m2(2), y2(2).
      clear: ls_line, pt_top_of_page.
      ls_line-typ  = 'H'.
      data pnpfrom(10).
      data pnpto(10).
      data: print_date(10).
      data: print_time(10).
      d1 = PNPBEGDA+6(2).          d2 = PNPENDDA+6(2).
      m1 = PNPBEGDA+4(2).          m2 = PNPENDDA+4(2).
      y1 = PNPBEGDA+2(2).          y2 = PNPENDDA+2(2).
      concatenate m1 '/' d1 '/' y1 into pnpfrom.
      concatenate m2 '/' d2 '/' y2 into pnpto.
      ls_line-info = sy-repid.
      append ls_line to pt_top_of_page.
      concatenate 'Printed by:' sy-uname 'on' print_date 'at' print_time
      into ls_line-info separated by space.
      append ls_line to pt_top_of_page.
      ls_line-info = 'BGM INDUSTRIES, INC.'.
      append ls_line to pt_top_of_page.
      concatenate 'Period:' pnpfrom 'to' pnpto
      into ls_line-info separated by space.
      append ls_line to pt_top_of_page.
    endform.                    "comment_build
    *       Build layout for ALV grid report
    form build_layout.
      gd_layout-no_input          = 'X'.
      gd_layout-colwidth_optimize = 'X'.
    *  gd_layout-totals_text       = 'Totals'(255).
    *  gd_layout-info_fieldname    = 'LINE_COLOR'.
    endform.                    " BUILD_LAYOUT
    * TOP_OF_PAGE
    form top_of_page.
      call function 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          i_logo             = 'Z_BGLOGO'
          it_list_commentary = header_alv.
    endform.                    "top_of_page
    *&      Form  build_sorttab
    *       Set up the sorting for the report.
    form build_sorttab using pt_sort type slis_t_sortinfo_alv.
      clear lv_sortseq.
      perform build_sort tables pt_sort changing ls_sort.
      ls_sort-fieldname = 'PERNR'.
      ls_sort-subtot    = 'X'.
    endform.                    " build_sorttab
    *  Use to add another sort field.
    form build_sort
      tables   pt_sort
      changing ls_sort structure x_sortinfo_alv.
      clear ls_sort.
      add 1 to lv_sortseq.
      ls_sort-spos = lv_sortseq.
      ls_sort-up = 'X'.
      ls_sort-tabname = 'REC'.
    endform.                    "build_sort
    *&      Form  f4_for_variant
    form f4_for_variant.
      call function 'REUSE_ALV_VARIANT_F4'
        EXPORTING
          is_variant = v_variant
          i_save     = v_save
        IMPORTING
          e_exit     = v_exit
          es_variant = alv_variant
        EXCEPTIONS
          not_found  = 2.
      if sy-subrc = 2.
        message id sy-msgid type 'S' number sy-msgno
                with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      else.
        if v_exit = space.
          p_vari = alv_variant-variant.
        endif.
      endif.
    endform.
    Message was edited by:
            Anwarul Kabir

  • How to start with ALV reports

    hi xprts,
    pz tell me how to use ALV with a simple sample program ..
    thanks

    Hi,
    For More alv report examples check these Tcodes LIBS, BIBS Here u can find more number of examples on alv reports of different kinds
    check this sample code for intercative alv report
    codeTYPE-POOLS: SLIS.
    *type declaration for values from ekko
    TYPES: BEGIN OF I_EKKO,
    EBELN LIKE EKKO-EBELN,
    AEDAT LIKE EKKO-AEDAT,
    BUKRS LIKE EKKO-BUKRS,
    BSART LIKE EKKO-BSART,
    LIFNR LIKE EKKO-LIFNR,
    END OF I_EKKO.
    DATA: IT_EKKO TYPE STANDARD TABLE OF I_EKKO INITIAL SIZE 0,
    WA_EKKO TYPE I_EKKO.
    *type declaration for values from ekpo
    TYPES: BEGIN OF I_EKPO,
    EBELN LIKE EKPO-EBELN,
    EBELP LIKE EKPO-EBELP,
    MATNR LIKE EKPO-MATNR,
    MENGE LIKE EKPO-MENGE,
    MEINS LIKE EKPO-MEINS,
    NETPR LIKE EKPO-NETPR,
    END OF I_EKPO.
    DATA: IT_EKPO TYPE STANDARD TABLE OF I_EKPO INITIAL SIZE 0,
    WA_EKPO TYPE I_EKPO .
    *variable for Report ID
    DATA: V_REPID LIKE SY-REPID .
    *declaration for fieldcatalog
    DATA: I_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
    WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
    DATA: IT_LISTHEADER TYPE SLIS_T_LISTHEADER.
    declaration for events table where user comand or set PF status will
    be defined
    DATA: V_EVENTS TYPE SLIS_T_EVENT,
    WA_EVENT TYPE SLIS_ALV_EVENT.
    declartion for layout
    DATA: ALV_LAYOUT TYPE SLIS_LAYOUT_ALV.
    declaration for variant(type of display we want)
    DATA: I_VARIANT TYPE DISVARIANT,
    I_VARIANT1 TYPE DISVARIANT,
    I_SAVE(1) TYPE C.
    *PARAMETERS : p_var TYPE disvariant-variant.
    *Title displayed when the alv list is displayed
    DATA: I_TITLE_EKKO TYPE LVC_TITLE VALUE 'FIRST LIST DISPLAYED'.
    DATA: I_TITLE_EKPO TYPE LVC_TITLE VALUE 'SECONDRY LIST DISPLAYED'.
    INITIALIZATION.
    V_REPID = SY-REPID.
    PERFORM BUILD_FIELDCATLOG.
    PERFORM EVENT_CALL.
    PERFORM POPULATE_EVENT.
    START-OF-SELECTION.
    PERFORM DATA_RETRIEVAL.
    PERFORM BUILD_LISTHEADER USING IT_LISTHEADER.
    PERFORM DISPLAY_ALV_REPORT.
    *& Form BUILD_FIELDCATLOG
    Fieldcatalog has all the field details from ekko
    FORM BUILD_FIELDCATLOG.
    WA_FIELDCAT-TABNAME = 'IT_EKKO'.
    WA_FIELDCAT-FIELDNAME = 'EBELN'.
    WA_FIELDCAT-SELTEXT_M = 'PO NO.'.
    APPEND WA_FIELDCAT TO I_FIELDCAT.
    CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'IT_EKKO'.
    WA_FIELDCAT-FIELDNAME = 'AEDAT'.
    WA_FIELDCAT-SELTEXT_M = 'DATE.'.
    APPEND WA_FIELDCAT TO I_FIELDCAT.
    CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'IT_EKKO'.
    WA_FIELDCAT-FIELDNAME = 'BUKRS'.
    WA_FIELDCAT-SELTEXT_M = 'COMPANY CODE'.
    APPEND WA_FIELDCAT TO I_FIELDCAT.
    CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'IT_EKKO'.
    WA_FIELDCAT-FIELDNAME = 'BUKRS'.
    WA_FIELDCAT-SELTEXT_M = 'DOCMENT TYPE'.
    APPEND WA_FIELDCAT TO I_FIELDCAT.
    CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'IT_EKKO'.
    WA_FIELDCAT-FIELDNAME = 'LIFNR'.
    WA_FIELDCAT-NO_OUT = 'X'.
    WA_FIELDCAT-SELTEXT_M = 'VENDOR CODE'.
    APPEND WA_FIELDCAT TO I_FIELDCAT.
    CLEAR WA_FIELDCAT.
    ENDFORM. "BUILD_FIELDCATLOG
    *& Form EVENT_CALL
    we get all events - TOP OF PAGE or USER COMMAND in table v_events
    FORM EVENT_CALL.
    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
    EXPORTING
    I_LIST_TYPE = 0
    IMPORTING
    ET_EVENTS = V_EVENTS
    EXCEPTIONS
    LIST_TYPE_WRONG = 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. "EVENT_CALL
    *& Form POPULATE_EVENT
    Events populated for TOP OF PAGE & USER COMAND
    FORM POPULATE_EVENT.
    READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.
    IF SY-SUBRC EQ 0.
    WA_EVENT-FORM = 'TOP_OF_PAGE'.
    MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
    WA_EVENT-FORM.
    ENDIF.
    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.
    ENDIF.
    ENDFORM. "POPULATE_EVENT
    *& Form data_retrieval
    retreiving values from the database table ekko
    FORM DATA_RETRIEVAL.
    SELECT EBELN AEDAT BUKRS BSART LIFNR FROM EKKO INTO TABLE IT_EKKO.
    ENDFORM. "data_retrieval
    *& Form bUild_listheader
    text
    -->I_LISTHEADEtext
    FORM BUILD_LISTHEADER USING I_LISTHEADER TYPE SLIS_T_LISTHEADER.
    DATA HLINE TYPE SLIS_LISTHEADER.
    HLINE-INFO = 'this is my first alv pgm'.
    HLINE-TYP = 'H'.
    ENDFORM. "build_listheader
    *& Form display_alv_report
    text
    FORM DISPLAY_ALV_REPORT.
    V_REPID = SY-REPID.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    I_CALLBACK_PROGRAM = V_REPID
    I_CALLBACK_PF_STATUS_SET = ' '
    I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
    I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'
    I_GRID_TITLE = I_TITLE_EKKO
    I_GRID_SETTINGS =
    IS_LAYOUT = ALV_LAYOUT
    IT_FIELDCAT = I_FIELDCAT[]
    IT_EXCLUDING =
    IT_SPECIAL_GROUPS =
    IT_SORT =
    IT_FILTER =
    IS_SEL_HIDE =
    i_default = 'ZLAY1'
    I_SAVE = 'A'
    is_variant = i_variant
    IT_EVENTS = V_EVENTS
    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 TOP_OF_PAGE
    text
    FORM TOP_OF_PAGE.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
    IT_LIST_COMMENTARY = IT_LISTHEADER
    i_logo =
    I_END_OF_LIST_GRID =
    ENDFORM. "TOP_OF_PAGE
    *& Form USER_COMMAND
    text
    -->R_UCOMM text
    -->, text
    -->RS_SLEFIELDtext
    FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
    RS_SELFIELD TYPE SLIS_SELFIELD.
    CASE R_UCOMM.
    WHEN '&IC1'.
    READ TABLE IT_EKKO INTO WA_EKKO INDEX RS_SELFIELD-TABINDEX.
    PERFORM BUILD_FIELDCATLOG_EKPO.
    PERFORM EVENT_CALL_EKPO.
    PERFORM POPULATE_EVENT_EKPO.
    PERFORM DATA_RETRIEVAL_EKPO.
    PERFORM BUILD_LISTHEADER_EKPO USING IT_LISTHEADER.
    PERFORM DISPLAY_ALV_EKPO.
    ENDCASE.
    ENDFORM. "user_command
    *& Form BUILD_FIELDCATLOG_EKPO
    text
    FORM BUILD_FIELDCATLOG_EKPO.
    WA_FIELDCAT-TABNAME = 'IT_EKPO'.
    WA_FIELDCAT-FIELDNAME = 'EBELN'.
    WA_FIELDCAT-SELTEXT_M = 'PO NO.'.
    APPEND WA_FIELDCAT TO I_FIELDCAT.
    CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'IT_EKPO'.
    WA_FIELDCAT-FIELDNAME = 'EBELP'.
    WA_FIELDCAT-SELTEXT_M = 'LINE NO'.
    APPEND WA_FIELDCAT TO I_FIELDCAT.
    CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'I_EKPO'.
    WA_FIELDCAT-FIELDNAME = 'MATNR'.
    WA_FIELDCAT-SELTEXT_M = 'MATERIAL NO.'.
    APPEND WA_FIELDCAT TO I_FIELDCAT.
    CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'I_EKPO'.
    WA_FIELDCAT-FIELDNAME = 'MENGE'.
    WA_FIELDCAT-SELTEXT_M = 'QUANTITY'.
    APPEND WA_FIELDCAT TO I_FIELDCAT.
    CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'I_EKPO'.
    WA_FIELDCAT-FIELDNAME = 'MEINS'.
    WA_FIELDCAT-SELTEXT_M = 'UOM'.
    APPEND WA_FIELDCAT TO I_FIELDCAT.
    CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'I_EKPO'.
    WA_FIELDCAT-FIELDNAME = 'NETPR'.
    WA_FIELDCAT-SELTEXT_M = 'PRICE'.
    APPEND WA_FIELDCAT TO I_FIELDCAT.
    CLEAR WA_FIELDCAT.
    ENDFORM. "BUILD_FIELDCATLOG_EKPO
    *& Form event_call_ekpo
    we get all events - TOP OF PAGE or USER COMMAND in table v_events
    FORM EVENT_CALL_EKPO.
    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
    EXPORTING
    I_LIST_TYPE = 0
    IMPORTING
    ET_EVENTS = V_EVENTS
    EXCEPTIONS
    LIST_TYPE_WRONG = 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. "event_call_ekpo
    *& Form POPULATE_EVENT
    Events populated for TOP OF PAGE & USER COMAND
    FORM POPULATE_EVENT_EKPO.
    READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.
    IF SY-SUBRC EQ 0.
    WA_EVENT-FORM = 'TOP_OF_PAGE'.
    MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
    WA_EVENT-FORM.
    ENDIF.
    ENDFORM. "POPULATE_EVENT
    *& Form TOP_OF_PAGE
    text
    FORM F_TOP_OF_PAGE.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
    IT_LIST_COMMENTARY = IT_LISTHEADER
    i_logo =
    I_END_OF_LIST_GRID =
    ENDFORM. "TOP_OF_PAGE
    *& Form USER_COMMAND
    text
    -->R_UCOMM text
    -->, text
    -->RS_SLEFIELDtext
    *retreiving values from the database table ekko
    FORM DATA_RETRIEVAL_EKPO.
    SELECT EBELN EBELP MATNR MENGE MEINS NETPR FROM EKPO INTO TABLE IT_EKPO.
    ENDFORM.
    FORM BUILD_LISTHEADER_EKPO USING I_LISTHEADER TYPE SLIS_T_LISTHEADER.
    DATA: HLINE1 TYPE SLIS_LISTHEADER.
    HLINE1-TYP = 'H'.
    HLINE1-INFO = 'CHECKING PGM'.
    ENDFORM.
    FORM DISPLAY_ALV_EKPO.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    I_INTERFACE_CHECK = ' '
    I_BYPASSING_BUFFER = ' '
    I_BUFFER_ACTIVE = ' '
    I_CALLBACK_PROGRAM = V_REPID
    I_CALLBACK_PF_STATUS_SET = ' '
    I_CALLBACK_USER_COMMAND = 'F_USER_COMMAND'
    I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'
    I_CALLBACK_HTML_TOP_OF_PAGE = ' '
    I_CALLBACK_HTML_END_OF_LIST = ' '
    I_STRUCTURE_NAME =
    I_BACKGROUND_ID = ' '
    I_GRID_TITLE = I_TITLE_EKPO
    I_GRID_SETTINGS =
    IS_LAYOUT =
    IT_FIELDCAT = I_FIELDCAT[]
    IT_EXCLUDING =
    IT_SPECIAL_GROUPS =
    IT_SORT =
    IT_FILTER =
    IS_SEL_HIDE =
    I_DEFAULT =
    I_SAVE = 'A'
    IS_VARIANT =
    IT_EVENTS = V_EVENTS
    TABLES
    T_OUTTAB = IT_EKPO
    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.[/code]
    cheers,
    vasavi.
    kindly reward if helpful.

  • Getting problem with ALV reports

    I am trying to set lock on columns in alv report so that when i scroll right the columns will stay fix. The code is
    REPORT ZBPALV.
    type-pools SLIS.
    data: w_fcat type slis_fieldcat_alv,
    t_fcat type slis_t_fieldcat_alv.
    w_fcat-fieldname = 'kunnr'.
    w_fcat-seltext_m = 'Customer'.
    w_fcat-key = 'x'.
    append w_fcat to t_fcat.
    data: begin of ty_kna1 occurs 100,
    kunnr type kunnr,
    end of ty_kna1.
    select kunnr from kna1 into table ty_kna1.
    *loop at ty_kna1.
    *write: ty_kna1-kunnr.
    *endloop.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    I_INTERFACE_CHECK = ' '
    I_BYPASSING_BUFFER = ' '
    I_BUFFER_ACTIVE = ' '
    I_CALLBACK_PROGRAM = ' '
    I_CALLBACK_PF_STATUS_SET = ' '
    I_CALLBACK_USER_COMMAND = ' '
    I_CALLBACK_TOP_OF_PAGE = ' '
    I_CALLBACK_HTML_TOP_OF_PAGE = ' '
    I_CALLBACK_HTML_END_OF_LIST = ' '
    I_STRUCTURE_NAME =
    I_BACKGROUND_ID = ' '
    I_GRID_TITLE =
    I_GRID_SETTINGS =
    IS_LAYOUT =
    IT_FIELDCAT = t_fcat
    IT_EXCLUDING =
    IT_SPECIAL_GROUPS =
    IT_SORT =
    IT_FILTER =
    IS_SEL_HIDE =
    I_DEFAULT = 'X'
    I_SAVE = ' '
    IS_VARIANT =
    IT_EVENTS =
    IT_EVENT_EXIT =
    IS_PRINT =
    IS_REPREP_ID =
    I_SCREEN_START_COLUMN = 0
    I_SCREEN_START_LINE = 0
    I_SCREEN_END_COLUMN = 0
    I_SCREEN_END_LINE = 0
    IT_ALV_GRAPHICS =
    IT_HYPERLINK =
    IT_ADD_FIELDCAT =
    IT_EXCEPT_QINFO =
    I_HTML_HEIGHT_TOP =
    I_HTML_HEIGHT_END =
    IMPORTING
    E_EXIT_CAUSED_BY_CALLER =
    ES_EXIT_CAUSED_BY_USER =
    TABLES
    T_OUTTAB = ty_kna1
    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.
    i came to know from a thread that w_fcat-key = 'x' will use for setting locks in fieldset.But its changing color which is right.Can i know how to fix the columns in alv report.
    Thanks in advance

    Hi
    KEY attribute displays your column output in Blue Color but it will not act as a fixed column.
    Try setting the FIX_COLUMN parameter = 'X'. Generally this is set along with the key fields just to make the output look similar to SAP standard table output.
    Hope this solves your problem.
    Enjoy SAP.
    Rajasekhar

  • Printing logo with ALV report output?

    Hi all,
    I have written a sinple program to display a report output in ALV grid format and inserted a logo in it usingh standrad FM. Though the logo is inserted successfully displaying with list ,  but  when i am clicking on print preview the logo is missing.
    Please help me on how to print the logo with the list?
    Thanks,
    Vamshi.

    Hi Krishna,
    -->Firstly go to T-Code OAER.
    -->Give Class Name as PICTURES
    -->Give Class Type as OT
    -->Give Object Key as(watever the name you wish to give)
    -->Example key 1000
    -->Click on Execute.
    Here you will get Standard Document Types.
    Select which ever you want i.e., Attachment,Screen,Template ,etc.
    Double click on Attchment it will ask you the File on the Desktop.
    Upload the image.
    Now you can see the Image in the Folder PICTURES.
    Now go to the Report.
    Function Module 'REUSE_ALV_COMMENTARY_WRITE'.
                             i_logo = '1000'.
    Hope this will Help you.
    With Regards,
    Sharmishta.

  • Short Dump with ALV Report

    Hi
    I have one Zreport which gives the result in ALV form.
    After getting the result(1 row with 33 columns) when I tried to export the ALV results to spread sheet using the option : List-> Export-> Spread Sheet OR by click on Excel icon in the display screen,I'm getting the short dump with the description "No more storage space available for extending an internal table" .
    After analysis ,find that dump is raising in the FM : F4_GET_RESULT of Include Program : LSDH3U03.
    Can anyone provide us some clue .
    Thanks & Regards,
    Sreeram

    Hi,
    If the display is in ALV grid format, then you can try another approach to save the data in a spreadsheet.
    - Right-click on any output cell.
    - Select 'Spreadsheet' from the drop down list
    - radio-button 'All available formats'
    - Excel (In existing XXL format)
    Thanks!
    VS.

  • Puting buttons in the appl bar with alv reporting

    hai
    im trying to put buttons in alv in  applctn bar
    the coding i made is
    perform eventtab.
    form eventtab.
    wa_event-name='set_pf_status'.
    wa_event-form = 'status'.
    append wa_event to tab_event.
    endform.
    form status.
    set pf-status 'ystatus'.----
    >status havin buttons.
    endform.
    the result is
    program is geting run time error(shortdump)
    error is too many parameters in the perform.
    in coding itis pointing arroe mark like this
    >form status.
    plz help me how to add buttons in application bar
    tahnks in advance
    sindu.

    you should not populate FORM name of STATUS to EVENTS. instead you have to give the FORM name to the FUnction module.
    check this link,to know how to give our own GUI status.
    Re: own PF-Status for REUSE_ALV_GRID_DISPLAY
    FORM F_SET_PF_STATUS USING RT_EXTAB TYPE SLIS_T_EXTAB.
      CLEAR : WA_EXTAB,
              IT_EXTAB.
    *--Set the Modified PF status for the ALV.
      SET PF-STATUS 'STATUS_01' EXCLUDING RT_EXTAB.
    you have to copy any ALV related GUI status (from SE41 transaction) to STATUS_01. standard alv programs starts with BCALV*. so check it in SE41
    copy it and add your own button to the Application tool bar.
    ENDFORM.                               " SET_PF_STATUS
    Regards
    Srikanth
    Message was edited by: Srikanth Kidambi

  • Problems with ALV report

    Hello,
    I have a report that is showing data by company code and vendor number. I have the file sorted by company code and vendor number. when I run the report for 1 company, the company code prints on the first line.all of the other lines have the company code blank. but about halfway down the report, the same company code prints again on 1 line and from there to the end the company code is blank. I would expect that only the first line would have the company code and all others would be blank. Also for the total line on a vendor break, the vendor number is appearing in 1 of the total lines. all of the other total lines have blanks in the vendor number field. When I run the report with different parameters, the 2 issues appear on different lines. I did line counts and vendor counts to see if there was a pattern but I could not find any.  I have looked at my code and I am not sure what is causing this printing problem.
    thanks in advance for the help

    I am attaching the code that I used.  I think that this is the only place where you define subtotals.
    c_check = 'X'.
    FORM sort_output CHANGING p_it_alv_sort TYPE slis_t_sortinfo_alv.
    Local data declaration
      DATA: wa_alv_sort TYPE slis_sortinfo_alv.
    First Sorting Parameters for Company.
      wa_alv_sort-spos      = 1.
      wa_alv_sort-fieldname = 'BUKRS'.
      wa_alv_sort-tabname   = 'IT_OUTDATA'.
      wa_alv_sort-up        = c_check.
      <b>wa_alv_sort-subtot    = c_check.</b>  APPEND wa_alv_sort TO p_it_alv_sort.
      CLEAR wa_alv_sort.
    Second Sorting Parameters for Vendor No.
      wa_alv_sort-spos      = 2.
      wa_alv_sort-fieldname = 'LIFNR'.
      wa_alv_sort-tabname   = 'IT_OUTDATA'.
      wa_alv_sort-up        = c_check.
      <b>wa_alv_sort-subtot    = c_check</b>.
      APPEND wa_alv_sort TO p_it_alv_sort.
      CLEAR wa_alv_sort.
    ENDFORM.                    "sort_output

  • ALV  report in ECC 6.0  'TOP-OF-PAGE'

    Hi Friends,
    Please, Kindly help me on below issue with Alv report for 'TOP-OF-PAGE' in ECC 6.0.
    I have written the following code for "top-of-page' which is not getting the text given on this event, please help me if i committed any mistake in code.
    type-pools : slis.
    TABLES : KNA1,VBAK.
    TYPES: BEGIN OF ty_kna1,
            kunnr TYPE kna1-kunnr,
            land1 TYPE kna1-land1,
            name1 TYPE kna1-name1,
            ort01 TYPE kna1-ort01,
           END OF ty_kna1.
    TYPES: BEGIN OF ty_vbak,
            vbeln TYPE vbak-vbeln,
            erdat TYPE vbak-erdat,
            ernam TYPE vbak-ernam,
            netwr TYPE vbak-netwr,
          END OF ty_vbak.
    DATA : W_KNA1 TYPE TY_KNA1,
           W_VBAK TYPE TY_VBAK,
           I_KNA1 TYPE STANDARD TABLE OF TY_KNA1,
           I_VBAK TYPE STANDARD TABLE OF TY_VBAK.
    DATA : W_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
           I_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
    DATA : V_REPID LIKE SY-REPID.
    DATA: IT_LISTHEADER TYPE SLIS_T_LISTHEADER.
    DATA: V_EVENTS TYPE SLIS_T_EVENT,
          WA_EVENT TYPE SLIS_ALV_EVENT.
    declartion for layout
    DATA: ALV_LAYOUT TYPE SLIS_LAYOUT_ALV.
    SELECT-OPTIONS : S_KUNNR FOR KNA1-KUNNR.
    INITIALIZATION.
    V_REPID = SY-REPID.
    PERFORM BUILD_FIELDCAT.
    PERFORM EVENT_CALL.
    PERFORM POPULATE_EVENT.
    START-OF-SELECTION.
    PERFORM DATA_RETRIEVAL.
    PERFORM BUILD_LISTHEADER USING IT_LISTHEADER.
    END-OF-SELECTION.
    PERFORM DISPLAY_DATA.
    *&      Form  BUILD_FIELDCAT
          text
    -->  p1        text
    <--  p2        text
    form BUILD_FIELDCAT .
    W_FIELDCAT-TABNAME    = 'I_KNA1'.
    W_FIELDCAT-FIELDNAME  = 'KUNNR'.
    W_FIELDCAT-SELTEXT_M = 'CUST NAME'.
    APPEND W_FIELDCAT TO I_FIELDCAT.
    CLEAR W_FIELDCAT.
    W_FIELDCAT-TABNAME    = 'I_KNA1'.
    W_FIELDCAT-FIELDNAME  = 'LAND1'.
    W_FIELDCAT-SELTEXT_M = 'COUNTRY'.
    APPEND W_FIELDCAT TO I_FIELDCAT.
    CLEAR W_FIELDCAT.
    W_FIELDCAT-TABNAME    = 'I_KNA1'.
    W_FIELDCAT-FIELDNAME  = 'NAME1'.
    W_FIELDCAT-SELTEXT_M = 'NAME'.
    APPEND W_FIELDCAT TO I_FIELDCAT.
    CLEAR W_FIELDCAT.
    W_FIELDCAT-TABNAME    = 'I_KNA1'.
    W_FIELDCAT-FIELDNAME  = 'ORT01'.
    W_FIELDCAT-SELTEXT_M = 'CITY'.
    APPEND W_FIELDCAT TO I_FIELDCAT.
    CLEAR W_FIELDCAT.
    endform.                    " BUILD_FIELDCAT
    *&      Form  DATA_RETRIEVAL
          text
    -->  p1        text
    <--  p2        text
    form DATA_RETRIEVAL .
    SELECT KUNNR LAND1 NAME1 ORT01 FROM KNA1
                                   INTO TABLE I_KNA1
                                   WHERE KUNNR IN S_KUNNR.
    endform.                    " DATA_RETRIEVAL
    *&      Form  DISPLAY_DATA
          text
    -->  p1        text
    <--  p2        text
    form DISPLAY_DATA .
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
       I_CALLBACK_PROGRAM                = V_REPID
      I_CALLBACK_PF_STATUS_SET          = ' '
      I_CALLBACK_USER_COMMAND           = ' '
       I_CALLBACK_TOP_OF_PAGE            = 'TOP_OF_PAGE'
      I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
      I_CALLBACK_HTML_END_OF_LIST       = ' '
      I_STRUCTURE_NAME                  =
      I_BACKGROUND_ID                   = ' '
      I_GRID_TITLE                      =
      I_GRID_SETTINGS                   =
       IS_LAYOUT                         = ALV_LAYOUT
       IT_FIELDCAT                       = I_FIELDCAT[]
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         = 'X'
      I_SAVE                            = ' '
      IS_VARIANT                        =
       IT_EVENTS                         = V_EVENTS
      IT_EVENT_EXIT                     =
      IS_PRINT                          =
      IS_REPREP_ID                      =
      I_SCREEN_START_COLUMN             = 0
      I_SCREEN_START_LINE               = 0
      I_SCREEN_END_COLUMN               = 0
      I_SCREEN_END_LINE                 = 0
      I_HTML_HEIGHT_TOP                 = 0
      I_HTML_HEIGHT_END                 = 0
      IT_ALV_GRAPHICS                   =
      IT_HYPERLINK                      =
      IT_ADD_FIELDCAT                   =
      IT_EXCEPT_QINFO                   =
      IR_SALV_FULLSCREEN_ADAPTER        =
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER           =
      ES_EXIT_CAUSED_BY_USER            =
      TABLES
        t_outtab                          = I_KNA1
    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
    *&      Form  BUILD_LISTHEADER
          text
         -->P_IT_LISTHEADER  text
    form BUILD_LISTHEADER  using i_listheader TYPE SLIS_T_LISTHEADER.
      DATA HLINE TYPE SLIS_LISTHEADER.
      HLINE-INFO = 'CUSTOMER DETAILS'.
      HLINE-TYP = 'H'.
      append hline to it_listheader.
        CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          IT_LIST_COMMENTARY       = I_LISTHEADER
       i_logo                   =
       I_END_OF_LIST_GRID       =
    endform.                    " BUILD_LISTHEADER
    *&      Form  EVENT_CALL
          text
    -->  p1        text
    <--  p2        text
    form EVENT_CALL .
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
       EXPORTING
         I_LIST_TYPE           = 0
       IMPORTING
         ET_EVENTS             = V_EVENTS
    EXCEPTIONS
       LIST_TYPE_WRONG       = 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.                    " EVENT_CALL
    *&      Form  POPULATE_EVENT
          text
    -->  p1        text
    <--  p2        text
    form POPULATE_EVENT .
      READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.
      IF SY-SUBRC EQ 0.
        WA_EVENT-FORM = 'TOP_OF_PAGE'.
        MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
    WA_EVENT-FORM.
      ENDIF.
    Thanks in Advance,
    Chandra.

    type-pools : slis.
    TABLES : KNA1,VBAK.
    TYPES: BEGIN OF ty_kna1,
    kunnr TYPE kna1-kunnr,
    land1 TYPE kna1-land1,
    name1 TYPE kna1-name1,
    ort01 TYPE kna1-ort01,
    END OF ty_kna1.
    TYPES: BEGIN OF ty_vbak,
    vbeln TYPE vbak-vbeln,
    erdat TYPE vbak-erdat,
    ernam TYPE vbak-ernam,
    netwr TYPE vbak-netwr,
    END OF ty_vbak.
    DATA : W_KNA1 TYPE TY_KNA1,
    W_VBAK TYPE TY_VBAK,
    I_KNA1 TYPE STANDARD TABLE OF TY_KNA1,
    I_VBAK TYPE STANDARD TABLE OF TY_VBAK.
    DATA : W_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
    I_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
    DATA : V_REPID LIKE SY-REPID.
    DATA: IT_LISTHEADER TYPE SLIS_T_LISTHEADER.
    DATA: V_EVENTS TYPE SLIS_T_EVENT,
    WA_EVENT TYPE SLIS_ALV_EVENT.
    declartion for layout
    DATA: ALV_LAYOUT TYPE SLIS_LAYOUT_ALV.
    SELECT-OPTIONS : S_KUNNR FOR KNA1-KUNNR.
    INITIALIZATION.
    V_REPID = SY-REPID.
    PERFORM BUILD_FIELDCAT.
    PERFORM EVENT_CALL.
    PERFORM POPULATE_EVENT.
    START-OF-SELECTION.
    PERFORM DATA_RETRIEVAL.
    PERFORM BUILD_LISTHEADER USING IT_LISTHEADER.
    END-OF-SELECTION.
    PERFORM DISPLAY_DATA.
    *& Form BUILD_FIELDCAT
    text
    --> p1 text
    <-- p2 text
    form BUILD_FIELDCAT .
    W_FIELDCAT-TABNAME = 'I_KNA1'.
    W_FIELDCAT-FIELDNAME = 'KUNNR'.
    W_FIELDCAT-SELTEXT_M = 'CUST NAME'.
    APPEND W_FIELDCAT TO I_FIELDCAT.
    CLEAR W_FIELDCAT.
    W_FIELDCAT-TABNAME = 'I_KNA1'.
    W_FIELDCAT-FIELDNAME = 'LAND1'.
    W_FIELDCAT-SELTEXT_M = 'COUNTRY'.
    APPEND W_FIELDCAT TO I_FIELDCAT.
    CLEAR W_FIELDCAT.
    W_FIELDCAT-TABNAME = 'I_KNA1'.
    W_FIELDCAT-FIELDNAME = 'NAME1'.
    W_FIELDCAT-SELTEXT_M = 'NAME'.
    APPEND W_FIELDCAT TO I_FIELDCAT.
    CLEAR W_FIELDCAT.
    W_FIELDCAT-TABNAME = 'I_KNA1'.
    W_FIELDCAT-FIELDNAME = 'ORT01'.
    W_FIELDCAT-SELTEXT_M = 'CITY'.
    APPEND W_FIELDCAT TO I_FIELDCAT.
    CLEAR W_FIELDCAT.
    endform. " BUILD_FIELDCAT
    *& Form DATA_RETRIEVAL
    text
    --> p1 text
    <-- p2 text
    form DATA_RETRIEVAL .
    SELECT KUNNR LAND1 NAME1 ORT01 FROM KNA1
    INTO TABLE I_KNA1
    WHERE KUNNR IN S_KUNNR.
    endform. " DATA_RETRIEVAL
    *& Form DISPLAY_DATA
    text
    --> p1 text
    <-- p2 text
    form DISPLAY_DATA .
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    I_INTERFACE_CHECK = ' '
    I_BYPASSING_BUFFER = ' '
    I_BUFFER_ACTIVE = ' '
    I_CALLBACK_PROGRAM = V_REPID
    I_CALLBACK_PF_STATUS_SET = ' '
    I_CALLBACK_USER_COMMAND = ' '
    I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'
    I_CALLBACK_HTML_TOP_OF_PAGE = ' '
    I_CALLBACK_HTML_END_OF_LIST = ' '
    I_STRUCTURE_NAME =
    I_BACKGROUND_ID = ' '
    I_GRID_TITLE =
    I_GRID_SETTINGS =
    IS_LAYOUT = ALV_LAYOUT
    IT_FIELDCAT = I_FIELDCAT[]
    IT_EXCLUDING =
    IT_SPECIAL_GROUPS =
    IT_SORT =
    IT_FILTER =
    IS_SEL_HIDE =
    I_DEFAULT = 'X'
    I_SAVE = ' '
    IS_VARIANT =
    IT_EVENTS = V_EVENTS
    IT_EVENT_EXIT =
    IS_PRINT =
    IS_REPREP_ID =
    I_SCREEN_START_COLUMN = 0
    I_SCREEN_START_LINE = 0
    I_SCREEN_END_COLUMN = 0
    I_SCREEN_END_LINE = 0
    I_HTML_HEIGHT_TOP = 0
    I_HTML_HEIGHT_END = 0
    IT_ALV_GRAPHICS =
    IT_HYPERLINK =
    IT_ADD_FIELDCAT =
    IT_EXCEPT_QINFO =
    IR_SALV_FULLSCREEN_ADAPTER =
    IMPORTING
    E_EXIT_CAUSED_BY_CALLER =
    ES_EXIT_CAUSED_BY_USER =
    TABLES
    t_outtab = I_KNA1
    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
    *& Form BUILD_LISTHEADER
    text
    -->P_IT_LISTHEADER text
    form TOP_OF_PAGE using i_listheader TYPE SLIS_T_LISTHEADER.
    DATA HLINE TYPE SLIS_LISTHEADER.
    HLINE-INFO = 'CUSTOMER DETAILS'.
    HLINE-TYP = 'H'.
    append hline to it_listheader.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
    IT_LIST_COMMENTARY = I_LISTHEADER
    i_logo =
    I_END_OF_LIST_GRID =
    endform. " BUILD_LISTHEADER
    *& Form EVENT_CALL
    text
    --> p1 text
    <-- p2 text
    form EVENT_CALL .
    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
    EXPORTING
    I_LIST_TYPE = 0
    IMPORTING
    ET_EVENTS = V_EVENTS
    EXCEPTIONS
    LIST_TYPE_WRONG = 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. " EVENT_CALL
    *& Form POPULATE_EVENT
    text
    --> p1 text
    <-- p2 text
    form POPULATE_EVENT .
    READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.
    IF SY-SUBRC EQ 0.
    WA_EVENT-FORM = 'TOP_OF_PAGE'.
    MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
    WA_EVENT-FORM.
    ENDIF.
    just change the code  as i have u will get it
    plz reward points if useful

  • SAPGUI JAVA 7.10 rev 3 (OSX 10.5.2): ALV reports freeze

    Dear All,
    I've tried to use rev 3 of sapgui for java for mac osx. I have serious issues with ALV reports that makes it unusable (rev 2 is ok so far).
    With big lists ALV freezes after showing about half of the first screen lines.
    Is anyone experiencing the same issue? Any news about a rev 4 version?
    Many thanks,
    Lorenzo

    Hi Lorenzo,
    did you double check if selecting multiple columns works with SAP GUI for Windows in the same report?
    If yes, I suggest to file a bug report so we can do a remote logon to run your custom report.
    If not it might be because of REUSE_ALV_GRID_DISPLAY itself or your parameters calling REUSE_ALV_GRID_DISPLAY.
    Best regards
    Rolf-Martin

  • Display Currency symbol with value in ALV Report

    Hi Experts,
    I need to display currency symbol with value in ALV Report like if currency type is dollar then $200.
    Here I am using field catalog type slis_t_fieldcat_alv and suing field merge catalog FM: 'REUSE_ALV_FIELDCATALOG_MERGE'
    I tried like this
        IF <fs_fieldcat>-fieldname = 'STPRS'.
          <fs_fieldcat>-seltext_s = 'Std Cost '.
          <fs_fieldcat>-seltext_m = 'Std Cost'.
          <fs_fieldcat>-seltext_l = 'Std Cost '
           <fs_fieldcat>-tabname = 'MBEW'.
          <fs_fieldcat>-ctabname = 'T001'.
          <fs_fieldcat>-cfieldname ='WAERS'.
          <fs_fieldcat>-datatype = 'CURR'.
        ENDIF.
    Please any one can suggest the solution for this.
    Advance Thanks.
    Regards,
    Bala Achari

    Hİ,
    Check this link.
    http://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=24379571
    Take care.
    Çağatay

  • To capture the selected rows along with edited field contents in alv report

    Dear All,
             I do have requirement where, in alv report output one field is editable and need to save the content of the edited field along with the selected rows.
             For example If there are 10 records displayed in the alv output with 20 fields.
    Out of this 20 fields one field (say XYZ) is editable. Also i have already created a new pushbutton (say ABC) on alv output. Now in the alv output if we maintain some value in the field (XYZ ) for the 2nd and 4th record and select this two records, and when clicked on the pushbutton (ABC) it has to update the DB table.
          I am using the Func Module  'REUSE_ALV_GRID_DISPLAY'. 
          Your early reply with sample code would be appreciated.
    Thanks in Advance.

    HI Naveen ,
    There is an import parameter "i_callback_program" in the function module,
    plz pass the program name to it.
    Capture the command by passing a field of type sy-ucomm to "I_CALLBACK_USER_COMMAND ".  Check the returned command and
    and program a functionality as desired.
    u can try the event double_click or at line selection. there u can use READLINE command to c if the line has been selected.
    In case it is , process the code segment.
    Regards
    Pankaj

  • Problem with Footer in ALV Report

    Hi Experts,
    What is coding for Footer In my ALV Report  how can I resolve it.
    for example will come in footer like this....
    'This Report is created by '
             Date is ',
              'Time is '
             Page No ' *
    Please find below the piece of codes
    REPORT  ZALV2      .
    TABLES :   MAKT.                            " Material Description
    TYPE-POOLS : SLIS.
    TYPES : BEGIN OF TY_MAKT,
            MATNR TYPE MATNR,                   " Material No
            SPRAS TYPE SPRAS,                   " Language Key
            MAKTX TYPE MAKTX,                   " Material Description
            MAKTG TYPE MAKTG,                   " Material des in upper case
            END OF TY_MAKT.
    DATA : T_MAKT TYPE STANDARD TABLE OF TY_MAKT INITIAL SIZE 0,
           T_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
           T_LISTHEADER TYPE SLIS_T_LISTHEADER.
    DATA : W_MAKT TYPE TY_MAKT,
           W_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
           W_LISTHEADER TYPE SLIS_LISTHEADER,
           W_LAYOUT TYPE SLIS_LAYOUT_ALV.
    CONSTANTS : C_MATNR TYPE SLIS_FIELDNAME VALUE 'MATNR',
                C_SPRAS TYPE SLIS_FIELDNAME VALUE 'SPRAS',
                C_MAKTX TYPE SLIS_FIELDNAME VALUE 'MAKTX',
                C_MAKTG TYPE SLIS_FIELDNAME VALUE 'MAKTG'.
    SELECTION-SCREEN BEGIN OF BLOCK BLK WITH FRAME TITLE TEXT-000.
    SELECT-OPTIONS : S_MATNR FOR MAKT-MATNR.
    SELECTION-SCREEN END OF BLOCK BLK.
    INITIALIZATION.
           PERFORM SUB_CLEAR_OBJ.
    AT SELECTION-SCREEN.                     " it is used for validation
           PERFORM SUB_VALIDATE_DATA.
    START-OF-SELECTION.
           PERFORM SUB_FETCH_DATA.
           PERFORM SUB_FIELDCAT USING :
                       C_MATNR TEXT-001  'X',
                       C_SPRAS TEXT-002  ' ',
                       C_MAKTX TEXT-003  ' ',
                       C_MAKTG TEXT-004  ' '.
           PERFORM SUB_LAYOUT.
           PERFORM SUB_DISPLAY.
    END-OF-SELECTION.
    TOP-OF-PAGE.
           PERFORM SUB_TOP_OF_PAGE.
           PERFORM SUB_WRITE_HEADER.
    END-OF-PAGE.
       PERFORM  SUB_SET_PF_STATUS.
    *&      Form  SUB_CLEAR_OBJ
          text
    -->  p1        text
    <--  p2        text
    FORM SUB_CLEAR_OBJ .
    REFRESH  : T_MAKT,
               T_FIELDCAT,
               T_LISTHEADER.
    CLEAR    : W_MAKT,
               W_FIELDCAT,
               W_LISTHEADER.
    ENDFORM.                    " SUB_CLEAR_OBJ
    *&      Form  SUB_VALIDATE_DATA
          text
    -->  p1        text
    <--  p2        text
    FORM SUB_VALIDATE_DATA .
    DATA :  L_MATNR TYPE MATNR.
    SELECT MATNR UP TO 1 ROWS FROM MAKT INTO L_MATNR.   " IN S_MATNR.
    ENDSELECT.
    IF SY-SUBRC <> 0.
    MESSAGE E000(15) WITH 'IT IS AN INVALID NUMBER'.
    ENDIF.
    ENDFORM.                    " SUB_VALIDATE_DATA
    *&      Form  SUB_FETCH_DATA
          text
    -->  p1        text
    <--  p2        text
    FORM SUB_FETCH_DATA .
    SELECT MATNR SPRAS MAKTX MAKTG FROM MAKT INTO TABLE T_MAKT WHERE MATNR
    IN S_MATNR.
    ENDFORM.                    " SUB_FETCH_DATA
    *&      Form  SUB_FIELDCAT
          text
         -->P_C_MATNR  text
         -->P_TEXT_001  text
         -->P_0122   text
         -->P_0123   text
    FORM SUB_FIELDCAT  USING :
                            FLD TYPE SLIS_FIELDNAME
                            TXT TYPE SCRTEXT_L
                           COL TYPE SLIS_FIELDCAT_ALV-OPTIMIZE
                            HPOT TYPE C.
    W_FIELDCAT-TABNAME = 'ZSHEREE2'.
    W_FIELDCAT-FIELDNAME = FLD.
    W_FIELDCAT-SELTEXT_M = TXT.
    *W_FIELDCAT-EMPHASIZE = COL.
    W_FIELDCAT-HOTSPOT = HPOT.
    APPEND W_FIELDCAT TO T_FIELDCAT.
    ENDFORM.                    " SUB_FIELDCAT
    *&      Form  SUB_LAYOUT
          text
    -->  p1        text
    <--  p2        text
    FORM SUB_LAYOUT .
    W_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
    W_LAYOUT-ZEBRA = 'X'.
    W_LAYOUT-F2CODE = '&ETA'.
    ENDFORM.                    " SUB_LAYOUT
    *&      Form  SUB_DISPLAY
          text
    -->  p1        text
    <--  p2        text
    FORM SUB_DISPLAY .
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
       I_CALLBACK_PROGRAM                = 'ZSHEREE2 '
       I_CALLBACK_PF_STATUS_SET          = 'PF_STATUS_SET '
      I_CALLBACK_USER_COMMAND           = ' '
       I_CALLBACK_TOP_OF_PAGE            = 'SUB_TOP_OF_PAGE '
      I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
      I_CALLBACK_HTML_END_OF_LIST       = ' '
      I_STRUCTURE_NAME                  =
      I_BACKGROUND_ID                   = 'ALV_BACKGROUND '
       I_GRID_TITLE                      = 'Header Item / Data'
      I_GRID_SETTINGS                   = 5
       IS_LAYOUT                         = W_LAYOUT
       IT_FIELDCAT                       = T_FIELDCAT
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         = 'X'
      I_SAVE                            = ' '
      IS_VARIANT                        =
      IT_EVENTS                         =
      IT_EVENT_EXIT                     =
      IS_PRINT                          =
      IS_REPREP_ID                      =
      I_SCREEN_START_COLUMN             =
      I_SCREEN_START_LINE               =
      I_SCREEN_END_COLUMN               = 0
      I_SCREEN_END_LINE                 = 0
      IT_ALV_GRAPHICS                   =
      IT_HYPERLINK                      =
      IT_ADD_FIELDCAT                   =
      IT_EXCEPT_QINFO                   =
      I_HTML_HEIGHT_TOP                 =
      I_HTML_HEIGHT_END                 =
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER           =
      ES_EXIT_CAUSED_BY_USER            =
      TABLES
        T_OUTTAB                          = T_MAKT
    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.                    " SUB_DISPLAY
    *&      Form  SUB_TOP_OF_PAGE
          text
    -->  p1        text
    <--  p2        text
    FORM SUB_TOP_OF_PAGE .
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
      EXPORTING
        IT_LIST_COMMENTARY       = T_LISTHEADER
      I_LOGO                   =
      I_END_OF_LIST_GRID       =
    REFRESH T_LISTHEADER.
    ENDFORM.                    " SUB_TOP_OF_PAGE
    *&      Form  SUB_WRITE_HEADER
          text
    -->  p1        text
    <--  p2        text
    FORM SUB_WRITE_HEADER .
    W_LISTHEADER-TYP  = 'H'.
    W_LISTHEADER-INFO = 'PLANT WISE DATA DISPLAYED'.
    APPEND W_LISTHEADER TO T_LISTHEADER.
    ENDFORM.                    " SUB_WRITE_HEADER
    *&      Form  SUB_SET_PF_STATUS
          text
    -->  p1        text
    <--  p2        text
    FORM PF_STATUS_SET USING
                            RT_EXTAB TYPE SLIS_T_EXTAB.
    SET PF-STATUS  'ZSTATUS1'.
    ENDFORM.                    " SUB_SET_PF_STATUS
    If any mistake  where i am wrong sorry for that.

    You create one subroutine for END-OF-PAGE. Call this in the FM,
    REUSE_ALV_EVENTS_GET.
    Example:
    Data:       i_event       TYPE slis_t_event.
    *&      Form  f_build_eventtab
          text
    FORM f_build_eventtab  USING   ps_event TYPE slis_t_event.
      DATA: wa_event TYPE slis_alv_event.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          i_list_type = 0
        IMPORTING
          et_events   = ps_event.
       READ TABLE ps_event WITH KEY name = slis_ev_end_of_page INTO wa_event.
      IF sy-subrc EQ c_0.
        MOVE slis_ev_end_of_page TO wa_event-form.
        APPEND wa_event TO ps_event.
      ENDIF.
    ENDFORM.                    " f_build_eventtab
    *&      Form  END OF PAGE                                             *
    *& To display the footer details                                *
    FORM end_of_page .      
    Write the footer details
    ENDFORM.                    "END_OF_PAGE
    I hope this will be useful for you.
    Regards,
    Joan

  • Problem with Page Break In ALV Report

    Hi
    I have got a problem in my ALV report. I have a checkbox in the user input screen where users decide whether they want a page break or not in the print preview (or print) page. Now i also have the option to have layout name in the input screen. so If i leave the layout box empty the check or not check of page break works fine. but if use a save layout name in the layout box the add check box doesn't work anymore. If i have a layout name in the layout box it doesn't matter whether i have checked for page break or not it does the same thing.(in one report it always puts the page breaked)
    Any ideas where to look for the error?
    here is the code for the page break. Opt5 is the check box.
      perform build_sort tables pt_sort changing ls_sort.
      ls_sort-fieldname = 'PERNR'.
      ls_sort-subtot    = 'X'.
    IF OPT5 = 'X'.
       ls_sort-GROUP = '*'.
      ENDIF.
      append ls_sort to pt_sort.
      ls_sort-subtot    = ' '.
      ls_sort-GROUP = ''.

    Never mind it was acting like the page break was not working because the layout was saved with the page break on/OFF.

Maybe you are looking for

  • Can't sync music on 3rd gen ipod touch

    I recently recieved a new laptop running windows 8.1 and at least three quarters of my music downloads will not sync to my ipod. I keep getting anywhere from file cannot be converted to unknown error has occurred. Yes some of these were downloaded fr

  • Can modprobe.d conf files be multiline?

    Hey i've created a fglrx.conf file which has two lines, one which blacklists radeon and one that load the fglrx module. However, I get the following output, so it doesn't seem to happy libkmod: kmod_config_parse: /etc/modprobe.d/fglrx.conf line 2: ig

  • JDBC Adapter problem

    Hi, We have a scenario, data comes SAP via proxy to XI and then SQL DB using JDBC adapter. Data is not being updated in SQL DB table. SXMB_MONI, shows a chequered flag. Any ideas. -Naveen.

  • Sales order third party

    Hi, In third party sales order pr is generated and then the PO is done using same PR afterwards some how user managed to delete the PR from sales order  schedule lines  now  the issue is i am not able to  see the PR  number in schedule lines .because

  • Microsoft Security Advisory (2757760): Vulnerabil​ity in Internet Explorer

    Vulnerability in Internet Explorer Could Allow Remote Code Execution Microsoft is investigating public reports of a vulnerability in Internet Explorer 6, Internet Explorer 7, Internet Explorer 8, and Internet Explorer 9. Internet Explorer 10 is not a