Alv report subtotals error

hai friend iam imple menting alv grid report in that iam getting dump error how can i solve this problem
iam posting my program pls any bady can help me pls
the program is
REPORT ZZ_TEST2 .
TABLES : KNA1,LFA1,LFB1,BSIK.
TYPE-POOLS: slis.                      " ALV Global types
data: BEGIN OF TBSIK OCCURS 0,
        BUKRS LIKE BSIK-BUKRS,
        LIFNR LIKE BSIK-LIFNR,
        BUDAT LIKE BSIK-BUDAT,
        SHKZG LIKE BSIK-SHKZG,
        DMBTR LIKE BSIK-DMBTR,
        UMSKZ LIKE BSIK-UMSKZ,
        GJAHR LIKE BSIK-GJAHR,
  END OF TBSIK.
DATA : BEGIN OF TLFA1 OCCURS 0,
       LIFNR LIKE LFA1-LIFNR,
END OF TLFA1.
DATA : BEGIN OF TLFB1 OCCURS 0,
       BLIFNR LIKE LFA1-LIFNR,
END OF TLFB1.
SELECTION-SCREEN : BEGIN OF BLOCK B1 WITH FRAME TITLE text-001.
SELECT-OPTIONS : s_LIFNR FOR TLFA1-LIFNR OBLIGATORY,
                 s_BUDAT FOR TBSIK-BUDAT.
PARAMETERS: GJAHR LIKE TBSIK-GJAHR.
SELECTION-SCREEN : END OF BLOCK B1.
INITIALIZATION.
START-OF-SELECTION.
  PERFORM f_read_data.
  PERFORM f_display_data.
     Form  f_read_data
FORM f_read_data.
  select bukrs lifnr budat shkzg dmbtr from bsik into table tbsik where
lifnr in s_lifnr.
ENDFORM.                               " F_READ_DATA
     Form  f_display_data
FORM f_display_data.
  DEFINE m_fieldcat.
    add 1 to ls_fieldcat-col_pos.
    ls_fieldcat-fieldname   = &1.
    ls_fieldcat-ref_tabname = 'tbsik'.
    ls_fieldcat-do_sum      = &2.
    ls_fieldcat-cfieldname  = &3.
    append ls_fieldcat to lt_fieldcat.
  END-OF-DEFINITION.
  DEFINE m_sort.
    add 1 to ls_sort-spos.
    ls_sort-fieldname = &1.
    ls_sort-up        = 'X'.
    ls_sort-subtot    = &2.
    append ls_sort to lt_sort.
  END-OF-DEFINITION.
  DATA:
    ls_fieldcat TYPE slis_fieldcat_alv,
    lt_fieldcat TYPE slis_t_fieldcat_alv,
    lt_sort     TYPE slis_t_sortinfo_alv,
    ls_sort     TYPE slis_sortinfo_alv,
    ls_layout   TYPE slis_layout_alv.
  m_fieldcat 'bukrs' ''  ''.
  m_fieldcat 'lifnr' ''  ''.
  m_fieldcat 'budat' ''  ''.
  m_fieldcat 'shkzg' 'X' 'shkzg'.
  m_fieldcat 'dmbtr' ''  ''.
m_sort 'bukrs' 'X'.                  " Sort by vkorg and subtotal
  m_sort 'lifnr' 'X'.                  " Sort by kunnr and subtotal
  m_sort 'shkzg' ''.                   " Sort by vbeln
  ls_layout-cell_merge = 'X'.
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
            is_layout   = ls_layout
            it_fieldcat = lt_fieldcat
            it_sort     = lt_sort
       TABLES
            t_outtab    = tbsik.
ENDFORM.                               " F_DISPLAY_DATA

Hello,
I have made the changes to ur code.
Just copy and paste the code
REPORT ZZ_TEST2 .
TABLES : KNA1,LFA1,LFB1,BSIK.
TYPE-POOLS: SLIS. " ALV Global types
DATA: BEGIN OF TBSIK OCCURS 0,
BUKRS LIKE BSIK-BUKRS,
LIFNR LIKE BSIK-LIFNR,
BUDAT LIKE BSIK-BUDAT,
SHKZG LIKE BSIK-SHKZG,
DMBTR LIKE BSIK-DMBTR,
UMSKZ LIKE BSIK-UMSKZ,
GJAHR LIKE BSIK-GJAHR,
END OF TBSIK.
DATA : BEGIN OF TLFA1 OCCURS 0,
LIFNR LIKE LFA1-LIFNR,
END OF TLFA1.
DATA : BEGIN OF TLFB1 OCCURS 0,
BLIFNR LIKE LFA1-LIFNR,
END OF TLFB1.
SELECTION-SCREEN : BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS : S_LIFNR FOR TLFA1-LIFNR OBLIGATORY,
S_BUDAT FOR TBSIK-BUDAT.
PARAMETERS: GJAHR LIKE TBSIK-GJAHR.
SELECTION-SCREEN : END OF BLOCK B1.
INITIALIZATION.
START-OF-SELECTION.
  PERFORM F_READ_DATA.
  PERFORM F_DISPLAY_DATA.
*FORM F_READ_DATA
FORM F_READ_DATA.
  SELECT BUKRS LIFNR BUDAT SHKZG DMBTR FROM BSIK INTO TABLE TBSIK WHERE
  LIFNR IN S_LIFNR.
ENDFORM. " F_READ_DATA
*FORM F_DISPLAY_DATA
FORM F_DISPLAY_DATA.
  DEFINE M_FIELDCAT.
    ADD 1 TO LS_FIELDCAT-COL_POS.
    LS_FIELDCAT-FIELDNAME = &1.
    LS_FIELDCAT-REF_TABNAME = 'tbsik'.
    LS_FIELDCAT-DO_SUM = &2.
    LS_FIELDCAT-CFIELDNAME = &3.
    APPEND LS_FIELDCAT TO LT_FIELDCAT.
  END-OF-DEFINITION.
  DEFINE M_SORT.
    ADD 1 TO LS_SORT-SPOS.
    LS_SORT-FIELDNAME = &1.
    LS_SORT-UP = 'X'.
    LS_SORT-SUBTOT = &2.
    APPEND LS_SORT TO LT_SORT.
  END-OF-DEFINITION.
  DATA:
  LS_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
  LT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
  LT_SORT TYPE SLIS_T_SORTINFO_ALV,
  LS_SORT TYPE SLIS_SORTINFO_ALV,
  LS_LAYOUT TYPE SLIS_LAYOUT_ALV.
  M_FIELDCAT 'BUKRS' '' ''.
  M_FIELDCAT 'LIFNR' '' ''.
  M_FIELDCAT 'BUDAT' '' ''.
  M_FIELDCAT 'SHKZG' 'X' 'SHKZG'.
  M_FIELDCAT 'DMBTR' '' ''.
  M_SORT 'BUKRS' 'X'. " Sort by vkorg and subtotal
  M_SORT 'LIFNR' 'X'. " Sort by kunnr and subtotal
  M_SORT 'SHKZG' ''. " Sort by vbeln
  LS_LAYOUT-CELL_MERGE = 'X'.
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
            IS_LAYOUT   = LS_LAYOUT
            IT_FIELDCAT = LT_FIELDCAT
            IT_SORT     = LT_SORT
       TABLES
            T_OUTTAB    = TBSIK.
ENDFORM. " F_DISPLAY_DATA
Cheers,
Vasanth

Similar Messages

  • In ALV report is possible to display the subtotals in separate column

    Hi,
    I have made one ALV report, i need to show the subtotals of ekpo-brtwr (Gross Value)  grouped by or sorted by
    ekko-ebeln (Purshasing Doc) but in separate column  not at the end of the line items of each purshasing doc
    any idea how can i do this?
    let us say i have the following cols in my report:
    ekko-bukrs
    ekko-ebeln,
    ekko-aedat,
    kko-lifnr,
    ekpo-brtwr
    i want to add one more col for example (T-Gross) and to fill it with the suptotals of (ekpo-brtwr) sorted by the
    ekko-ebeln (Purshasing Doc).
    thanks a lot.

    If you need one more column, then you need to expand the field catalog table and data table as you did for all other fields and you need to code the logic to calculate the subtotals and populate the new column, but if you want to have row, that will be easy. For more info you can [refer |http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/4063c42a-2549-2c10-fab6-a8c99d98b9b5?quicklink=index&overridelayout=true]this:

  • Subtotals and Totals In ALV Report

    Hi Experts,
    I have a problem in my current scenario,
    I have 3 fields,
    KUNNR, WAERS, DMBTR.
    000001 USD         100.00
    000001 USD         200.00
    000002 USD         100.00
    000002 USD         400.00
    000002 EUR         300.00
    000002 EUR         100.00
    The above mentioned is the data I have in my internal table & in my ALV report as well, Which is fine...!
    Now I need Subtotals for each customer,
    Means for customer 000001 The subtotal is 300 (USD)
    Means for customer 000002 The subtotal is 500 (USD)
    Means for customer 000002 The subtotal is 400 (EUR)
    At the end I need grand totals.
    USD 800
    EUR 400.
    Currently My field catalog is given below.
        FIELDCATALOG-COL_POS     = COL_POS.
        FIELDCATALOG-FIELDNAME   = 'DMBTR'.
        FIELDCATALOG-SELTEXT_M   = TEXT-106.
        FIELDCATALOG-DO_SUM      = 'X'.
        APPEND FIELDCATALOG TO FIELDCATALOG.
        CLEAR  FIELDCATALOG.
    what else I need to do for getting individual subtotals by currency and customers.
    Thanks & regards,
    Dileep .C

    Hi Deelip,
    FOR TOTAL:
    there is a property of fieldcatalog, that is do_sum.
    USE COED LIKE:
    PERFORM fieldcat USING:
    '1' 'KUNNR' 'I_MARD' 'CUSTOMER NO' ,
    '2' 'DMBTR' 'I_MARD' 'CURRENCY' ,
    FORM fieldcat USING value(p_0029)
    value(p_0030)
    value(p_0031)
    value(p_0032)
    wa_fieldcat-col_pos = p_0029.
    wa_fieldcat-fieldname = p_0030.
    wa_fieldcat-tabname = p_0031.
    wa_fieldcat-reptext = p_0032.
    wa_fieldcat-do_sum = 'X'.
    APPEND wa_fieldcat TO i_fieldcat.
    ENDFORM. " FIELDCAT
    in final output you will get the total of currency field.
    FOR SUB TOTAL:
    decleare: i_sort type standard table of slis_sortinfo_alv,
              wa_sort type slis_t_sortinfo_alv.
    wa_sort-spos = '1'.
    wa_sort-fieldname = 'KUNNR'.
    wa_sort-tablename = 'i_final'
    wa_sort-up = 'x'
    wa_sort-subtot = 'X'.
    wa_sort-spos = '2'.
    wa_sort-fieldname = 'WAERS'.
    wa_sort-tablename = 'i_final'
    wa_sort-up = 'x'
    wa_sort-subtot = 'X'.
    append wa_tab to i_sort.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    i_callback_program = sy-repid
    it_fieldcat = it_fieldcat
    it_sort = i_sort
    Hope this can solve your pbs.
    Regards,
    Tutun

  • Error in alv report

    hi expert i have created alv report ... it is giving runtime error .. in   CALL FUNCTION 'REUSE_ALV_EVENTS_GET' how to solve this plz help ....
    *& Report  ZALVTRIAL                                                   *
    REPORT  ZALVTRIAL                               .
    tables : vbak,vbap.
    type-pools: slis.
    types : begin of scr1,
            vbeln type VBELN_VA,
            erdat type erdat,
            ernam type ernam,
            end of scr1.
    data : i_vbak type standard table of scr1,
           wa_vbak type scr1.
    types : begin of scr2,
            vbeln type VBELN_VA,
            matnr type matnr,
            posnr type posnr_va,
            end of scr2.
    data : i_vbap type standard table of scr2,
           wa_vbap type scr2.
    types : begin of scr_final,
            vbeln type VBELN_VA,
            erdat type erdat,
            ernam type ernam,
            matnr type matnr,
            posnr type posnr_va,
            end of scr_final.
    data : i_final type standard table of scr_final,
           wa_final type scr_final.
    **START OF DATA DECLERATION  FOR ALV
    *DATA  FOR CATLOG
    DATA: wa_fldcat  TYPE  slis_fieldcat_alv,
          i_fldcat  TYPE slis_t_fieldcat_alv  WITH HEADER LINE .
    *DATA FOR EVENT
    DATA : wa_event  TYPE slis_alv_event,
           i_event  TYPE slis_t_event  WITH HEADER LINE.
    *DATA FOR HEADER
    DATA: wa_head  TYPE slis_listheader,
          i_head TYPE slis_t_listheader WITH HEADER LINE.
    *data for layout
    DATA: wa_layout  TYPE slis_layout_alv.
    selection-screen: begin of block b1 with frame title text-001.
    select-options: s_vbeln for vbak-vbeln .
    SELECTION-SCREEN: END OF BLOCK B1.          
    start-of-selection.
    select vbeln erdat ernam
    from vbak
    into table i_vbak where vbeln in s_vbeln.
    if sy-subrc <> 0.
      leave list-processing.
    else.
      sort i_vbak by vbeln.
    endif.
    if i_vbak[] is not initial.
      select vbeln matnr posnr
      from vbap
      into table i_vbap
      for all entries in i_vbak
      where vbeln = i_vbak-vbeln.
    endif.
    loop at i_vbak into wa_vbak.
      wa_final-vbeln = wa_vbak-vbeln.
      wa_final-erdat = wa_vbak-erdat .
      wa_final-ernam = wa_vbak-ernam .
      append wa_final to i_final.
    endloop.
    if sy-subrc = 0.
      loop at i_final into wa_final.
        read table i_vbap into wa_vbap
        with key vbeln = wa_vbak-vbeln binary search.
        if sy-subrc = 0.
          wa_final-matnr = wa_vbap-matnr.
          wa_final-posnr = wa_vbap-posnr.
          modify i_final from wa_final transporting matnr posnr.
        endif.
        clear : wa_vbap , wa_final.
      endloop.
    endif.
    **WRITE:/1 sy-uline(63).
    **WRITE:/1'|', 2 'Sales Document' COLOR 4 ON ,11'|',12 'Date' COLOR 5
    **ON
    **,21'|',22 'Name' COLOR 4 ON,35'|',
          36 'Material Number' COLOR 5 ON, 55'|',56 'line no' COLOR 4 ON
    **63'|'.
    **WRITE:/1 sy-uline(63).
    **LOOP AT  i_final INTO wa_final.
    WRITE:/1'|', 2 wa_final-vbeln,11'|',12  wa_final-erdat,21'|',22
    wa_final-ernam,35'|',
           36 wa_final-matnr, 55'|',56 wa_final-posnr,63'|'.
    **endloop.
    perform builtcatalog.
    perform event.
    perform listheader.
    perform layout.
    perform display.
    *&      Form  builtcatalog
          text
    form builtcatalog.
      wa_fldcat-col_pos = '1'.
      wa_fldcat-fieldname = 'vbeln'.
      wa_fldcat-tabname = 'I_FINAL'.
      wa_fldcat-reptext_ddic = 'Sales Document'.
      APPEND wa_fldcat  TO i_fldcat.
      CLEAR wa_fldcat.
      wa_fldcat-col_pos = '2'.
      wa_fldcat-fieldname = 'erdat'.
      wa_fldcat-tabname = 'I_FINAL'.
      wa_fldcat-reptext_ddic = 'Date'.
      APPEND wa_fldcat  TO i_fldcat.
      CLEAR wa_fldcat.
      wa_fldcat-col_pos = '3'.
      wa_fldcat-fieldname = 'ernam'.
      wa_fldcat-tabname = 'I_FINAL'.
      wa_fldcat-reptext_ddic = 'Name'.
      APPEND wa_fldcat  TO i_fldcat.
      CLEAR wa_fldcat.
      wa_fldcat-col_pos = '4'.
      wa_fldcat-fieldname = 'matnr'.
      wa_fldcat-tabname = 'I_FINAL'.
      wa_fldcat-reptext_ddic = 'Material Number'.
      APPEND wa_fldcat  TO i_fldcat.
      CLEAR wa_fldcat.
      wa_fldcat-col_pos = '5'.
      wa_fldcat-fieldname = 'posnr'.
      wa_fldcat-tabname = 'I_FINAL'.
      wa_fldcat-reptext_ddic = 'Sales Document Item'.
      APPEND wa_fldcat  TO i_fldcat.
      CLEAR wa_fldcat.
    endform.                    "builtcatalog
    *&      Form  event
          text
    form event.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
       EXPORTING
         I_LIST_TYPE = 0
        IMPORTING
          ET_EVENTS   = i_final[].
    EXCEPTIONS
       LIST_TYPE_WRONG       = 1
       OTHERS                = 2
      IF sy-subrc = 0.
        READ TABLE i_event INTO wa_event
        WITH KEY name  = slis_ev_top_of_page.
        IF sy-subrc = 0.
          wa_event-form = slis_ev_top_of_page.
          MODIFY i_event FROM wa_event  INDEX sy-tabix TRANSPORTING form.
        ENDIF.
        READ TABLE i_event INTO wa_event
         WITH KEY name  = slis_ev_pf_status_set .
        IF sy-subrc = 0.
          wa_event-form = slis_ev_pf_status_set .
          MODIFY i_event FROM wa_event  INDEX sy-tabix TRANSPORTING form.
        ENDIF.
        READ TABLE i_event INTO wa_event
         WITH KEY name  = slis_ev_user_command.
        IF sy-subrc = 0.
          wa_event-form = slis_ev_user_command .
          MODIFY i_event FROM wa_event  INDEX sy-tabix TRANSPORTING form.
        ENDIF.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    endform.                    "event
    *&      Form
          text
    form listheader.
      wa_head-typ = 'H'.
      wa_head-info = 'ALV PROGRAM                             AUTHOR jessy'
      APPEND wa_head  TO i_head.
    endform.                    "listheader
    *&      Form  layout
          text
    form layout.
      wa_layout-zebra = 'X'.
      wa_layout-f2code =  'DUB'.
    endform.                    "layout
    *&      Form  display
          text
    form display.
      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           = ' '
      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                         = wa_layout
       IT_FIELDCAT                       = i_fldcat[]
      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                          = i_event[]
    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

    Hi,
    The error has been corrected.
    Copy the following code and execute. You won't get any runtime errors.
    *& Report ZALVTRIAL *
    REPORT ZALVTRIAL .
    tables : vbak,vbap.
    type-pools: slis.
    types : begin of scr1,
    vbeln type VBELN_VA,
    erdat type erdat,
    ernam type ernam,
    end of scr1.
    data : i_vbak type standard table of scr1,
    wa_vbak type scr1.
    types : begin of scr2,
    vbeln type VBELN_VA,
    matnr type matnr,
    posnr type posnr_va,
    end of scr2.
    data : i_vbap type standard table of scr2,
    wa_vbap type scr2.
    types : begin of scr_final,
    vbeln type VBELN_VA,
    erdat type erdat,
    ernam type ernam,
    matnr type matnr,
    posnr type posnr_va,
    end of scr_final.
    data : i_final type standard table of scr_final,
    wa_final type scr_final.
    **START OF DATA DECLERATION FOR ALV
    *DATA FOR CATLOG
    DATA: wa_fldcat TYPE slis_fieldcat_alv,
    i_fldcat TYPE slis_t_fieldcat_alv WITH HEADER LINE .
    *DATA FOR EVENT
    DATA : wa_event TYPE slis_alv_event,
    i_event TYPE SLIS_T_EVENT." WITH HEADER LINE.   "-----> correction done here
    *DATA FOR HEADER
    DATA: wa_head TYPE slis_listheader,
    i_head TYPE slis_t_listheader WITH HEADER LINE.
    *data for layout
    DATA: wa_layout TYPE slis_layout_alv.
    selection-screen: begin of block b1 with frame title text-001.
    select-options: s_vbeln for vbak-vbeln .
    SELECTION-SCREEN: END OF BLOCK B1.
    start-of-selection.
    select vbeln erdat ernam
    from vbak
    into table i_vbak where vbeln in s_vbeln.
    if sy-subrc = 0.
    leave list-processing.
    else.
    sort i_vbak by vbeln.
    endif.
    if i_vbak[] is not initial.
    select vbeln matnr posnr
    from vbap
    into table i_vbap
    for all entries in i_vbak
    where vbeln = i_vbak-vbeln.
    endif.
    loop at i_vbak into wa_vbak.
    wa_final-vbeln = wa_vbak-vbeln.
    wa_final-erdat = wa_vbak-erdat .
    wa_final-ernam = wa_vbak-ernam .
    append wa_final to i_final.
    endloop.
    if sy-subrc = 0.
    loop at i_final into wa_final.
    read table i_vbap into wa_vbap
    with key vbeln = wa_vbak-vbeln binary search.
    if sy-subrc = 0.
    wa_final-matnr = wa_vbap-matnr.
    wa_final-posnr = wa_vbap-posnr.
    modify i_final from wa_final transporting matnr posnr.
    endif.
    clear : wa_vbap , wa_final.
    endloop.
    endif.
    **WRITE:/1 sy-uline(63).
    **WRITE:/1'|', 2 'Sales Document' COLOR 4 ON ,11'|',12 'Date' COLOR 5
    **ON
    **,21'|',22 'Name' COLOR 4 ON,35'|',
    *36 'Material Number' COLOR 5 ON, 55'|',56 'line no' COLOR 4 ON
    **63'|'.
    **WRITE:/1 sy-uline(63).
    **LOOP AT i_final INTO wa_final.
    WRITE:/1'|', 2 wa_final-vbeln,11'|',12 wa_final-erdat,21'|',22
    wa_final-ernam,35'|',
    36 wa_final-matnr, 55'|',56 wa_final-posnr,63'|'.
    **endloop.
    perform builtcatalog.
    perform event.
    perform listheader.
    perform layout.
    perform display.
    **& Form builtcatalog
    *text
    form builtcatalog.
    wa_fldcat-col_pos = '1'.
    wa_fldcat-fieldname = 'vbeln'.
    wa_fldcat-tabname = 'I_FINAL'.
    wa_fldcat-reptext_ddic = 'Sales Document'.
    APPEND wa_fldcat TO i_fldcat.
    CLEAR wa_fldcat.
    wa_fldcat-col_pos = '2'.
    wa_fldcat-fieldname = 'erdat'.
    wa_fldcat-tabname = 'I_FINAL'.
    wa_fldcat-reptext_ddic = 'Date'.
    APPEND wa_fldcat TO i_fldcat.
    CLEAR wa_fldcat.
    wa_fldcat-col_pos = '3'.
    wa_fldcat-fieldname = 'ernam'.
    wa_fldcat-tabname = 'I_FINAL'.
    wa_fldcat-reptext_ddic = 'Name'.
    APPEND wa_fldcat TO i_fldcat.
    CLEAR wa_fldcat.
    wa_fldcat-col_pos = '4'.
    wa_fldcat-fieldname = 'matnr'.
    wa_fldcat-tabname = 'I_FINAL'.
    wa_fldcat-reptext_ddic = 'Material Number'.
    APPEND wa_fldcat TO i_fldcat.
    CLEAR wa_fldcat.
    wa_fldcat-col_pos = '5'.
    wa_fldcat-fieldname = 'posnr'.
    wa_fldcat-tabname = 'I_FINAL'.
    wa_fldcat-reptext_ddic = 'Sales Document Item'.
    APPEND wa_fldcat TO i_fldcat.
    CLEAR wa_fldcat.
    endform. "builtcatalog
    **& Form event
    *text
    form event.
    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
    EXPORTING
    I_LIST_TYPE = 0
    IMPORTING
    ET_EVENTS = i_event                                         "-----> correction done here
    EXCEPTIONS
    LIST_TYPE_WRONG = 1
    OTHERS = 2
    IF sy-subrc = 0.
    READ TABLE i_event INTO wa_event
    WITH KEY name = slis_ev_top_of_page.
    IF sy-subrc = 0.
    wa_event-form = slis_ev_top_of_page.
    MODIFY i_event FROM wa_event INDEX sy-tabix TRANSPORTING form.
    ENDIF.
    READ TABLE i_event INTO wa_event
    WITH KEY name = slis_ev_pf_status_set .
    IF sy-subrc = 0.
    wa_event-form = slis_ev_pf_status_set .
    MODIFY i_event FROM wa_event INDEX sy-tabix TRANSPORTING form.
    ENDIF.
    READ TABLE i_event INTO wa_event
    WITH KEY name = slis_ev_user_command.
    IF sy-subrc = 0.
    wa_event-form = slis_ev_user_command .
    MODIFY i_event FROM wa_event INDEX sy-tabix TRANSPORTING form.
    ENDIF.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    endform. "event
    **& Form
    *text
    form listheader.
    wa_head-typ = 'H'.
    wa_head-info = 'ALV PROGRAM AUTHOR jessy'
    APPEND wa_head TO i_head.
    endform. "listheader
    **& Form layout
    *text
    form layout.
    wa_layout-zebra = 'X'.
    wa_layout-f2code = 'DUB'.
    endform. "layout
    **& Form display
    *text
    form display.
    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 = ' '
    *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 = wa_layout
    IT_FIELDCAT = i_fldcat[]
    *IT_EXCLUDING =
    *IT_SPECIAL_GROUPS =
    *IT_SORT =
    *IT_FILTER =
    *IS_SEL_HIDE =
    *I_DEFAULT = 'X'
    *I_SAVE = ' '
    *IS_VARIANT =
    IT_EVENTS = i_event[]                                                 "-----> correction done here
    *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 = i_final                                                        "-----> correction done here
    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
    You need to check the TYPE before passing the internal tables or workareas to the PARAMETERS of a Function Module.
    Regards,
    Ravi Kiran..

  • Subtotals in ALV report for ALPHA-NUMERIC field

    Hi Experts,
    I have problem while subtotalling values in ALV report.
    I have 8 fields in my fieldcatalog. Now, I have to do the subtotal based on 3rd field having name 'ABC'. This field is having type CHAR & having lenght 3.
    Now I wanted to do subtotalling for field 7 & 8 as 'NETWR' & 'MENGE' based on 3rd field.
    How we can do the subtotal?

    Hi,
    Refer this code
    *&      Form  sub_display_data
          text
    FORM sub_display_data .
    *--To sort the output through material number
      DATA : lwa_sort TYPE slis_sortinfo_alv.
      DATA : lit_sort TYPE slis_t_sortinfo_alv.
    *--Pass the values to the table
      lwa_sort-fieldname = 'PERNR'.             "Field name in o/p inttable
      lwa_sort-tabname   = 'it_final2'.         "Output Internal table
      lwa_sort-spos      = '1'.                 "Sort  sequence
      lwa_sort-up        = 'X'.                 "Sort in ascending order
      lwa_sort-down      = ' '.                 "Sort in descending order
      lwa_sort-subtot    = 'X'.                 "Subtotal
      APPEND lwa_sort TO lit_sort.
    *--Pass the values to the table
      lwa_sort-fieldname = 'WORKDATE'.          "Field name in o/p inttable
      lwa_sort-tabname   = 'it_final2'.         "Output Internal table
      lwa_sort-spos      = '2'.                 "Sort  sequence
      lwa_sort-up        = 'X'.                 "Sort in ascending order
      lwa_sort-down      = ' '.                 "Sort in descending order
      lwa_sort-subtot    = ' '.                 "Subtotal
      APPEND lwa_sort TO lit_sort.
    *--Pass the values to the table
      lwa_sort-fieldname = 'WEKLY'.             "Field name in o/p inttable
      lwa_sort-tabname   = 'it_final2'.         "Output Internal table
      lwa_sort-spos      = '3'.                 "Sort  sequence
      lwa_sort-up        = 'X'.                 "Sort in ascending order
      lwa_sort-down      = ' '.                 "Sort in descending order
      lwa_sort-subtot    = ' '.                 "Subtotal
      APPEND lwa_sort TO lit_sort.
      wa_layout-colwidth_optimize = 'X'.
      IF NOT it_final2[] IS INITIAL.
    *--Call the function module to display the ALV report
        CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
          EXPORTING
            is_layout          = wa_layout
            i_callback_program = v_repid
            it_fieldcat        = it_fieldcat1[]
            i_default          = c_chk
            i_save             = c_save
            it_sort            = lit_sort
          TABLES
            t_outtab           = it_final2
          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.
      ELSE.
    *--Message No data found
        MESSAGE i888 WITH text-017.
        LEAVE LIST-PROCESSING.
      ENDIF.
    ENDFORM.                    " sub_display_data
    Regards,
    Prashant

  • How to display subtotals in separate column in alv report?

    hi,
    I am displayed the subtotals  for QUantity field BDMNG in Reuse_alv_grid_display  in the same column.
    but I want to display subtotal in separate column.
    How to display subtotals in separate column in alv report?
    thanks&regards.
    samba.k

    Hi
    As far as i know you can't do this,the option you have is to create one more column (subtotal) and populate it by manual calculation at every subtotal (not alv subtotal but yours) .
    Best Regards
    Yossi

  • Error in alv report (fieldcatlog is not found)

    Hai Genious
    i am a new of the sap-abap, i have a one problem in my alv report, now i am using the reuse_alv_ fieldcatlog_merge,
    i declared with my internal table with type,
    my error is :- fieldcatlog not found
    for example
    types: begin of ty_mara,
    matnr type matnr,
    meins type meins,
    ersda type ersda,
    ernam type ernam,
    end of ty_mara.
    data: wa_mara type ty_mara,
    it_mara like table of wa_mara.
    select matnr meins ersda ernam from mara into table it_mara.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
    I_PROGRAM_NAME = SY-REPID
    I_INTERNAL_TABNAME = 'IT_MARA'
    I_STRUCTURE_NAME =
    I_CLIENT_NEVER_DISPLAY = 'X'
    I_INCLNAME = SY-REPID
    IF sy-subrc 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    call function 'reuse_alv_list_display'

    Hi,
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
    I_PROGRAM_NAME = SY-REPID
    I_INTERNAL_TABNAME = 'IT_MARA'
    I_STRUCTURE_NAME = 'TY_MARA'-->give it
    I_CLIENT_NEVER_DISPLAY = 'X'
    I_INCLNAME = SY-REPID
    IF sy-subrc 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    also use...
    CHANGING
          ct_fieldcat                  = i_fieldtab
    data :i_fieldtab TYPE slis_t_fieldcat_alv,
    s_fieldtab_body TYPE slis_fieldcat_alv.
    fill i_fieldtab like this...
    CASE s_fieldtab_body-fieldname.
          WHEN 'OA_NO'.
            s_fieldtab_body-seltext_l = 'Order Accep. No.'.
            MODIFY i_fieldtab FROM s_fieldtab_body INDEX sy-tabix.
            CLEAR s_fieldtab_body.
          WHEN 'KTEXT'.
            s_fieldtab_body-seltext_l = 'Ramco Order No.'.
            MODIFY i_fieldtab FROM s_fieldtab_body INDEX sy-tabix.
            CLEAR s_fieldtab_body.
    and so on

  • Error message log in session method of ALV report,

    In ALV report please let me know:
    1) In session method:
    where all error messages are stored,I know that error messages are stored in a log file, so please tell me where is it stored.
    2)transaction method:
    How to handle error messages in transaction methos(for eg if a weight field text box value is negative)

    Ans for 2nd point.
    CALL TRANSACTION c_mb USING i_bdcdata
                              MODE g_ctumode
                              UPDATE g_cupdate
                              MESSAGES INTO i_messtab.
       COMMIT WORK.
       IF sy-subrc EQ 0. " BDC Executed Successfully
         CLEAR wa_messtab.
         LOOP AT i_messtab INTO wa_messtab .
           IF wa_messtab-msgtyp  = 'S' AND
              wa_messtab-msgid   = 'M7' AND
              wa_messtab-msgnr   = '060'.
             CALL FUNCTION 'MESSAGE_TEXT_BUILD'
               EXPORTING
                 msgid               = wa_messtab-msgid
                 msgnr               = wa_messtab-msgnr
                 msgv1               = wa_messtab-msgv1
                 msgv2               = wa_messtab-msgv2
                 msgv3               = wa_messtab-msgv3
                 msgv4               = wa_messtab-msgv4
               IMPORTING
                 message_text_output = l_msg.
             APPEND l_msg TO i_sucsess.
             CLEAR l_msg.
             g_docsuc = 1.
           ELSE.
             IF wa_messtab-msgtyp  = 'E'.
               CALL FUNCTION 'MESSAGE_TEXT_BUILD'
                 EXPORTING
                   msgid               = wa_messtab-msgid
                   msgnr               = wa_messtab-msgnr
                   msgv1               = wa_messtab-msgv1
                   msgv2               = wa_messtab-msgv2
                   msgv3               = wa_messtab-msgv3
                   msgv4               = wa_messtab-msgv4
                 IMPORTING
                   message_text_output = l_msg.
               g_errflg = 1.
               APPEND l_msg TO i_error.
               CLEAR: l_msg.
             ENDIF.

  • Adding/Enabling Totals & Subtotals Button in ALV Report Output

    Hi Guys,
    I would like to know , how to add / enable Totals & Subtotals Button on the application tool bar in alv report output.
    Regards,
    Kishan

    ok so here i am sending my code....its also interactive...
    and in second list i am displaying quantity....
    *& Report  ZINT_ALV
    REPORT  zint_alv.
    TYPE-POOLS:slis.
    TABLES:mara,
           makt,
           mseg.
    DATA:BEGIN OF itab OCCURS 0,
          matnr LIKE mara-matnr,
          maktx LIKE makt-maktx,
         END OF itab.
    DATA:BEGIN OF itab1 OCCURS 0,
          mblnr LIKE mseg-mblnr,
          menge LIKE mseg-menge,
          meins LIKE mseg-meins,
          werks LIKE mseg-werks,
         END OF itab1.
    DATA:fcat TYPE slis_t_fieldcat_alv,
         fcat1 TYPE slis_t_fieldcat_alv,
         eve TYPE slis_t_event,
         eve1 TYPE slis_t_event.
    DATA:t_mat LIKE mara-matnr,
         s_mat LIKE mara-matnr,
         g_repid LIKE sy-repid.
    SELECTION-SCREEN:BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS:mat FOR mara-matnr OBLIGATORY.
    SELECTION-SCREEN:END OF BLOCK blk1.
    INITIALIZATION.
      PERFORM build_fcat USING fcat.
      PERFORM build_eve.
    START-OF-SELECTION.
      PERFORM get_data.
      PERFORM dis_data.
    *&      Form  build_fcat
          text
         -->T_FCAT     text
    FORM build_fcat USING t_fcat TYPE slis_t_fieldcat_alv.
      DATA:wa_fcat TYPE slis_fieldcat_alv.
      wa_fcat-tabname = 'ITAB'.
      wa_fcat-fieldname = 'MATNR'.
      wa_fcat-ref_fieldname = 'MATNR'.
      wa_fcat-ref_tabname = 'MARA'.
      wa_fcat-seltext_m = 'Material'.
    wa_fcat-input = ' '.
    wa_fcat-edit = 'X'.
      wa_fcat-input = 'X'.
      APPEND wa_fcat TO t_fcat.
      CLEAR wa_fcat.
      wa_fcat-tabname = 'ITAB'.
      wa_fcat-fieldname = 'MAKTX'.
      wa_fcat-seltext_m = 'Description'.
      APPEND wa_fcat TO t_fcat.
      CLEAR wa_fcat.
    ENDFORM.                    "build_fcat
    *&      Form  build_eve
          text
    FORM build_eve.
      DATA:t_eve TYPE slis_alv_event.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
       EXPORTING
         i_list_type           = 0
       IMPORTING
         et_events             = eve
    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.                    "build_eve
    *&      Form  get_data
          text
    FORM get_data.
      SELECT maramatnr maktmaktx INTO CORRESPONDING FIELDS OF TABLE itab
      FROM mara INNER JOIN makt
      ON maramatnr = maktmatnr
      WHERE mara~matnr IN mat.
    ENDFORM.                    "get_data
    *&      Form  dis_data
          text
    FORM dis_data.
      g_repid = sy-repid.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
         i_callback_program                = g_repid         "'ZINT_ALV'
         i_callback_user_command           = 'USER_COMMAND'
         i_grid_title                      = 'Interactive ALV'
         it_fieldcat                       = fcat
         it_events                         = eve
        TABLES
          t_outtab                          = itab
    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.                    "dis_data
    *&      Form  user_command
          text
         -->U_COM      text
    FORM user_command USING u_com LIKE sy-ucomm sel_field TYPE slis_selfield.
      CLEAR fcat1.
      CASE u_com.
        WHEN '&IC1'.
          READ TABLE itab INDEX sel_field-tabindex.
          IF sel_field-fieldname = 'MATNR'.
            IF sy-subrc = 0.
              t_mat = itab-matnr.
              PERFORM build_cat1 USING fcat1.
              PERFORM build_eve1.
              PERFORM get_data1.
              PERFORM dis_data1.
            ENDIF.
          ENDIF.
         SET PARAMETER ID 'MAT' FIELD t_mat.
         CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
      ENDCASE.
    ENDFORM.                    "user_command
    *&      Form  build_fcat1
          text
         -->T_FCAT1    text
    FORM build_cat1 USING t_fcat1 TYPE slis_t_fieldcat_alv.
      DATA:wa_fcat1 TYPE slis_fieldcat_alv.
      wa_fcat1-tabname = 'ITAB1'.
      wa_fcat1-fieldname = 'MBLNR'.
      wa_fcat1-seltext_m = 'Material Doc.'.
      APPEND wa_fcat1 TO t_fcat1.
      CLEAR wa_fcat1.
      wa_fcat1-tabname = 'ITAB1'.
      wa_fcat1-fieldname = 'MENGE'.
      wa_fcat1-seltext_m = 'Quantity'.
      APPEND wa_fcat1 TO t_fcat1.
      CLEAR wa_fcat1.
      wa_fcat1-tabname = 'ITAB1'.
      wa_fcat1-fieldname = 'MEINS'.
      wa_fcat1-seltext_m = 'UOM'.
      APPEND wa_fcat1 TO t_fcat1.
      CLEAR wa_fcat1.
      wa_fcat1-tabname = 'ITAB1'.
      wa_fcat1-fieldname = 'WERKS'.
      wa_fcat1-seltext_m = 'Plant'.
      APPEND wa_fcat1 TO t_fcat1.
      CLEAR wa_fcat1.
    ENDFORM.                    "build_fcat1
    *&      Form  build_eve1
          text
    FORM build_eve1.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          i_list_type     = 0
        IMPORTING
          et_events       = eve1
        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.                                                    "build_eve1
    *&      Form  get_data1
          text
    FORM get_data1.
      SELECT mblnr menge meins werks FROM mseg
      INTO CORRESPONDING FIELDS OF TABLE itab1
      WHERE matnr = t_mat.
    ENDFORM.                                                    "get_data1
    *&      Form  dis_data1
          text
    FORM dis_data1.
      g_repid = sy-repid.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
         i_callback_program                = g_repid              "'ZINT_ALV'
         i_callback_user_command           = 'USER_COMMAND1'
         it_fieldcat                       = fcat1
         it_events                         = eve1
        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.                                                    "dis_data1

  • Error when OO ALV report run in background

    Hello all,
    We recently applied stack 12 for a 7.0 system.  My custom ALV report using CL_GUI_CUSTOM_CONTAINER coding now returns an error when run in Background.  It works fine in dialog.
    The error occurred in program CL_GUI_CUSTOM_CONTAINER=======CP.  The log message was "Control Framework: Fatal error - GUI cannot be reached".
    Is there a solution for OO ALV reports run in the background?  I would not like to re-write my ALV reports using the function call.  Any advice is appreciated.  Thanks!!

    Yes, you need to code it a little differently, but you can still use CL_GUI_ALV_GRID.  Here is an example. 
    REPORT ZRICH_0006 .
    DATA: ITAB TYPE TABLE OF MARA.
    DATA: R_GRID TYPE REF TO CL_GUI_ALV_GRID.
    DATA: R_CONTROL TYPE REF TO CL_GUI_CUSTOM_CONTAINER.
    DATA: G_DOCK TYPE REF TO CL_GUI_DOCKING_CONTAINER.
    DATA: OKCODE type sy-ucomm.
    START-OF-SELECTION.
      SELECT * FROM MARA INTO TABLE ITAB  up to 100 rows.
      CALL SCREEN 100.
    *& Module STATUS_0100 OUTPUT
    * text
    MODULE STATUS_0100 OUTPUT.
      SET PF-STATUS '0100'.
      SET TITLEBAR '0100'.
      IF R_CONTROL IS INITIAL.
    * Check whether the program is run in batch or foreground
        IF CL_GUI_ALV_GRID=>OFFLINE( ) IS INITIAL.
    * Run in foreground
          CREATE OBJECT R_CONTROL EXPORTING CONTAINER_NAME = 'CONTAINER_1'.
          CREATE OBJECT R_GRID EXPORTING I_PARENT = R_CONTROL.
        ELSE.
    * Run in background
          CREATE OBJECT R_GRID EXPORTING I_PARENT = G_DOCK.
        ENDIF.
        CALL METHOD R_GRID->SET_TABLE_FOR_FIRST_DISPLAY
        EXPORTING
        I_STRUCTURE_NAME = 'MARA'
        CHANGING
        IT_OUTTAB = ITAB.
      ENDIF.
    ENDMODULE. " STATUS_0100 OUTPUT
    *& Module USER_COMMAND_0100 INPUT
    * text
    MODULE USER_COMMAND_0100 INPUT.
      CASE OKCODE.
        WHEN 'BACK'.
          leave program.
      ENDCASE.
    ENDMODULE. " USER_COMMAND_0100 INPUT
    Regards,
    Rich Heilman

  • While Saving ALV report in Local File getting error

    Hello Experts,
    Did one alv report.
    Getting output properly , but while saving(downloading) the output result getting Dump from system.
    Runtime Errors         GETWA_NOT_ASSIGNED
    Short text
         Field symbol has not yet been assigned.
    What happened?
         Error in the ABAP Application Program
         The current ABAP program "SAPLKKBL" had to be terminated because it has
         come across a statement that unfortunately cannot be executed.
    NOT GETTING WHERE EXACTLY IT IS WRONG....
    Please suggest the solution..
    Thanks in advance

    Usually this is due to wrong fieldcatalog, or inconsistenecy between field catalog, internal table or some fields of the layout (bselect box or lights for example) -> The FIRST thing to do is the execution of [The Consistency Check|http://help.sap.com/saphelp_470/helpdata/en/d6/23253963143e6ae10000000a11402f/frameset.htm], then correct the program to adjust field catalog or layout.
    Regards,
    Raymond

  • Time Limit exceeded error in ALV report

    I am gettting error "Time Limit Exceeded" when i execute ALV report. Can i run the program in background and how to do that?. I had already optimized my query in the program but even then i am facing the same issue.

    You can process the alv in background by pressing F9...I guess that the output would be available as a spool in SP01.
    You may need to re-check your query...And also, review the alv catalog and any events you are using....
    Greetings,
    Blag.

  • Clear the values in the ALV report after calculating Subtotals

    Hi All,
    In my ALV report, I am displaying subtotals by passing DO_SUM in the Field Catalog.
    Now my problem is in the display I do not want the individual values to be displayed, I want to hide the values in the column(Not the whole column) but I want to display the subtotal of these values in the Subtotal Row.
    Example:
    Item1   10   20
    Item2   20   30
    Item3   10   50
               40   100
    As per our requirements, the output should be
    Item1
    Item2
    Item3
              40   100
    How can this be done? Please suggest.

    Populate i_sort table for the fields for which u want subtotal as shown below:
    *&      Form  sub_populate_sort
          Populate ALV sort table
          No Parameter
    FORM sub_populate_sort .
    Sort on material
      wa_sort-spos = '01' .
      wa_sort-fieldname = 'MATNR'.
      wa_sort-tabname = 'I_EKPO'.
      wa_sort-up = 'X'.
      wa_sort-subtot = 'X'.
      APPEND wa_sort TO i_sort .
      CLEAR wa_sort.
    Sort on plant
      wa_sort-spos = '02'.
      wa_sort-fieldname = 'WERKS'.
      wa_sort-tabname = 'I_EKPO'.
      wa_sort-up = 'X'.
      wa_sort-subtot = 'X'.
      APPEND wa_sort TO i_sort .
      CLEAR wa_sort.
    ENDFORM.                    " sub_populate_sort
    Then when populating the field catalog tables use:
    wa_lfl_fcat-no_out         =  'X'.        "No output
    Then display ur data:
    This function module for displaying the ALV report
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program       = l_repid
          i_callback_top_of_page   = 'SUB_ALV_TOP_OF_PAGE'
          is_layout                = wa_layout
          it_fieldcat              = i_fieldcat
          it_sort = i_sort
          it_events                = i_event
          i_default                = 'X'
          i_save                   = 'A'
        TABLES
          t_outtab                 = i_ekpo
        EXCEPTIONS
          program_error            = 1
          OTHERS                   = 2.
    Regards,
    Joy.

  • Adding new rows after displaying subtotals in an ALV report by using OOABAP

    Dear All,
    I am creating an ALV report, displaying subtotals and total by using Classes. I have used classes CL_SALV_AGGREGATIONS (Method : add_aggregation) and CL_SALV_AGGREGATIONS (Method : add_sort) for sorting and doing subtotals.
    Output of my report as follows :- (I have used * for displaying spaces between fields)
    Materia*******Quantity**SerialNo*Equipment**Value***WBS Element
    ISM-DBSVR****1********12363****31872565***2165***Q-0040358945.001010
    ISM-DBSVR****1********12364****31872566***2165***Q-0040358945.001010
    **************************************Subtotal***********4330
    -> If the value of "Quantity" is greater than 1 then the value of subtotal for the field "Value" is to be divided by the Quantity for that line item and needs to be displayed Quantity, SerialNo, Value details information after subtotal .
    -> Basically I need to add few more rows for displaying above additional information in the ALV grid after displaying subtotal .
    Q: Do we have any methods for change the layout for the above requirement.
    I Appreciate your early response.
    Thank you.
    RajaSekhar.

    Hi,
    For such type of requirement you need to use ALV hierchical table.
    You can have your main table in master table.
    For quantity greater than 1 you need to move the data into a seperate internal table....this internal table will have material as the key between the main table and the second table.
    *... §2 create an ALV hierseq table
      try.
          cl_salv_hierseq_table=>factory(
            exporting
              t_binding_level1_level2 = lt_binding
            importing
              r_hierseq               = gr_hierseq
            changing
              t_table_level1           = gt_master
              t_table_level2           = gt_slave ).
        catch cx_salv_data_error cx_salv_not_found.
      endtry.
    you can display both the tables together with the subtotals also.
    please refer to program SALV_DEMO_HIERSEQ_SIMPLE to see how to display the hierarchical display.
    Plr reward points if found helpful.
    Regards,
    Mayank

  • Run-time error '13' in ALV report

    Hello,
    In a standard ALV report we are using Excel report layout. The Excel contains a table and a graph. The excel table refreshes with no errors.
    In order to refresh the graph data we recorded a VB Macro but when we run the report (which runs the macro) we are getting the error:
    run-time error '13'
    When we open the excel report from our workstation (not trough the SAP system) we are not getting this error.
    Please Advice,
    Amir

    hi
    this is a bug(error )in microsoft excel:
    Run-time error:'13' Type Mismatch" error message when you click a macro or a function on a menu in Excel 2002
    Please chec kthis link for the details:
    http://support.microsoft.com/kb/821292
    Regards
    Neha

Maybe you are looking for

  • Mac User Cannot Use Form Created in Windows Acrobat 9.0 Pro

    I have created a form and emailed it to a Mac user.  He does not know what version of Acrobat he has or even if he is using a full version of Acrobat or Acrobat Reader (I tried to walk him through to check his version, but he could not find it). He i

  • Edit html in JEDITORPANE

    HEllo friends! I need your help, for editing html in editorpane. I want to create a textarea in which the user type simple text than select some part of it & makes it bold, italic etc. by using an event of button or popup any thing. So guide me that

  • My Iphone was stolen. I was wondering if I connect a new phone, if I can continue to track the old one?

    My phone is stolen. I need to know if by connecting a new phone to my cell number, if I will no longer be able to track my iphone. HELP

  • Screensaver is not showing on all monitors

    windows 7 pro all windows updates are done.  have 3 monitor with displayport (hp) when the screensaver starts, it only shows on one monitor and only cuts top part of the picture.  Is there a way to make the pictures show on other monitors too?  thank

  • Using NAT and PAT together?

    ASA is 5540 w/8.3. I have a large inside block of inside address I want to NAT or PAT to outside addresses.  Is it possible to use a block of outside addresses with NAT with rollover PAT to the whole range, or is it restricted to roll over to only a