Row level calculation

hi SAP kings
I created one udf in row level.its contain the different data in each row.i create the another one filed in title part the title part have a value of division of row level value.how can i write the query for this ticket

Hello Lakshmi Narayanan,
When you are on the module, the row level values of one row cannot be accessed in another.
Example: If you want row 1 UDF value divided by row 2 UDF value, it will not be possible.
I also believe you want to copy the result to the header level UDF and again from within the module this would not be possible.
There is the option of using the SBO_SP_TransactionNotification stored procedure to make the calculation and update UDF's.
Let me know
Suda

Similar Messages

  • Query regarding row level calculations in Bex

    I have a scenario where I am creating a report on a multiprovider. This multiprovider is based on General Ledger and Profit Center Accounting cube. The PCA cube has accumulated balances at G/L account and profit center level, and GL cube has balances only at General Ledger account level.So when a report is created on this the data displayed looks like:
    Account Profit Center Balance
    1000             1234            100000  - From PCA cube
    1000              2345            200000  - From PCA cube
    1000              Not assigned 400000 - From GL cube
    There are some cases where the total balance at G/L account level does not match both the cubes ( as in the above example, as per PCA, balance for G/L account 1000 is 300000 whereas as per GL cube, balance at G/L account 1000 level is 400000.)
    Hence we require a separate row showing this difference ( not column)
    Therefore actual output required for the above scenario is:
    Account Profit Center Balance
    1000             1234            100000 
    1000              2345            200000 
    1000              DIFFERENCE           100000 - (400000 - sum of above 2 balances)
    Total                                 400000
    It would be very helpful if anyone can give inputs on how this can be achieved.

    Have you considered Virtual Key figure. This will allow you to do such complex calculations.
    Thanks
    Sharan

  • Calculating total discount at the row level

    Hi,
    I want to determine the total discount amount for all of the invoice row levels by summing the row totals that have the same discount % and then multiplying that total by the row discount percent.
    Example:
    Lets say there is an invoice with 3 line items
    Qty     ItemCode     Price    Discount%
    2         A                $30            10
    2         B                $20            10
    2         C                $15             5
    I want to figure the total for the first 2 lines (because they have the same discount amount) by multiplying the quantity (230)+(220)=100 and then calculating the discount from this total. (100) * (.10) = $10 and then calculating the discount for the third line item ((215).05)=1.5. This brings the total discount amount to $11.50.
    Below is what I have drafted for a query so far.
    Select
    //For each grouping of items with the same discount %
    (SUM ((T0.Quantity * T0.PriceBefDi)) * DiscPrcnt)
    FROM INV1 T0 WHERE T0.DocEntry=$[OINV.DocEntry]
    Any ideas?
    Thanks,
    Luke

    Gordon,
    I was thinking that I would have to use a group by (grouping on the discount %) statement or possible a sub-query to accomplish this. The group by statement would replace the commented section. "//For each grouping of items with the same discount %"
    I will work on this query some more and post my results if I figure out a way to accomplish this.
    Thanks,
    Luke

  • Row level Tax Calculation

    Hi,
    I have to calculate the row level tax in following query.
    SELECT T0.[DocEntry], T0.[DocNum], T0.[DocDate], T0.[CardCode], T0.[CardName], T0.[NumAtCard], T1.[LineNum], T1.[ItemCode], T1.[Dscription], T1.[Quantity], T1.[LineTotal], T1.[VatSum], T1.[GTotal], T1.[TaxCode],
    (SELECT Sum(TaxSum) FROM INV4 where statype=-90 and stacode='BED10' and DocEntry=T1.DocEntry) as ' ED 10% (Rs.) ',
    (SELECT Sum(TaxSum) FROM INV4 where statype=-60 and DocEntry=T1.DocEntry) as 'Cess 2% (Rs.)',
    (SELECT Sum(TaxSum) FROM INV4 where statype=-55 and DocEntry=T1.DocEntry) as 'HSCess 1% (Rs.)',
    (SELECT Sum(TaxSum) FROM INV4 where statype=4 and stacode='CST2' and DocEntry=T1.DocEntry) as ' CST 2% (Rs.) '
    FROM OINV T0  LEFT JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry LEFT JOIN INV4 T2 ON T0.DocEntry = T2.DocEntry AND T1.LineNum = T2.LineNum WHERE T0.[DocEntry] >=[%0] AND  T0.[DocEntry] <=[%1] AND T0.DocType='I'
    GROUP BY T0.[DocEntry], T0.[DocNum], T0.[DocDate], T0.[CardCode], T0.[CardName], T0.[NumAtCard], T1.[LineNum], T1.[ItemCode], T1.[Dscription], T1.[Quantity], T1.[LineTotal], T1.[VatSum], T1.[GTotal], T1.[TaxCode], T1.[DocEntry]
    ORDER BY T0.[DocEntry], T0.[DocNum], T0.[DocDate], T1.[LineNum]
    Regards,
    Datta Kharat

    Hi Datta........
    Try this......
    SELECT M.DocEntry, M.DocNum AS 'AR Inv. #', M.DocDate as 'Date', L.ItemCode, L.Dscription, L.Quantity, L.TaxCode, M.CardName as 'Customer Name',M.NumAtCard as 'PO No. & Dt.',
    L.LineTotal as 'Base Amt.(Rs.)',
    (SELECT Sum(TaxSum) FROM INV4 where statype=-90 and stacode='BED10' and DocEntry=M.DocEntry And LineNum=M.LineNum) as ' ED 10% (Rs.) ',
    (SELECT Sum(TaxSum) FROM INV4 where statype=-90 and stacode='BED4' and DocEntry=M.DocEntry And LineNum=M.LineNum) as ' ED 14% (Rs.) ',
    (SELECT Sum(TaxSum) FROM INV4 where statype=-60 and DocEntry=M.DocEntry And LineNum=M.LineNum) as 'Cess 2% (Rs.)',
    (SELECT Sum(TaxSum) FROM INV4 where statype=-55 and DocEntry=M.DocEntry And LineNum=M.LineNum) as 'HSCess 1% (Rs.)',
    (SELECT Sum(TaxSum) FROM INV4 where statype=1 and stacode='VAT4' and DocEntry=M.DocEntry And LineNum=M.LineNum) as ' VAT 4% (Rs.) ',
    (SELECT Sum(TaxSum) FROM INV4 where statype=1 and stacode='VAT5' and DocEntry=M.DocEntry And LineNum=M.LineNum) as ' VAT 5% (Rs.) ',
    (SELECT Sum(TaxSum) FROM INV4 where statype=1 and stacode='VAT12.5' and DocEntry=M.DocEntry And LineNum=M.LineNum) as ' VAT 12.5% (Rs.) ',
    (SELECT Sum(TaxSum) FROM INV4 where statype=4 and stacode='CST2' and DocEntry=M.DocEntry And LineNum=M.LineNum) as ' CST 2% (Rs.) ',
    (SELECT Sum(TaxSum) FROM INV4 where statype=4 and stacode='CST4' and DocEntry=M.DocEntry And LineNum=M.LineNum) as ' CST 4% (Rs.) ',
    (SELECT Sum(TaxSum) FROM INV4 where statype=4 and stacode='CST5' and DocEntry=M.DocEntry And LineNum=M.LineNum) as ' CST 5% (Rs.) ',
    (SELECT Sum(TaxSum) FROM INV4 where statype=4 and stacode='CST12.5' and DocEntry=M.DocEntry And LineNum=M.LineNum) as ' CST 12.5% (Rs.) ',
    (SELECT Sum(TaxSum) FROM INV4 where statype=5 and stacode='ST10' and DocEntry=M.DocEntry And LineNum=M.LineNum) as ' ST 10% (Rs.) ',
    (SELECT Sum(TaxSum) FROM INV4 where statype=6 and stacode='Cess_ST2' and DocEntry=M.DocEntry And LineNum=M.LineNum) as ' Cess_ST 12.5% (Rs.) ',
    (SELECT Sum(TaxSum) FROM INV4 where statype=-10 and stacode='HSC_ST1' and DocEntry=M.DocEntry And LineNum=M.LineNum) as ' HCS_ST 12.5% (Rs.) ',
    (Select Sum(LineTotal) From INV3 Q Where Q.DocEntry=M.DocEntry) AS 'Freight (Rs.)',
    M.DocTotal as 'Total (Rs.)',U.Dscription, U.ChapterID
    FROM OINV M LEFT OUTER JOIN INV1 L on L.DocEntry=M.DocEntry
    LEFT OUTER JOIN INV4 T on T.DocEntry=L.DocEntry and L.LineNum=T.LineNum
    LEFT OUTER JOIN INV5 J ON M.DocEntry = J.AbsEntry
    LEFT OUTER JOIN INV3 Q ON M.DocEntry = Q.DocEntry
    LEFT OUTER JOIN OITM S ON L.ItemCode = S.ItemCode
    LEFT OUTER JOIN OCHP U ON S.ChapterID = U.AbsEntry
    WHERE (M.DocDate >= '[%0]' AND M.DocDate <= '[%1]') AND M.DocType='I'
    GROUP BY
    M.DocNum,M.DocDate,L.ItemCode, L.Dscription, L.Quantity, L.TaxCode, M.CardName,M.NumAtCard,L.LineTotal,M.DocEntry,M.DiscSum,M.WTSum,M.DocTotal,U.Dscription, U.ChapterID
    ORDER BY
    M.DocNum,M.DocDate,L.ItemCode, L.Dscription, L.Quantity, L.TaxCode, M.CardName,M.NumAtCard,L.LineTotal,M.DocEntry,M.DiscSum,M.WTSum,M.DocTotal,U.Dscription, U.ChapterID
    Regards,
    Rahul

  • Setting row level field in table using jQuery

    Hi,
    I'm utilising the following to read and then set values in the same row within a report.
    Re: Referencing a row level field value in an Interactive Report using jquery
    Consider the following snippet
    // read information eg
    var row = $x_UpTill(this.triggeringElement, 'TR');
    var dateCompleted = $('input[name="f03"]', row)[0];
    console.log(dateCompleted.value);
    // write information eg
    var dateBooked = $('input[name="f02"]', row)[0];
    //dateBooked.value = 'xyz'; // sets to xyz, as expected
    dateBooked.value = return_date; // sets the actual code, not returning stringAll works as I'd expect except the last line. I have a js function returning a formatted string (Set Date With Javascript but in this case my field now contains the actual code definition, not the date string the function actually returns.
    I'm thinking I'm just misunderstanding a simple concept for JavaScript here?
    A simple workaround could be to create field P0_SYSDATE, calculated to TO_CHAR(SYSDATE,:F_DATE_FORMAT), then apply
    dateBooked.value = $v('P0_SYSDATE');but I'm trying to improve my understanding of javascript/jQuery...
    Cheers,
    Scott

    So are you saying that return_date is an actual javascript function that returns the formated string/date you want?
    If so, then I think you simply need parenthesis to run the function:
    dateBooked.value = return_date();Or... am I missing something here?
    Thanks
    -Jorge

  • Calculate profit at row level in Discoverer Plus

    HI,
    I need to calculate profit at row level in Discoverer Plus as follows.
    There are columns
    1)     Account Name- Contains Expense and revenue account names
    2)     Account type- Contains Identifier for account (E or R)
    3)     Amount --- Contains amount
    4)     Period     Name -- Contains Numeric Amount.
    Cross Tabular Report Look like as follows
    Period Name          Feb-2009     Mar-2009
    Account Name
    Total Revenue          100          90     
    Total Labor Cost          30          30     
    Total G&A Cost          20          50
    Profit               ???          ??     
    Need to show PROFIT =Total Revenue- (Total Labor Cost- Total G&A Cost)
    at bottom for each period.
    I am unable to use calculations because it appears column wise…
    Would you please suggest solution for this?
    Thanks,
    Mahesh.

    Hi
    Try dragging the data point headings off the top axis and place them to the right of the Account Name. They will all drag together so just moving one will move them all.
    If your profit is already calculated and is a data point as you have commented then it too will come over to the left. For displaying it under the other items, a really cool feature about having data points on the left is that you can drag their heading and place it anywhere you want. I will be including this trick in my free March ask Michael webinar. (By the way, if anyone reading this thread you can sign up for my free webinar by clicking here: http://ascbi.com/question.htm)
    You should now be able to display your calculated profit as a row underneath the other items. I tried this on my own system and it worked just fine.
    Best wishes
    Michael

  • Row Level Security not working for SAP R/3

    Hi Guys
    We have an environment where the details are as mentioned below:
    1. Crystal Reports are created using Open SQL driver to extract data from SAP R/3 using the SAP Integration Kit.
    2. The SAP roles are imported in Business Objects CMC.
    3. Crystal Reports are published on the Enterprise as well.
    3. Authorization objects are created in SAP R/3 and added as required for the row level security as mentioned in the SAP Installation guide as well. The aim is when the user logs into the Infoview and refreshes the report he should only see data that he is meant to so through the authorization objects.The data security works very much fine when the reports are designed directly on the table but when the reports are built on the Business View it doesnt work hence the user is able to see all data.
    Any help in this issue is greatly appreciated.
    Thanks and Regards
    Kamal

    Hi,
    In order for row level security to work for you using the OpenSql driver, you need to configure the Security Definition Editor on your SAP server.  This is a server side tool which the Integration solution for SAP offers as a transport.
    This tool defined which tables are to be restricted based on authorizations.
    However since you are seeing the issue on reports based on Business Views, you need to identify whether the Business View is configured in such a way where the user refreshing the report is based on the user logging into Infoview.  If the connection to your SAP server is always established with the same user when BV is used then you security definition is pointless.
    You can confirm this by tracing your SAP server to identify what user is being used to logon to SAP to refresh the reports.
    thanks
    Mike

  • Pl sql row level locking with wait ?

    Hi,
    I am using oracle 10g.
    I am new to Oracle locks. I have two tables Table1(id_no, employee, salary) and Table2(id_no, employee, salary).
    I need to pull any requested row from Table1 into Table2 only once on demand. I have a procedure to pull data and there could be more than one requests try to call same procedure to pull a row from Table1 into Table2 at any given time.
    I coded below to achieve row level lock. if one transaction gets row level lock on Table1 at 2, so other Transactions should wait till the lock is released at line 2 or 5 to avoid duplicates.
    But below code is not working, I am getting duplicates when I call this using two concurrent java threads.
    How do I control this concurrency issue so that I can avoid duplicate entries in Table2. Could any one please help?
    1.begin
    2.select 0 into emp_cnt
    3.from Table1 where id=id_no
    4.for update;
    5.update Table1 set employee='xyz'
    6.where id=id_no;
    7.select count(*) into table2_cnt from Table2 where id=id_no;
    8.if(table2_cnt =0) then
    9.code to insert above row from Table1 to Table2;
    10.end if;
    11.commit;
    12.End;
    Edited by: 980916 on Jan 9, 2013 5:48 PM

    Welcome to the forums and welcome to Oracle.
    Lets establish one thing right from the beginning ... the Oracle Database is not a Microsoft product.
    There is no general reason to use row level locks, you should not want to use row level locks, you don't need row level locks, and you will almost never have any valid reason to consider row level locks.
    That said there are two situations were it may be necessary to lock a row prior to an update or delete (possibly in a merge) and in those cases you want to use the built-in SELECT FOR UPDATE syntax. (Demo here: http://www.morganslibrary.org/reference/deadlocks.html#dlfu). But we should be clear here ... one rarely needs to use this locking mechanism as the chances of a collision in a well designed application are essentially zero.
    Also as you are new to Oracle please explore the dynamic performance view V$RESERVED_WORDS and do not name objects, columns, etc. with reserved word names not that there is an excuse in any product to name a column "ID." Something Joe Celko has railed about for decades and a tradition I think we should all follow.
    In the case of your posted code example (btw please read the FAQ and learn how to use tags) the solution is SELECT FOR UPDATE if locking can be justified which is unlikely.
    Edited by: damorgan on Jan 9, 2013 6:11 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How to get a row level share lock

    Is it possible to acquire a row-level share lock, which would do all of the following?
    1. Prevent others from updating that row.
    2. Allow others to read that row.
    3. Allow others to update other rows in the same table.
    I have the following scenario where two transactions need to lock eachother out:
    Set-up:
    Insert into TABLE_A(value_a) values ('ok');
    Insert into TABLE_B(value_b) values ('ok');
    Transaction A:
    Select value_b from TABLE_B
    If value_b = 'ok', update TABLE_A set value_a = 'not ok'
    Transaction B:
    Select value_a from TABLE_A
    If value_a = 'ok', update TABLE_B set value_b = 'not ok'
    If transaction A runs first then the end result is "not ok" only in TABLE_A.
    If transaction B runs first then the end result is "not ok" only in TABLE_B.
    If the two transactions run concurrently, it is possible to get "not ok" in both tables. This is what I would like to prevent.
    One way to get what I want is to use "select for update":
    Transaction A:
    Select value_a from TABLE_A for update
    Select value_b from TABLE_B for update
    If value_b = 'ok', update TABLE_A set value_a = 'not ok'
    Transaction B:
    Select value_a from TABLE_A for update
    Select value_b from TABLE_B for update
    If value_b = 'ok', update TABLE_B set value_a = 'not ok'
    This way both transactions won't perform their update unless they know that the result if their select will still be the same after they commit. However, by using "select for update" Transaction A has gained an exclusive lock on the TABLE_B row. If a Transaction C with the same contents as Transaction A happens concurrently, then the two will block eachother even though all they both want is to read data from the same table.
    Another way is to use "lock table", however using that would block out not only writes to a specific row, but writes to all rows in the table. (In my example there is only one row, but obviously that's just a simplified example.)
    I have looked at the "serializable" isolation level, but that doesn't seem to help because the queries and updates involve more than one table.
    I know that "reads don't block writes" is a fundamental part of the Oracle design that makes Oracle what it is, but is there any way I can explicitly make it happen anyway? Or can anyone see some other solution to what I'm trying to achieve?

    Let me give a more real-world example to show what I'm talking about.
    Imagine a simple bug-reporting OLTP application. Each bug has 3 fields:
    1. Description
    2. Resolution
    3. Status (open/closed)
    The application also has some rules:
    A. If the Status is "closed", Description and Resolution cannot be changed.
    B. In order to change the Status to "closed", both a Description and Resolution must be specified.
    Now as long as only one person at a time updates a bug, everything is fine. However, if one person switches the Status to "closed" while another concurrently blanks out the Resolution you end up with a closed bug that has no Resolution. This is why some locking is necessary.
    If Description, Resolution, and Status are all stored in the same table row, then it makes sense for each transaction to simply select the whole row FOR UPDATE, and then UPDATE it after it ensures all the rules are passed. However, in my fictional bug-reporting application they are all stored in separate tables. Now, the transaction that is making the change to Resolution could lock the row in the Status table FOR UPDATE (as everyone so far has suggested). Transactions making a similar change to the Description should then also lock the row in the Status table FOR UPDATE for the same reason. The end result of this is that Description changes and Resolution changes lock eachother out (can't happen concurrently, are serialized) when they don't need to be. Description changes and Resolution changes don't affect eachother, but because they both need to (exclusively) lock the same row, they are serialized.
    If there was a way to acquire a share lock on the row in the Status table, then Description and Resolution changes would use that and not affect eachother. Status changes would still acquire an exclusive lock on the row, and would be blocked by (and block any further) concurrent Description and Resolution changes. This would be ideal.

  • Row level locks

    Hi All,
    Version - Oracle Database 10g Enterprise Edition Release 10.2.0.2.0
    I have a card's data in a table. Whenver a two different sessions/threads selects the data sometimes they get the same card.
    Now I need to lock the record. If Thred-1 selects then it will lock the first records and thread-2 must select the second record as the first record is locked by thread-1.
    I have written a piece of code , at first session it locks one record and when second session select it selects no records.
    I have takem MIN group function because I want the cards to be selected in order.
    Can you please tell where is my code went wrong or need some changes. Data and code is given below.
    SQL> SELECT * FROM crm_pps_cards_sz ORDER BY 1;
    CARD_NO          PIN  SERIAL_NUMBER DATE_CREATED DATE_MERGED DATE_ALLOCATED DATE_REGISTERED
    6338079966430591 9985 9950013661    12/06/2011                             
    6338079973369543 6858 9950013660    12/06/2011                             
    6338079978994154 7144 9950013655    12/06/2011                             
    6338079981471778 7631 9950013654    12/06/2011                             
    6338079986365041 7849 9950013657    12/06/2011                             
    SQL>
    Thread - 1
    Connected to Oracle Database 10g Enterprise Edition Release 10.2.0.2.0
    Connected as crm
    SQL> set serveroutput on
    SQL>
    SQL> DECLARE
      2    l_rec crm_pps_cards_sz%ROWTYPE;
      3    CURSOR c IS
      4      SELECT * FROM crm_pps_cards_sz t WHERE t.card_no =
      5      (SELECT MIN(card_no) card FROM crm_pps_cards_sz)
      6      FOR UPDATE NOWAIT SKIP LOCKED;
      7 
      8  BEGIN
      9    OPEN c;
    10    FETCH c
    11      INTO l_rec;
    12    CLOSE c;
    13    dbms_output.put_line('Card Allocated ' || l_rec.card_no);
    14 
    15  END;
    16  /
    Card Allocated 6338079966430591
    PL/SQL procedure successfully completed
    SQL>
    Thread - 2
    Connected to Oracle Database 10g Enterprise Edition Release 10.2.0.2.0
    Connected as crm
    SQL> set serveroutput on
    SQL>
    SQL> DECLARE
      2    l_rec crm_pps_cards_sz%ROWTYPE;
      3    CURSOR c IS
      4      SELECT * FROM crm_pps_cards_sz t WHERE t.card_no =
      5      (SELECT MIN(card_no) card FROM crm_pps_cards_sz)
      6      FOR UPDATE NOWAIT SKIP LOCKED;
      7 
      8  BEGIN
      9    OPEN c;
    10    FETCH c
    11      INTO l_rec;
    12    CLOSE c;
    13    dbms_output.put_line('Card Allocated ' || l_rec.card_no);
    14 
    15  END;
    16  /
    Card Allocated
    PL/SQL procedure successfully completed
    SQL> My concern is that it must allocate in the order
    6338079966430591
    6338079973369543
    ....

    It is because MIN(ard_no) is able to find value from table which is locked by you thread 1 and thread 1 mentioned NOWAIT thus it thread 2 went out without getting anything.
    Please check my reply to your duplicate thread "row level locking" .

  • Row Level Restrictions on DeskI Report not working under InfoView

    When running/refreshing DesktopIntelligence XI r3 (Full Client) reports under InfoView, the row-level restrictions applied in the universe are not being included in the SQL (additional filtering is NOT happening). However, if a user creates a report using the same universe in WebIntelligence or if the user runs the same report in DesktopIntelligence, the row-level restrictions are working.
    It strikes me that the problem has to do with security rights granted (or not granted), but I can't figure out which settings would allow the proper running of a DeskI report under InfoView.
    Thanks for any assistance rendered!

    Mike,
    Do people connect to Infoview and Deski using the same authentication method and the same username?
    How does this compare to how your data restrictions are configured?
    Are you using @Variable('BOUSER') restrictions? Have you taken domain into account e.g. "Domain\UserName" vs "UserName"?

  • Relationship between header and row level data.

    Hi all
    I need to know how to relate a field in the header level and the row level...
    On my row level i want the route id to be related to the route name field at the header level...instead of showing this route id  it must show only the header so...based on the row level data the header must change...
    I tried insertin the field but when i do a relate to on either fields its showing me only fields on that catagory ( Header only or Row Level only)
    Thanks

    The Header is evaluated and printed first and then only Repetitive area is computed and printed. You cannot try to arrive header based on the Repetitive area.
    Please explain in detail which screen etc.. so that we can suggest some work arounds

  • SBO - Approval Procedures at row level

    Does anyone know how to create an approval procedure that is triggered by a row field. For example if I want an approval procedure that verifies discount percentage in row level.
    There must be a workaround, cause I know this is not a functionality in SBO.
    Thanks,
    Hernán Baudrit

    The way you could solve this is to create a UDF at Header level and link a formatted search which loops through the number of rows in the transaction and returns TRUE if for example the Discount % is greater than allowed.
    The coding should be something as follows:
    Declare @Counter as integer
    Set @Couter = 0
    Declare @TempTable TABLE (STAT varchar(50)) -- Temporary table holding results of loop
    Declare @LoopFor as integer
    Set @LoopFor = (select (*) from (select T1.DocEntry
                                                              from INV1 T0 join OINV T1 on T0.DocEntry = T1.DocEntry
                                                                      where T0.DocNum = $[OINV.DocNum])
    While @Counter < @LoopFor
    BEGIN
          Declare @Disc as integer
           Set @Disc = ( select T1.DiscPrcnt
                                            from INV1 T0 join OINV T1 on T0.DocEntry = T1.DocEntry
                                                       where T0.DocNum = $[OINV.DocNum]) and T1.LineNum = @Counter
         IF @Disc > 20
         BEGIN
                  INSERT @TempTable VALUES ('TRUE')
         END ELSE INSERT @TempTable VALUES ('FALSE')
    @Counter = @Counter + 1
    END
    SELECT Distinct 'TRUE' from @TempTable where STAT = 'TRUE'
    Please note that the coding is not 100% accurate but should give you an idea of how to work around the problem.
    Next you should write a simple validation query on the value of the UDF to check whether it is set to 'True'.
    I hope this helps.

  • How to restrict table data at a row level?

    Hi everybody,
    I need create a database user and restrict his data access to certain tables.
    What is the best way to do this?
    Eg Table Emp has two columns, sal and dept. Sal has three distinct values: 500, 1000, 1500.
    I need to make it so that new_user can only see the data in table emp where the sal value = 500.
    Many thanks
    Rup

    You can use row-level security (VPD) for this sort of thing, so you assign a policy to the table that restricts which rows a particular user can see.
    You can also roll your own solution by creating a view on the table and granting the user access to that view rather than direct access to the table.
    Justin

  • Flex updates at a row level in a grid

    I needs to updates row level in a grid for frequent basis, Also i don't want to Refresh the Grid.
    Is there any method i can use ?
    Using flex Grid -> updates at a row level in a grid

    I mean DataGrid. I am trying to change the data rows based on realtime data feed.
    First time i'll add all the Employees in the Grid. Later i'll get indivual request will change only Status column.
    Is there is any other way i can update with out refresh in datagrid.
    <mx:DataGrid 
    id="dg" height="260" width="900" x="0" y="20">
    <mx:columns>
    <mx:DataGridColumn headerText="EmpID" dataField="EmpID" width="10" visible="false"/>
    <mx:DataGridColumn headerText="Emp Name" dataField="Emp Name" width="110"/>
    <mx:DataGridColumn headerText="Status" dataField="Status" width="80"/>
    </mx:columns>   
    </mx:DataGrid>

Maybe you are looking for

  • Can two different people who have Dreamweaver CS6 installed edit the same website?

    AS the title suggests, I'm trying to figure out if it is possible for two different people to make edits to the same website if CS6 is installed on BOTH computers.

  • Resend XI Message RWD Status as System Error

    Hi All, The Message failed is due to FTP connection,  In SXMB_Moni the status of the message was succesfully processed. Where as when i check in Runtime Workbench, the status shows as "System Error" and Adapter Engine Status says the same as connecti

  • How do I get windows8 toolbar to display?

    I have an HP desktop pc 1yr old *HP pavillion AMD50 ?. Running latest windows op system but do not know how to get windows toolbar to display. Have downloaded it but believed it should be in with Explorer . However it does not & has never displayed .

  • SQL Loader (newbee)

    Can anyone tell me how I would go about uploading a .csv file into Oracle 8i? I understand that this can be done via the SQL loader, but how?

  • Preload extern swf results in weid behavior. It this normal?

    Hello, I tried to load an external swf file. In this swf file i have an embeded movie so that i see the preloader in action. What happens is, that while preloading i hear the movie playing in the background. So when the external swf is at for example