SBO_SP_TransactionNotification, check status of open items with other sales

Good morning,
need help with a SQL to SBO_Transaction.
I need to check the database (Table ORDR and RDR1) if there are items on other sales documents with the open status and must be for the same business partner of the document being entered.
The scenario is, if a seller trying to include a sales document for a business partner of the same item that is already in another document of sale and that has not been met, the SAP can not allow.
Includes the following SQL procedure SBO_TransactionNotification, but could not run at all.
Does anyone know how to help me with this SQL?
IF @object_type = '17' AND @transaction_type in ('A', 'U')
BEGIN
IF (SELECT COUNT (T0.DocEntry)
     FROM [dbo].[ORDR] T0 INNER JOIN [dbo].[RDR1] T1 On T0.DocEntry = T1.DocEntry
     where (T0.CardCode = @list_of_cols_val_tab_del AND
                 T1.ItemCode = @list_of_cols_val_tab_del AND
                 T1.LineStatus <> 'C') AND T0.DocEntry = @list_of_cols_val_tab_del) > 0
BEGIN
     SET @error = 1
     SET @error_message = 'There items with open status in other documents of sale! Check!'
END
END
When I change the values ​​with the code "@list_of_cols_val_tab_del" by inserting the values ​​of CardCode and ItemCode, can cause the SQL Server returns the correct value it should return in SBO_Transaction, the counter works, if there are open items for the same business partner , returns the counter value greater than zero of should give the message stopping the process, but within the SBO_Transaction SQL does not work.
Thanks everyone!

Hi,
You may try:
IF @object_type = '17' AND @transaction_type in ('A', 'U')
BEGIN
IF EXISTS (SELECT T0.DocEntry
     FROM dbo.ORDR T0 INNER JOIN dbo.RDR1 T1 On T0.DocEntry = T1.DocEntry
     where (T0.DocEntry = @list_of_cols_val_tab_del AND
                 T1.ItemCode IN (SELECT T2.ItemCode FROM RDR1 T2 INNER JOIN ORDR T3 ON T3.DocEntry = T2.DocEntry
          WHERE  T3.CardCode=T0.CardCode AND
                 T2.LineStatus = 'O' AND T0.DocEntry != @list_of_cols_val_tab_del))
BEGIN
     SET @error = 17
     SET @error_message = 'There items with open status in other sale order! Check!'
END
END
Thanks,
Gordon

Similar Messages

  • FPBW: Extract Open Items with a posting date in the future

    Dear all,
    I'm are currently searching for possibilities to extract Open Items with a posting date in the future from SAP IS-U 4.72 into SAP BW 3.5.
    Currently I'm using the Business Content extractor 0FC_OP_01 together with the mass transaction FPBW in IS-U.
    The problem I'm facing is within the mass transaction FPBW. I've have set the key date at 01.11.2007, but this job already runs for 52.000 seconds on the same database select-statement.
    Does anybody know a possible solution to improve the performance of the statement below? (I pasted it from the process overview)
    ================================
    SELECT
    /*+
      INDEX("DFKKOP" "DFKKOP~1" "DFKKOP^1" "DFKKOP____1" "DFKKOP____1__X" "DFKKOP_1")
      "BETRH" , "BETRW" , "BUDAT" , "BUKRS" , "FAEDN" , "GPART" , "GSBER" , "INKPS" , "SPART" , "VKONT" ,
      "WAERS" , "MAHNV" , "ABWBL" , "APPLK" , "AUGBD" , "AUGBL" , "AUGBT" , "AUGDT" , "AUGRD" , "AUGST" ,
      "AUGWA" , "BLART" , "BLDAT" , "EMGPA" , "GRKEY" , "HVORG" , "MANSP" , "MWSKZ" , "OPBEL" , "OPSTA" ,
      "OPUPK" , "PERSL" , "PYMET" , "QSSHB" , "SBETW" , "SPZAH" , "STUDT" , "TVORG" , "VTREF" , "XBLNR" ,
      "XMANL" , "HKONT" , "OPUPZ" , "OPUPW" , "STAKZ" , "WHGRP" , "AUGBS" , "XANZA" , "XRAGL" , "ABWTP" ,
      "ASTKZ"
    FROM
      "DFKKOP"
    WHERE
      "MANDT" = :A0 AND "AUGST" = :A1 AND "GPART" BETWEEN :A2 AND :A3 AND ( "AUGDT" = :A4 OR "AUGDT" > :A5
      AND ( "BUDAT" <= :A6 OR "AUGBD" <= :A7 ) OR "WHGRP" <> :A8 AND "OPUPW" = :A9 )
    ORDER BY
      "AUGST" , "GPART"#
    =================================
    I have already tried to create an index on the following fields (in the same order):
    - MANDT           Client
    - AUGST           Clearing status
    - GPART           Business Partner Number
    - AUGDT           Clearing date
    - BUDAT           Posting Date in the Document
    Any help would be appreciated!
    Thanks in advance,
    Steven Groot

    Hi Marcos,
    When you have created the Restricted keyfigures for Open Items, You have to add the date characteristic on which you are looking open item and add the variable there.Here you have to use a variable of type Interval and select the operator "<" the date of the Variable.If you go through, there are standard variable for keydate, which you can use directly.
    Hope you got the idea
    Regards
    Happy Tony

  • OVA8 credit check against overdue open item

    Hi,
    In OVA8, there is a check on open items.
    May I know what is max open item % and NoDays OpenI?
    Let say i maintain max open item % = 10 and NoDays OpenI = 40, can advise how system work with these with example?
    As each open item has its own due date. so I just wonder what does this 40 for. I read F1 but not quite understand.
    Thanks

    Hi,
    Check the Below links
    [Maximum open item % and no of days open item in credit management|Maximum open item % and no of days open item in credit management;
    [Re: Open items check in OVA8 |Open items check in OVA8;
    I hope you understand
    Regards,
    Prasanna

  • How to make a single payment for different open  items with same due date

    Hi,
    I have created a payment method  and selected "Payment per due day " option in payment method company code settings.
    Even I have selected that option, Payment will not happen grouping for the items with same due date
    for ex : I have two open items with one due date and another open item with another due date so when I am trying performing F110 system should make a single payment for the item with same due date and seperate payment for another item.
    But system making single payment for all items
    Could you please suggest anything how to make a seperate payment with due date.
    Regards
    VK GUPTA

    Hi,
    Please check Vendor Master data: FK02 ->company code data -> Payment transaction accounting: unflag 'individual payment'.
    Make a test and let me know if it's okay.
    regards

  • Post to clear open item and other G/L account in FPCJ

    Dear all,
    Would you please suggest how can we post incoming payment transaction via FPCJ as below
    Dr. Cash 110.00
    Cr. Customer 107.00-   => this item choose from open item
    Cr. Other revenue 3.00- => this item input in tab G/L acct posting
    when i try to post this transaction, i got error message Message no. FICA_CD057
    "Posting already assigned to contract account"
    Thanks,
    Kaew.

    Hi Kaew,
    Do not think this is possible with Cash desk or any other Payment lot as normally the  entry would be:
    DR: Bank Clearing /Cash Account
    CR: Customer /Clarfication Account
    If there is any Tax item in the Invoice, of course it woud be setoff with a separate Config.
    Hope this helps
    Rgds
    Rajendra

  • S_ALR_87010007 (open items with foriegn customers)

    While executing S_ALR_87010007 (open items with foriegn customers) i get the following error:
    Call contained error(s): ADS (2)
    This is happening after we have upgraded to ECC 6
    Can anyone tell me what is the reason for this error? How do we rectify this?
    Thanks and Regards,
    Satya

    Do we need to install ADS for this? We are able to execute this report in 4.7 version but not in ECC 6

  • Why open items with dunning level 0 sometimes appear?

    Hi All,
    when I run the dun transaction (F150) sometimes in table MHND and MHNK open items with dunning level 0 appear. These are open items overdue, but not enough to level 1. Note that this problem appear only sometimes.
    Do you know how to avoid this?
    Many thanks

    Check if deselcting the indicator for Always Dun? in dunning level configuration in FBMP ,solves your issue.
    Thanks and regards
    Kedar

  • Charge off difference whening clearing customer open item with bank receipt

    Hi,
    Our company users will use F-32 to clear customer open item with bank receipt, sometimes, our invoice is 100 RMB issue to customer, the customer finally pay 99.98, then in F-32, we use charge off difference to post 0.02 difference to a account.
    The user then want to control this, saying for example, if the customer pay only 90, whening using charge off differnce, the system will pop up a error message.
    Can this be done in SAP, or we need to use user exit, then which user exit?
    Thanks.

    Dear,
    This is done through customer tolerance group using transaction OBA3. Here enter the maximum amount in Loss under the Permitted Payment Differences. you are able to hold tolerance for customer clearing.
    Is this what you wanted?
    Regards,
    Chintan Joshi.

  • Clearing forex open item with INR receipt

    Hi,
    We have a scenario were original customer invoice is in foreign currency.  However, the money remitted by the customer is directly credited in the bank, not in the same foreign currency, but in Indian currency.  In this case, the system is able to clear if we manually enter the forex gain or loss.  But this gain or loss is calculated with reference to the current exchange rate and not with exchange rate as at the invoice posting.
    Any idea how this could be handled?
    Thanks
    Muru

    Lawrence,
    The issue came because the user was trying to clear a Forex open item with local currency.  In F-28, he was entering the local currency amount as receipt.  The rate at which the receipt is converted is different from the rate maintained for forex valuation (M rate).
    If the receipt is posted in the original document currency, the complication is avoided.  However, I would be interested to know if you are aware of some other way of handling this.
    Thanks
    Muru

  • How to change status of open item management check box??

    Dear Members,
    There is a GL which was not defined as Open Item Management Previously.
    Now we Identified and we wanted to define it as Open Item Managed account.
    For ex take ..Payable Account
    say there is one line item with credit balance ..to make this accoount balance as 0 (ZERO)  ..we reversed the original entry ..we tried to select open item check box..
    but system is not allowing us to change ..instead its giving msg"Account balance is zero but stil open items exists"
    i dont understan this ..
    now how to solve this problem
    thanks & regards.

    Hi suja csc,
    Thanks for the points : )
    OK it's very easy to transfer the balance. Either u have already customised program to upload data or if the data is "little" u can just manual posting using FB01. just zerorise all balances in the old account.
    Eg. old journal:
    01  MAN        NIAGA SDN.              1,975.00 
    50  80070010   Rental-Car Park              1,975.00-
    To transfer:
    17  MAN        NIAGA SDN.              1,975.00-
    40  80070010   Rental-Car Park              1,975.00
    Means, the account will be zero.
    Hope this will help you.
    TQ
    Regards,
    Nazrul

  • How to display Open Items (with current status as Cleared) for prior date?

    Hi all,
    We have an existing Customer Balances report wherein we are able to veiw the Debit/Credit amount Of all the open items based on the input date given by the user but unable to view the items which have been cleared later for the items opened on the mentioned date.
    However, in case of ECC, if the user enter a specific key date, he is able to view the Open & Cleared items for the mentioned date.
    The user is expecting the same logic for the BW report.
    E.g: If i run the report for date 30th Oct, 2010 and for Comp Code X; then the output should show all the Open items as of date 30th Oct, 2010 irrespective of the case that some of the items have been cleared later than the mentioned date.
    PLEASE HELP!!!!!!!!!!!!!!!

    Hi Sneha,
    I think you are talking about the open item means opening balance as on date along with the sales or collections or adjustments and the Closing balance as on date right?
    for this we had designed in modeling. our requirement is also similar one which shows the opening bal,, sales ,coll ,adjustments and closing balance. for a particular customer and company code entered in selection screen.
    For this in order to get the open items
    we had create a new cumulative key figure in which i had taken
    inflow : debit amount
    outflow: credit amount
    you will get the closing balance.
    For getting the opening bal we had a formula like
    opening bal+sale-Adj-coll = closing bal
    now in order to cal opening bal=closing bal-salesadjcoll
    in this way we acieved the requirement.
    if you can give more details can help u on this.
    i think you are using 0FI_AR_4 data source for your requirement right?
    Regards
    KP

  • Clearing: how to get open items with net amount?

    Hi
    I need to obtain the open items for clearing <b>with the net amount</b> as it shows up in the transaction FB05 after considering any discounts that may apply. The BAPI BAPI_AR_ACC_GETOPENITEMS does not calculate the net amount.
    I see that the data is calculated in SAPMF05B and saved in the internal table POSTAB which has the structure RFOPS. Basically i need to obtain the data of this internal table.
    I was thinking of exporting the table in some user exit, but didn't find any suitable exit yet.
    Any ideas anyone...?
    Thanks for any hint.
    Andreas

    Hi All,
    Thanks for the reply..
    ==============================================================
    Basically create one ckf and two rkfs for each aging bucket
    ie ckf 0-30 days = rkf 0-30 days open + rkf 0-30 days subsequently cleared
    Because you need to restate the AP report to a key date - some items have changed their status since that key date but were open at the key date (ie we call those subsequently cleared)
    so rkf 0-30 days open is
    posting date <= key date
    item status = O
    net due date between variable date (cmod which reads key date) offset 0 and variable date (cmod which reads key date) offset -30
    rkf 0-30 days subsequently cleared is
    posting date <= key date
    cleared date > variable date (which reads cmod of key date)
    net due date between variable date (cmod which reads key date) offset 0 and variable date (cmod which reads key date) offset -30
    ========================================================================
    In the above two cases, while creating restricted key figures how to design this;
    net due date between variable date (cmod which reads key date) offset 0 and variable date (cmod which reads key date) offset -30
    And also after creation of two rkfs i created a ckf i.e ckf = rkf1+rkf2.
    Now i dragged this ckf into columns and when i checked the query it is giving error that key date variable is used more than once. ( Bcz we have used key date variable both in rkf1 and rkf2 for getting posting date <= to key date )
    What is the solution for this ?
    Regards,
    Rao.

  • Change the Status to Open Items

    Hi
    How can we change the Status of GL Master to Open Item. We have balances in the GL Account
    Satish

    Hello,
    You can put tick box for the GL Account "Open item" tick box though it has some posting.
    You have forgotten to tick the "open item" check box and number of posting are being happened, the question now you want to make it as open item. You have the solution here.
    1. Block the GL account in question in FS00 for any postings
    2. Take ABAPer help to copy the program RFSEPA01 to ZRFSEPA01 and initialization check needs to be commented in the program
    3. Run the program ZRFSEPA01 (Give relevant company code and GL account in question)
    4.Remove the block that has been put on GL account in point 1.
    Now, if you see you will have a check box ticked for GL Account with open item.
    Hope this solves your issue.
    Regards,
    Ravi

  • Credit check for oldest open item

    Hello friends
    While checking oldest open item for credit management, open line items with credit nature should not be considered. Only debit entry should be considered and based on date given for blocking the oldest due item should be followed.
    Please help me doing this.
    Urgent

    Hi Inder,
    U wish to have the invoiced items, which has to be payable by the customer,ok?
    If this is the case it is existing already in the credit management settings. No need to configure any thig specially to capture this.
    Regards,
    Ravi Duggirala

  • F110- Check number and open item

    Good Morning SAP Guru's,
    A new one for me here that I need some help with-
    I executed F110 on our payment method 9 and I got a debit entry to offset the item and it moved them to cleared however I still have the item in open items as a credit.  Is this because I didn't print the check yet?  The debit entry has nothing in the reference field which would/should be the check number if printed. 
    What am I doing wrong?
    POINTS PROMISED

    hi,
    After running the Payment Run you have to do 1 more step
    Fo to Tcode Se38 and enter the RFFOUS_C and execute it.
    It will ask u abt the Program Run date and Identification Feature, pls fill all the required information and execute it.
    Pls note u must creat the Check lot number in Tcode FCHI.
    Assing points if this solution is works out......
    Ranjit

Maybe you are looking for

  • Mid 2010 MacBook Pro 15" Blacks Out Without Warning

    Quick Summary of Problem: My MacBook Pro is currently shutting down without warning. It would be more accurate to say that the screen goes blank but the machine remains on as can be heard by the fan. Nothing resolves it without powering down and rest

  • Numbers: Save file as xls using AppleScript

    Hi all, I need to remove all the external links from an Excel file. Tried to do this first using Automator and the Excel actions, but every time Excel opens one of the files it displays an error message that it's missing the external files and the Au

  • A HEART FELT THANK YOU TO EVERYONE!

    A HUGE THANK YOU!!  to one and all here on this forum for all the help you have been and I am certain will continue to be to and for me.  You honestly have no idea how grateful I am for your kindness, patience with me. You made my giant leap of faith

  • Deploy an Oracle Application

    Hi. Somebody knows how can i deploy an ADF application of ORACLE in the sun one application server 7.0?? Thanks

  • El Expression Not Evaluated

    can someone please tell me why the following EL expression does not get evaluated: $ { person.name } Person is a Java bean class. And here is the header of my web.xml file: <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE web-app PUBLIC "-//Sun