ALV SUM problem

Hi All,
I am using ALV grid to display report output and to sum column values i am using the DO_SUM = 'X'
but the sum is mot populating please give any suggestions.
Regards,
Phani.

Hi,
Check My [Sample Code Here |Re: Automatic Sum At the Bottom Or At the Top of an ALV Grid]. Hope will solve out your problem,
Best Regards,
Faisal

Similar Messages

  • Help PLZ Parrell Prefix Sum Problem

    i'm really stuck i need to write a parrell soultion to the prefix sum problem. i'm new 2 java and v.confused any help anybody can give would be major major help

    STFW
    http://www-2.cs.cmu.edu/afs/cs/academic/class/15251-s00/2000/Site/Materials/Lectures/lecture07/parallel.htm
    Slides 26-32 shows exactly how it could be done.
    - Marcus Sundman

  • ALV sum various columns problem

    Hi all,
    I'm doing a report on ABAP for a timesheet of the current month. The output i want is similar to this:
    Year      Month     Type         Item       #days  tue-1      wed-2    thu-3 ...
    2009     September  Project    Project1      3        1        1          1
    2009     September  Project    Projec2       5        1        1          0
    2009     September  Task       Task1         1        0        1          0
    The field #days is a sum of all the days columns for september next right to the #days column.
    I can have an SQL wich can extract all the data to fill year,month,type,item and #days. But then, i need to flat these #days in the correct days column. I think i can do it with 2 sqls, but then i need to join these data to display it right.
    Finally, present that data in an ALV.
    I have a structure defined in ABAP dictionary with all the static fields. The columns representing the days (sat-1,sun-2,...) are not in the structure.
    I've tried to define a new structure wich include the old one and define the remaining columns, but i can't show the fields defined in this extra structure, only the static fields defined in ABAP dictionary.
    This is probably simple, but i'm just starting in ABAP, and this seems odd and confusing right now.
    What's your advice to solve this problem?

    Hi,
    The question is not very clear but, u can try this.
    while populating the field catalog try using
    set_column_name,
    set_short_text,
    set_medium_text,
    set_long_text for the extra fileds added.
    if possible make it clear what exactly r u using asin, the reuse alv's or oo alv's or object alv's.

  • ALV TEXT problem

    Hi Abaper ,
    In my alv repoer i  am doing sum base on the bkpf-month to the field
    bseg-DMBTR .
    my problem is i want  text when summing in every month .
    like
    Amount in month June is           
    how can  i do ? if any one can face same problem help me .
    Regards
    Ajay pandey

    hi Ajay,
    Check this out
    Re: ALV Subtotals
    Regards,
    santosh

  • ALV Sum N columns how to?

    Hi all,
    I'm doing a report on ABAP for a timesheet of the current month. The output i want is similar to this:
    Year      Month     Type         Item       #days  tue-1      wed-2    thu-3 ...
    2009     September  Project    Project1      3        1        1          1
    2009     September  Project    Projec2       5        1        1          0
    2009     September  Task       Task1         1        0        1          0
    The field #days is a sum of all the days columns for september next right to the #days column.
    I can have an SQL wich can extract all the data to fill year,month,type,item and #days. But then, i need to flat these #days in the correct days column. I think i can do it with 2 sqls, but then i need to join these data to display it right.
    Finally, present that data in an ALV.
    I have a structure defined in ABAP dictionary with all the static fields. The columns representing the days (sat-1,sun-2,...) are not in the structure.
    I've tried to define a new structure wich include the old one and define the remaining columns, but i can't show the fields defined in this extra structure, only the static fields defined in ABAP dictionary.
    This is probably simple, but i'm just starting in ABAP, and this seems odd and confusing right now.
    What's your advice to solve this problem?

    Hi vasanth,
    I'm trying to define my ALV from 2 structures.
    The YTS_REPORT_PROJ has year,month,type_item,item and #days
    The YTS_WEEK_DESC is a static structure with an interval of weekdays such as : saturday1,sunday1,monday1,...,saturday2,sunday2,... until i get the 31 days possibles to show for a month.
    I'm declaring this way:
      DATA: BEGIN OF IT_ALV_YTMSHT.
              INCLUDE STRUCTURE YTS_REPORT_PROJ.
              INCLUDE STRUCTURE YTS_WEEK_DESC.
      DATA: END OF IT_ALV_YTMSHT.
    For field catalogs i call this subrutine:
    *      Form  get_LayoutTable - Set Up Columns/Headers
    FORM GET_LAYOUTTABLE.
      DATA: LS_FCAT TYPE LVC_S_FCAT.
      REFRESH: FIELDCAT.  CLEAR: LS_FCAT.
      LS_FCAT-REPTEXT    = 'Year'.
      LS_FCAT-FIELDNAME  = 'YEAR_ITEM'.
      LS_FCAT-REF_TABLE  = 'IT_YTMSHEET'.
      LS_FCAT-OUTPUTLEN  = '4'.
      LS_FCAT-FIX_COLUMN = 'X'.
      LS_FCAT-COL_POS    = '1'.
      APPEND LS_FCAT TO FIELDCAT.  CLEAR: LS_FCAT.
      LS_FCAT-REPTEXT    = 'Month'.
      LS_FCAT-FIELDNAME  = 'MONTH_ITEM'.
      LS_FCAT-REF_TABLE  = 'IT_YTMSHEET'.
      LS_FCAT-OUTPUTLEN  = '6'.
      LS_FCAT-FIX_COLUMN = 'X'.
      LS_FCAT-COL_POS    = '2'.
      APPEND LS_FCAT TO FIELDCAT.  CLEAR: LS_FCAT.
      LS_FCAT-REPTEXT    = 'Type_of_item'.
      LS_FCAT-COLTEXT    = 'Type of item'.
      LS_FCAT-FIELDNAME  = 'TYPE_ITEM'.
      LS_FCAT-REF_TABLE  = 'IT_YTMSHEET'.
      LS_FCAT-FIX_COLUMN = 'X'.
      LS_FCAT-OUTPUTLEN  = '12'.
      LS_FCAT-COL_POS    = '4'.
      APPEND LS_FCAT TO FIELDCAT.  CLEAR: LS_FCAT.
      LS_FCAT-REPTEXT    = 'Item'.
      LS_FCAT-FIELDNAME  = 'ITEM'.
      LS_FCAT-REF_TABLE  = 'IT_YTMSHEET'.
      LS_FCAT-FIX_COLUMN = 'X'.
      LS_FCAT-OUTPUTLEN  = '20'.
      LS_FCAT-COL_POS    = '5'.
      APPEND LS_FCAT TO FIELDCAT.
      CLEAR: LS_FCAT.
      LS_FCAT-REPTEXT    = 'Number_of_days'.
      LS_FCAT-COLTEXT    = 'Days number'.
      LS_FCAT-FIELDNAME  = 'DAYS_ITEM'.
      LS_FCAT-REF_TABLE  = 'IT_YTMSHEET'.
    *  LS_FCAT-FIX_COLUMN = 'X'.
      LS_FCAT-OUTPUTLEN  = '11'.
      LS_FCAT-TOOLTIP    = '#Days=Hours/8'.
      LS_FCAT-COL_POS    = '6'.
      APPEND LS_FCAT TO FIELDCAT.
    DO 30 TIMES.
        CLEAR: LS_FCAT.
        LS_FCAT-REPTEXT    = 'day of week'.
        LS_FCAT-COLTEXT    = 'Day of week'.
        LS_FCAT-FIELDNAME    = ' '.             ----------> HOW CAN I REFERENCE HERE "SUNDAY1,SATURDAY1,..."?
        LS_FCAT-REF_TABLE  = 'IT_ALV_YTMSHT'.
    *  LS_FCAT-FIX_COLUMN = 'X'.
        LS_FCAT-OUTPUTLEN  = '11'.
        APPEND LS_FCAT TO FIELDCAT.
    As you can see, at the end of the routine i try to create 30 more columns, and those columns actually appear, but i don't know how to fill the data of those columns.
    To construct the ALV i'm using
    DATA: VARIAVEL LIKE IT_ALV_YTMSHT OCCURS 0 WITH HEADER LINE.
    *IT_YTMSHEET[] has the first part that i want to show (year,month,type,item and #days.
      VARIAVEL[] = IT_YTMSHEET[].
      CALL METHOD GRID->SET_TABLE_FOR_FIRST_DISPLAY
        EXPORTING
          IS_LAYOUT = GD_LAYOUT
          I_SAVE = 'A'
        CHANGING
          IT_FIELDCATALOG  = FIELDCAT[]
          IT_OUTTAB        = VARIAVEL[].

  • On-click on ALV sum line to raise an event

    Hello, ladies and gentlemen,
    Happy New Year first of all.
    I have a following problem: I have an ALV grid and in each line I have an icon, which one can on-click and something happens. That works fine. But now I was challenged to add a sum line which should support the same on-click event, but should process the data of all lines that belong to this SUM group in one batch.
    Of course I can put in the "manual sum lines" - define groups that will support these sum lines and then add extra lines into the grid data. Unfortunatelly there is no way of telling which lines will belong to which group. I need the ALV standard summing so any user can define his own groups.
    Has anybody ever tried such thing? I am using cl_gui_alv_grid OO ALV.
    Thanks for any input,
    cheers Otto

    Hi Otto.
    You can check the logic below. Please try to disable the sort functionality as done below in the ALV because the subtotals returned by the method get_subtotals is always sorted in ascending order.
    report  z335_alv_sel.
    class lcl definition deferred.
    type-pools: slis.
    types:begin of t_data,
          werks type werks_d,
          labst type mard-labst,
          end of t_data.
    data :i_exclude type ui_functions,
          i_fcat type slis_t_fieldcat_alv ,
          i_sort type lvc_t_sort,
          i_data type table of t_data,
          i_cat type lvc_t_fcat,
          wa_sort like line of i_sort,
          wa_exclude type ui_func,
          wa type t_data,
          wa_cat type lvc_s_fcat,
          cont type ref to cl_gui_custom_container,
          grid  type ref to cl_gui_alv_grid,
          receiver type ref to lcl.
    class lcl definition.
      public section.
        methods handle_click for event double_click of
                   cl_gui_alv_grid importing e_row
                                             e_column.
    endclass.                    "lcl DEFINITION
    class lcl implementation.
      method handle_click.
        data:val(10) type n,
             it type ref to data.
        field-symbols: <ft_tab> type standard table,
                       <fs_tab> type any,
                       <ff_field> type any.
        if e_row+0(1) = 'S'.  "Subtotal
          val = e_row+23(10).
          call method grid->get_subtotals
              importing
                ep_collect01 = it.
          assign it->* to <ft_tab>.
          read table <ft_tab> assigning <fs_tab> index val.
          if sy-subrc = 0.
            assign component 1 of structure <fs_tab> to <ff_field>.
            if <ff_field> is assigned.
              loop at i_data into wa where werks = <ff_field>.
                "Process your block Here
              endloop.
            endif.
          endif.
        endif.
      endmethod.                    "handle_click
    endclass.                    "lcl IMPLEMENTATION
    start-of-selection.
      call screen 100.
    module fill_data output.
      select werks labst from mard
             into corresponding fields of table i_data
             up to 1000 rows where labst > 0.
      if sy-subrc = 0.
        wa_cat-fieldname = 'WERKS'.
        append wa_cat to i_cat.
        clear wa_cat.
        wa_cat-fieldname = 'LABST'.
        wa_cat-do_sum = 'X'.
        append wa_cat to i_cat.
        clear wa_cat.
        wa_sort-fieldname = 'WERKS'.
        wa_sort-subtot = 'X'.
        wa_sort-group = 'X'.
        wa_sort-up = 'X'.
        append wa_sort to i_sort.
        wa_exclude = cl_gui_alv_grid=>mc_fc_sort .
        append wa_exclude to i_exclude.
        wa_exclude = cl_gui_alv_grid=>mc_fc_sort_asc .
        append wa_exclude to i_exclude.
        wa_exclude = cl_gui_alv_grid=>mc_fc_sort_dsc .
        append wa_exclude to i_exclude.
      endif.
    endmodule.                 " fill_data  OUTPUT
    module display output.
      if cont is initial .
        create object cont
          exporting
            container_name = 'CONT1'.
        create object grid
          exporting
            i_parent = cont.
        call method grid->set_table_for_first_display
          exporting
          it_toolbar_excluding = i_exclude
          changing
            it_outtab       = i_data[]
            it_sort         = i_sort[]
            it_fieldcatalog = i_cat[].
        create object receiver.
        set handler receiver->handle_click  for grid.
      endif.
    endmodule.                    "DISPLAY OUTPUT

  • ALV SUM error

    Hi all !!
    I'm dipalying CURR field on alv. When trying to do sum on i get short dump.
    that is my fieldcat definition:
      ls_fieldcat-fieldname    = 'NETWR'.
      ls_fieldcat-ref_fieldname  = 'NETWR'.
      ls_fieldcat-ref_tabname  = 'VBRP'.
      ls_fieldcat-datatype = 'CURR'.
      ls_fieldcat-cfieldname = 'WAERK'.
      ls_fieldcat-ctabname = 'VBRK'.
    What is my error ??
    BR, JAcek

    Nothing of that doesnt work fine on my system (4.7).
    (ST22 Error):  MESSAGE_TYPE_X
    assign component
              <ls_fieldcat>-fieldname of structure rt_data to <g_field>.
       if sy-subrc ne 0.
         message x000(0k).
       endif.
    or when using in fieldac:
    ls_fieldcat-cfieldname = 'WAERS'.
    what was suggested in similiar problem in that formum sone times ago:
    (st22)
    Invalid dynamic line component.
    When the ABAP program "SAPLSKBH" attempted to process the internal
    table "RT_COLLECT00[]" with "SORT", a component "WAERS " was specified
    dynamically
    as the contents of the field "L_UFIELDNAME".
    One of the following errors then occurred:
    - The line type "u" of the internal table "RT_COLLECT00[]" contains no
      component "WAERS ".
    - "WAERS " contained an invalid offset or length specification (for
      example, you may have tried to access part of a field with type I or
      STRING).
    - The program "SAPLSKBH" is a Unicode program. In Unicode programs, you
      can only apply offset/length access to a structure within its
      character-type initial section. The system went beyond the
      boundaries of "WAERS " 's initial section in this case.
    - "WAERS " contains a declaration of the form "A->B" for dynamically
      accessing an object attribute. At present, attributes can only be
      addressed in this way statically.
    - "WAERS " contained significant trailing spaces (only possible with type
      STRING).
    Message was edited by: Jacek Slowikowski

  • TSTRDURAN Domain Sum Problem

    Hi Gurus;
    I use TSTRDURAN domain in my table. It use conversion routine (CONVERSION_EXIT_TSTRN_INPUT, 
    CONVERSION_EXIT_TSTRN_OUTPUT ) This domain is dec but values show as time. And I dont entry not time value. For example ; not entry 08:65:00.
    But it has very big problem. I sum some time values and it wrong calculate in alv and program. For example I want to sum (00:30
    00:30
    01:00
    00:40
    00:50
    00:20
    00:35) Sum result and show: 03:05. But should correct result 04:25.
    Maybe there is OSS note. But I dont know.
    If there any answer, please help me.
    Thanks.

    problem is data element definition, conver the values to type t....here's what works:
    data: t1 type t value '003000',
          t2 type t value '010000',
          t3 type t value '004000',
          t4 type t value '005000',
          t5 type t value '002000',
          t6 type t value '003500',
          t_result type t.
    start-of-selection.
    t_result = t1 + t1 + t2 + t3 + t4 + t5 + t6.
    write:/ t_result.
    t_result = 042500.

  • Alv report problem

    hi,
    i have problem in ALV.
    my requirement is in a ALV report if i double click on a row it has to take me to another transaction ( say for eg vf03).
    how should i do it.
    john.

    hi
    good
    try this report
    MESSAGE-ID ZZ_9838                      .
    TYPE-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.
    implement your logic in it and i hope this will definitely work.
    thanks
    mrutyun

  • SUM problem in SSRS 2005 report

    I don't know how best to explain this but will try.
    In my SSRS 2005 report, i have one group in my table.  In that group, I have a field that for each company record in my dataset, this field value is repeated for each record. This is a transactions table so you'd expect several records in the dataset for each company..that's not the problem.
    example data from dataset:
    TransID     CompanyID      FeeGoal
    1                1000                  100
    2                1000                  100
    3                1000                  100
    4                2000                   400
    5                2000                   400
    My SSRS 2005 Report has:
    Group1 fields:
    CompanyID                                       FeeGoal
    =Fields!CustomerNumber.Value        =Fields!FeeGoal.Value
    The output when previewed looks like this:
    Company   FeeGoal
    1000               100
    2000               400
    Footer            209409730.83 (totals up all feegoals!  not just unique instances!)
    I have a footer, and this is where the problem comes in.  I am not able to sum 100 + 400 because if I do a SUM(=Fields!FeeGoal.Value) It doesn't just sume up 100 + 400 but rather (100 + 100 + 100) + (400 + 400)
    I can't find a way to sum up basically the top values for FeeGoal which is really what the Group Field is doing since I get 100 and 400 in my group field for feeGoal.  I should end up with a total of 500 for my footer total for Fee Goal but not sure how to get this to work in this unique situation.
    FYI: FeeGoal is an input from an ASP.NET form to allow managers to update that one column in my report so that other calculations can rely on it in my group fields.  Once the user finishes, I run a stored proc to insert that fee goal in every customer transaction record / feegoal field
    I guess is there a way to do some sort of Distinct SUM in an expression? I also tried:
    =SUM((Max(Fields!FeeGoal_AZ.Value)) / Fields!FeeSchedule.Value) * 100)
    but you can't have an aggregate function like this, I get this error:
    [rsAggregateofAggregate] The Value expression for the textbox 'GrossGoal_gt' contains an aggregate function (or RunningValue or RowNumber functions) in the argument to another aggregate function (or RunningValue). Aggregate functions cannot be nested inside other aggregate functions.
    Build complete -- 1 errors, 0 warnings
     

    Hi,
    I need to generate a SSRS 2005 report like bellow:
    OrderNumber    MultiInvoice    SalesAmt        
    TaxAmt          TotalAmt
    301256              1                     
    302                   20                  322
    369856                                    
     501                   10                  511
    359826                                    
    456                    1                    457
    785412              2                    
    725                    25                  750
    totalRow=4      totalRow=2      Sum=1984        Sum=56          
    Sum=2040 ----------------------->Footer
    --I added textbox in ther footer of that report table, and try to add expression for each, like
    1>OrderNumber : =CountRows()
    2>MultiInvoice :  =Count(column name) //but it is return no of rows,
    where it should be only 2.
    How can do that?
    3>SalesAmt : =
    SUM(Fields!SalesAmt.Value)   //It is not returning actual summation of all rows for
    SalesAmt
     column. How can I do that?
    Dipen Bhadra

  • ALV GRID Problem with reading contents

    Hi there! I'm quite new with ABAP and I have some problems with the syntax of it. Maybe I should first describe my aim and then I'll show you my code.
    1. I read contents from two database tables, called 'zbc_dan_registry' and 'zbc_dan_category'.
    'zbc_dan_registry' has 2 columns: name, value.
    zbc_dan_category' has 1 column: category.
    Now I want to have an ALV Grid, that displays the contents of 'zbc_dan_registry' and one additional column with dropdown fields, where the user can select a category for each row. This is, what my code already does.
    Now I want to save the contents of the whole table in a new table 'zbc_dan_registrz' (you see: 'registrz', not 'registry'!) with 3 columns:
    name, category, value.
    My problem is, how can I read the contents of the ALV Grid, with the user selected category for each row, and save them in an internal table? I've tried to adapt the code of "BCALV_EDIT_04", but I don't get it running.
    Some detailled help would be great, you know, I'm really working hard to understand ABAP, but it's really hard for me. Thanks for your support and help!!
    Here's my code so far:
    *& Report  ZBC400_DAN_TESTNO4
    REPORT  ZBC400_DAN_TESTNO4.
    DATA: lt_registrz TYPE TABLE OF zbc_dan_regstrz WITH HEADER LINE,
          lt_category TYPE TABLE OF zbc_dan_category WITH HEADER LINE,
          ls_category TYPE zbc_dan_category, "Struktur Kategorie
          ok_code LIKE sy-ucomm,
          container_r TYPE REF TO cl_gui_custom_container,
          grid_r TYPE REF TO cl_gui_alv_grid,
          gc_custom_control_name TYPE scrfname VALUE 'CONTAINER_REG',
          fieldcat_r TYPE lvc_t_fcat,
          layout_r TYPE lvc_s_layo,
          lt_ddval TYPE lvc_t_drop,
          ls_ddval TYPE lvc_s_drop,
          c TYPE i.
    CLASS lcl_event_receiver DEFINITION DEFERRED.
      DATA g_verifier TYPE REF TO lcl_event_receiver.
      DATA: BEGIN OF gt_outtab OCCURS 0.
        INCLUDE STRUCTURE zbc_dan_regstrz.
        DATA: celltab TYPE lvc_t_styl.
      DATA: END OF gt_outtab.
    CLASS lcl_event_receiver DEFINITION.
      PUBLIC SECTION.
      TYPES: BEGIN OF lt_registrz_key.         "Struktur mit den Schlüsseln der Tabelle 'Registry'
        TYPES:  name TYPE zbc_dan_name,
                value TYPE zbc_dan_value,
                category TYPE zbc_dan_cat.
      TYPES: END OF lt_registrz_key.
      TYPES:  ls_registrz_keys TYPE STANDARD TABLE OF lt_registrz_key,
              ls_registrz_table TYPE STANDARD TABLE OF zbc_dan_regstrz.
      METHODS: get_inserted_rows EXPORTING inserted_rows TYPE ls_registrz_keys.
      METHODS: refresh_delta_tables.
      METHODS: handle_data_changed FOR EVENT data_changed OF cl_gui_alv_grid IMPORTING er_data_changed.
    *  METHODS: get_inserted_rows EXPORTING inserted_rows TYPE registrz_keys.
    *  METHODS: refresh_delta_tables.
      PRIVATE SECTION.
      DATA: inserted_rows TYPE ls_registrz_keys.
      DATA: error_in_data TYPE c.
      METHODS: get_cell_values IMPORTING row_id TYPE int4 pr_data_changed TYPE REF TO cl_alv_changed_data_protocol EXPORTING key TYPE lt_registrz_key.
    ENDCLASS.
    CLASS lcl_event_receiver IMPLEMENTATION.
      METHOD handle_data_changed.
        DATA: ls_good TYPE lvc_s_modi,
              ls_new TYPE lvc_s_moce.
        error_in_data = space.
        IF error_in_data = 'X'.
          CALL METHOD er_data_changed->display_protocol.
        ENDIF.
      ENDMETHOD.
      METHOD get_cell_values.
        CALL METHOD pr_data_changed->get_cell_value
          EXPORTING i_row_id = row_id i_fieldname = 'NAME'
            IMPORTING e_value = key-name.
        CALL METHOD pr_data_changed->get_cell_value
          EXPORTING i_row_id = row_id i_fieldname = 'VALUE'
            IMPORTING e_value = key-value.
        CALL METHOD pr_data_changed->get_cell_value
          EXPORTING i_row_id = row_id i_fieldname = 'CATEGORY'
            IMPORTING e_value = key-category.
      ENDMETHOD.
      METHOD get_inserted_rows.
        inserted_rows = me->inserted_rows.
      ENDMETHOD.
      METHOD refresh_delta_tables.
        clear me->inserted_rows[].
      ENDMETHOD.
    ENDCLASS.
    START-OF-SELECTION.
        SELECT client name value
          INTO CORRESPONDING FIELDS OF TABLE lt_registrz FROM zbc_dan_regstry.
        SELECT category INTO CORRESPONDING FIELDS OF TABLE lt_category FROM zbc_dan_category.
    CALL SCREEN 0100.
    MODULE user_command_0100 INPUT.
      CASE ok_code.
        WHEN 'BACK'.
          SET SCREEN 0.
          MESSAGE ID 'BC400' TYPE 'S' NUMBER '057'.
        WHEN 'SAVE'.
          PERFORM save_data.
        WHEN OTHERS.
      ENDCASE.
    ENDMODULE.
    MODULE clear_ok_code OUTPUT.
      CLEAR ok_code.
    ENDMODULE.
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'DYNPRO100'.
      SET TITLEBAR 'D0100'.
    ENDMODULE.
    MODULE display_alv OUTPUT.
      PERFORM display_alv.
    ENDMODULE.
    FORM display_alv.
    IF grid_r IS INITIAL.
    *----Creating custom container instance
      CREATE OBJECT container_r
      EXPORTING
        container_name = gc_custom_control_name
      EXCEPTIONS
        cntl_error = 1
        cntl_system_error = 2
        create_error = 3
        lifetime_error = 4
        lifetime_dynpro_dynpro_link = 5
        others = 6.
        IF sy-subrc <> 0.
    *--Exception handling
        ENDIF.
    *----Creating ALV Grid instance
        CREATE OBJECT grid_r
        EXPORTING
          i_parent = container_r
        EXCEPTIONS
          error_cntl_create = 1
          error_cntl_init = 2
          error_cntl_link = 3
          error_dp_create = 4
          others = 5.
          IF sy-subrc <> 0.
    *--Exception handling
          ENDIF.
          CREATE OBJECT g_verifier.
          SET HANDLER g_verifier->handle_data_changed FOR grid_r.
    *----Preparing field catalog.
          PERFORM prepare_field_catalog CHANGING fieldcat_r.
    *----Preparing layout structure
          PERFORM prepare_layout CHANGING layout_r.
    *----Here will be additional preparations
    *--e.g. initial sorting criteria, initial filtering criteria, excluding
    *--functions
          CALL METHOD grid_r->set_table_for_first_display
          EXPORTING
    * I_BUFFER_ACTIVE =
    * I_CONSISTENCY_CHECK =
    * I_STRUCTURE_NAME =
    * IS_VARIANT =
    * I_SAVE =
    * I_DEFAULT = 'X'
            is_layout = layout_r
    * IS_PRINT =
    * IT_SPECIAL_GROUPS =
    * IT_TOOLBAR_EXCLUDING =
    * IT_HYPERLINK =
          CHANGING
            it_outtab = lt_registrz[]
            it_fieldcatalog = fieldcat_r
    * IT_SORT =
    * IT_FILTER =
          EXCEPTIONS
            invalid_parameter_combination = 1
            program_error = 2
            too_many_lines = 3
            OTHERS = 4.
          IF sy-subrc <> 0.
    *--Exception handling
          ENDIF.
          ELSE.
            CALL METHOD grid_r->refresh_table_display
    * EXPORTING
    * IS_STABLE =
    * I_SOFT_REFRESH =
          EXCEPTIONS
            finished = 1
            OTHERS = 2.
          IF sy-subrc <> 0.
    *--Exception handling
          ENDIF.
        ENDIF.
        CALL METHOD grid_r->register_edit_event
          EXPORTING
            i_event_id = cl_gui_alv_grid=>mc_evt_enter.
        CALL METHOD grid_r->register_edit_event
          EXPORTING
            i_event_id = cl_gui_alv_grid=>mc_evt_modified.
    ENDFORM.
    FORM prepare_field_catalog CHANGING pt_fieldcat TYPE lvc_t_fcat.
      DATA ls_fcat TYPE lvc_s_fcat.
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
      EXPORTING
        i_structure_name = 'ZBC_DAN_REGSTR2'
      CHANGING
        ct_fieldcat = pt_fieldcat[]
      EXCEPTIONS
        inconsistent_interface = 1
        program_error = 2
        OTHERS = 3.
      IF sy-subrc <> 0.
    *--Exception handling
      ENDIF.
      LOOP AT pt_fieldcat INTO ls_fcat.
        CASE ls_fcat-fieldname.
          WHEN 'NAME'.
            ls_fcat-coltext = 'Name'.
            ls_fcat-outputlen = '40'.
            MODIFY pt_fieldcat FROM ls_fcat.
          WHEN 'VALUE'.
            ls_fcat-coltext = 'Wert'.
            ls_fcat-outputlen = '30'.
            MODIFY pt_fieldcat FROM ls_fcat.
          WHEN 'CATEGORY'.
              LOOP AT lt_category into ls_category.
                ls_ddval-handle = 1.
                ls_ddval-value = ls_category-category.
    *            ls_ddval-style = cl_gui_alv_grid=>mc_style_enabled.
                APPEND ls_ddval TO lt_ddval.
             ENDLOOP.
             CALL METHOD grid_r->set_drop_down_table
                EXPORTING it_drop_down = lt_ddval.
            ls_fcat-edit = 'X'.
            ls_fcat-drdn_hndl = '1'.
            ls_fcat-coltext = 'Kategorie'.
            MODIFY pt_fieldcat FROM ls_fcat.
        ENDCASE.
      ENDLOOP.
    ENDFORM.
    FORM prepare_layout CHANGING ps_layout TYPE lvc_s_layo.
      ps_layout-zebra = 'X'.
      ps_layout-grid_title = 'Kategorie zur Registry hinzufügen'.
      ps_layout-smalltitle = 'X'.
    ENDFORM.
    FORM save_data.
      DATA: ls_ins_keys TYPE g_verifier->ls_registrz_keys,
            ls_ins_key TYPE g_verifier->lt_registrz_key,
            ls_registrz TYPE zbc_dan_regstrz,
            ls_outtab LIKE LINE OF gt_outtab,
            lt_instab TYPE TABLE OF zbc_dan_regstrz.
      CALL METHOD g_verifier->get_inserted_rows IMPORTING inserted_rows = ls_ins_keys.
      LOOP AT ls_ins_keys INTO ls_ins_key.
        READ TABLE gt_outtab INTO ls_outtab
        WITH KEY  name = ls_ins_key-name
                  value = ls_ins_key-value
                  category = ls_ins_key-category.
        IF sy-subrc = 0.
          MOVE-CORRESPONDING ls_outtab TO ls_registrz.
          APPEND ls_registrz TO lt_instab.
        ENDIF.
      ENDLOOP.
      INSERT zbc_dan_regstrz FROM TABLE lt_instab.
      CALL METHOD g_verifier->refresh_delta_tables.
      ENDFORM.

    Hi Hans,
    You raised the Question in the Webdynpro ABAP forum. Here its very diffcult to get the answer from this forum. Please close it here and raise the same question in ABAP General Forum there you will get faster and so many anwsers.
    Please close the question here.
    Warm Regards,
    Vijay

  • ALV flickering problem

    Hi,
    I have  flickering problem with ALV control (cl_gui_alv_grid).  My alv grid  control is not in edit mode.
    I am using ALV grid for event planning with drag drop operations, so there may be 1000+ rows sometimes at grid.
    Also I call refresh_table_display with soft_refresh and is_stable='XX.'
    (I call cfw=>set_new_ok_code to trigger PBO. refresh_table_display is being called at PBO )
    It flickers just a second or two after drop_complete but it is critical for usability.
    I think flickering happens because of scrolling, so I used set_scroll_via_id but nothing changed.
    Thanks.

    Hi Manu,
    I tried not to trigger PBO (Called refresh_table_display at PAI, commented set_new_ok_code)
    It does not help..
    (Same behaviour : se38-> BC_ALV_TEST_GRID_PERFORMANCE.Increase record count to 5000.Run.
    Scroll to the bottom of list.)
    Thank you..

  • ALV Grid Problem in WebGUI

    Hi All,
    We've created an ALV grid using classes in R3 and we're testing it in WebGUI.  All of those scenarios are working fine in R3 however the behavior in WebGUI is different.  We're encountering a problem wherein the cellstyles are not being reflected (eg. a particular cell for a particular row should be grayed out if a particular field has this value).  Furthermore, if we enter a value in this field, it should automatically populate values for other fields (eg. column name - PERNR.  Once pernr is entered; column name - NAME should have a value automatically).  Another thing is, the Refresh button is  missing in WebGUI.  One more problem is that the error message for that particular column was not shown.  We're using the add_protocol_entry method, so it should generate a pop-up screen.
    Any solution for all these problems?  Are these problems limitations of the ALV Grid in WebGUI? 
    We'll appreciate all your responses.  Thanks a lot.

    Have a look at example code: BCALV_GRID_01, where they suppress the error by catching it...
    If you are using the ABAP Grid Control (OO object), you can still create the ALV list as a spool listing for the background job.
    The easiest way to do this is to put all the create object statements and method calls for the custom container and ALV grid object inside a subroutine (for example, present_grid).
    All that is required is a simple check of the sy-batch variable to determine if the program is being executed in the foreground or background.
    e.g. if sy-batch is initial.
    call screen 0100.
    else.
    perform present_grid.
    endif.
    In a PBO module of screen 0100, the subroutine present_grid is also performed.
    The set_table_for_first_display method will be invoked in the routine present_grid, however, due to the job being executed in the background, the ALV list output will be written as spool output for the background job.

  • OO ALV buffer problem

    Hello all,
    When a workflow work item is executed, a function module is called that displays a screen.  The workitem calls a function module that displays an ALV on a screen.  The same ALV is displayed for 3 different workitems.
    I am changing the field catalog based on certain criteria to set an individual field to be editable/non-editable.  I can see that the edit field in the field catalog contains the appropriate value, but the grid does not reflect what is in the field catalog.
    The first workitem displays the ALV correctly.
    The second and third workitems display the ALV using fieldcat values from the first workitem.  The fieldcat contains the correct values when the grid is displayed using method "set_table_for_first_display".
    If I log off of SAP and log back on, the second workitem ALV displays with the correct value.  But the third workitem now display with the fieldcat values from the second workitem.
    If I log off of SAP and log back on, the third workitem ALV displays with the correct value.
    Any thought on what I need to do to correct this problem?
    This is the logic that creates and displays the ALV in the PBO of the screen of the function module.
    clear: il_fieldcat, l_layout.
      refresh: il_fieldcat.
      free: il_fieldcat.
      submit balvbufdel and return.                         " clear ALV buffer
      submit bcalv_buffer_del_shared and return. " clear ALV buffer
    *            Create an instance for the event handler
      create object gr_event_handler .
    *          Create an instance of the container displayed on screen 1400
      create object w_custom_container_1400
             exporting container_name = w_container_1400.
    *            Create an instance of the grid displayed in the container
      create object w_grid_1400
             exporting i_parent = w_custom_container_1400.
    * Build fieldcat - edit enabled.
      perform build_fieldcat_1400 changing il_fieldcat.
    *         >>  call method w_alv->set_frontend_fieldcatalog  after modifying the field ctalog <<
      call method w_grid_1400->set_frontend_fieldcatalog
       exporting
          it_fieldcatalog  =   il_fieldcat.
    * Disable generic ALV toolbar functions
      perform exclude_tb_functions_1400 changing lt_exclude.
    *  Set layout options:
      l_layout-grid_title = 'ZFXXU003'.
      l_layout-zebra      = 'X'.
      l_layout-edit_mode  = 'X'.  
      set handler gr_event_handler->handle_user_command for w_grid_1400 .
      set handler gr_event_handler->handle_toolbar      for w_grid_1400 .
      set handler gr_event_handler->handle_menu_button  for w_grid_1400 .
      set handler gr_event_handler->handle_data_changed for w_grid_1400 .
      data: w_is_variant type disvariant.
      w_is_variant-report = sy-cprog.
      w_is_variant-variant = '/DEFAULT'.
      call method w_grid_1400->set_table_for_first_display
        exporting
          i_buffer_active      = 'X'
          i_bypassing_buffer   = 'X'
          is_layout            = l_layout
          it_toolbar_excluding = lt_exclude
          i_save               = 'A'       " enable save option
          is_variant           = w_is_variant
        changing
          it_fieldcatalog      = il_fieldcat
          it_outtab            = il_outtab.
    * set editable cells to ready for input
      call method w_grid_1400->set_ready_for_input
        exporting
          i_ready_for_input = 1.
    * Register ENTER to raise event DATA_CHANGED.
      call method w_grid_1400->register_edit_event
        exporting
          i_event_id = cl_gui_alv_grid=>mc_evt_enter.
      create object w_event_receiver_1400.
      set handler w_event_receiver_1400->handle_data_changed
                  for w_grid_1400.
    Edited by: Bruce Tjosvold on Dec 8, 2010 4:21 PM
    Edited by: Bruce Tjosvold on Dec 8, 2010 4:24 PM
    Edited by: Bruce Tjosvold on Dec 8, 2010 5:04 PM

    Hi Bruce,
    You should avoid the creation of the ALV everytime that you need to change the fieldcatalog by calling the method "set_table_for_first_display". Instead, you should call the "refresh_table_display" method.
    Regarding the code that you provide to us, it should be something like this:
    if ...
    * Build fieldcat - edit enabled.
      perform build_fieldcat_1400 changing il_fieldcat.
    call method w_grid_1400->set_table_for_first_display
        exporting
          i_buffer_active      = 'X'
          i_bypassing_buffer   = 'X'
          is_layout            = l_layout
          it_toolbar_excluding = lt_exclude
          i_save               = 'A'       " enable save option
          is_variant           = w_is_variant
        changing
          *it_fieldcatalog      = il_fieldcat* "Here you are specifying your first catalog
          it_outtab            = il_outtab.
    else.
       call method w_grid_1400->refresh_table_display
    *     EXPORTING
    *     IS_STABLE =
    *     I_SOFT_REFRESH =
         EXCEPTIONS
          finished = 1
          OTHERS = 2 .
    endif.
    If you want at this point change the catalog, you should modify the values of it_fieldcat and update it on the existing ALV
      call method w_grid_1400->set_frontend_fieldcatalog
       exporting
          it_fieldcatalog  =   il_fieldcat.
    Best regards,
    Eric

  • Sum problems in Acrobat XI Pro

    I am having a problem with the sum command in Acrobat XI Pro wherby the total field is duplicating the sum of the calcualted fields, i.e ten fields are totalled and it duplicates the sum of the last 4 fields in the total fields. I have checked the calucation order is correct, but still ti will not work. Can anyone help please?

    Hi there, thanks for responding.
    Basically yes, that is my problem. I have say 10 rows and each one has a freetype box where people can enter the number of miles, the next field is a pull down list to specify a mileage rate and the last one calculates the product of the two. Then I have a total field at the bottom to sum all the totals. However, it is duplicating the totals from row two onwards, e.g. if I have two values, £12 and £15 the result returned is £42, adding the last line twice.
    I have checked the calculation order in my document and still have the same problem. I am lost......

Maybe you are looking for

  • Line item issue in order confirmation

    Hi folks..!!!   i have an issue regarding order confirmation. while i am trying to display a sale order that line item quantity and somo more data's are printing in second line. i need those data's has to be print in same line in line i.e  item , mat

  • SAP MDM Query

    Hi I have one query in MDM. I want to create one Product Category structure in taxonomy. I am new to this MDM, I can not relate this type of structure with taxonomy. Please help meu2026u2026u2026u2026 Here, we have one SKUA which is a 250 ml Fountain

  • Dynamic variables name

    Hello, I'm a beginner and i'm looking from several days to resolve this problem but i don't find the solution. Can someone help me, Please. for each (var art:XML in Rs) { var eRef:String = String(art.ref); // Exemple Ref AX51 Ref.data = eRef; // Exem

  • Photoshop elements 12 Unable to get the sharing (email) to work.

    Hi, The sharing (emailing) feature talks about using other email client but can not??? I have Outlook 2013. the other option is to use the adobe email service that needs to verify the email that I am using but does not send the verification code that

  • Automating specific tasks in Aperture

    I've been looking for a few days how best to do this, or if it's possible at all, please hear me out (this is not a 'lift and stamp'). Task: Select a number of images and perform a batch auto-level. Problem: I can't seem to find a way to do this. If