Problem with sub totals ALV Grid

Hi experts,
   I got one requirement, I am using ALV GRID function modules technique. My requirement is, I want to display one value at subtotal line(i.e. like header value). How to display the table values in the subtotal line.
Please give any solution for this.
Thanks in advance.
Sandya.

Hi Sandhya,
                   i will send a sample code for ur problem.And also i will send a entire program about subtotals.Check it once ok..Copy the below prog and execute it and debug it..
*SubTotal on the Field NETWR
    wa_fieldcat-tabname       = 'IT_SALESORDER'. "Internal
  wa_fieldcat-fieldname     = 'NETWR'.         "Field Name
  wa_fieldcat-do_sum        = 'X'.             "Sum
   APPEND wa_fieldcat TO gt_fieldcat.
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                         =
    it_fieldcat                       = gt_fieldcat
SAMPLE PROGRAM:
*& Report  YSALESORDER_ALV_SUBTOTALS                                   *
*& DEVELOPER  : KIRAN KUMAR.G                                          *
*& PURPOSE    : DISPLAYING SUBTOTALS FOR A PARTICULAR SALES DOC NO     *
*& CREATION DT: 26/11/2007                                             *
*&  REQUEST   : ERPK900035                                             *
REPORT  ysalesorder_alv_subtotals.
Type Pools
TYPE-POOLS:slis.
Tables
TABLES: vbak,  "Sales Document: Header Data
        vbap.  "Sales Document: Item Data
Global Structures
DATA:gt_fieldcat TYPE slis_t_fieldcat_alv,
     wa_fieldcat TYPE slis_fieldcat_alv,
     gt_sortcat TYPE slis_t_sortinfo_alv,
     wa_sortcat  LIKE LINE OF gt_sortcat.
Internal Table
DATA: BEGIN OF gt_salesorder OCCURS 0,
        vbeln LIKE vbak-vbeln,    " Sales Document Number
        posnr LIKE vbap-posnr,    " Sales Doc Item
        netwr LIKE vbap-netwr,    " Net Value
      END OF gt_salesorder.
SELECT OPTIONS
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: s_vbeln FOR vbak-vbeln.   " Sales Document Number.
SELECTION-SCREEN END OF BLOCK b1.
Initialization
INITIALIZATION.
  PERFORM initialization.
Start Of Selection
START-OF-SELECTION.
  PERFORM field_catalog.   "For Structure Creation
  PERFORM fetch_data.      "Get the Data From DB Table
  PERFORM sorting USING gt_sortcat.
End Of Selection
END-OF-SELECTION.
  PERFORM display_data.
*&      Form  initialization
      text
-->  p1        text
<--  p2        text
FORM initialization .
  s_vbeln-sign   = 'I'.
  s_vbeln-option = 'BT'.
  s_vbeln-low    = '4969'.
  s_vbeln-high   = '5000'.
  APPEND s_vbeln.
ENDFORM.                    " initialization
*&      Form  field_catalog
      text
-->  p1        text
<--  p2        text
FORM field_catalog .
  REFRESH : gt_fieldcat.
  CLEAR   : wa_fieldcat.
  wa_fieldcat-col_pos       = '1'.             "Column Position
  wa_fieldcat-tabname       = 'IT_SALESORDER'. "Internal Table
  wa_fieldcat-fieldname     = 'VBELN'.         "Field Name
  wa_fieldcat-key           = 'X'.             "Blue Color
  wa_fieldcat-seltext_m     = 'Sales Doc No'.  "Display Text In Screen
  APPEND wa_fieldcat TO gt_fieldcat.
  CLEAR wa_fieldcat.
  wa_fieldcat-col_pos       = '2'.             "Column Position
  wa_fieldcat-tabname       = 'IT_SALESORDER'. "Internal Table Name
  wa_fieldcat-fieldname     = 'POSNR'.         "Field Name
  wa_fieldcat-seltext_m     = 'Sales Doc Item'."Display Text In Screen
  APPEND wa_fieldcat TO gt_fieldcat.
  CLEAR wa_fieldcat.
*SubTotal on the Field NETWR
  wa_fieldcat-col_pos       = '3'.             "Column Position
  wa_fieldcat-tabname       = 'IT_SALESORDER'. "Internal Table
  wa_fieldcat-fieldname     = 'NETWR'.         "Field Name
  wa_fieldcat-do_sum        = 'X'.             "Sum
  wa_fieldcat-seltext_m     = 'Net Value'.     "Display Text In Screen
  APPEND wa_fieldcat TO gt_fieldcat.
  CLEAR wa_fieldcat.
ENDFORM.                    " field_catalog
*&      Form  sorting
      text
     -->P_IT_SORTCAT  text
FORM sorting USING p_it_sortcat TYPE slis_t_sortinfo_alv.
  CLEAR wa_sortcat.
  wa_sortcat-fieldname = 'VBELN'.
  wa_sortcat-up        ='X'.
  wa_sortcat-subtot    = 'X'.
  APPEND wa_sortcat TO p_it_sortcat.
ENDFORM.                    " sorting
*&      Form  display_data
      text
-->  p1        text
<--  p2        text
FORM display_data .
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
   EXPORTING
  I_INTERFACE_CHECK                 = ' '
  I_BYPASSING_BUFFER                = ' '
  I_BUFFER_ACTIVE                   = ' '
    i_callback_program                = 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                         =
    it_fieldcat                       = gt_fieldcat
  IT_EXCLUDING                      =
  IT_SPECIAL_GROUPS                 =
    it_sort                           = gt_sortcat
  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                          = gt_salesorder
   EXCEPTIONS
    program_error                     = 1
    OTHERS                            = 2.
  IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
ENDFORM.                    " display_data
*&      Form  fetch_data
      text
-->  p1        text
<--  p2        text
FORM fetch_data .
  REFRESH : gt_salesorder.
  CLEAR   : gt_salesorder.
  SELECT a~vbeln
         posnr
         b~netwr
    FROM vbak AS a
   INNER JOIN vbap AS b ON  avbeln = bvbeln
    INTO TABLE gt_salesorder
    WHERE a~vbeln IN s_vbeln.
ENDFORM.                    " fetch_data
Reward points if helpful.
Kiran Kumar.G.A
        Have a Nice Day..

Similar Messages

  • Problems with checkbox in ALV-GRID OO

    Hi,
    i have Problems by listing an editable checkbox
    in ALV GRID OO and handle the itab with
    the marked fields.
    Here my Code extract. Has anybody an idea or a short example.
    TYPES: BEGIN OF ALV_TAB,
            SGTXT  LIKE RK23B-SGTXT,
            CHECK(1),
          END   OF ALV_TAB.
    DATA: ITAB    TYPE TABLE OF ALV_TAB.
    Is this Declaration correct??
    <b>  GS_FIELDCAT-FIELDNAME  = 'CHECK'.
      GS_FIELDCAT-CHECKBOX   = 'X'.
      APPEND GS_FIELDCAT TO GT_FIELDCAT.
      GS_LAYOUT-EDIT         = 'X'.
      GS_LAYOUT-BOX_FNAME    = 'CHECK'.</b>
      CALL METHOD GR_ALVGRID->SET_TABLE_FOR_FIRST_DISPLAY
        EXPORTING
          IT_TOOLBAR_EXCLUDING = PT_EXCLUDE
          IS_LAYOUT            = GS_LAYOUT
        CHANGING
          IT_FIELDCATALOG      = GT_FIELDCAT
          IT_OUTTAB            = ITAB.
    FORM HANDLE_USER_COMMAND USING E_UCOMM.
      CASE E_UCOMM.
        WHEN 'REFR'.
    <b>      Here i will have the itab with the marked checkbox.
          how can i refresh?</b>*
        WHEN 'EXCEL'.
          MESSAGE I010 WITH E_UCOMM.
      ENDCASE.
    ENDFORM.                    "HANDLE_USER_COMMAND
    Regards, Dieter

    Hi, in reference to....
    ASE E_UCOMM.
    WHEN 'REFR'.
    Here i will have the itab with the marked checkbox.
    how can i refresh?*
    Do you want to get rid of the checks in any checkbox?
    If so,  just loop at modify.
    ASE E_UCOMM.
    WHEN 'REFR'.
    <b>   Loop at itab where check = 'X'.
            itab-check = space.
            modify itab.
       endloop.</b>
    Regards,
    Rich Heilman

  • Problems with do_sum in ALV-GRID OO

    Hi,
    i want to sum in ALV-GRID OO, but the sum-line are not displayed.
    Here my short extrac.
      GS_FIELDCAT-REF_TABLE  = 'COEP'.
      GS_FIELDCAT-REF_FIELD  = 'WKGBTR'.
      GS_FIELDCAT-FIELDNAME  = 'WKGBTR'.
      GS_FIELDCAT-DO_SUM     = 'X'.
      APPEND GS_FIELDCAT TO GT_FIELDCAT.
      CALL METHOD GR_ALVGRID->SET_TABLE_FOR_FIRST_DISPLAY
       EXPORTING
                 IT_TOOLBAR_EXCLUDING = GT_EXCLUDE
                 IS_LAYOUT            = GS_LAYOUT
                 IS_VARIANT           = GS_VARIANT
                 I_SAVE               = 'X'
       CHANGING
                 IT_FIELDCATALOG      = GT_FIELDCAT
                 IT_OUTTAB            = ITAB.
    Any idea want i'm doing wrong??
    Regards, Dieter

    IF that don't work try this little program to find what is missing
    report z_what.
    TYPE-POOLS slis.
    DATA: ct_fieldcat TYPE slis_t_fieldcat_alv,
          zt_fieldcat LIKE LINE OF ct_fieldcat.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
         EXPORTING
              i_structure_name = 'COEP'
         CHANGING
              ct_fieldcat      = ct_fieldcat.
    READ TABLE ct_fieldcat INTO zt_fieldcat
      WITH KEY fieldname = 'WKGBTR'.
    BREAK-POINT.
    Regards

  • Problem with Grand total in Crystal report xi

    Post Author: eshwar_polawar
    CA Forum: Crystal Reports
    Dear all,
    I am facing the problem with Grand total field in Report footer.Please advise me how should we resolve it.
    My report design as follows
    Report Title
    Page Header section:
    charged date    fee_ description charge_ amount currency_code
    Group  Header #1(Group by bank_ref)
    Group Header #2(Group by Currency code)
    Details
    charged date    fee_ description charge_ amount currency_code
    Group Footer#2 
    (Sub Total )
    Running Total field(Fields to Summarize on Charge_amount, Evaluate on "Group2# change of currency code) ,Sum of Charge_amount,Currency_ code
    Report footer:
    Sum of (charge_amount) currecy code
    Example of data:
    charged date   fee desc   chrage amount  currencycode
    0000000060129
    CAD
    10-Oct-2007    Transfer     200   Cad
    11-Oct-2007  comm          150 cad
    Sub total                        350 Cad
    0000000060129
    CAD
    10-Oct-2007    Transfer     100   USD
    11-Oct-2007  comm          150  USD
    Sub total                        250 USD
    Grand total     should   350 CAD  but it is showing  all total amoun 1000 CAD ,Group by Curreny code in the table
                                        250 USD but it is showing all  total amount 1200 USD
    Please provide the solutions like:
    1).About Running total in Report footer section
    2).Formula on While printing records for grand total
    3).How will send links with subreports
    Thanks and Regards
    Eshwar

    Post Author: eshwar_polawar
    CA Forum: Crystal Reports
    eshwar_polawar:
    Dear all,
    I am facing the problem with Grand total field in Report footer.Please advise me how should we resolve it.
    My report design as follows
    Report Title
    Page Header section:
    charged date    fee_ description charge_ amount currency_code
    Group  Header #1(Group by bank_ref)
    Group Header #2(Group by Currency code)
    Details
    charged date    fee_ description charge_ amount currency_code
    Group Footer#2 
    (Sub Total )
    Running Total field(Fields to Summarize on Charge_amount, Evaluate on "Group2# change of currency code) ,Sum of Charge_amount,Currency_ code
    Report footer:
    Sum of (charge_amount) currecy code
    Example of data:
    charged date   fee desc   chrage amount  currencycode
    0000000060129
    CAD
    10-Oct-2007    Transfer     200   Cad
    11-Oct-2007  comm          150 cad
    Sub total                        350 Cad
    0000000060129
    CAD
    10-Oct-2007    Transfer     100   USD
    11-Oct-2007  comm          150  USD
    Sub total                        250 USD
    Grand total     should   350 CAD  but it is showing  all total amoun 1000 CAD ,Group by Curreny code in the table
                                        250 USD but it is showing all  total amount 1200 USD
    Please provide the solutions like:
    1).About Running total in Report footer section
    2).Formula on While printing records for grand total
    3).How will send links with subreports
    Thanks and Regards
    Eshwar

  • Problem with Grand Total

    Post Author: eshwar_polawar
    CA Forum: Formula
    Dear all,
    I am facing the problem with Grand total field in Report footer.Please advise me how should we resolve it.
    My report design as follows
    Report Title
    Page Header section:
    charged date    fee_ description charge_ amount currency_code
    Group  Header #1(Group by bank_ref)
    Group Header #2(Group by Currency code)
    Details
    charged date    fee_ description charge_ amount currency_code
    Group Footer#2 
    (Sub Total )
    Running Total field(Fields to Summarize on Charge_amount, Evaluate on "Group2# change of currency code) ,Sum of Charge_amount,Currency_ code
    Report footer:
    Sum of (charge_amount) currecy code
    Example of data:
    charged date   fee desc   chrage amount  currencycode
    0000000060129
    CAD
    10-Oct-2007    Transfer     200   Cad
    11-Oct-2007  comm          150 cad
    Sub total                        350 Cad
    0000000060129
    CAD
    10-Oct-2007    Transfer     100   USD
    11-Oct-2007  comm          150  USD
    Sub total                        250 USD
    Grand total     should   350 CAD  but it is showing  all total amoun 1000 CAD ,Group by Curreny code in the table
                                        250 USD but it is showing all  total amount 1200 USD
    Thanks and Regards
    Eshwar

    Post Author: eshwar_polawar
    CA Forum: Crystal Reports
    eshwar_polawar:
    Dear all,
    I am facing the problem with Grand total field in Report footer.Please advise me how should we resolve it.
    My report design as follows
    Report Title
    Page Header section:
    charged date    fee_ description charge_ amount currency_code
    Group  Header #1(Group by bank_ref)
    Group Header #2(Group by Currency code)
    Details
    charged date    fee_ description charge_ amount currency_code
    Group Footer#2 
    (Sub Total )
    Running Total field(Fields to Summarize on Charge_amount, Evaluate on "Group2# change of currency code) ,Sum of Charge_amount,Currency_ code
    Report footer:
    Sum of (charge_amount) currecy code
    Example of data:
    charged date   fee desc   chrage amount  currencycode
    0000000060129
    CAD
    10-Oct-2007    Transfer     200   Cad
    11-Oct-2007  comm          150 cad
    Sub total                        350 Cad
    0000000060129
    CAD
    10-Oct-2007    Transfer     100   USD
    11-Oct-2007  comm          150  USD
    Sub total                        250 USD
    Grand total     should   350 CAD  but it is showing  all total amoun 1000 CAD ,Group by Curreny code in the table
                                        250 USD but it is showing all  total amount 1200 USD
    Please provide the solutions like:
    1).About Running total in Report footer section
    2).Formula on While printing records for grand total
    3).How will send links with subreports
    Thanks and Regards
    Eshwar

  • Problem with sub-screen actions on Cancel button

    Hi all,
    I have a problem with sub-screen.
    I created a subscreen (screen sequence in MM01/MM02/MM03). When users leave this screen, I call POPUP_TO_CONFIRM to ask if they want to save the data.
    1) My goal is: when they choose Cancel, no actions are performed and users will see the current screen. However, I cannot use command: SET SCREEN 0 or LEAVE TO SCREEN 0 because the system gives an error message:
    *SET SCREEN not allowed in subscreens*.
    2) How can we determine when the user leaves the screen? which value of SY-UCOMM will be used to check this?
    Thanks in advance.

    for dis SET SCREEN is not required.
    Consider d code given below as n eg:
    CALL FUNCTION 'POPUP_TO_CONFIRM'
        EXPORTING
          titlebar              = 'SAVE'
          text_question         = 'SOME _QUS'
          text_button_1         = 'YES'
          text_button_2         = 'NO'
          default_button        = '2'
          display_cancel_button = ' '
        IMPORTING
          answer                = l_ans
        EXCEPTIONS
          text_not_found        = 1
          OTHERS                = 2.
      IF sy-subrc <> 0.
        MESSAGE e066.
      ENDIF.
    IF l_ans EQ '1'.    " when yes is pressed
       MODIFY db.
       commit work.
       leave program.
    ELSEIF l_ans EQ '2'.  "when no is pressed
        leave program.
    ELSE.     " when cancel is pressed
    ENDIF.
    In above module when Yes is pressed it saves data den leave prog.
    As no action is specified for cancel button it will remain on that screen only from which popup is called, in this way ur problem can be solved.
    Reward properly.

  • Problem with the "Total By" icon

    Hi.
    Working with Answer I've a problem with the "Total By" icon when the fact displayed is semi-additive.
    I try to explain better:
    1) my fact table has the following dimensions
    Time (year granularity)
    City
    Type of contracts
    2) the fact table contains the fact "Number of Active Contracts"
    this fact is additive by City and Type but not by Year.
    The "Number of Active Contracts" is calculated usign 2 existing logical columns
    Sum (of Number Of Contracts (at base granularity)) / Count Distinct ( of Years )
    This fact express an average when more than year is involed in the aggregation,
    but express the exact number of contracts if the year is displayed as an output column of the report.
    This fact works well changing the aggregation in reports, but when I click on the "Total By" icon to show
    the totals its behaviour is different from expected.
    consider the report with the following columns:
    Yearm City, Number of Active Contracts
    Click her to view it: http://yfrog.com/euerrtotaliconj
    The "Total By" icon Instead of the sum divided by ditinct years involed, i.e. 1, shows the sum divided by the number of Cities.
    It seem it is counting 5 tiimes (= number of cities) the same year.
    But If make a report with
    Year, Number of Active Contracts
    Click her to view it: http://yfrog.com/mjoktotalj
    it works as expected !
    Many thanks,
    Andrea
    Edited by: aromani on 17-nov-2010 8.06

    Philipp is right to tell the developer that the toolbar is automatically disappearing after customizing the add-on on the toolbar. I tried it, and it looks like it gets attached to the Bookmark Tool bar. It may help to make sure all the Toolbars are visible in '''View> Toolbars. '''
    It may also be because I have too many extensions on my toolbar ( Too many favorites :-))

  • Excel File Format Problem while downloading in ALV Grid

    Hi All,
    My program gives an ALV Grid Output which contains the file download button , when I choose spread sheet as the file format , the actual data starts only from 4th line and the lines above it contain date, heading etc and the rest are blank. Is it possible that I can download only the records in the grid output with the column names and not the unnecessary log?
    Also the format is not proper excel format, this same file will be used for upload into another program using the Function Module 'TEXT_CONVERT_XLS_TO_SAP'. When I load the file saved in the above format, this Function Module always fails.
    Please let me know any solution for this problem
    Thanks in Advance.

    Hi
    try this code----
    *&      Form  DOWNLOAD_EXCEL_TEMPLATE
          text
    -->  p1        text
    <--  p2        text
    FORM download_excel_template .
      TYPES: BEGIN OF lt_data,
                field1(20),
                field2(30),
                field3(20),
                field4(20),
                field5(20),
                field6(30),
                field7(15),
                field8(10),
                field9(10),
                field10(20),
                field11(20),
                field12(10),
                field13(20),
                field14(20),
              END OF lt_data.
      DATA: lv_file TYPE rlgrap-filename,
            li_data TYPE STANDARD TABLE OF lt_data,
            wa_data TYPE lt_data,
            lv_pathcheck type c,
            lv_file1 type string.
      wa_data-field1 = ''.
      APPEND wa_data TO li_data.
      REFRESH gi_header.
      wa_header-name = 'Company Code'.
      APPEND wa_header TO gi_header.
      wa_header-name = 'Main Asset Number'.
      APPEND wa_header TO gi_header.
      wa_header-name = 'Asset Sub Number'.
      APPEND wa_header TO gi_header.
      wa_header-name = 'Document Date'.
      APPEND wa_header TO gi_header.
      wa_header-name = 'Posting Date'.
      APPEND wa_header TO gi_header.
      wa_header-name = 'Asset Value Date'.
      APPEND wa_header TO gi_header.
      wa_header-name = 'Item Text'.
      APPEND wa_header TO gi_header.
      wa_header-name = 'Reference'.
      APPEND wa_header TO gi_header.
      wa_header-name = 'Allocation'.
      APPEND wa_header TO gi_header.
      wa_header-name = 'Amount Posted'.
      APPEND wa_header TO gi_header.
      wa_header-name = 'Percentage Rate'.
      APPEND wa_header TO gi_header.
      wa_header-name = 'Quantity'.
      APPEND wa_header TO gi_header.
      wa_header-name = 'Prior-Yr Quantity'.
      APPEND wa_header TO gi_header.
      wa_header-name = 'Curr-Yr Quantity'.
      APPEND wa_header TO gi_header.
      lv_file = gv_file.
      lv_file1 = gv_file.
      CALL METHOD cl_gui_frontend_services=>directory_exist
        EXPORTING
          directory            = lv_file1
        RECEIVING
          result               = lv_pathcheck
        EXCEPTIONS
          cntl_error           = 1
          error_no_gui         = 2
          wrong_parameter      = 3
          not_supported_by_gui = 4
          OTHERS               = 5.
       FIND '.xls' IN lv_file IGNORING CASE.
      IF sy-subrc = 0.
        REPLACE '.XLS' IN lv_file WITH ' ' IGNORING CASE.
      ENDIF.
      FIND '.TXT' IN lv_file IGNORING CASE.
      IF sy-subrc = 0.
        REPLACE '.TXT' IN lv_file WITH ' ' IGNORING CASE.
      ENDIF.
      CALL FUNCTION 'MS_EXCEL_OLE_STANDARD_DAT'
        EXPORTING
          file_name                 = lv_file
          data_sheet_name           = 'DATA'
        TABLES
          data_tab                  = li_data
          fieldnames                = gi_header
        EXCEPTIONS
          file_not_exist            = 1
          filename_expected         = 2
          communication_error       = 3
          ole_object_method_error   = 4
          ole_object_property_error = 5
          invalid_pivot_fields      = 6
          download_problem          = 7
          OTHERS                    = 8.
      IF sy-subrc <> 0.
        MESSAGE ID gv_msgid TYPE 'E' NUMBER 002.
      ENDIF.
    ENDFORM.                    " DOWNLOAD_EXCEL_TEMPLATE
    regards,
    Prashant

  • Problem refreshing fieldcatalog in ALV grid classic

    Hi gurus,
    I´m really having problems with the column titles that are display in my ALV report and I cannot figure out why. I want to be able to print the text either in Spanish or in English, depending on the company code in the selection criteria screen. I refresh and populate the fieldcatalog with EN texts and I can see that changes are taken and pass to FM REUSE_ALV_GRID_DISPLAY but when I execute it they still show the Spanish text.
    Please help me with things. Points will be rewarded.
    I show here part of the code.
    FORM make_field_catalog.
      DATA: l_repid LIKE sy-repid.
      DATA: ls_fieldcat TYPE slis_fieldcat_alv.
      DATA: pos         TYPE i VALUE 1.
      l_repid   = sy-repid.
      CLEAR ls_fieldcat.
      REFRESH i_fieldcat.
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
       EXPORTING
          i_program_name     = l_repid
          i_internal_tabname = 'GT_OUTPUT'
          i_inclname         = l_repid
          i_bypassing_buffer = 'X'
       CHANGING
          ct_fieldcat        = i_fieldcat.
    Fields to output in the ALV.
    Show different languages, depending on the company code.
      IF is_es EQ 'X'.
        ls_fieldcat-col_pos        =   pos.
        ls_fieldcat-fieldname      =  'CUSTOMER'.
        ls_fieldcat-seltext_l      =  text-002.
        ls_fieldcat-ddictxt        =  'L'.
        ls_fieldcat-outputlen      =   10.
        ls_fieldcat-key            =  'X'.
        APPEND ls_fieldcat TO i_fieldcat.
        CLEAR ls_fieldcat.
        pos = pos + 1.
        ls_fieldcat-col_pos        =   pos.
        ls_fieldcat-fieldname      =  'DOC_NO'.
        ls_fieldcat-seltext_l      =  text-003.
        ls_fieldcat-ddictxt        =  'L'.
        ls_fieldcat-outputlen      =   10.
        APPEND ls_fieldcat TO i_fieldcat.
        CLEAR ls_fieldcat.
        pos = pos + 1.
        ls_fieldcat-col_pos        =   pos.
        ls_fieldcat-fieldname      =  'DOC_DATE'.
        ls_fieldcat-seltext_l      =  text-004.
        ls_fieldcat-ddictxt        =  'L'.
        ls_fieldcat-outputlen      =   10.
        APPEND ls_fieldcat TO i_fieldcat.
        CLEAR ls_fieldcat.
        pos = pos + 1.
        ls_fieldcat-col_pos        =   pos.
        ls_fieldcat-fieldname      =  'NET_AMOUNT'.
        ls_fieldcat-seltext_l      =  text-005.
        ls_fieldcat-ddictxt        =  'L'.
        ls_fieldcat-outputlen      =   15.
        ls_fieldcat-do_sum         =  'X'.
        ls_fieldcat-datatype       =  'QUAN'.
        APPEND ls_fieldcat TO i_fieldcat.
        CLEAR ls_fieldcat.
        pos = pos + 1.
      ELSE.
        ls_fieldcat-col_pos        =   pos.
        ls_fieldcat-fieldname      =  'CUSTOMER'.
        ls_fieldcat-seltext_l      =  text-012.
        ls_fieldcat-ddictxt        =  'L'.
        ls_fieldcat-outputlen      =   10.
        ls_fieldcat-key            =  ' '.
        APPEND ls_fieldcat TO i_fieldcat.
        CLEAR ls_fieldcat.
        pos = pos + 1.
        ls_fieldcat-col_pos        =   pos.
        ls_fieldcat-fieldname      =  'DOC_NO'.
        ls_fieldcat-seltext_l      =  text-013.
        ls_fieldcat-ddictxt        =  'L'.
        ls_fieldcat-outputlen      =   10.
        APPEND ls_fieldcat TO i_fieldcat.
        CLEAR ls_fieldcat.
        pos = pos + 1.
        ls_fieldcat-col_pos        =   pos.
        ls_fieldcat-fieldname      =  'DOC_DATE'.
        ls_fieldcat-seltext_l      =  text-014.
        ls_fieldcat-ddictxt        =  'L'.
        ls_fieldcat-outputlen      =   10.
        APPEND ls_fieldcat TO i_fieldcat.
        CLEAR ls_fieldcat.
        pos = pos + 1.
        ls_fieldcat-col_pos        =   pos.
        ls_fieldcat-fieldname      =  'NET_AMOUNT'.
        ls_fieldcat-seltext_l      =  text-015.
        ls_fieldcat-ddictxt        =  'L'.
        ls_fieldcat-outputlen      =   15.
        ls_fieldcat-do_sum         =  'X'.
        ls_fieldcat-datatype       =  'QUAN'.
        APPEND ls_fieldcat TO i_fieldcat.
        CLEAR ls_fieldcat.
        pos = pos + 1.
      ENDIF.
    ENDFORM.
    And later i make the call like follows:
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                i_buffer_active       = g_alv_buffer
                i_callback_program    = l_repid
               i_callback_top_of_page = 'TOP_OF_PAGE'
               i_callback_html_top_of_page = 'TOP_OF_PAGE'
                is_layout             = g_layout
                it_fieldcat           = i_fieldcat
                it_special_groups     = g_fieldgroups_tab[]
                it_sort               = g_sortfields_tab[]
                i_default             = c_n
                i_save                = c_a
                is_variant            = g_variant
                it_events             = g_events_tab[]
                it_event_exit         = g_event_exit_tab[]
                is_print              = g_print
                i_screen_start_column = g_screen_start_column
                i_screen_start_line   = g_screen_start_line
                i_screen_end_column   = g_screen_end_column
                i_screen_end_line     = g_screen_end_line
           TABLES
                t_outtab              = gt_output
           EXCEPTIONS
                program_error         = 1
                OTHERS                = 2.
    Does anybody knows what am I missing?
    Thanks! Elena

    hi ..
    Ensure Field catalog is Refreshed every time before it is buid.
    Code:
    <b>REFRESH i_fieldcat.</b>
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
    i_program_name = l_repid
    i_internal_tabname = 'GT_OUTPUT'
    i_inclname = l_repid
    i_bypassing_buffer = 'X'
    CHANGING
    ct_fieldcat = i_fieldcat.
    <b>Reward if Helpful.</b>

  • Problem with document total

    Dear All,
    I have problem adding an invoice through DI API with the total amount of 50,000 including VAT. The system is SBO 2005B, PL42; Document Setting is as following:
    - Rounding Method = By Document
    - Rounding Rule for Tax = Round Down
    - Round Tax Amount in Rows = False
    The following VBA code is used to add an invoice:
    Dim boInv As SAPbobsCOM.Documents
    Dim boCom As SAPbobsCOM.Company
    Set boCom = GetSboCompany() 'this function returns SBO company
    Set boInv = boCom.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInvoices)
    boInv.CardCode = "Customer1"
    boInv.DocDate = #9/1/2008#
    boInv.DocType = dDocument_Items
    boInv.DocCurrency = "JPY"
    'Now add a invoice line
    'boInv.Lines.Add - No need for the first line
    boInv.Lines.ItemCode = "item1"
    boInv.Lines.VatGroup = "S01" 'VAT rate for Japan is 5%
    boInv.Lines.PriceAfterVAT = 50000
    boInv.Add 'add the invoice
    What I get is an invoice with:
    Gross Price = 50000 (in a line)
    Total (LC) = 47619 (in a line)
    Tax Amount = 2380.952381 (in a line)
    and
    Total Before Discount = 47619 (in a header)
    Tax = 2380 (in a header; fractional part was round down because of the Document Setting)
    Total = 49999 (in a header; which is different from Gross Price by 1 yen)
    However, if I enter this invoice directly from the screen, then there will be no difference between Gross Price (Price after VAT) and Total, so, the invoice will be created correctly.
    My question is how to add an invoice with the total amount of 50000? (Of course, 50000 is not the only "difficult" number, for example, 40000 also poses the same problem). I tried to use boInv.Lines.NetTaxAmount property to directly assign the tax amount (which is possible from the SBO screen), but in PL42 there's an error saying that this property is not yet implemented.

    Verner, thank you for advice. I also tried that way, but wasn't helpful. OK, I found a solution that is I think acceptible. I will describe it in short, for those who face such problem. Basic idea is to use XML to create an invoice. Here's the code:
    Dim boInv As SAPbobsCOM.Documents
    Dim boCom As SAPbobsCOM.Company
    Dim strXML As String
    Set boCom = GetSboCompany() 'this function returns SBO company
    'XML data will be supplied as string variable, not an external file
    gboCom.XMLAsString = True
    'Here you will create your XML stream. Important tags are <DocTotal> for the invoice header, and
    '<Quantity>, <PriceAfVAT> tags for invoice lines. If <DocTotal> is specified then you will get invoice with
    'this exact total amount. If sum of <Quantity> x <PriceAfVAT> is equal to '<DocTotal>, then
    'document level discount will be zero.
    strXML = "<BOM> ... </BOM>" 'building XML here
    Set boInv = gboCom.GetBusinessObjectFromXML(strXML, 0) 'Create an invoice object from XML
    boInv.Add 'add the invoice
    Edited by: Jandos Khalik on Sep 2, 2008 10:17 AM
    Edited by: Jandos Khalik on Sep 2, 2008 10:18 AM
    Edited by: Jandos Khalik on Sep 2, 2008 10:20 AM

  • Problems with exporting PWA views (grids in general) to Excel 2010 with Windows 8 + IE 10 as a client configuration

    Hello,
    I wondering if windows 8 + IE10 is a supported client configuration for PWA (Project Server 2010). I am unable to export PWA views to Excel 2010. No problems with Windows 7 + IE8/9
    Any ideas?
    thanks,
    Daniel
    Daniel Villacis

    Hi,
    We followed the below steps in the local machine and check the behavior.
    a. Open the Windows registry editor (regedit.exe)
    b. Go the location HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\excel.exe
    c. Here, you’ll see a string value named “useURL”
    d. Rename this value to something else.  For example “useURLx”
    Note: You might have to restart the machine to apply the registry change to take effect.

  • Problem with PF_STATUS in ALV

    Hi
    I have the following code written in my report to set PF_STATUS in ALV.But its not working
    call function 'REUSE_ALV_GRID_DISPLAY'
         exporting
              i_callback_program = g_repid
              i_callback_pf_status_set = 'PF_STATUS_SET'
             I_CALLBACK_USER_COMMAND =  ''
             i_structure_name = 'I_BOLACT'
             i_grid_title = 'BOL Action Report'(031)
             is_layout = gs_layout
              i_save             = 'A'
              it_fieldcat        = gt_fieldcat[]
    FORM PF_STATUS_SET USING rt_extab TYPE slis_t_extab.
    set PF-STATUS 'ZPF_STAT'.
    ENDFORM.
    Please help where am I going wrong.
    Regards
    Ishita

    If any of the above solution in not working, you can use EVENTS to handle it.
    using
    * TO Get all the ALV Events
      call function 'REUSE_ALV_EVENTS_GET'
        exporting
          i_list_type     = 0
        importing
          et_events       = it_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.
    * FOR THE PF-STATUS EVENT
      read table it_events into wa_event with key name = slis_ev_pf_status_set.
      if sy-subrc eq 0.
        wa_event-form = 'PF_STATUS_SET'.
        modify it_events from wa_event
                         transporting form
                         where name = wa_event-name.
      endif.
    and then set your PF Status in Form 'PF_STATUS_SET'
    hope this solves your problem.
    Jinson.

  • Download excel with formula from alv grid

    I developed a alv report and I have one percentage field(say PER) in the grid.When I sum on that field PER then it comes in my formula basis.Suppose If I have 5 line items and all PER field have a value 2 then when I sum in PER column then it come 7 inseted of 10 becoze of my formula basis and it comes perfect.But my query is when I download to excel then it comes real value 10 insted of 7. here my formula basis sum which is 7 for all 5 line items is not comming. Can any body help me how will it come?
    Thanks,
    Rakesh

    Hi,
    I dont think its possible because... it uses its internal functionality in displaying the alv with the formula you have given.... but while downloading it only considers the internal table that will be downloaded so whatever is there in the internal table that only would be downloaded... you can do one thing..... instead of using a sort standard button include your own sort button and write its code for gui_download and in the internal table append a line which contains the formula you wanted that will work....
    Regards,
    Siddarth

  • Problems with sub menus in Internet Explorer

    My menu bars work great in Chrome and Firefox however my submenus are jacked up in Internet Explorer. Can someone please give me some direction? Thanks.
    The website is www.aptyssolutions.com

    Have a look here http://www.dwcourse.com/dreamweaver/ten-commandments-spry-menubars.php#one
    Then have a look at what you have got
    BROWSER HACKS: the hacks below should not be changed unless you are an expert
    /* HACK FOR IE: to make sure the sub menus show above form controls, we underlay each submenu with an iframe */
    ul.MenuBarHorizontal iframe
        position: absolute;
        z-index: 1010;
        filter:alpha(opacity:0.1);
    /* HACK FOR IE: to stabilize appearance of menu items; the slash in float is to keep IE 5.0 from parsing */
    @media screen, projection
        ul.MenuBarHorizontal li.MenuBarItemIE
           display: block;
            f\loat: auto;
            background:
    and
    /* Submenus should appear below their parent (top: 0) with a higher z-index, but they are initially off the left side of the screen (-1000em) */
    ul.MenuBarHorizontal ul
        margin: 0;
        padding: 0;
        list-style-type: none;
        font-size: 100%;
        cursor: default;
        width: AUTO;
        position: absolute;
        left: -1000em;
       top: 23px;
        height: 35px;
        background-image: url(/images/bluebar.png);
    There is more, but the above is most likely what is causing the problem.
    I suggest that you resurrect the original SpryMenuBarHorizontal.css and start again.

  • Problem with sub queries

    Hi
    I have 3 tables like,
    LIST (ID NUMBER, NAME)
    LIST_VERSION (ID NUMBER, VER NUMBER, STATE_CODE number)
    STATE_CODES (CODE NUMBER, DESC VARCHAR2)
    LIST to LIST_VERSION is one to many relation. I have a query like this,
    SELECT LV.* from LIST_VERSION WHERE
    LV.VER = (SELECT MAX(LV1.VER) FROM LIST_VERSION LV1 WHERE
    LV1.ID = LV.ID)
    OR LV.VER = (SELECT MAX(LV2.VER) FROM LIST_VERSION LV2 WHERE
    LV2.ID = LV.ID and LV2.STATE_CODE=1)
    LIST to LIST_VERSION and LIST_VERSION to STATE_CODES table is defined
    in toplink mapping. To translate this into expression I have tried several possible combinations with out any luck. I was able to get the individual queries (the ones in OR) work, but not together. Here is what I did for individual queries
    ExpressionBuilder bldr = new ExpressionBuilder(ListVersion.class);
    ExpressionBuilder sub1 = new ExpressionBuilder ();
    ExpressionBuilder sub2 = new ExpressionBuilder ();
    ReportQuery subQ1 = new ReportQuery (ListVersion.class, sub1);
    ReportQuery subQ2 = new ReportQuery (ListVersion.class, sub2);
    subQ1.addMaximum ("listVer");
    subQ1.setSelectionCriteria (sub1.get ("list").get ("id").equal (bldr.get ("list").get("id")));
    subQ2.addMaximum ("listVer");
    subQ2.setSelectionCriteria (sub2.get ("list").get ("id").equal (bldr.get ("list").get("list")).and (sub2.get ("stateCode").get ("code").equal (1)));
    Expression exp1 = bldr.get("listVer").equal(subQ1);
    Expression exp2 = bldr.get("listVer").equal(subQ2);
    Each of the above expressions work fine independenty. However if I try to do some thing like,
    exp1.or(exp2) I get very strange SQL generated and get SQL exceptions in code. The SQL it generates is
    SELECT t0.ID, t0.VER, t0.STATE_CODE FROM LIST_VERSION t0 WHERE ((t0.VER = (SELECT MAX(t1.VER) FROM LIST t3, LIST t2, LIST_VERSION t1 WHERE ((t2.ID = t3.ID) AND ((t3.ID = t0.ID) AND (t2.ID = t1.ID))))) OR (t0.VER = (SELECT MAX(t4.VER) FROM LIST t5, LIST_VERSION t4, STATE_CODES t6 WHERE (((t5.ID = t3.ID) AND (t6.STATE_CODE = ?)) AND ((t6.STATE_CODE = t4.CODE) AND (t5.ID = t4.ID))))))
    The problem occurs because the t3.ID in the second sub query is not correct. it should be t0.ID, but I can't figureout why this is happening. Any help or suggessions to achieve my objective?
    Thanks
    Bhaskar

    Looking at your query that works at the bottom, I do not see any reason that you would need to include the Assignment table in the From list. Just use the same where clause in the form:
      Where project.resources_maximum
        > (Select Count(assignment.employee_ID)
           From assignment
           Where assignment.project_ID = project.project_ID
           group by assignment.project_ID  )

Maybe you are looking for

  • Report for viewing Sales order no against delivery date & actual GI date

    Hi Experts, Is there any report for viewing Sales order no against delivery date & *actual GI date* Because in VL06F , i can only able to get planned GI. Please guide regarding the same where i can get 'ACTUAL GI DATE ' against above combination . Re

  • Buying an external hard drive

    I just learned that memory and hard disk capacity are not the same thing. Anyway, since I've just increased my memory from 2 to 4 GB, while since my computer is now telling me that my "Starter Drive?" is full, I've decided to buy an external hard dri

  • File Polling is not working in FTP adapter

    Experts, Configured FTP adapter should poll the file from the FTP server which is in active mode .But this is not happening as expected. This feature was not available in Oracle soa 10g http://download.oracle.com/technology/tech/soa/soa_best_practice

  • Exporting Frame content to Word?

    Hi, I am working on manuals that have been done in both Frame 7.2 and Word 2003 and am hoping to migrate to a newer version of Frame some day. Right now I'm trying to update a few Word-based manuals with some content from Frame docs but it's slow and

  • Bridge/Photoshop Web Gallery Question-flashobject.js file

    Hi There, I have a question about the Photoshop Flash Gallery, particularly the flashobject.js file and index.html file.  Whenever I try and open the finished Flash Gallery HTML page, I get a message that says "Please upgrade your Flash player" and "