ALV - Subtotals with different waers

Hello!
I have a hierarquical ALV sorted by LIFNR and payments with the WRBTR and WAERS columns.
WAERS can be 'ARS' 'USD' etc. for the same LIFNR.
I want to display subtotals of WRBTR field for each LIFNR by WAERS.
Can anyone help me please?
Thanks,
Liliana.

Hi Liliana,
Plz check this code .
report  zxx_alvexer4    message-id zz        .
*& TABLES DECLARATION                                                  *
tables: vbak, vbap.
*& TYPE POOLS DECLARATION                                              *
type-pools: slis.
                      DATA DECLARATIONS                             *
data: v_flag type c.                        "Flag to display the header
data: v_repid type sy-repid.
*& INTERNAL TABLE DECLARATION                                          *
data: begin of it_vbak occurs 0,
       vbeln like vbak-vbeln,
       audat like vbak-audat,
       auart like vbak-auart,
       netwr like vbak-netwr,
       expand(1),
      end of it_vbak.
data: begin of it_vbap occurs 0,
       vbeln like vbap-vbeln,
       posnr like vbap-posnr,
       matnr like vbap-matnr,
       pstyv like vbap-pstyv,
       charg like vbap-charg,
     end of it_vbap.
data: it_fldcat type slis_t_fieldcat_alv,
      it_fldcat1 type slis_t_fieldcat_alv,
*events
      it_events type slis_t_event with header line,
      v_call type c,
      x_user type  slis_exit_by_user,
      it_variant like  disvariant occurs 0 with header line,
      x_keyinfo type slis_keyinfo_alv,
*layout
      x_layout type slis_layout_alv,
*sort
      it_sort type slis_t_sortinfo_alv,
      wa_sort like line of it_sort,
      x_cat type slis_fieldcat_alv,
      v_tabix like sy-tabix.
      Selection screen Declaration
*--BLOCK1
selection-screen begin of block b1 with frame title text-001.
select-options: s_vbeln for vbak-vbeln,
                s_auart for vbak-auart.
selection-screen end of block b1.
AT SELECTION-SCREEN                                                 *
*- Validations
at selection-screen.
  perform validate_screen.
              START OF SELECTION                                    *
start-of-selection.
*- To get data from VBAK
  perform get_data.
*to get data from VBAP
  perform get_data_vbap.
  perform prepare_alv.
              END OF SELECTION                                    *
end-of-selection.
  perform display_report.
*&      Form  VALIDATE_SCREEN
      text
-->  p1        text
<--  p2        text
form validate_screen .
  data: lv_vbeln like vbak-vbeln,
        lv_auart like vbak-auart.
  if not s_vbeln[] is initial.
    select vbeln
           into lv_vbeln
           from vbak
           where vbeln in s_vbeln.
    endselect.
    if sy-subrc <> 0.
      message e000 with 'INVALID SALES DOC'(002).
    endif.
  endif.
  if not s_auart[] is initial.
    select auart
           into lv_auart
           from vbak
           where auart in s_auart.
    endselect.
    if sy-subrc <> 0.
      message e000 with 'INVALID SALES DOC TYPE'(003).
    endif.
  endif.
endform.                    " VALIDATE_SCREEN
*&      Form  GET_DATA
      text
-->  p1        text
<--  p2        text
form get_data .
  select vbeln
         audat
         auart
         netwr
         from vbak
         into table it_vbak
         where vbeln in s_vbeln
         and auart in s_auart.
  if sy-subrc = 0.
    sort it_vbak by vbeln.
  endif.
endform.                    " GET_DATA
*&      Form  GET_DATA_VBAP
      text
-->  p1        text
<--  p2        text
form get_data_vbap .
  select vbeln
         posnr
         matnr
         pstyv
         charg
         into table it_vbap
         from vbap
         for all entries in it_vbak
         where vbeln = it_vbak-vbeln.
  if sy-subrc = 0.
    sort it_vbap by vbeln posnr.
  endif.
endform.                    " GET_DATA_VBAP
*&      Form  prepare_alv
      text
-->  p1        text
<--  p2        text
form prepare_alv .
Prepare field catalog .
  perform prepare_catalog.
Modify catalog
  perform change_attr_of_catalog.
Modify Layout
  perform modify_layout.
Sort Catalog
  perform sort_catalog.
endform.                    " prepare_alv
*&      Form  prepare_catalog
      text
-->  p1        text
<--  p2        text
form prepare_catalog .
  call function 'REUSE_ALV_FIELDCATALOG_MERGE'
    exporting
      i_program_name         = sy-repid
      i_internal_tabname     = 'IT_VBAK'
      i_inclname             = sy-repid
    changing
      ct_fieldcat            = it_fldcat1[]
    exceptions
      inconsistent_interface = 1
      program_error          = 2
      others                 = 3.
  if sy-subrc <> 0.
    message id sy-msgid type sy-msgty number sy-msgno
            with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  endif.
  append lines of it_fldcat1 to it_fldcat.
  clear: it_fldcat1[].
  call function 'REUSE_ALV_FIELDCATALOG_MERGE'
    exporting
      i_program_name         = sy-repid
      i_internal_tabname     = 'IT_VBAP'
      i_inclname             = sy-repid
    changing
      ct_fieldcat            = it_fldcat1[]
    exceptions
      inconsistent_interface = 1
      program_error          = 2
      others                 = 3.
  if sy-subrc <> 0.
    message id sy-msgid type sy-msgty number sy-msgno
            with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  endif.
  append lines of it_fldcat1 to it_fldcat.
endform.                    " prepare_catalog
*&      Form  change_attr_of_catalog
      text
-->  p1        text
<--  p2        text
form change_attr_of_catalog .
  loop at it_fldcat into x_cat.
    v_tabix = sy-tabix.
    case x_cat-fieldname.
      when  'EXPAND'.
        if x_cat-tabname = 'IT_VBAK'.
          x_cat-no_out = 'X'.
        endif.
     when  'VBELN'.
       if x_cat-tabname = 'IT_VBAK'.
         x_cat-no_out = 'X'.
       endif.
      when  'VBELN'.
        if x_cat-tabname = 'IT_VBAK'.
          x_cat-col_pos   = '1'.
          x_cat-seltext_m = 'SALES DOC'.
          x_cat-seltext_l = 'SALES DOC'.
          x_cat-seltext_s = 'SALES DOC'.
          x_cat-outputlen = '10'.
        endif.
      when  'AUDAT'.
        if x_cat-tabname = 'IT_VBAK'.
          x_cat-col_pos   = '2'.
          x_cat-seltext_m = 'DOC DATE'.
          x_cat-seltext_l = 'DOC DATE'.
          x_cat-seltext_s = 'DOC DATE'.
          x_cat-outputlen = '8'.
        endif.
      when  'AUART'.
        if x_cat-tabname = 'IT_VBAK'.
          x_cat-col_pos   = '3'.
          x_cat-seltext_m = 'ORDER REASON'.
          x_cat-seltext_l = 'ORDER REASON'.
          x_cat-seltext_s = 'ORDER REASON'.
          x_cat-outputlen = '5'.
        endif.
      when  'NETWR'.
        if x_cat-tabname = 'IT_VBAK'.
          x_cat-col_pos   = '4'.
          x_cat-seltext_m = 'NET PRICE'.
          x_cat-seltext_l = 'NET PRICE'.
          x_cat-seltext_s = 'NET PRICE'.
          x_cat-outputlen = '15'.
        endif.
    endcase.
    modify it_fldcat from x_cat.
    clear x_cat.
  endloop.
endform.                    " change_attr_of_catalog
*&      Form  modify_layout
      text
-->  p1        text
<--  p2        text
form modify_layout .
  x_layout-default_item = 'X'.
  x_layout-zebra = 'X'.
  x_layout-expand_fieldname = 'EXPAND'.
endform.                    " modify_layout
*&      Form  sort_catalog
      text
-->  p1        text
<--  p2        text
form sort_catalog .
  clear wa_sort.
  wa_sort-spos = '01'.
  wa_sort-fieldname = 'VBELN' .
  wa_sort-tabname   = 'IT_VBAP'.
  wa_sort-up        = 'X'.
  append wa_sort to it_sort.
  clear  wa_sort.
  wa_sort-spos = '02'.
  wa_sort-fieldname = 'POSNR' .
  wa_sort-tabname   = 'IT_VBAP'.
  wa_sort-up        = 'X'.
  append wa_sort to it_sort.
endform.                    " sort_catalog
*&      Form  DISPLAY_REPORT
      text
-->  p1        text
<--  p2        text
form display_report .
  it_variant-report = sy-repid.
  sort it_vbak by vbeln.
  sort it_vbap by vbeln posnr.
  call function 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
    exporting
      i_callback_program      = sy-repid
      is_layout               = x_layout
      it_fieldcat             = it_fldcat[]
      it_sort                 = it_sort
      is_variant              = it_variant
      it_events               = it_events[]
      i_tabname_header        = 'IT_VBAK'
      i_tabname_item          = 'IT_VBAP'
      is_keyinfo              = x_keyinfo
    importing
      e_exit_caused_by_caller = v_call
      es_exit_caused_by_user  = x_user
    tables
      t_outtab_header         = it_vbak
      t_outtab_item           = it_vbap
    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_REPORT
Regards,
Laxmi
Message was edited by: Laxmi

Similar Messages

  • Display amount in ALV Grid with different Decimal Places based on Currency

    HI Experts,
    Working with ALV Report i have one Amount field NETWR which is having Length 15 and Decimal Places 2.
    we have two different types of currency's AED and KWD and AED having 2 decimal Places and KWD having 3 decimal places.
    im using FM: REUSE_ALV_GRID_DISPLAY for Display. value storing in Table was like this
    AED---22.56
    KWD---225.65
    i need to display values like AED : 22.56

    HI Experts,
    Working with ALV Report i have one Amount field NETWR which is having Length 15 and Decimal Places 2. we have two different types of currency's AED and KWD and AED having 2 decimal Places and KWD having 3 decimal places.
    im using FM: REUSE_ALV_GRID_DISPLAY for Display. value storing in Table was like this
    AED---22.56
    KWD---225.65 (converting this value to 22.565 using BAPI_CURRENCY_GETDECIMALS according to currency in my Report)
    i need to display values like AED : 22.56
                                             KWD---22.565 but here field is NETWR with 2 decimal.
    Need to Display amount in ALV Grid with different Decimal Places based on Currency
    Regards,
    Dileep Kumar Reddy

  • ALV output with different Titles

    Hi,
    I have one requirement,that we have set of radibuttons in selection screen.
    when we are selecting that radiobutton ALV out put will be displayed.
    but user wants the description of the selected radio button in Menu Title Bar of AlV out put.
    can any one help me to know ,what is approach to sort this...?
    Thanks...

    Hi Sekhar,
    go through this thread.
    Changing title bar of ALV  list
    also try this code patch.
    start-of-selection.
    SET PF-STATUS 'MAIN'.
    SET TITLEBAR 'TEST'.
    write 'hi'.
    at user-command.
    if sy-ucomm = 'TEST'.
    MESSAGE 'HI' TYPE 'I'.
    ENDIF.
    Regards,
    Vijay

  • ALV Reporting with drill down capabillities

    I'm creating a abap custom report using the ALV.  I want to drill down to CJ03 which is projects.  I know how to do it in regular custom reporting, but I don't seem to be able to get it to work using the ALV.  Can anyone help?
    Thanks.
    Linda

    Hi Linda,
    Take a look at this sample program. The logic to handle any interaction with the user is in my "PORCESS_USER_COMMANDS" routine.
    This is defined in the "I_CALLBACK_USER_COMMAND" parameter in the ALV FM.
    Hope this helps.
    Cheers,
    Pat.
    [code]
    Modification History
    Date      | Author    | Chg Req #     | Description
    15.08.2001| Pat Yee   | $TMP          | Program Creation
    This program is an example of how the ALV Display works.
    It will display Customer Data.
    This report will also show how to display an ALV report with different
    colored lines and icons
    REPORT zpat.
    Include Programs
    INCLUDE <icon>.
    Database Tables
    TABLES: kna1.                  "Customer Master
    Types
    TYPE-POOLS: kkblo.
    Structures
    Structure to hold the Color Information
    DATA: BEGIN OF st_color,
            color(3) TYPE c,
          END OF st_color.
    Structure to hold the Icon Information
    DATA: BEGIN OF st_icon,
            icon(4) TYPE c,
          END OF st_icon.
    ALV Field Catalog Structure
    DATA: st_fieldcat   TYPE slis_fieldcat_alv.
    ALV Layout Structure
    DATA: st_layout     TYPE slis_layout_alv.
    Internal Tables
    Output Table
    DATA: BEGIN OF tbl_kna1 OCCURS 0.
            INCLUDE STRUCTURE st_icon.   "Icon Structure
            INCLUDE STRUCTURE kna1.      "Customer Master Structure
            INCLUDE STRUCTURE st_color.  "Color Structure
    DATA: END OF tbl_kna1.
    ALV Field Catalog Table
    DATA: tbl_fieldcat  TYPE slis_t_fieldcat_alv.
    Variables
    DATA: fieldname(30) TYPE c,
          g_repid       LIKE sy-repid.
    Start of Selection
    START-OF-SELECTION.
      g_repid = sy-repid.
      PERFORM get_data.
    End of Selection
    END-OF-SELECTION.
      PERFORM do_fancy_stuff.
      PERFORM get_layout.
      PERFORM get_fieldcat.
      PERFORM create_report.
    *&      Form  CREATE_REPORT
          Learn to read the subroutine name!
    FORM create_report.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
           EXPORTING
                i_interface_check       = ' '
                i_callback_program      = g_repid
                i_callback_user_command = 'PROCESS_USER_COMMANDS'
                it_fieldcat             = tbl_fieldcat
                i_default               = 'X'
                i_save                  = ' '
                is_layout               = st_layout
           TABLES
                t_outtab                = tbl_kna1
           EXCEPTIONS
                program_error           = 1
                OTHERS                  = 2.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    ENDFORM.                               " CREATE_REPORT
    *&      Form  GET_FIELDCAT
          Build the Field Catalog
    FORM get_fieldcat.
    Here the field catalog is created. To display more fields simply
    'uncomment' the additional lines and add the field name. Also note
    that the field catalog is much more powerful than this. You can
    intensify fields, change the colour, assign reference fields, etc.
    Look at type slis_fieldcat_alv for more options.
      PERFORM write_fieldcat USING 'ICON'  'TBL_KNA1' '    ' 'X' 1 '2' 'X'
      PERFORM write_fieldcat USING 'KUNNR' 'TBL_KNA1' 'KNA1' 'X' 2 ' ' ' '
      PERFORM write_fieldcat USING 'NAME1' 'TBL_KNA1' 'KNA1' ' ' 3 '10' ' '
                                   'X'.
      PERFORM write_fieldcat USING 'STRAS' 'TBL_KNA1' 'KNA1' ' ' 4 ' ' ' '
      PERFORM write_fieldcat USING 'TELF1' 'TBL_KNA1' 'KNA1' ' ' 5 ' ' ' '
      PERFORM write_fieldcat USING 'ORT01' 'TBL_KNA1' 'KNA1' ' ' 6 ' ' ' '
      PERFORM write_fieldcat USING 'PSTLZ' 'TBL_KNA1' 'KNA1' ' ' 7 ' ' ' '
      PERFORM write_fieldcat USING 'SORTL' 'TBL_KNA1' 'KNA1' ' ' 8 ' ' ' '
      PERFORM write_fieldcat USING 'ERNAM' 'TBL_KNA1' 'KNA1' ' ' 9 ' ' ' '
      PERFORM write_fieldcat USING 'SPRAS' 'TBL_KNA1' 'KNA1' ' ' 10 ' ' ' '
    perform write_fieldcat using '     ' 'TBL_KNA1' 'KNA1' ' ' 10 ' '.
    perform write_fieldcat using '     ' 'TBL_KNA1' 'KNA1' ' ' 11 ' '.
    perform write_fieldcat using '     ' 'TBL_KNA1' 'KNA1' ' ' 12 ' '.
    ENDFORM.                               " GET_FIELDCAT
    *&      Form  WRITE_FIELDCAT
          Write the Field Catalog data to the Field Catalog Table
         -->name   Field name
         -->tab    Table name
         -->st     Structure Name
         -->key    Is this field a Key?
         -->pos    Position Number
         -->length Field Length
         -->icon   Display as Icon
         -->hot    Hotspot
    FORM write_fieldcat USING name tab st key pos length icon hot.
      st_fieldcat-fieldname   = name.
      st_fieldcat-tabname     = tab.
      st_fieldcat-ref_tabname = st.
      st_fieldcat-key         = key.
      st_fieldcat-col_pos     = pos.
      st_fieldcat-outputlen   = length.
      st_fieldcat-icon        = icon.
      st_fieldcat-hotspot     = hot.
      APPEND st_fieldcat TO tbl_fieldcat.
      CLEAR st_fieldcat.
    ENDFORM.                               " WRITE_FIELDCAT
    *&      Form  PROCESS_USER_COMMANDS
          Interactive Reporting Commands
    FORM process_user_commands USING syst-ucomm LIKE syst-ucomm
                                     selfield TYPE slis_selfield.
    This subroutine is called when there is user interaction in the output
    In this case if the user double clicks the Customer Number then the
    program will call transaction XD03 and display the Customer Master
    Data
      CASE syst-ucomm.
        WHEN '&IC1'.
    get cursor field fieldname.
          READ TABLE tbl_kna1 INDEX selfield-tabindex.
          SET PARAMETER ID 'KUN' FIELD tbl_kna1-kunnr.
          CALL TRANSACTION 'XD03' AND SKIP FIRST SCREEN.
      ENDCASE.
    ENDFORM.                               " PROCESS_USER_COMMANDS
    *&      Form  GET_LAYOUT
      set the layout of the ALV.
      add color to the row?
    FORM get_layout.
      st_layout-info_fieldname    = 'COLOR'.
      st_layout-colwidth_optimize = 'X'.
      st_layout-get_selinfos      = 'X'.
    ENDFORM.                    " GET_LAYOUT
    *&      Form  get_data
          Get some data to play with
    FORM get_data.
      SELECT * FROM kna1 INTO CORRESPONDING FIELDS OF TABLE tbl_kna1
             UP TO 30 ROWS.
    ENDFORM.                    " get_data
    *&      Form  do_fancy_stuff
          Do some fancy pants stuff for example changing the color of
          lines and adding icons
    FORM do_fancy_stuff.
    Here we will demonstrate changing the color of ALV Record lines as
    well as displaying Icons
      LOOP AT tbl_kna1.
    All records where NAME1 begins with 'M', will be displayed in Bluish
    Green
        IF tbl_kna1-name1(1) EQ 'M'.
          tbl_kna1-color = 'C41'.  "Bluish Green
          MODIFY tbl_kna1 TRANSPORTING color.
        ENDIF.
    All records with no TELF1 will be displayed in White and have a
    Warning Icon
        IF tbl_kna1-telf1 IS INITIAL.
          tbl_kna1-color = 'C00'.  "White
          tbl_kna1-icon  = '@AH@'. "Warning Icon
          MODIFY tbl_kna1 TRANSPORTING icon color.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    " do_fancy_stuff[/code]

  • ALV Table: DROPDOWN-Column with different valuesets per row

    Hello,
    I tried to create a dropdown by index cell in a table with different valuesets in each row. So I created an attribute VALUESET of type WDR_CONTEXT_ATTR_VALUE_LIST in my node to provide different valuesets per element. In my ALV-table I bound the property "valueset_fieldname" of the dropdown-cell to the context-attribute VALUESET:
      lo_column = lo_alv_model>if_salv_wd_column_settings~get_column( id = 'PRICE').
      CREATE OBJECT lo_drop_down_idx
        EXPORTING
          selected_key_fieldname = u2018PRICEu2019.
      lo_drop_down_idx->set_valueset_fieldname( value = u2018VALUESETu2019 ).
      lo_column->set_cell_editor( lo_drop_down_idx ).
    Now I have the problem, that the list of the dropdown-cell displays the proper amount of values but not the proper texts . My valueset looks for example like this:
    Value: A
    Text:  A
    Value: B
    Text:  B
    Value: C
    Text:  C
    Value: D
    Text:  D
    But my Dropdown-cell shows these values:
    A
    A
    A
    D
    Could you please help?
    Edited by: Developer on Feb 2, 2010 5:32 PM

    Hello Lekha,
    thank you for your answer. I think there might be an other reason for this problem. When I debug the view with the Webdynpro-Debugger the valueset in the context contains the correct values but the dropdown shows wrong values.
    You also sent me a link with a codesample. In this coding you use the following statement:
    lr_drp_idx->set_texts( 'VALUESET'   ). This is a method of the class CL_WD_DROPDOWN_BY_IDX. I used the class cl_salv_wd_uie_dropdown_by_idx as I'm working with an ALV-Table. This class doesn't have the method set_texts. Instead it has a method called 'set_valueset_fieldname'. Maybe this method has a bug?
    Regards,

  • ALV GRID with own EXCEL-Template

    Hallo,
    I have Problem with using ALV-Grid with a own created
    template.
    At First I copy the SAP_OM.XLS template to CUS_OM.XLS.
    Then I update it by deleting all sheets, but not RAWDATA.
    When I use this template in ALV-GRID, it would be the right one, but it his no Data.
    The security settings in Excel are correct.
    Can anyone help me to show the data like the normal
    ALV-GRID??
    thanks Dieter

    Hi
    Check this link...
    How to send data  to different tabs of an excel sheet?

  • Vendor Payment with different document types

    Dear Sapguru,
    We have a scenario where a particular vendor payable is in two different document types for example, RE and KZ.
    When we execute TC F110, the payment proposal is grouping the payments by document type. I.e. it grouped all the documents under type RE and grouped all the documents under type KZ and created two line items in the payment proposal.
    Actually, we want to have a single group consisting of all the document types payable to the vendor.
    We have checked different SAP notes and also verified out system settings, but the problem still remains.
    Can somebody let us know how to group all the open items in a single line item in F110 irrespective of document types.
    Thanks in Advance.
    Regards.,
    Rama

    Dear Naravi,
    the main factor which affects the grouping of items is the Structure ZHLG1:
    ZBUKR
    ABSBU
    LIFNR
    KUNNR
    EMPFG
    WAERS
    ZLSCH
    HBKID
    HKTID
    BVTYP
    SRTGB
    SRTBP
    XINVE
    PAYGR
    UZAWE
    DTWS1
    DTWS2
    DTWS3
    DTWS4
    KIDNO
    All these fields have to coincide, to have a single payment.
    Please check why two documents with different document type are paid into two different payments.
    Read the SAP notes 109233 and 164835 and 305414 as well.
    I hope this helps.
    Mauri

  • Contracts with different Currencies

    Hi SAP experts,is it possible  to create a Contract with different currencies in line items for a vendor???.Thank you for any advice.

    No, the currency is a header field (EKKO-WAERS).
    It is possible to enter conditions with a different currency, but this will then be converted into the "PO currency"

  • ALV Subtotals

    Hi ABAP Gurus,
    I have a problem with ALV subtotals and don't now how to solve it using ALV. I might have to go back to Classical reports if I cannot solve it. Here is the Problem :
    The tables BSET stores the Taxes info for the accounting documents. Each line is for the tax jurisdiction levels and tax jurisdiction code. The base amount on all the lines is same say 100.00 and let us assume 6 lines. When the subtotals are done for the jurisdiction levels the subtotal for the base amount is 100.00 ( only one line per level ) and this is what is expected. But for tax jurisdiction code the total comes to 600.00 Which is what is expected from ALV totals . But since 100.00 is the base amount for tax report purposes this should be the subtotal. That is the subtotal should be 100 for the jurisdiction codes not 600.00.
    I tried varous stuff but couldn't get desired results? Any solution is highly appreciated.
    Thanks,
    Nanda

    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
    pls see this example and try u r program.i
    regards
    ravi

  • ALV table with two dimensions and a link in each cell to a document

    Hi,
    I want to create an ALV output for a 2-dimension table. The table should look like:
    ---  |  Col1  |  Col2  | ...
    L1 | Cell11 | Cell12 | ...
    L2 | Cell21 | Cell22 | ...
    Do you have any hints how I could implement such a two dimensional ALV with different links when clicking on Cell11, Cell12, Cell21, ....
    Thanks for your help!
    Caroline

    if u use OO ALV,
    1.on clicking CELL1, CELL2 etc, to get different links,
    u can put hotspot for the fields in fieldcat
    and u can handle method
    button_click event of cl_gui_alv_grid.
          CLASS LCL_EVENT_RECEIVER DEFINITION
    CLASS LCL_EVENT_RECEIVER DEFINITION.
      PUBLIC SECTION.
        METHODS HANDLE_CLICK_ROW_COL
        FOR EVENT CLICK_ROW_COL OF CL_GUI_ALV_GRID
        IMPORTING ROW_ID COL_ID.
    ENDCLASS.                    "cl_event_receiver DEFINITION
          CLASS CL_EVENT_RECEIVER IMPLEMENTATION
    CLASS LCL_EVENT_RECEIVER IMPLEMENTATION.
      METHOD HANDLE_BUTTON_CLICK.
        perform button_click using ROW_ID COL_ID.
      ENDMETHOD .                    "handle_top_of_page
    ENDCLASS .                    "cl_event_receiver
    2.
    FOR GETTING TWO DIMENSIONS, HANDLE PRINT_TOP_OF_PAGE
    and using write statements, build a row at the top of grid.
    or else
    IN THE LAYOUT , U CAN PLACE BUTTONS JUST ABOVE THE CUSTOM CONTAINER

  • Default collapsed view in ALV grid with subtotoal lines

    Hallo experts,
    I am displaying a ALV grid with subtotals. Now my requirement to display the Grid with only subtotal lines. Means the grid should be displayed in collapsed mode by default.
    Can any you help me finding this option.
    Thanks.
    Matt.

    Hallo experts,
    I am displaying a ALV grid with subtotals. Now my requirement to display the Grid with only subtotal lines. Means the grid should be displayed in collapsed mode by default.
    Can any you help me finding this option.
    Thanks.
    Matt.
    Hi Matt,
    Whe you call the FM REUSE_ALV_GRID_DISPLAY, you have to fill the table it_sort.
    In this table, you have to fill the field FIELDNAME with the field that you can show with susbstotals and fill the field EXPA with 'X'.
    W_SORT-SPOS = 1.
    W_SORT-FIELDNAME = 'CODIGO'.
    W_SORT-SUBTOT = 'X'.
    W_SORT-EXPA = 'X'.
    APPEND W_SORT TO IT_SORT.
    In the fieldcatalog there must be any with the field DO_SUM = 'X'
    You can maka this directly in the list by creating a variant with susbtotals, colapse them and save as a default variant for all users.
    Regards,
    Pepe
    Regards,
    Pepe

  • How to monitor kids text with different ID

    I created a different ID for my child but still want to monitor his texts till he's mature enough. How do i do that

    hi nagendre.
    check it might help u.
    ****************/Tutorials/ALV/Subtotals/text.htm
    thanks n regards
    Sachin

  • Hi, i am trying to open and view a report that comes from another server with different odbc connection

    hi, i am trying to open and view a report that comes from another server with different odbc connection
    i created a crystal report for a mysql database on my machine and everything works great
    but we have other reports that come from other machines with different odbc connection
    and this its not working when opens the report asks for credentials
    and i cannot use the remote ip for these reports that come from other machine
    question
    if i cannot connect to remote ip to open the report
    for each report i have to create a database the report database on my machine and then open the report ?
    or there is some other way to open the report ?
    i am using visual studio 2013 and mysql and
       <add key="MYSQLODBCDRIVER" value="{MySQL ODBC 5.3 UNICODE Driver}"/>
    thanks

    short
    i have a report that it was created on another server with a specific dsn
    now i am trying to open the report on my machine
    the database from the other server does not exist on my machine
    the server machine where the report was created the ip its not accessible
    question ?
    can i open the report on my machine or its impossible ?
    thanks

  • How can I transfer contacts from one iPad to a new iPad with different iCloud addresses?

    how can I transfer contacts from one iPad to a new iPad with different iCloud addresses?

    One way would be to e-mail them from yourself to yourself. That would totally avoid the different ID issue.

  • How to backup multiple iphones with different iCloud accounts but same apple id?

    I would like to back up 3 idevices each with different icloud accounts to itunes. But they use the same apple id so that itune purchases can be installed on each device (2 iphones and 1 ipad).
    All I want to do is create a backup in case the phones need to be restored. I also want to back up before downloading iOS 8.
    The Macbook Pro that I will back up to has one user and one itunes library.
    Is this possible without mixing up address books and contacts etc? Appreciate if some one could direct me to detail step-by-step instructions if they exist or please tell me how I can do this.
    Thanks.

    With Family Sharing they don't need to have the same Apple ID anymore.
    But backups to iTunes are kept separate among multiple devices; Apple ID and iCloud isn't involved at all. Just make sure the devices do not have the same name.

Maybe you are looking for