Creating a query that provides a default transaction type for those transactions not categorized?

How could I create a query that provides a default transaction type for those transactions not categorized?
So assuming I have:
* Transactions table (with transactions)
* Categories table
* transactions_categories table - allows to allocate multiple categories (with a percentage)
 - tranactionID
 - categoryID
 - percentageAllocation
* Usage is such that only non-personal categories have been applied through out data.  So there is a lot of transactions with no categories applied
Aim:
* Want to create a query that creates a list of all the allocated amounts, so would include as columns:  transaction.tDate, transaction.tTitle, categories.name, allocatedAmount(calculated from percentage * transaction amount)
BUT:
* How could I include in the query, the entries that cover all transaction that haven't been allocated, to a default category "personal", where the allocated Amount would be 100% of the transaction value
* And also (if it were possible), for transactions that have been categorized but not for the complete transaction value (say only 50% was allocated to a category), how to to cover this off to.  

To default the value of the category:
select IIf(IsNull(Category),"Personal",Category) as Category,IIf(IsNull(Category),"100%",PercentageAllocation
) as PercentageAllocation from [yourtable]
What do you want to put the values of these ones:
And also (if it were possible), for transactions that have been categorized but not for the complete transaction
value (say only 50% was allocated to a category), how to to cover this off to.  
Fouad Roumieh

Similar Messages

  • Help: How to create a query that transpose the column content?

    Here, suppose that I have two tables
    TAB_A:
    ID     TYPE
    1     AA
    1     AB
    1     AC
    2     BA
    2     BB
    2     BC
    2     BD
    I'd like to create a query that gives result as:
    ID     TYPE
    1     AA AB AC
    2     BA BB BC BD Any suggestions?
    Thank you in advance.
    Jimmy

    Hi
    Try this:
    SELECT id,
    replace(LTRIM(MAX(SYS_CONNECT_BY_PATH(type,'*'))
    KEEP (DENSE_RANK LAST ORDER BY curr),'*'),'*', ', ') AS type
    FROM (SELECT id, type,
    ROW_NUMBER() OVER (PARTITION BY id ORDER BY type) AS curr,
    ROW_NUMBER() OVER (PARTITION BY id ORDER BY type) -1 AS prev
    FROM tab_a)
    GROUP BY id
    CONNECT BY prev = PRIOR curr AND id = PRIOR id
    START WITH curr = 1;
    Ott Karesz
    http://www.trendo-kft.hu

  • Trying to create a query that shows Sales Order/Invoice Totals as well as Paid/Outstanding/Available Down Payments

    Currently working on SAP B1 v8.82
    I'm looking to generate a query that will give an overall report for a given customer that shows Sales Order No, Invoice No, Sales Order Total, Invoice Total, Amount Paid on Invoice, Amount Remaining on Invoice, Down Payments Available, Open on Sales Order.
    I'm not sure what the best way to select the columns in bold above.  Invoice Total should be self-explanatory.  Amount Paid should be any down payments or applied payments on the invoice.  The balance due on the invoice (which seems to be T0.DocTotal if I'm not mistaken) should = 'Invoice Total' - 'Amount Paid on Invoice'. In the Down Payments Available column I want the total amount of money on the account or on down payments that aren't tied to a Sales Order.  If a client overpaid in the past for instance and there's a credit on their account, then it should contribute to this sum.  Open on Sales Order should be pretty easy.  I guess it's just the sum of everything that is still open on the Sales Order.  I'm just not sure what the best way to sum all the un-delivered freight, tax, and line items is.  Here's what my query looks like so far.
    SELECT DISTINCT T4.[DocNum] [Sales Order No],
    T0.DocNum [Invoice No],
    T4.DocTotal [Sales Order Total]
    T0.DocTotal [Amount Outstanding],
    FROM OINV T0
    INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry
    INNER JOIN DLN1 T2 ON T1.BaseEntry = T2.DocEntry AND T1.BaseLine = T2.LineNum
    INNER JOIN RDR1 T3 ON T2.BaseEntry = T3.DocEntry AND T2.BaseLine = T3.LineNum
    INNER JOIN ORDR T4 ON T3.DocEntry = T4.DocEntry
    INNER JOIN OSLP T5 ON T4.SlpCode = T5.SlpCode
    WHERE T0.CardName Like '%%[%0]%%'
    GROUP BY T4.DocNum, T0.DocNum, T0.DocTotal, T4.DocTotal
    I tried doing a little searching around for queries similar to what I need, but I could find exactly what I was looking for and I'm very unfamiliar with OJDT, JDT1, and ITR1 tables which I think might be important to finding unapplied payments...

    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.

  • How to allow create different transaction type for different customer

    We are using CRM 7.0 now. We have two types customer, one is sap customer, the other is potential customer. We want to distinguish the two types customer. And user can create all transaction (for example: quotation, opportunity, activity) the sap customer. And the user only can create activity for  the potential customer, they can't create others transaction type for potential customer. How can we realize it? Thanks.

    Hi,
    We can make use of the BLOCKING REASONS to realize your requirement.
    A Blocking Reason can be assigned to the Business Partner role dependent data  and to the transaction type. A Business partner can be used in a transaction only if he is not assigned to this blocking reason.
    For Ex, In your scenario you can create a Blocking reason 'Not a SAP Customer ' and assign it to all the Potential Customers. You should assign the blocking reason to all the transaction  types which the potential customers should not be allowed.
    Hope it helps. Please let me know if you need further help.
    Regards,
    Vamsi.
    Edited by: Vamsi Krishna Potta on Sep 7, 2010 9:41 AM

  • I need a query that selects the amount of records for each day in a table.

    I need a query that selects the amount of records for each
    day in a table.
    Eg the result would be:
    date 1 14
    date 2 3
    etc
    Any ideas?

    sorted:
    SELECT count([commentID]),convert(varchar, dateAdded, 112)
    FROM COMMENTSgroup by convert(varchar, dateAdded,
    112)

  • Default Billing Type for Delivery against PO

    Hi Experts,
    Is there any setting to maintain Default Billing Type for Delivery against STO. Though the invoice is crated by manually putting customized Biiling Type and A/Cing doc also generated, but in the VF04 still system shows the same deliveries pending with Billing Type (F2).
    Kinly help in finding out the reason.
    Thanks & Regards
    Girish

    Hi
    There is a customization available here no default or hard coded
    Normally in a sales doc type we mention which billing type system has to pick
    If the billing happens from a PO which billing type system will take depends on the controls set in the areas mentioned below
    Go to your delivery type OVLK (say your delivery type is NL)
    In that there is a field called default order qty in the order reference tab (say if you maintained DL there)
    This DL is called PSEUDO order type
    Then in VOV8 for DL based on the billing types mentioned ,system will take the billing doc
    For delivery related billing say if you mention say ZF8  in the details of DL in VOV8(provided you have created ZF8)
    Then while you bill the delivery doc of NL system will take ZF8
    For intercompany delivery you can create ZIV billing type also Pure customization
    PO is linked to delivery type ( MM spro settings)--Del type linked to order (pseudo)  type---in order type (pseudo) we mention the billing types. Here the flow is bit different that pure SD flow
    Though the invoice is crated by manually putting customized Biiling Type and A/Cing doc also generated, but in the VF04 still system shows the same deliveries pending with Billing Type (F2).
    This manual is not reqd if the said assignments are done properly
    Regards
    Raja

  • How to set a default Billing type for a particular Delivery type

    Dear All,
    How to set a default billing type for a particular delivery type.
    My requirement is, we are creating delivery for a Stock Transport Order. Delivery type is NL and the Purchase order type is UB.
    When we are creating Billing, it should take Billing type "ZSTO" by default, which is the customised Billing type.
    Where we have to do this setting?
    In case of normal sales order, this control will be available in the Sales order document types.
    In case STO, how to set a default billing type for a delivery type (NL).
    Regards,
    Rajesh

    There is a customization available here no default or hard coded
    Normally in a sales doc type we mention which billing type system has to pick
    If the billing happens from a PO which billing type system will take depends on the controls set in the areas mentioned below
    Go to your delivery type OVLK (say your delivery type is NL)
    In that there is a field called default order qty in the order reference tab (say if you maintained DL there)
    This DL is called PSEUDO order type
    Then in VOV8 for DL based on the billing types mentioned ,system will take the billing doc
    For delivery related billing say if you mention say ZF8 in the details of DL in VOV8(provided you have created ZF8)
    Then while you bill the delivery doc of NL system will take ZF8
    For intercompany delivery you can create ZIV billing type also Pure customization
    PO is linked to delivery type ( MM spro settings)--Del type linked to order (pseudo) type---in order type (pseudo) we mention the billing types. Here the flow is bit different that pure SD flow
    Though the invoice is crated by manually putting customized Biiling Type and A/Cing doc also generated, but in the VF04 still system shows the same deliveries pending with Billing Type (F2).
    This manual is not reqd if the said assignments are done properly
    Hope it can assist you.
    Thanks & Regards
    JP
    Edited by: J Prakash on Jun 23, 2010 4:05 PM

  • Default billing type for delivery type

    Dear friends,
    I am doing STO scenario. After creation of purchase order and delivery I am creating proforma Invoice with reference to delivery document. By default it is taking F2 billing document type, but I want my own created proforma invoice ZF2 as default billing type for this delivery type. Is it possible? If so how?
    Regards
    Rama

    Dear Rama Rao
    Go to VTFL, select your delivery type and assign ZF2 billing type so that whenever you create billing for delivery, by default system will take zf2.
    thanks
    G. Lakshmipathi

  • Default output type for PO

    Dear All,
    Can some body so kind to help me to resort the following problem?
    My client have more then 5 purchase organization & each purchase organization use different 'output type' for Purchase order.
    Client requirement is ' there should be a different default output type for different purchase organization while creating PO .
    Thanks in advance.
    Regards,
    sp sahu

    Hi,
    You don't need ABAP or BADIs for this  !!!!!!
    Simply use the options already available as standard in MN04 and choose the output type and select the P org that it relates to and set up the communications data.
    PLEASE don't make SAP any more complex than it is by using ABAP or BADIs when the standard system does it (even without config) as standard.
    Steve B

  • Default PR type for MRP (planned order -- PR)

    Hi Expert,
    Is there any posibility to set default PR type for planned order - PR conversion from MRP?
    in SAP standard, PR type is NB, we have configured specific PR type, let say PRM. The purpose is we do not need to change NB to PRM while converting the planned order into PR.
    Pls help.Thanks
    Rgds,

    Hi Gurus,
    This is my first post in this forum. Have been trying to search this forum for my case all day and found some answers but when i implemented it in my SAP , the answers didn't work.
    The case is:
    When i try to convert Planned Order to PR through tcode MD15/MD16, the system will propose PR Document Type NB as default. In my company we don't use that NB PR type. We have another 10 customized PR Type and one of them is for Replenishment. I'd like to set this ZR09(Replenishment) PR Type as default and it's not possible to choose another PR Type.
    I have read several answers and implemented them, for example:
    1. OPPR with MRP Group 000, and I found no indicator except Scheduling/Doc Type. I typed ZR09 in field Doc Type SPO but in MD15/MD16 other PR Types still appear with NB as default.
    2.  SPRO-MM- Consumption based planning u2013Procurement Proposal u2013 Define Order Profile or SPRO-PRoduction - MRP- Procurement Proposal - Planned Order - Define order Profile, when creating new entries with Object Type Planned Order/PR still canu2019t find my customize PR Type in field Order Type. Field Order Type only consist of 2 digits order type such as NB,LA,RS,KD,KB,PE,PR,VP. No place to choose PR Type ZR09 or other customized PR Type.
    Can anyone help my case?
    Thanks and regards,
    IC BUMA

  • Default Procurement Type for a Material Type

    Hello everybody,
    Is it possible to assign a default procurement type (for example: F) to a Material Type?
    If yes, can you explain me where (which transaction)?
    If no, can you explain me an alternative to do so?
    Thanks a lot in advance for your help...
    Regards,
    Rudy

    You can do this by configuring material type.
    Follow the path
    IMG->Logistic general->material master->Basic Settings>Material types-->Define attributes of the material type
    Select the material type and click detail button
    In the External/Internal Purchase order Subscreen---Set the following details
    Ext. Putchase Order should be 2 (external purchase order allowed)
    Int. Purchase Order should be 0 (No internal purchase order allowed)
    If u save the setting
    then when u create material master, Procure type would be F in MRP 2 screen and you cant change this value becuase the field is greyed out it will be only displayed

  • SUB TRANSACTION TYPE FOR J1IH

    Hi,
    I have creating manual JV for subsequent credit for that i have created GL accounts under transaction type MRDY. But already they were some GL accounts for PLA and Excise Duty paid so that i have created one sub transaction type and try to post the Jv in J1IH under other adjustment.At the time system generating an error (Licence   is not included for the material
    Message no. 8I993).Please resolve it.
    Regards
    R.Manigandan

    hi mahesh,
    pl check this  :
    Specify Excise Accounts per Excise Transaction - In this IMG activity, you specify which excise accounts (for excise
    duty and CENVAT) are to be posted to for the various transaction types. Enter all the accounts that are affected by each transaction type. If you use sub transaction types, enter the accounts for each sub transaction type as well.
    Transaction type UTLZ is used for determining accounts only while posting excise JVs and also if the payment of excise duty has to be done fortnightly. The fortnightly CENVAT payment utility picks up the credit side accounts from the transaction types of GRPO, EWPO, and TR6C for determining the CENVAT and PLA accounts. There is no separate transaction type for fortnightly payment.
    Example:
    - Excise TT DC ind Account name
    - GRPO CR CENVAT clearing account
    - GRPO CR RG 23 BED account
    - GRPO DR CENVAT on hld account
    Specify G/L Accounts per Excise Transaction - In this IMG activity, you assign the excise and CENVAT accounts to G/L
    accounts. When you come to execute the various transactions, the system determines which G/L accounts to post to by looking at the:
    - Excise group
    - Company code
    - Chart of accounts
    Furthermore, if you want separate account determination settings within an excise group, you can also use sub transaction types.
    Requirements
    You have already:
    - Defined the G/L accounts
    - Defined the excise groups
    - Maintained the transaction accounts
    regards
    sadhu kishore

  • Define Transaction Types for ASSET Acquisitions

    Hi friends,
    I have below requirement and need help on the same.
         I need transaction types (or another solution) that post ASSET Acquisitions only to certain depreciation areas in chart of depreciation (not in 01).
    Kindly suggest on this.
    Thanks in advance.
    Regards,
    Dragoslav

    Hi,
       You have to create new ones.
       In SPRO  .....  AA >Transactions > Acquisitions >  Define Transaction types for acquisitions.  
                 Copy an existing type that covers the type of movement to Zxx
                 Then use Limit Transaction Types to restrict the Zxx to only post in thoose areas that you wish to be posted.
    Kind regards

  • Want Transaction History for Particular Transaction for Particular User. .

    Hello Friends,
    I have one query.
    I want to get detailed Transaction History for Particular Transaction for Particular User_Id for particular Time/Date period, with his/her Terminal ID info ,also.
    One USER_ID in SAP Server is shared among 6-7 people to do their work.
    So, I want to know that from which terminal that user has run that transaction to do its work on particular Date/time.
    I tried STAT, STAD, ST03N,  but did not help me very much to get deep level information.
    May be, i am missing something to get the solution for this kind of situation.
    Any Solution for this kind of Situation ?
    I am waiting for your valuable Response.
    Regards,
    Bhavik Shroff

    I want to get detailed Transaction History for Particular Transaction for Particular User_Id for particular Time/Date period, with his/her Terminal ID info ,also.
    ST01 will give you the Result after switching on the TRACE. I want to get Transaction History for a particular DAY/Weeks/Month .
    e.g.
    One User Id is shared among 6-7 people. One of the person did something using FB08 transaction on last 08/07/2008. But, as the User ID is shared among several User, How can i know the person who did that change and from which place/Terminal.
    See,
    I have the following information to fire the search.
    -> User Id information
    -> which transaction he/she used to do that work
    -> When he did the change for something (means i know the exact date)
    But , I want to know ,from which Terminal he/she executed that transaction, as the User ID is shared among several people.
    You tell me the way ,so that i can have total required information for this kind of situation.
    If  i am wrong at any step , then let me know.
    Regards,
    Bhavik Shroff.

  • Default  Doc Type for PO

    Hi Friends..
    I need your help in solving a Puzzle in SAP.
    I want to use ME59N automatic po conversion option for creation of PO from PR.Here PR doc type is NB-Standard, I want PO doc type to be my own doc type " CT3 " doc type. I have made below settings,
    a.Activated Auto PO in VMR.
    b.Activated Auto PO in MMR
    c.Linked my CT3 doc type in SPRO.
    But, when I tried to do default doc type settings in SPRO, SAP didn't
    accept this Tcode (ME59N) & hence not successfull.
    SAP is taking default doc type as NB & not tailor made "CT3" doc type.
    Pl respond.
    Thanks,  VK.

    Hi,
    You hve done settings for Automatic PO, I think those setting are not required for you. Because your scenario is not Automatic PO.
    In ME21N transaction you can do personnel settings with this whenever you run the ME21N tcode by default system will pick tht doc type as default doc type. This can be user based setting.
    Hve you maintained the combination of PO document type and PR docuement type ? If you are using onli CT3 PO document type, assign this PO document type only.
    In SPRO - MM - Purchasing - Define default Doc types maintain the defulat doc type for ME21N transaction.
    Hope its clear, still if u hve questions let me know.
    reg
    Durga
    *Assign points if the info is useful

Maybe you are looking for

  • Clearing Values in Sctript

    i am issuing the output from VF31. there are some values(serial numbers) are there to display in the script .if first document have the five values and second have only one even it is dipslyin five.previous values are not clearing. even i am not call

  • Sending info. from SAP R/3 HR  to SAP CRM

    Hi everyone , I`m trying to send information from my R / 3 system  to CRM`s bp using <i>PFAL</i> transaction . But when I entered the information requiered for this  I got the error "No data found for search conditions" I`m pretty sure I should get i

  • Video Streaming from PC to Mobile phone

    Hello guys, Here is the problem before me : If a web cam is attached to a computer and i want to stream the video to a Java enabled cell phone. What algorithm should i be using? No Ports are allowed on the network :( so i have to go through HTTP prot

  • General Ledger Budget Extractor

    Hi, Is there a BC extractor for extracting General Ledger budget data? I looked at help.sap.com and I couldnt find any thing. Thanks, Ravi.

  • Extension Manager Goes on Strike

    Hi folks, For some reason, the Extension Manager running with DW 8.02 is choking on any attempt to install a new extension. I'm getting a message that "The extension package is invalid. The extension will not be installed". I have deleted the EM and