Sales Order + Activity query

Hi,
I set up the following query in one company:
SELECT T0.DocNum, T1.ClgCode, T3.U_NAME, T2.name, T1.endDate, T1.Priority, T0.CardCode, T0.CardName, T0.NumAtCard, T0.DocDate, T0.DocTotal
FROM ORDR T0 LEFT OUTER JOIN OCLG T1 ON T0.DocNum = T1.DocNum LEFT OUTER JOIN OCLA T2 ON T1.status = T2.statusID LEFT OUTER JOIN OUSR T3 ON T1.AttendUser = T3.INTERNAL_K
WHERE T0.DocStatus = 'O'
When I replicate it in another company, I get the following error:
SQL Server Native Client 10.0|| SQL Server||  Conversion failed when converting the nvarchar value 'STBs-EN-0002' to data type int. 'Received Alerts' (OAIB)
The STBs value indicated is an Item Code/IMD record which isn't even referred to in the query so not sure why it's getting picked up and/or causing an error.
When I separate the two parts of the query - one query on just open sales orders, another on activities - they both work. It seems to be with the linking of ORDR to the Activities tables (if I try just ORDR and OCLG I get the same error above).
Any assistance on figuring out how to fix the query would be much appreciated,
Heather

Hi Heather,
Try:
SELECT T0.DocNum, T1.ClgCode, T3.U_NAME, T2.name, T1.endDate, T1.Priority,
T0.CardCode, T0.CardName, T0.NumAtCard, T0.DocDate, T0.DocTotal
FROM ORDR T0
LEFT JOIN OCLG T1 ON T0.DocNum = T1.DocNum AND T1.DocType = '17'
LEFT JOIN OCLA T2 ON T1.status = T2.statusID
LEFT JOIN OUSR T3 ON T1.AttendUser = T3.INTERNAL_K
WHERE T0.DocStatus = 'O'
Thanks,
Gordon

Similar Messages

  • Sales order invoice query

    Hi
    Please send the sales order invoice query as basic columns.. Further I will modify the query according to the requirement.
    Pleas send to my personal ID: [email protected]
    Thanks
    Sree

    Thanks.  There's a few problems though.
    1)  It seems that OINV DocTotal != Balance Due.  I'm seeing a number of invoices where there was a balance due, but we applied additional money (either we took another incoming payment and applied it or applied money from the account balance, etc.) and yet it still shows a total.
    2)  It's pulling incoming payments from different customers.  I think this is because the table was joined based on "RCT2 T4 on T4.[DocEntry]  =  T3.[DocNum] and T4.[InvoiceId] = T2.[LineNum]"  In one example I have 2 incoming payments 446 and 614.  Both have the DocEntry 542, but one relates to A/R Invoice 542 (for a different client) while the other relates to Down Payment Invoice 542.  *I was able to fix this by adding WHERE T5.CardCode = [%0]*
    3)  I'm going to work with this a little bit and see if I can alter it to make it work for me.  Basically this query falls a little short on the following:
    -  Doesn't include incoming payments that aren't linked to a down payment invoice.
    -  Does not give the Invoice Total (I'd like to know how much of the SO was invoiced.  DocTotal seems to give me Amount Invoiced - Down Payments.  I'm not sure the best way to get this number.  Maybe I could do the sum of each line * tax + freight)
    -  Does not give the outstanding amount on an invoice.  The ARtotal [DocTotal] column gives me how much was owed when the invoice was created, but it doesn't tell me what is currently owed.
    -  Lastly it may complicate the query too much and could be left off, but it would be nice to see if they have any money from credits or incoming payments that has not been applied.  Perhaps this would be easily accomplished by simply pulling in their account balance.

  • Finding the original quanitity on sales order : Select Query on CDPOS ?

    Hello ABAPers,
      I have created a sales order and I changed the order quantity over many times using Va02. If i want to programatically determine the orginal quantity, on the sales order when it was created , how would i determine ?
    I thought, I would do a select query on CDPOS table and find out. But i found from se16 that for the Object ID - VERKBELEG and Object id = 00000XXXXX ( where XXXXX is sales order number), the VBEP and VBAP entries for Update mode shows no Old_vales and New_values.
    But if i click on environment>Changes> in Va02 for that particular Sales order, I see the old and new values list.
    Why is this not listed in CDPOS ? How do I progrmatically determine the original quanitity on Sales order ?
    Thanks
    SHK

    Hi Ferry,
      That FM did the trick. I ended up creating a FM myself to find the original qty and original unit. Somehow select qry on CDHDR and CDPOS, returned empty field for Old_value and new_value. Here is my FM below
    FUNCTION z_sw_originalqty_on_so.
    *"*"Local interface:
    *"  IMPORTING
    *"     VALUE(I_VBELN) TYPE  VBELN OPTIONAL
    *"     VALUE(I_POSNR) TYPE  POSNR OPTIONAL
    *"  EXPORTING
    *"     VALUE(I_ORIGINAL_QTY) TYPE  KWMENG
    *"     VALUE(I_ORIGINAL_UNIT) TYPE  VRKME
      DATA : i_editpos TYPE TABLE OF cdred INITIAL SIZE 1  .
      DATA : wa_editpos LIKE LINE OF i_editpos.
      DATA : wa_editpos1 LIKE LINE OF i_editpos.
      DATA : i_cdhdr   TYPE TABLE OF cdhdr INITIAL SIZE 1.
      DATA : i_cdpos   TYPE TABLE OF cdpos INITIAL SIZE 1.
      DATA : wa_cdhdr  LIKE LINE OF i_cdhdr.
      DATA : wa_cdpos  LIKE LINE OF i_cdpos.
      DATA : i_objid TYPE  cdhdr-objectid.
      DATA : delimiter(1) VALUE ' '.
      DATA : lv_org_qty(127)      TYPE c,
             lv_org_unit(127)      TYPE c.
      DATA : l_tabkey TYPE cdpos-tabkey.
      DATA : i_flag.
      CLEAR i_flag.
      CONCATENATE sy-mandt i_vbeln i_posnr '0001'  INTO l_tabkey.
      i_objid = i_vbeln .
      CALL FUNCTION 'CHANGEDOCUMENT_READ'
           EXPORTING
                objectclass                = 'VERKBELEG'
                objectid                   = i_objid
                tablekey                   = l_tabkey
                tablename                  = 'VBEP'
           TABLES
                editpos                    = i_editpos
           EXCEPTIONS
                no_position_found          = 1
                wrong_access_to_archive    = 2
                time_zone_conversion_error = 3
                OTHERS                     = 4.
      IF sy-subrc <> 0.
        SELECT SINGLE bmeng  INTO i_original_qty FROM vbep
                       WHERE vbeln = i_vbeln  AND
                             posnr = i_posnr.
        SELECT SINGLE vrkme INTO i_original_unit FROM vbep
                       WHERE vbeln = i_vbeln  AND
                             posnr = i_posnr.
      ENDIF.
      SORT i_editpos  BY udate utime tabname fname .
      LOOP AT i_editpos INTO wa_editpos.
        READ TABLE i_editpos INTO wa_editpos1
                 WITH KEY tabname = 'VBEP'
                          fname   = 'WMENG'
                          CHNGIND = 'U'.
        CLEAR : i_original_qty,i_original_unit.
        IF sy-subrc EQ 0.
          SHIFT wa_editpos1-f_old  LEFT DELETING LEADING space.
          SPLIT wa_editpos1-f_old AT delimiter INTO lv_org_qty lv_org_unit .
          i_original_qty  = lv_org_qty.
          i_original_unit = lv_org_unit.
          i_flag = 'X'.
          EXIT .
        ENDIF.
      ENDLOOP.
      sy-subrc = 4.
      IF sy-subrc <> 0 AND i_flag NE 'X'.
        SELECT SINGLE bmeng  INTO i_original_qty FROM vbep
                       WHERE vbeln = i_vbeln  AND
                             posnr = i_posnr.
        SELECT SINGLE vrkme INTO i_original_unit FROM vbep
                       WHERE vbeln = i_vbeln  AND
                             posnr = i_posnr.
      ENDIF.

  • Sales order form query

    If i want to display the fright and Insurance charges in sales order how do I go about. Please it is very urgent

    HI
      Not every company has the same set of feilds. Kindly
    explain if you need to add these two fields in Sales
    Order screen or value from sales order to be displayed
    in a report???
    Kind Regards
    Eswar

  • Sales Oportunity / Activity Query Question

    I am trying to create a query to look up all Activities assigned / associated with a specific Sales Oportunity. I can not determine how to join the the Activity / Activities to the Sales Oportunity.  I see the the table OCLG, Activities table , that there is a Business Partner column, but how do I determine if the Activity is associated with an Activity and if so, which Sales Oportunity?
    Is there another table I need to join to?
    Hope this makes sense.
    Thanks in advance
    Dana

    hi,
    Activity can be linked to a business partner,not to sales opportunity,
    U can link sales opportunity indirectly with Acitivity via BP Code.
    Develop this query
    SELECT T0.OpprId, T0.CardCode, T1.ClgCode, T1.CardCode, T1.Notes
    FROM OOPR T0 INNER JOIN OCLG T1 ON
    T0.CardCode = T1.CardCode
    Jeyakanthan

  • Display sales orders in query regardless of vendor

    Hi BI gurus,
    I have got a query with the selection screen. The users specify a vendor in this selection screen. At the moment, if the orderline does not have purchase order against it, it does not display the order. For example, order no. 99999 which has got 3 lines. Line 20 does not have purchase order against it but the rest (line 10 and 30) got PO against them. When users specify the vendor and execute it, this order will not be displayed in the report. System thinks that there is no Purchase Order raised for line 20. Which is right. But is there any way that we can display this order in report?
    Order             Line               Purchase Order
    99999            10                  Yes
                         20                  Not created yet
                         30                  Yes
    Please do let me know.
    Thanks for your help.

    Hello SDBI,
    I tried the way you mentioned. But unfortunately, it did not work. The problem is the user key in the vendor in the selection screen. Now, some order lines may not have purchase order created for them. But user wants to see order lines with or without purchase order. Is there anyway I can resolve this issue?
    Please let me know.
    Thanks for your help.

  • How to Link Sales Order for Non Purchase items to Purchase Order

    Hi,
    I am using SAP 2007A SP01 PL05.
    I am creating a Sales Order for Non Purchase Items where i have 3 companies involved.
    1. Owner of the Product
    2. Transport Agent
    3. Customer
    Owner Sells to the Customer non Purchase Items manufactured internally.
    Owner buys transports services from the Agent for these non purchase items.
    I am creating a Sales Order for the Customer and at the same time i want to create a Purchase Order to the Transport Agent.
    How do i Link Sales Order to a Purchase Order for Transport.
    The Transport Charges are not to be Charged to the Customer and should not be added to the Sales Order.

    Hi
    Create purchase Item frieght in the purchase tab enter the transporter. include this in the sales order and in the logistic tab of sales order active purchase order check box, you frieght item will have a value of 0. when you create sales order the the system will lead you to create purchase order. there you can enter the price of freight. you can explore options there.
    hope this will help you.. by doing this your base ref for PO would be Sales order.
    Regards
    Sandeep

  • Preventing update to COPA tables for a particular Sales order type

    Hi ,
    We need to have incoming sales order transfer to COPA activated only for one particular sales order type activated.
    Earlier we implemented note 571697  for user exit to allow COPA update only for particular sales order type.
    This prevented the transfer of SO to actuals table, but off late the performance for VA01 and VA02 has decreased substantially.
    Upon checking, we found this is happening because of other CE4XXXX tables (excluding CE1XXXX) which are getting updated during creation/ change of SO. as the data in these tables is huge .
    If possible, please advise, right userexit to prevent update to these tables.
    Thanks.
    Neeraj

    Thanks for your inputs..I have few more queries on same.
    Initially we had incoming sales order activated in KEKF allong with implemented SAP note 571697, which helped us to update CE1XXXX only for a particular sales order type. This was initial requirement to have system updating COPA values only for one particular sales order type.Also, KEQ3 was also activated which resulted in updates to CE4XXXX. This was not a problem initially since we had few sales orders now that plant has grown old with more sales order (resulting in huge size of CE4XXXX) VA01 is impacted..
    Currently ,since we have KEQ3 activated so, Segment is created the moment we create sales order.. and table CE4XXXX is updated..
    As most of you have suggested to switch off sales order in KEQ3, i need to analyze the impact of this..
    From what i understand CE1XXXX will continue with updation for that order type... and CE4XXXX won't be updated in future..Please correct me if i am wrong..
    Also, please advise what all can be possible impacts on COPA reporting if I switch off from now onwards (client has been using this since long) , and what all should be the precautions that i should take while doing this.
    Thanks

  • Backend Tables for Chargeback regarding Sales Order.

    Hi,
    I am Searching for the tables Chargeback Data regarding Sales Orders, and also Joins for sales tables.
    Can any one help me in this.
    Thanks in Advance
    Regards
    Vamsi...
    Edited by: 965678 on Apr 29, 2013 6:05 AM
    Edited by: 965678 on Apr 29, 2013 6:42 AM

    Thanks for your inputs..I have few more queries on same.
    Initially we had incoming sales order activated in KEKF allong with implemented SAP note 571697, which helped us to update CE1XXXX only for a particular sales order type. This was initial requirement to have system updating COPA values only for one particular sales order type.Also, KEQ3 was also activated which resulted in updates to CE4XXXX. This was not a problem initially since we had few sales orders now that plant has grown old with more sales order (resulting in huge size of CE4XXXX) VA01 is impacted..
    Currently ,since we have KEQ3 activated so, Segment is created the moment we create sales order.. and table CE4XXXX is updated..
    As most of you have suggested to switch off sales order in KEQ3, i need to analyze the impact of this..
    From what i understand CE1XXXX will continue with updation for that order type... and CE4XXXX won't be updated in future..Please correct me if i am wrong..
    Also, please advise what all can be possible impacts on COPA reporting if I switch off from now onwards (client has been using this since long) , and what all should be the precautions that i should take while doing this.
    Thanks

  • Update a sales order

    Hi All,
    It seems that after I have raised a deposit invoice on an actual material
    you cannot update the spec of that material, in that you cannot update to the
    sales order. So the material is grayed out and can't be changed.
    In the document flow, the sales order is in process, and there is a delivery block. This is fine. But how do I make the sales order active again so I can update the material with other components.
    Rgds
    TV

    Hi Montee
    If order is not delivered completey then you can maintain another line item.But If you are adding another line item, after billing is also completed then it is not possible .So check wheather any Material determination is done for the material or not.Also check wheather any user exit is working or not.So kindly check with your technical team
    Thanks and Regards
    Srinath

  • SQL to fetch contract number for a sales order

    Hello,
    I am using API's to create service contracts, all is working well except one scenario - when install based item switches ownership.
    I need some help crafting a query that will return the contract number, if one exists, for a particular sales order. I am trying to determine if a contract already exists so I can either create new contract header then add lines.... or add lines to existing.
    I have this query so far, however it will return the prior/old service contract and not the most recent if an IB item is being resold after refurbish:
    SELECT okh.id
    FROM okc_k_headers_b okh
    ,okc_k_lines_b okl
    ,okc_k_items oki
    ,csi_item_instances cii
    ,oe_order_lines_all oolv
    ,oe_order_headers_all oohv
    WHERE okh.id=okl.dnz_chr_id
    AND oki.cle_id = okl.id
    AND okh.sts_code <> 'TERMINATED'
    AND to_char(cii.instance_id) = oki.object1_id1
    AND oolv.line_id=cii.last_oe_order_line_id
    AND oohv.header_id=oolv.header_id
    AND okl.end_date >= trunc(sysdate)+vDuration
    AND oohv.order_number=vOrderNumber
    Thanks!
    Any help would be great.

    I found similar question here:
    Relation between Order Number & Contract Number
    But that query does not return contract number consistently for me. Meaning I know a contract exists related to a certain sales order yet query does not find it.
    I am new to contracts I appologise for my ignorance
    thanks
    Edited by: user7513372 on Jul 6, 2010 11:23 AM

  • To deactivate sales order in FM

    Hi,
    Can anybody let me know how to deactivate Sales Order Update in Fund Management?
    We are using ECC 6.0 and I have used OFUP but it is not working asking G/L Account..Error.
    Regards
    Rahkes

    Hi Alex,
    Thanks for your reply.
    You wrote: "from TCode: FMNSDN delete commitments generated from sales order"
    from Tcode: FMNSDN I got the following result:
    Doc.no.       Type Appl. area     Msgno Message text
    1120125783 W    FI                   053   Item 00010 contains commitment item with fin. trans. other than 30
    I browse the Sales Order with VA03 but could not find the commitment item
    How to delete the commitment item?
    I have two options for Sales Order
    1. Going ahead with Sales Order Active with FM, it means Dummy Commitment item with fin. trans=50 will be updated where I don't require any budget impact with Sales Order
    2. If option 1 is not possible then I have to deActivate Sales Order in FM.
    Can I go with Option 1 in this case?
    Please advice.
    Rahkes

  • How to see Active customers that are having atleast one Sales Order?

    Dear Friends,
    How can we see all active customers in the system, means customers those are having atleast one sales order.
    How to see

    It depends on which role this customer might have on the sales order. If it's a Sold-to, then you can run a query by VBAK-KUNNR, otherwise VBPA table will have all other partner types (use POSNR = 000000 to see only the header-level partners). Most likely there will be a lot of records. You might want to run the query in batches or limit the selection. Then download the results to Excel and there you can delete the duplicates and get a list of the unique customer numbers.
    MCTE will help only if the corresponding info structure (S003) is being updated correctly. Also it has only sold-to customers.

  • Query needed to find what time a sales order was closed

    Hi to All,
    Need to find when a sales order was closed. Meaning the exact time. I know the flags that needed to be considered. But what table/column holds the exact time that the sales order was closed.
    Thanks

    If your workflow process details are not purged below query end_date will be order closed date.
    select a.instance_id
    , to_char(b.begin_date, 'DD-MON-RR HH24:MI:SS') begin_date
    ,to_char(b.end_date, 'DD-MON-RR HH24:MI:SS') end_date
    , a.process_name process
    from  wf_process_activities a, wf_item_activity_statuses b
    where b.item_type        = 'OEOH'
    and   b.item_key     in (select to_char(header_id) from oe_order_headers_all where order_number = <Ordrer_num>)
    and a.process_name = 'CLOSE_HEADER_PROCESS'.
    and   b.process_activity = a.instance_idIn R12 if you do not have any customizations ,
    Current close process defines wake up time as last day of month, there is no time component.
    So order will be eligible from midnight of the last day of the month.
    First run of Workflow background process program for item type OEOH should be closing them.
    For example : If the Wait activity in 'Close - Order' process encountered first time on 09-May-2013(Any time in the month of May), then Wake up time will be last day of current month I.e. 31-May-2013 00:00.

  • Sales Order Query Join

    Hi I have a query which returns the sum of linetotals from sales orders related to a specific Business Partner and also related to a specific Item Code.
    The problem which I'm having is that when I am testing the reports I am finding out that some of the amounts are being multiplied for a number of times.
    I think that it is a join problem.
    The query is the below:
    select distinct
              t0.cardcode
    ,          t0.cardname
    ,          sum(t2.linetotal) as 'Total'
    ,          sum(t3.linetotal) as 'GATEWAY - IPLCS'
    ,          sum(t4.linetotal) as 'GATEWAY - IP TERMINATING CHRGS & LINKS'
    ,          sum(t5.linetotal) as 'Dedicated Symmetric International IP Bandwidth'
    ,          sum(t6.linetotal) as 'Dedicated Symmetric International IP Bandwidth Daily'
    ,          sum(t7.linetotal) as 'Shared IP Transit'
    ,          sum(t8.linetotal) as 'Premium IP'
    ,          sum(t9.linetotal) as 'IP Addresses'
    ,          sum(t10.linetotal) as 'DDos Service'
    ,          sum(t11.linetotal) as 'MIX'
    ,          sum(t12.linetotal) as 'PVC'
    ,          sum(t13.linetotal) as 'Short term IP Transit'
    ,          sum(t14.linetotal) as 'Shared Premium IP'
    ,          sum(t15.linetotal) as 'Shared Rack Co-Location - Setup And Installation Charge'
    ,          sum(t16.linetotal) as 'Shared Rack Co-Location'
    ,          sum(t17.linetotal) as 'Remote Hands / Engineering Support'
    ,          sum(t18.linetotal) as 'Rack Co-Location- Setup & Installation Charge'
    ,          sum(t19.linetotal) as 'Rack Co-Location Space'
    ,          sum(t20.linetotal) as 'Power'
    ,          sum(t21.linetotal) as 'Wireless Ip Microwave Link - Single-Homed Setup & Installation Charge'
    ,          sum(t22.linetotal) as 'Wireless Ip Microwave Link - Dual-Homed Setup & Installation Charge'
    ,          sum(t23.linetotal) as 'Wireless Ip Microwave Link - Recurring Charge Including Mca Fees'
    ,          sum(t24.linetotal) as 'Local Connectivity - Vlan'
    ,          sum(t25.linetotal) as 'Local Connectivity - Bandwidth Access Cost (Traffic)'
    ,          sum(t26.linetotal) as 'Local Connectivity - Activation And Installation Charges For Fibre-Based Ethernet Business Plus'
    ,          sum(t27.linetotal) as 'Local Connectivity - Ethernet Over Fibre'
    ,          sum(t28.linetotal) as 'International Private Leased Circuit'
    ,          sum(t29.linetotal) as 'International Private Leased Circuit Setup Fee'
    ,          sum(t30.linetotal) as 'Wireless link operating on the Unlicensed Band - Setup fee'
    ,          sum(t31.linetotal) as 'Wireless link operating on the Unlicensed Band - Recurring Charge'
    ,          sum(t32.linetotal) as 'GIGE LX SFP Module'
    ,          sum(t33.linetotal) as 'PSAX 1000 Fan/Alarm Module'
    ,          sum(t34.linetotal) as '-48 VDC PS PSAX 2300 4500'
    ,          sum(t35.linetotal) as 'Stratum/-48VDC PS PSAX 1000'
    ,          sum(t36.linetotal) as 'Alcatel Equipment TNEs FOR INVOICE POSTING ONLY'
    ,          sum(t37.linetotal) as 'Tower Site Works'
    from
              ocrd t0 left outer join ordr t1 on t0.cardcode = t1.cardcode
                        left outer join rdr1 t2 on t2.docentry = t1.docentry
                        left outer join rdr1 t3 on t3.docentry = t1.docentry and t3.itemcode = 'DSC000001'
                        left outer join rdr1 t4 on t4.docentry = t1.docentry and t4.itemcode = 'FLC000001'
                        left outer join rdr1 t5 on t5.docentry = t1.docentry and t5.itemcode = 'RVL000001'
                        left outer join rdr1 t6 on t6.docentry = t1.docentry and t6.itemcode = 'RVL000002'
                        left outer join rdr1 t7 on t7.docentry = t1.docentry and t7.itemcode = 'RVL000003'
                        left outer join rdr1 t8 on t8.docentry = t1.docentry and t8.itemcode = 'RVL000004'
                        left outer join rdr1 t9 on t9.docentry = t1.docentry and t9.itemcode = 'RVL000005'
                        left outer join rdr1 t10 on t10.docentry = t1.docentry and t10.itemcode = 'RVL000006'
                        left outer join rdr1 t11 on t11.docentry = t1.docentry and t11.itemcode = 'RVL000007'
                        left outer join rdr1 t12 on t12.docentry = t1.docentry and t12.itemcode = 'RVL000008'
                        left outer join rdr1 t13 on t13.docentry = t1.docentry and t13.itemcode = 'RVL000009'
                        left outer join rdr1 t14 on t14.docentry = t1.docentry and t14.itemcode = 'RVL0000010'                    
                        left outer join rdr1 t15 on t15.docentry = t1.docentry and t15.itemcode = 'RVM000001'
                        left outer join rdr1 t16 on t16.docentry = t1.docentry and t16.itemcode = 'RVM000002'
                        left outer join rdr1 t17 on t17.docentry = t1.docentry and t17.itemcode = 'RVM000003'
                        left outer join rdr1 t18 on t18.docentry = t1.docentry and t18.itemcode = 'RVM000004'
                        left outer join rdr1 t19 on t19.docentry = t1.docentry and t19.itemcode = 'RVM000005'
                        left outer join rdr1 t20 on t20.docentry = t1.docentry and t20.itemcode = 'RVM000006'
                        left outer join rdr1 t21 on t21.docentry = t1.docentry and t21.itemcode = 'RVN000001'
                        left outer join rdr1 t22 on t22.docentry = t1.docentry and t22.itemcode = 'RVN000002'
                        left outer join rdr1 t23 on t23.docentry = t1.docentry and t23.itemcode = 'RVN000003'
                        left outer join rdr1 t24 on t24.docentry = t1.docentry and t24.itemcode = 'RVN000004'
                        left outer join rdr1 t25 on t25.docentry = t1.docentry and t25.itemcode = 'RVN000005'                    
                        left outer join rdr1 t26 on t26.docentry = t1.docentry and t26.itemcode = 'RVN000006'
                        left outer join rdr1 t27 on t27.docentry = t1.docentry and t27.itemcode = 'RVN000007'
                        left outer join rdr1 t28 on t28.docentry = t1.docentry and t28.itemcode = 'RVN000008'
                        left outer join rdr1 t29 on t29.docentry = t1.docentry and t29.itemcode = 'RVN000009'
                        left outer join rdr1 t30 on t30.docentry = t1.docentry and t30.itemcode = 'RVN0000010'
                        left outer join rdr1 t31 on t31.docentry = t1.docentry and t31.itemcode = 'RVN0000011'
                        left outer join rdr1 t32 on t32.docentry = t1.docentry and t32.itemcode = 'TNE000001'
                        left outer join rdr1 t33 on t33.docentry = t1.docentry and t33.itemcode = 'TNE000002'
                        left outer join rdr1 t34 on t34.docentry = t1.docentry and t34.itemcode = 'TNE000003'
                        left outer join rdr1 t35 on t35.docentry = t1.docentry and t35.itemcode = 'TNE000004'
                        left outer join rdr1 t36 on t36.docentry = t1.docentry and t36.itemcode = 'TNE000005'
                        left outer join rdr1 t37 on t37.docentry = t1.docentry and t37.itemcode = 'TNE000006'
    where
              t0.groupcode in (100,114)
    group by
              t0.cardcode
    ,          t0.cardname
    Can you help please?
    Thanks,
    vankri
    Edited by: vankri on Nov 10, 2009 1:02 PM

    Try something like this with all your required items:
    Select  t0.cardcode , t0.cardname , sum(t2.linetotal) as 'Total'
      ,(select sum(r.linetotal) from rdr1 r join ordr o on r.docentry=o.docentry
              where o.cardcode=t0.Cardcode and r.ItemCode= u2019DSC000001')
                        as 'GATEWAY - IPLCS'
      ,(select sum(r.linetotal) from rdr1 r join ordr o on r.docentry=o.docentry
              where o.cardcode=t0.Cardcode and r.ItemCode= u2019FLC000001u2019)
                        as 'GATEWAY - IP TERMINATING CHRGS & LINKS'
    From ocrd t0 left outer join ordr t1 on t0.cardcode = t1.cardcode
                      left outer join rdr1 t2 on t2.docentry = t1.docentry
    group by t0.cardcode ,t0.cardname

Maybe you are looking for

  • Firefox won't load certain websites.

    Firefix won't load some certain websites. I even have to use google chrome now, to ask advice. I did all the things said in the help page but it only seemed to turn internet connection slower! It seems that FF is having problems with save websisites

  • Forward/backward annotation

    Hello, I tried these features and was very suprised by the -bad- result. First after having placed all my components I wanted to change my 2 connectors name from U? to X? so I did it in Multisim and forward annotate it to Ultiboard. Suprise! allmost

  • Mountain Lion Image Capture won't recognize my Canon MP800 Scanner

    My MP800 is able to print from my new iMac but it is not even recognized for scanning.  Is this something that will be corrected soon?  It's a bummer to have this perfectly good all-in-one printer/scanner from Canon and now it won't scan.  Anyone hav

  • I can't download updates from the update option in PS CS 5.1.

    I can't download updates from the update option in PS CS 5.1. Also having trouble installing the update directly from ADOBE. The program is crashing my system on a regular basis. Anybody got any ideas?

  • Serial Number, no email, not listed.

    I want to register my new product (Adobe CC Photoshop/Lightroom) but I never received an email with my serial number and CC is not listed as a product on my profile.  Where else can I get my serial number?