How can i sum the columns by condition?

ID    Type    QTY
1      A         20
2      A         20
3      B         20
I want to some QTY group by A but I also need the ID column to identify the order of  row.
How can I sum QTY group by A and the result is sort by ID ?
Thanks you 

Whats your expected output?
Is this the below?
Create Table test(id int,[Type] char(1), QTY int)
Insert into test Values(1,'A',20),
(2,'A',20),
(3,'B',20)
SElect *,SUM(qty)Over(partition by Type) From test Order by id
Drop table test

Similar Messages

  • How can I sum the values in a given column on sheet 1 i.e. A1:A50 based on the adjacent columns specific value i.e. B1:B50 = "Living Room" on sheet 2

    How can I sum the values in a given column on sheet 1 i.e. A1:A50 based on the adjacent columns specific value i.e. B1:B50 = “Dinning Room” on sheet 2
    For Example:
    SHEET 1
    A
    B
    $50
    Dinning Room
    $800
    Dinning Room
    $300
    Kitchen
    $1,000
    Master Bedroom
    $100
    Dinning Room
    SHEET 2
    Display the total SUM amount of each Project based on Sheet 1
    Project Name
    Total Cost
    Dinning Room
    $950
    Kitchen
    $300

    Would be a good idea to open iWork Formulas and Functions User Guide and search for the description of the function named SUMIF
    The Guide is available for every user thru the Help menu.
    Yvan KOENIG (VALLAURIS, France) jeudi 19 mai 2011 17:32:42
    Please :
    Search for questions similar to your own before submitting them to the community
    To be the AW6 successor, iWork MUST integrate a TRUE DB, not a list organizer !

  • How can i  change the column label text in a alv table display

    how can i change the column label text in a alv table display??
    A similar kinda of question was posted previuosly where the requirement was the label text was needed and following below code was given as solution :
    <i>*  declare column, settings, header object
    DATA: lr_column TYPE REF TO cl_salv_wd_column.
    DATA: lr_column_settings TYPE REF TO if_salv_wd_column_settings.
    DATA: lr_column_header type ref to CL_SALV_WD_COLUMN_HEADER.
    get column by specifying column name.
    lr_column = lr_column_settings->get_column( 'COLUMN_NAME1' ).
    set Header Text as null
    lr_column_header = lr_column->get_header( ).
    lr_column_header->set_text( ' ' ).</i>
    My specific requirement is i have an input field on the screen and i want reflect that value as the column label for one of the column in the alv table. I have used he above code with slight modification in the MODIFYVIEW method of the view since it is a process after input. The component gets activated without any errors but while run time i get an error stating
    <i>"The following error text was processed in the system CDV : Access via 'NULL' object reference not possible."</i>
    i have checked in debugging and the error occured at the statement :
    <i>lr_column = lr_column_settings->get_column( 'CURRENT_YEAR' ).</i>Please can you provide me an alternative for my requirement or correct me if i have done it wrong.
    Thanks,
    Suri

    I found it myself how to do it. The error says that it is not able to find the reference object i.e  it is asking us to refer to the table. The following piece of code will solve this problem. Have to implement this in WDDOMODIFYVIEW method of the view. This thing works comrades enjoy...
      DATA : lr_cmp_usage TYPE REF TO if_wd_component_usage,
             lr_if_controller  TYPE REF TO iwci_salv_wd_table,
             lr_cmdl   TYPE REF TO cl_salv_wd_config_table,
             lr_col    TYPE REF TO cl_salv_wd_column.
      DATA : node_year  TYPE REF TO if_wd_context_node,
             elem_year  TYPE REF TO if_wd_context_element,
             stru_year  TYPE if_alv_layout=>element_importing,
             item_year  LIKE stru_year-i_current_year,
             lf_string    TYPE char(x),
      DATA: lr_column TYPE REF TO cl_salv_wd_column.
      DATA: lr_column_header TYPE REF TO cl_salv_wd_column_header.
      DATA: lr_column_settings TYPE REF TO if_salv_wd_column_settings.
    Get the entered value from the input field of the screen
    node_year  = wd_context->get_child_node( name = 'IMPORTING_NODE' ).
    elem_year  = node_year->get_element( ).
      elem_year->get_attribute(
       EXPORTING
        name = 'IMPORT_NODE-PARAMETER'
       IMPORTING
        value = L_IMPORT_PARAM ).
      WRITE L_IMPORT_PARAM TO lf_string.
    Get the reference of the table
      lr_cmp_usage  =  wd_this->wd_cpuse_alv( ).
      IF lr_cmp_usage->has_active_component( ) IS INITIAL.
        lr_cmp_usage->create_component( ).
      ENDIF.
      lr_if_controller  = wd_this->wd_cpifc_alv( ).
      lr_column_settings = lr_if_controller->get_model( ).
    get column by specifying column name.
      IF lr_column_settings IS BOUND.
        lr_column = lr_column_settings->get_column( 'COLUMN_NAME').
    set Header Text as null
        lr_column_header = lr_column->get_header( ).
        lr_column_header->set_text( lf_string ).
    endif.

  • How can i remove the terms and conditions from my app store on iphone 5s ?

    How can i remove the terms and conditions from my app store icon on iphone 5s

    Hello mrh1962,
    Thank you for providing the details of the issue you are experiencing with accepting Terms & Conditions on your iPhone 5s.
    First, I recommend restarting your phone and then resetting if it's still not working:
    Restarting your device
    Press and hold the Sleep/Wake button for a few seconds until the red "slide to power off" slider appears, and then slide the slider.
    Press and hold the Sleep/Wake button until the Apple logo appears.
    Note: Reset your device only if you are unable to restart it.
    Resetting your device
    Press and hold the Sleep/Wake button and the Home button together for at least ten seconds, until the Apple logo appears.
    You can find the full article here:
    iPhone, iPad, iPod touch: Turning off and on (restarting) and resetting
    http://support.apple.com/kb/ht1430
    If you can access your home screen, I also recommend verifying that cookies are not blocked and private browsing is turned off in Settings>Safari:
    iPhone User Guide - Safari settings
    http://help.apple.com/iphone/7/#/iph3d7aa74dc
    Thank you for using Apple Support Communities.
    Best,
    Sheila M.

  • How can i know the Column Position in a table

    Dear all
    How can i know the Column position in a table ..
    For example :-
    I have a table
    Desc EMPLOYEES
    Empid
    Ename
    Sal
    I want to know the Empid is in 1st position , ename is in 2nd position and sal is in 3rd position .
    is it possible ?

    Hi
    SELECT * FROM ALL_TAB_COLUMNS WHERE
    TABLE_NAME ='EMPLOYEES' AND owner=<OwNeR nAmE> ;)

  • HT204053 how can i accept the terms and conditions on the icolud

    how can i accept the terms and conditions on the icolud

    Welcome to the Apple Community.
    Try deleting the account, restarting the device and signing in again.

  • How can i set the column width in the jtable?

    how can i set the column width in the jtable?
    can anybody send me a simple example??

    TableColumn column = table.getColumnModel().getColumn( columnIndex );
    column.setWidth( desiredColumnWidth);
    column.setMinWidth( desiredMinColumnWidth);
    column.setMaxWidth( desiredMaxColumnWidth);

  • How can i bring the column heading downloaded in excel sheet?

    hi all,
    I am using  FM SAP_CONVERT_TO_XLS_FORMAT to downloading populated internal table data into excel sheet by using filename type rlgrap-filename.
    Now I need the column heading(field name) for downloaded data in excel sheet.
    pls tell me how can i merge the col heading with data perfectly. Is there any FM fulfills this requirement.
    pls give me a suitable approch.
    Thanks
    PRR

    HI,
    Go thru this code.
    REPORT  ZRMM0056  NO STANDARD PAGE HEADING
                          MESSAGE-ID ZZ
                          LINE-SIZE 300
                          LINE-COUNT 65.
    Program              : ZRMM0056
    Title                : Non Inventory PO's
    Description          : Non Inventory Purchase Orders details with
                           Vendor and Invoice Receipts and Goods Receipts.
    Input  :
           Select-options  : 1. G/L Account No
           Parameters      : 1.File Paths for the Excel sheet
           Others (Specify):
    Output : Extract Files in the application server
           Report  :
    Hear Ticket #        : 113392
    Created by           : Srinivas Rao.M
    Created on           : 12/15/2005
    Version              : 1
    Request              : D10K944304
    Transaction Code     : Z420
    Change History                                                       *
    Date         Programmer  Search String   Description                 *
    12/19/2005   Srinivas    D10K944316      Removed Purchasing document
                                             Company code and Plant from
                                             Select-Options and Inculded
                                             G/L Account No and changed
                                             code accordingly.
    T A B L E S                                                          *
    TABLES: EKBE,              " History of Purchasing Document
            EKPO,              " Purchasing Document Item
            EKKO,              " Purchasing Document Header
            LFA1,              " Vendor master (general section)
            EKKN.              " Account Assignment in Purchasing Doc
                        INTERNAL TABLES
    *--Internal table to store Purchasing document header data
    DATA : BEGIN OF IT_POHEADER OCCURS 0,
            EBELN LIKE EKKO-EBELN,      "Purchasing document
            AEDAT LIKE EKKO-AEDAT,      "Created on
            ERNAM LIKE EKKO-ERNAM,      "Created by
            LIFNR LIKE EKKO-LIFNR,      "Vendor
          END OF IT_POHEADER.
    *--Internal table to store Purchasing document Item data
    DATA : BEGIN OF IT_POITEM OCCURS 0,
            EBELN LIKE EKPO-EBELN,       "Purchasing document
            EBELP LIKE EKPO-EBELP,       "Item Number
            MATNR LIKE EKPO-MATNR,       "Material number
            BUKRS LIKE EKPO-BUKRS,       "Company code
            WERKS LIKE EKPO-WERKS,       "Plant
            MATKL LIKE EKPO-MATKL,       "Material Group
            MENGE LIKE EKPO-MENGE,       "Order Quantity
            NETPR LIKE EKPO-NETPR,       "Net Price
            PEINH LIKE EKPO-PEINH,       "Price unit
            NETWR LIKE EKPO-NETWR,       "Net Value
          END OF IT_POITEM.
    *--Internal table to hold final display data.
    DATA : BEGIN OF IT_FINAL OCCURS 0,
             EBELN LIKE EKKO-EBELN,       "Purchasing document
             EBELP LIKE EKPO-EBELP,       "Item Number
             AEDAT LIKE EKKO-AEDAT,       "Created on
             ERNAM LIKE EKKO-ERNAM,       "Created by
             MATNR LIKE EKPO-MATNR,       "Material number
             BUKRS LIKE EKPO-BUKRS,       "Company code
             WERKS LIKE EKPO-WERKS,       "Plant
             MATKL LIKE EKPO-MATKL,       "Material Group
             MENGE LIKE EKPO-MENGE,       "Order Quantity
             NETPR LIKE EKPO-NETPR,       "Net Price
             PEINH LIKE EKPO-PEINH,       "Price unit
             NETWR LIKE EKPO-NETWR,       "Net Value
             LIFNR LIKE EKKO-LIFNR,       "Vendor
             NAME1 LIKE LFA1-NAME1,       "Vendor Name
             GSBER LIKE EKKN-GSBER,      "Business area
    *--IR details
            IR_BELNR LIKE EKBE-BELNR,     "IR-Number of Material Document
            IR_BUZEI LIKE EKBE-BUZEI,     "IR-Item in material Document
            IR_BUDAT LIKE EKBE-BUDAT,     "IR-Posting date
            IR_MENGE LIKE EKBE-MENGE,     "IR-Quantity
    *--GR details
            GR_BELNR LIKE EKBE-BELNR,     "GR-Number of Material Document
            GR_BUZEI LIKE EKBE-BUZEI,     "GR-Item in material Document
            GR_BUDAT LIKE EKBE-BUDAT,     "GR-Posting date
            GR_MENGE LIKE EKBE-MENGE,     "GR-Quantity
          END OF IT_FINAL.
    *--Internal table to store History per Purchasing Document data
    DATA : BEGIN OF IT_HISTORY OCCURS 0,
            EBELN LIKE EKBE-EBELN,        "Purchasing document
            EBELP LIKE EKBE-EBELP,        "Item
            VGABE LIKE EKBE-VGABE,        "Trans/Event type
            BELNR LIKE EKBE-BELNR,        "Number of Material Document
            BUZEI LIKE EKBE-BUZEI,        "Item in material Document
            BUDAT LIKE EKBE-BUDAT,        "Posting date
            MENGE LIKE EKBE-MENGE,        "Quantity
            BEWTP LIKE EKBE-BEWTP,        "Posting history category
           END OF IT_HISTORY.
    *--Internal table to store vendor name.
    DATA : BEGIN OF IT_VENDOR OCCURS 0,
             LIFNR LIKE LFA1-LIFNR,      "Vendor Number
             NAME1 LIKE LFA1-NAME1,      "Vendor Name
           END OF IT_VENDOR.
    *--Internal table to store Business area for Purchasing document
    DATA : BEGIN OF IT_BUSINESS OCCURS 0,
             EBELN LIKE EKKN-EBELN,      "Purchasing document
             EBELP LIKE EKKN-EBELP,      "Purchasing Item
             SAKTO LIKE EKKN-SAKTO,      "G/L Account No
             GSBER LIKE EKKN-GSBER,      "Business area
           END OF IT_BUSINESS.
    DATA : BEGIN OF FIELDNAMES OCCURS 0,
           TEXT(40),
          END OF FIELDNAMES.
                    VARIABLES DECLARATION                                *
    DATA: V_FILE LIKE IBIPPARMS-PATH,         "File path
           V_FLD  LIKE DYNPREAD-FIELDNAME,     "Dynpread fieldname
           V_FLAG(1) VALUE SPACE.              "FLAG VARIABLE
                            SELECTION-SCREEN                             *
    SELECTION-SCREEN BEGIN OF BLOCK S1 WITH FRAME TITLE TEXT-001.
    *--Begin of change D10K944316
    SELECT-OPTIONS : S_SAKTO FOR EKKN-SAKTO.  "G/L Accoun no.
    *--End of change D10K944316
    SELECTION-SCREEN END OF BLOCK S1.
    SELECTION-SCREEN BEGIN OF BLOCK S2 WITH FRAME TITLE TEXT-002.
    PARAMETERS : P_EXCEL    AS CHECKBOX DEFAULT ' ' .  " download to excel
    PARAMETERS : C_FILE(128) DEFAULT : 'C:\ZRMM0056.xls'.
    SELECTION-SCREEN END OF BLOCK S2.
    A T   S E L E C T I O N - S C R E E N                                *
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR C_FILE.
    *-Form to get file path for download of data
      PERFORM GET_FILE_PATH.
    AT SELECTION-SCREEN.
      PERFORM SCREEN_VALIDATIONS.
    START-OF-SELECTION
    START-OF-SELECTION.
    *--Extract Purchasing document header data.
       PERFORM GET_PO_HEADER_DATA.
    *--Extract Purchasing document Item data.
       IF NOT IT_BUSINESS[] IS INITIAL.
         PERFORM GET_PO_ITEM_DATA.
    *--Get complete required data in final internal table
         PERFORM GET_FINAL_DATA.
       ENDIF.
    END-OF-SELECTION
    END-OF-SELECTION.
      IF V_FLAG IS INITIAL.
    *--Display Purchasing document details
        IF NOT IT_FINAL[] IS INITIAL.
           PERFORM DISPLAY_PODATA.
          IF P_EXCEL = 'X'.
    *--To down load data to excel sheet
            PERFORM DOWN_LOAD_TO_EXCEL.
          ENDIF.
        ENDIF.
      ELSE.
           MESSAGE I001(ZZ) WITH 'No data found'(003).
      ENDIF.
    TOP-OF-PAGE
    TOP-OF-PAGE.
    *--To display page header
      PERFORM PAGE_HEADER.
    *&      Form  GET_PO_HEADER_DATA
          To Get Purchasing header data
    FORM GET_PO_HEADER_DATA .
    *--To extract Business Area details
           CLEAR IT_BUSINESS.
           REFRESH IT_BUSINESS.
            SELECT EBELN    "Purchasing document
                   EBELP    "Purchasing document item
                   SAKTO    "G/L Account no
                   GSBER    "Business area
                   FROM EKKN
                   INTO TABLE IT_BUSINESS
                   WHERE SAKTO IN S_SAKTO.
      IF SY-SUBRC <> 0.
        V_FLAG = 'X'.
        MESSAGE I001(ZZ)  WITH
        'No data selected for the given selection criteria'(004).
        STOP.
      ELSE.
    *--To extract Purchasing document details with respect
    to G/L Account no
           CLEAR   IT_POHEADER.
           REFRESH IT_POHEADER.
           SELECT EBELN       "Purchasing document
                  AEDAT       "Created on
                  ERNAM       "Created by
                  LIFNR       "Vendor
                FROM EKKO
                INTO TABLE IT_POHEADER
                FOR ALL ENTRIES IN IT_BUSINESS
                WHERE EBELN = IT_BUSINESS-EBELN.
             IF NOT IT_POHEADER[] IS INITIAL.
                CLEAR   IT_VENDOR.
                REFRESH IT_VENDOR.
    *--Extracting Vendor details
                SELECT LIFNR   "Vendor #
                       NAME1   "Name
                     FROM LFA1
                     INTO TABLE IT_VENDOR
                     FOR ALL ENTRIES IN IT_POHEADER
                     WHERE LIFNR = IT_POHEADER-LIFNR.
            ENDIF.
      ENDIF.
    ENDFORM.                    " GET_PO_HEADER_DATA
    *&      Form  GET_PO_ITEM_DATA
          To extract Purchasing document item data
    FORM GET_PO_ITEM_DATA .
    CLEAR   IT_POITEM.
    REFRESH IT_POITEM.
       SELECT EBELN        "Purchasing document
              EBELP        "Item Number
              MATNR        "Material number
              BUKRS        "Company code
              WERKS        "Plant
              MATKL        "Material Group
              MENGE        "Order Quantity
              NETPR        "Net Price
              PEINH        "Price unit
              NETWR        "Net Value
           FROM EKPO
           INTO TABLE IT_POITEM
           FOR ALL ENTRIES IN IT_BUSINESS
           WHERE EBELN = IT_BUSINESS-EBELN
            AND  EBELP = IT_BUSINESS-EBELP.
    IF NOT IT_POITEM[] IS INITIAL.
       CLEAR   IT_HISTORY.
       REFRESH IT_HISTORY.
       SELECT EBELN    "Purchasing document
              EBELP    "Item
              VGABE    "Trans/Event type
              BELNR    "Number of Material Document
              BUZEI    "Item in material Document
              BUDAT    "Posting date
              MENGE    "Quantity
              BEWTP    "Posting history category
            FROM EKBE
            INTO TABLE IT_HISTORY
            FOR ALL ENTRIES IN IT_POITEM
            WHERE EBELN = IT_POITEM-EBELN
              AND EBELP = IT_POITEM-EBELP
              AND ( VGABE = '1' OR VGABE = '2' )   "1 = GR , 2 = IR
              AND ( BEWTP =  'Q' OR BEWTP = 'E' ). "Q = GR , R = IR
       IF SY-SUBRC = 0.
         SORT IT_HISTORY BY EBELN EBELP.
       ENDIF.
    ENDIF.
    ENDFORM.                    " GET_PO_ITEM_DATA
    *&      Form  GET_FILE_PATH
          Select file path
    FORM GET_FILE_PATH .
    CLEAR V_FILE.
      MOVE 'p_flname' TO V_FLD.
      MOVE C_FILE TO V_FILE.
      CALL FUNCTION 'F4_FILENAME'
           EXPORTING
                PROGRAM_NAME  = SYST-CPROG
                DYNPRO_NUMBER = SYST-DYNNR
                FIELD_NAME    = V_FLD
           IMPORTING
                FILE_NAME     = V_FILE
           EXCEPTIONS
                OTHERS        = 1.
      MOVE V_FILE TO C_FILE.
    ENDFORM.                    " GET_FILE_PATH
    *&      Form  PAGE_HEADER
           To Print page header and other details
    FORM PAGE_HEADER .
    *--Page Header
    ULINE AT /1(300).
      FORMAT COLOR 1.
      WRITE:/ 'Run Date:'(005), SY-DATUM, 45 'Stanley Works'(006),
             100 'Page No:'(007), SY-PAGNO LEFT-JUSTIFIED, 298 ''.
      WRITE:/ 'Run Time:'(008), SY-UZEIT, 43 SY-TITLE, 100 SY-UNAME, 298 ''.
      WRITE:/ 'Source  :'(009), SY-SYSID, 100 SY-CPROG, 298 ''.
      FORMAT COLOR OFF.
      ULINE AT /1(300).
      FORMAT COLOR 4.
      WRITE : / SY-VLINE , (10) 'Purchasing Doc'(010),
                SY-VLINE,  (5)  'Item'(011),
                SY-VLINE,  (10) 'Created On'(012),
                SY-VLINE,  (7)  'Crea By'(013),
                SY-VLINE,  (10) 'Material'(014),
                SY-VLINE,  (6)  'Com cd'(015),
                SY-VLINE,  (5)  'Plant'(016),
                SY-VLINE,  (10) 'Mat Group'(017),
                SY-VLINE,  (13) 'Order Qty'(018),
                SY-VLINE,  (11) 'Net Price'(019),
                SY-VLINE,  (10) 'Price Unit'(020),
                SY-VLINE,  (13) 'Net Value'(021),
                SY-VLINE,  (8)  'Bus Area'(022),
                SY-VLINE,  (10) 'Vendor'(023),
                SY-VLINE,  (28) 'Vendor Name'(024),
    *--IR details
                SY-VLINE,  (10) 'IR-Mat Doc'(025),
                SY-VLINE,  (5)  'IR-It'(026),
                SY-VLINE,  (9) 'IR-Post dt'(027),
                SY-VLINE,  (13) 'IR-Quantity'(028),
    *--GR details
                SY-VLINE,  (10) 'GR-Mat Doc'(029),
                SY-VLINE,  (5)  'GR-It'(030),
                SY-VLINE,  (9) 'GR-Post dt'(031),
                SY-VLINE,  (13) 'GR-Quantity'(032), SY-VLINE.
      FORMAT COLOR OFF.
      ULINE AT /1(300).
    ENDFORM.                    " PAGE_HEADER
    *&      Form  SCREEN_VALIDATIONS
          Selection screen validations
    FORM SCREEN_VALIDATIONS .
    *--Validation for G/L Account No
    IF NOT S_SAKTO IS INITIAL.
        SELECT SAKNR UP TO 1 ROWS
               INTO EKKN-SAKTO
               FROM SKA1 WHERE
               SAKNR IN S_SAKTO.
        ENDSELECT.
        IF SY-SUBRC <> 0.
          MESSAGE E001(ZZ) with 'Please enter a valid G/L Account no'(048).
        ENDIF.
      ENDIF.
    *--Validation for Excel file path
    IF P_EXCEL = 'X'.
        IF C_FILE = ' '.
          MESSAGE E001(ZZ) with 'Please enter a valid Excle Path'(035).
        ENDIF.
      ENDIF.
    ENDFORM.                    " SCREEN_VALIDATIONS
    *&      Form  DISPLAY_PODATA
          To Display Purchasing Document details
    FORM DISPLAY_PODATA .
    FORMAT COLOR 2.
    SORT IT_FINAL BY EBELN EBELP AEDAT BUKRS WERKS.
    LOOP AT IT_FINAL.
         WRITE : / SY-VLINE ,(10)  IT_FINAL-EBELN,     "Purchasing Doc
                   SY-VLINE,  (5)  IT_FINAL-EBELP,     "Item
                   SY-VLINE,  (10) IT_FINAL-AEDAT,     "Created On
                   SY-VLINE,  (7) IT_FINAL-ERNAM,      "Created By
                   SY-VLINE,  (10) IT_FINAL-MATNR,     "Material
                   SY-VLINE,  (6) IT_FINAL-BUKRS,      "Company code
                   SY-VLINE,  (5)  IT_FINAL-WERKS,     "Plant
                   SY-VLINE,  (10) IT_FINAL-MATKL,     "Material Group
                   SY-VLINE,  (13) IT_FINAL-MENGE, "#EC UOM_IN_MES
                                                       "Order Qty
                   SY-VLINE,  (11) IT_FINAL-NETPR, "#EC UOM_IN_MES
                                                       "Net Price
                   SY-VLINE,  (10) IT_FINAL-PEINH, "#EC UOM_IN_MES
                                                       "Price Unit
                   SY-VLINE,  (13) IT_FINAL-NETWR, "#EC UOM_IN_MES
                                                        "Net Value
                   SY-VLINE,  (8)  IT_FINAL-GSBER,     "Bus Area
                   SY-VLINE,  (10) IT_FINAL-LIFNR,     "Vendor
                   SY-VLINE,  (28) IT_FINAL-NAME1,     "Vendor name
    *--IR details
                   SY-VLINE,  (10) IT_FINAL-IR_BELNR,  "IR-Mat Doc
                   SY-VLINE,  (5)  IT_FINAL-IR_BUZEI,  "IR-It
                   SY-VLINE,  (9) IT_FINAL-IR_BUDAT,   "IR-Post dt
                   SY-VLINE,  (13) IT_FINAL-IR_MENGE,  "#EC UOM_IN_MES
                                                        "IR-Quantity
    *--GR details
                   SY-VLINE,  (10) IT_FINAL-GR_BELNR,  "GR-Mat Doc
                   SY-VLINE,  (5)  IT_FINAL-GR_BUZEI,  "GR-It
                   SY-VLINE,  (9) IT_FINAL-GR_BUDAT,   "GR-Post dt
                   SY-VLINE,  (13) IT_FINAL-GR_MENGE, SY-VLINE.
                                                       "#EC UOM_IN_MES
                                                       "GR-Quantity
      ENDLOOP.
      FORMAT COLOR OFF.
    ENDFORM.                    " DISPLAY_PODATA
    *&      Form  DOWN_LOAD_TO_EXCEL
          text
    FORM DOWN_LOAD_TO_EXCEL .
      <b>REFRESH FIELDNAMES.
      FIELDNAMES-TEXT = TEXT-010.
      APPEND FIELDNAMES.CLEAR FIELDNAMES.
      FIELDNAMES-TEXT = TEXT-011.
      APPEND FIELDNAMES.CLEAR FIELDNAMES.
      FIELDNAMES-TEXT = TEXT-012.
      APPEND FIELDNAMES.CLEAR FIELDNAMES.
      FIELDNAMES-TEXT = 'Created By'(036).
      APPEND FIELDNAMES.CLEAR FIELDNAMES.
      FIELDNAMES-TEXT = TEXT-014.
      APPEND FIELDNAMES.CLEAR FIELDNAMES.
      FIELDNAMES-TEXT = 'Company Code'(037).
      APPEND FIELDNAMES.CLEAR FIELDNAMES.
      FIELDNAMES-TEXT = TEXT-016.
      APPEND FIELDNAMES.CLEAR FIELDNAMES.
      FIELDNAMES-TEXT = 'Material Group'(038).
      APPEND FIELDNAMES.CLEAR FIELDNAMES.
      FIELDNAMES-TEXT = 'Order Quantity'(039).
      APPEND FIELDNAMES.CLEAR FIELDNAMES.
      FIELDNAMES-TEXT = TEXT-019.
      APPEND FIELDNAMES.CLEAR FIELDNAMES.
      FIELDNAMES-TEXT = TEXT-020.
      APPEND FIELDNAMES.CLEAR FIELDNAMES.
      FIELDNAMES-TEXT = TEXT-021.
      APPEND FIELDNAMES.CLEAR FIELDNAMES.
      FIELDNAMES-TEXT = 'Business Area'(040).
      APPEND FIELDNAMES.CLEAR FIELDNAMES.
      FIELDNAMES-TEXT = TEXT-023.
      APPEND FIELDNAMES.CLEAR FIELDNAMES.
      FIELDNAMES-TEXT = TEXT-024.
      APPEND FIELDNAMES.CLEAR FIELDNAMES.
      FIELDNAMES-TEXT = 'IR Material Doc'(041).
      APPEND FIELDNAMES.CLEAR FIELDNAMES.
      FIELDNAMES-TEXT = 'IR Item'(042).
      APPEND FIELDNAMES.CLEAR FIELDNAMES.
      FIELDNAMES-TEXT = 'IR Posting Date'(043).
      APPEND FIELDNAMES.CLEAR FIELDNAMES.
      FIELDNAMES-TEXT = TEXT-028.
      APPEND FIELDNAMES.CLEAR FIELDNAMES.
      FIELDNAMES-TEXT = 'GR Material Doc'(044).
      APPEND FIELDNAMES.CLEAR FIELDNAMES.
      FIELDNAMES-TEXT = 'GR Item'(045).
      APPEND FIELDNAMES.CLEAR FIELDNAMES.
      FIELDNAMES-TEXT = 'GR Posting Date'(046).
      APPEND FIELDNAMES.CLEAR FIELDNAMES.
      FIELDNAMES-TEXT = TEXT-032.
      APPEND FIELDNAMES.CLEAR FIELDNAMES.
    *--FM to download data to Excel sheet
    CALL FUNCTION 'WS_DOWNLOAD'
           EXPORTING
                FILENAME                = C_FILE
                FILETYPE                = 'DAT'
                TABLES
                DATA_TAB                = IT_FINAL
                FIELDNAMES              = FIELDNAMES
           EXCEPTIONS
                FILE_OPEN_ERROR         = 1
                FILE_WRITE_ERROR        = 2
                INVALID_FILESIZE        = 3
                INVALID_TABLE_WIDTH     = 4
                INVALID_TYPE            = 5
                NO_BATCH                = 6
                UNKNOWN_ERROR           = 7
                GUI_REFUSE_FILETRANSFER = 8
                OTHERS                  = 9.
      IF SY-SUBRC <> 0.
         MESSAGE E001(ZZ) WITH 'Data could not downloaded'(047).
      ENDIF.</b>ENDFORM.                    " DOWN_LOAD_TO_EXCEL
    *&      Form  GET_FINAL_DATA
          To Populate required data in final internal table
    FORM GET_FINAL_DATA .
    CLEAR   IT_FINAL.
    REFRESH IT_FINAL.
    LOOP AT IT_POITEM.
       CLEAR IT_POHEADER.
       READ TABLE IT_POHEADER WITH KEY EBELN = IT_POITEM-EBELN.
       IF SY-SUBRC = 0.
        MOVE :  IT_POHEADER-EBELN TO IT_FINAL-EBELN,     "Purchasing Doc
                IT_POITEM-EBELP   TO IT_FINAL-EBELP,     "Item
                IT_POHEADER-AEDAT TO IT_FINAL-AEDAT,     "Created On
                IT_POHEADER-ERNAM TO IT_FINAL-ERNAM,     "Created By
                IT_POITEM-MATNR   TO IT_FINAL-MATNR,     "Material
                IT_POITEM-BUKRS   TO IT_FINAL-BUKRS,     "Company code
                IT_POITEM-WERKS   TO IT_FINAL-WERKS,     "Plant
                IT_POITEM-MATKL   TO IT_FINAL-MATKL,     "Material Group
                IT_POITEM-MENGE   TO IT_FINAL-MENGE,     "Order Qty
                IT_POITEM-NETPR   TO IT_FINAL-NETPR,     "Net Price
                IT_POITEM-PEINH   TO IT_FINAL-PEINH,     "Price Unit
                IT_POITEM-NETWR   TO IT_FINAL-NETWR,     "Net Value
                IT_POHEADER-LIFNR TO IT_FINAL-LIFNR.     "Vendor
    *--To Insert IR details
        CLEAR IT_HISTORY.
        READ TABLE IT_HISTORY WITH KEY EBELN = IT_POITEM-EBELN
                                       EBELP = IT_POITEM-EBELP
                                       VGABE = '2'
                                       BEWTP = 'Q'.
          IF SY-SUBRC = 0.
            MOVE :
              IT_HISTORY-BELNR TO IT_FINAL-IR_BELNR,  "IR-Number of Mat Doc
              IT_HISTORY-BUZEI TO IT_FINAL-IR_BUZEI,  "IR-Item in mat Doc
              IT_HISTORY-BUDAT TO IT_FINAL-IR_BUDAT,  "IR-Posting date
              IT_HISTORY-BUDAT TO IT_FINAL-IR_MENGE.   "IR-Quantity
          ENDIF.
    *--To insert GR details
        CLEAR IT_HISTORY.
        READ TABLE IT_HISTORY WITH KEY EBELN = IT_POITEM-EBELN
                                       EBELP = IT_POITEM-EBELP
                                       VGABE = '1'
                                       BEWTP = 'E'.
          IF SY-SUBRC = 0.
            MOVE :
              IT_HISTORY-BELNR TO IT_FINAL-GR_BELNR,  "IR-Number of Mat Doc
              IT_HISTORY-BUZEI TO IT_FINAL-GR_BUZEI,  "IR-Item in mat Doc
              IT_HISTORY-BUDAT TO IT_FINAL-GR_BUDAT,  "IR-Posting date
              IT_HISTORY-BUDAT TO IT_FINAL-GR_MENGE.  "IR-Quantity
          ENDIF.
    *--To insert Vendor details
         CLEAR IT_VENDOR.
         READ TABLE IT_VENDOR WITH KEY LIFNR = IT_POHEADER-LIFNR.
         IF SY-SUBRC = 0.
          MOVE : IT_VENDOR-NAME1 TO IT_FINAL-NAME1.
         ENDIF.
    *--To insert Business area
         CLEAR IT_BUSINESS.
         READ TABLE IT_BUSINESS WITH KEY EBELN = IT_POITEM-EBELN
                                         EBELP = IT_POITEM-EBELP.
         IF SY-SUBRC = 0.
           MOVE : IT_BUSINESS-GSBER TO IT_FINAL-GSBER.
         ENDIF.
          APPEND IT_FINAL.
          CLEAR  IT_FINAL.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    " GET_FINAL_DATA
    thanks
    Sunil

  • How can i get the column names in CSV file.

    Hi,
    After execution of infospoke i can not see the column names in that file.How can i get column of respective infoprovider?
    Thanks,
    Gananadha Lenka

    Hello Gana,
    Actually while exporting the data using Info Spoke, we have the possibility to modify the data that we send. This is possible using transformations.
    In your Info Spoke, you have a tab called Transformations.
    Here you need to create an implementation and then use BADi to populate data.
    Check if you can write a start routine sort of thing here and insert a new record into the internal table by hardcoding with your field headings.
    Let me know if you dont know how to create transformations.
    Kris...

  • How can i get  the column name   for assigned constraint name  from  the  user_constraints   table?????

    Hi  ,
    I  have a table  so  many constraints   on so  many  columns. I  need to  know  which column has which  constraint plsql dev?? like below...
    table_name -------- col_name ------ constraint_name_of_that_col
        xxxxxx              xxxxxxx              xxxxxxxxxxxxxxxx
    or else please let me know  how can i  get the  corresponding col_name for a particular  constraint name???

    My be this can give you a help:
    [code]
    SELECT *
    FROM   ALL_CONSTRAINTS
    WHERE  R_CONSTRAINT_NAME IN (SELECT CONSTRAINT_NAME
                                                               FROM   ALL_CONSTRAINTS
                                                               WHERE  TABLE_NAME = 'TABLE_NAME'
    [/code]

  • How can I reduce the column width in a spreadsheet according to the text?

    Hi,
    I added a spreadsheet to a pages document and now I want to reduce the column width so that it fits the content (text).
    I tried it the other way around: I added very small columns and then chose the adjust-automatically-option in informations. This worked, the columns became broader and matched the text.
    Now I got a lot of spreadsheets which columns are too broad. When choosing adjust-automatically just nothing happens. What can I do?
    Sorry if this sounds a little weird, I'm using English seldom at time and don't know which words to choose to describe my problem properly. Hope someone can help me nevertheless?
    Sarah

    Hi Sarah,
    In Pages, the table Autosize feature pertains to Row Height, not Column Width. Numbers has more Table sizing options than Pages does, so you might want to consider looking into doing your work in Numbers.
    In Pages, there are slight differences in how tables behave depending on whether they are Inline or Floating. You might want to experiment with that. Long tables, however, must be Inline.
    Jerry

  • How can I reorder the columns in the Files panel in Dreamweaver CC 2014.1?

    I just upgraded to Dreamweaver CC 2014.1, and I want to change the order of the columns in the Files panel. But I can't figure out how to do this. Can anyone help?
    Thanks,
    Kim

    <I want to change the order of the columns in the Files panel>
    You can change the sorting order by file name (ascending or descending), size, type, or date modified by clicking those labels on top of Files Panel.
    Nancy O.

  • How can I customize the Column Headers of the TABLE control/indicator in LabVIEW ?

    I need to customize the TABLE control/indicator in the LabVIEW as the same shape of the table in the LabWindows CVI or the DBgrid of the Borland Delphi. Where can I modify the color and shape of the Column Headers and the Row Headers.
    Thanks,
    Cleber

    Salutations,
    You asked this question about 3 months ago, and no one answered it.. How rude of them, well....
    You can customize any control/indicator by right mouse clicking on it, going to advanced, then customize. If you want to color it, you can always right mouse click with the shift key down, and pull up the painting tool stuff. Or use the tab key if you want to scroll through tools. I believe it's the tab key. Alright, i bet you've long since figured it out, but i couldn't resist.
    Sincerely,
    ElSmitho

  • How can I stop the column-view finder from centering its view?

    My finder is set to column-view so I can see the sub columns and easily move the files to different colums. 
    When I select a file in one of the lower sub solumns the view automatically shift to centerize the column, which make it difficult for me to see the head columns.  Is there a way to 'lock' its view?

    It changes the column width automatically when I select a file in a sub column even after I adjust it to my liking...
    This "centerizing" doesn't happen all the time - there are times that the columns stay the way I adjust - but I don't know what triggers this problem, thus I don't know how to stop it when it happens.

  • How can i reorder the columns in the do not display section of the interactive report.

    Hi,
    My interactive report contains 185 columns, and the user requieres to build his customized reports with some columns, but the he gets lost between this amount of columns, this would be easier if the columns in the do not display section of the interactive report would be sorted automaticaly, Is this possible?
    Thanks a lot,

    Hi Eva,
    One solution would be to order the column names alphabetically. You can create a JavaScript dynamic action to handle the sorting.
    The shuttle of the IR attribute "Select Columns" have the ID's "apexir_SHUTTLE_LEFT" or the Hidden colums and "apexir_SHUTTLE_RIGHT" for the displayed columns.
    The function you'd need to create would look like:
    var options = $('select#apexir_SHUTTLE_LEFT option');
    var arr = options.map(function(_, o) { return { t: $(o).text(), v: o.value }; }).get();
    arr.sort(function(o1, o2) { return o1.t > o2.t ? 1 : o1.t < o2.t ? -1 : 0; });
    options.each(function(i, o) {
      o.value = arr[i].v;
      $(o).text(arr[i].t);
    var options = $('select#apexir_SHUTTLE_RIGHT option');
    var arr = options.map(function(_, o) { return { t: $(o).text(), v: o.value }; }).get();
    arr.sort(function(o1, o2) { return o1.t > o2.t ? 1 : o1.t < o2.t ? -1 : 0; });
    options.each(function(i, o) {
      o.value = arr[i].v;
      $(o).text(arr[i].t);
    You'd need to find the propper timing for the dynamic action to run, I guess click of the button "Select Columns" would do the trick.
    Regards,
    Vincent
    http://vincentdeelen.blogspot.com

Maybe you are looking for