Can we use Selection Criteria Screen to tell Query which SQL script to run?

Dear All,
When I run this code, it gives me the screen below:
declare @ScanOp4 nvarchar (30)
set @ScanOp4=
/*select T3.U_ScanOp4 from [dbo].[@SCANNING] T3 where T3.U_ScanOp4*/ '[%0]'
I have used Tools -> Customization to define a UDT and UDF
Query - Selection Criteria
Invoice / Credit Note?            [----------------- ]
                                 (there's a drop-down arrow with 2 choices:
                                  Inv = Invoice
                                  CN  = Credit Note
[OK]       [Cancel]
Now, I have 2 very similar queries; the only difference is that they use different tables because one is for
Purchases (OPCH/PCH1), and the other is for Credit Memos (ORPC/RPC1)
I want to put the above declaration together with my 2 queries all in a single query so that:
(a) If I select 'Invoice', the Invoice part is executed and only invoices are displayed,
(b) If I select 'Credit Note', the Credit Note part is executed and only Credit Notes are displayed.
Do you think such a Query is possible? If yes, please give me an idea how I can achieve it.
I don't want to use UNION ALL because one of my fields is a LINK field to which I have linked all PDF Scanned documents.
I want to preserve the links, since this is the reason I'm writing the query.
Thanks
Leon Lai
Here are my skeleton codes
1st Query: User selects 'Invoice' -
SELECT
T0.[TaxDate] AS 'Doc Dt',
T5.[TransType] AS 'Txn Type',
T0.[DocNum] AS 'Doc No.',
T0.[DocTotal] AS 'Amount'
FROM [dbo].[OPCH] T0
INNER JOIN [dbo].[PCH1] T1 ON T0.[DocEntry] = T1.[DocEntry]
INNER JOIN [dbo].[OJDT] T5 ON T0.[TransID]  = T5.[TransID]
2nd Query: User selects 'Credit Note' -
SELECT
T0.[TaxDate] AS 'Doc Dt',
T5.[TransType] AS 'Txn Type',
T0.[DocNum] AS 'Doc No.',
T0.[DocTotal] AS 'Amount'
FROM [dbo].[ORPC] T0
INNER JOIN [dbo].[RPC1] T1 ON T0.[DocEntry] = T1.[DocEntry]
INNER JOIN [dbo].[OJDT] T5 ON T0.[TransID]  = T5.[TransID]

Try this:
declare @ScanOp4 nvarchar (30)
set @ScanOp4=
/*select T3.U_ScanOp4 from [dbo].[@SCANNING] T3 where T3.U_ScanOp4*/ '[%0]'
If @ScanOp4='Inv'
SELECT
T0.[TaxDate] AS 'Doc Dt',
T5.[TransType] AS 'Txn Type',
T0.[DocNum] AS 'Doc No.',
T0.[DocTotal] AS 'Amount'
FROM [dbo].[OPCH] T0
INNER JOIN [dbo].[PCH1] T1 ON T0.[DocEntry] = T1.[DocEntry]
INNER JOIN [dbo].[OJDT] T5 ON T0.[TransID]  = T5.[TransID]
If @ScanOp4='CN'
SELECT
T0.[TaxDate] AS 'Doc Dt',
T5.[TransType] AS 'Txn Type',
T0.[DocNum] AS 'Doc No.',
T0.[DocTotal] AS 'Amount'
FROM [dbo].[ORPC] T0
INNER JOIN [dbo].[RPC1] T1 ON T0.[DocEntry] = T1.[DocEntry]
INNER JOIN [dbo].[OJDT] T5 ON T0.[TransID]  = T5.[TransID]

Similar Messages

  • Skiping initial selection criteria screen of HR report for Manager Desktop

    Dear All,
    The reports are configured using a custom scenario (Z Scenario) for Manager Desktop and used over the Portal through MSS. I have a requirement where for only one report (named Expired Qualifications) the initial selection criteria screen which comes when accessed through portal needs to be disabled or skipped and directly the transaction S_AHR_61015536 for this report needs to be called.
    Please provide the inputs if it can be done and how for one report only.
    Regards,
    Samir

    Dear Sen,
    I have checked the thread suggested by you but the report here is not independent transaction integrated using iView. It is a part of Scenario which makes the reports available to the managers. It uses MSS Standard iView "Reports" and "Selection Criteria". Both iViews are in one page as delivered by SAP. The reports iView displays all the reports configured in the scenario for Manager Desktop and Selection Criteria iView is launched first in the portal content area when the report ( "Expired Qualifications") link is clicked from the Reports iView.
    Regards,
    Samir

  • Can i use select statements in LDB

    Hai All,
       Can i use select statements and internal table in a LDB program.
    my requirement is that if i enter company code , fiscal year and reporting periods.
    generally fiscal year will be jan to dec.but in my requirement the fiscal year is apr of previous year to march of currentyear.
    so as i require the last years data can iuse select statement in that ldb program or is there any solution for this.
    Thanks in Advance
    kiran

    Hi Kiran,
    To retrive records from ldb you have to use the
    GET <node> statement. This will invoke the selection screen of the node. An alternate solution is to use the function module LDB_PROCESS.
    Please see the following link for help and example
    http://help.sap.com/saphelp_nw04/helpdata/en/64/237f8cd43711d1950b0000e8353423/content.htm
    Thanks
    Vinod

  • Can we use select options in smartform

    can we use select options in smartform if so can any one send me a sample code...
    Thanks
    bhaskhar

    Hi ,
    Can u explain why u want to use select options in smartforms . U can try it in program lines .
    Its better to use select options in the driver program and fetch data accordingly in the driver program or passing the selected values from select options to the smatfrom and fdetching the data there in smartform .
    Regards

  • I recently installed iTunes on my new HP laptop computer, authorized it according to the instructions, but now can't get past a screen that tells me that I need to authorize the computer.  I purchased an album and it's in the library, but it won't sync.

    I recently installed iTunes on my new HP laptop computer, authorized it according to the instructions, but now can't get past a screen that tells me that I need to authorize the computer.  I purchased an album and it's in the library, but it won't sync.

    Have a look here...
    http://support.apple.com/kb/TS1389

  • Can I use the iMac Screen as an external screen for a PC laptop ?

    can I use the iMac Screen as an external screen for a PC laptop ?

    iMac- How to use your iMac as a Target Display Mode display
    Target Display Mode- Frequently Asked Questions (FAQ)
    I am unaware of any PCs that support connection via Target Display Mode. I have never tried it myself, so I don't know if it would work. All you can do is try provided you have an iMac that supports TDM and the proper cable adaptors.

  • Can I use my iMac Screen as an external screen for my PC laptop

    Can I use my iMac screen as an external screen for my PC laptop ?

    Thanks for your reply. After reading the article though, I'm still not really sure what the answer is. For example, you mention something that can be done, with some hurdles to go through, for 27" iMacs. Mine is a 21.5" iMac, but seems to have the same port you mentioned in the article. Or maybe it isn't. Anyway, I'm still not sure if it is possible after reading that. Interesting information though.
    doug

  • I can´t use my PH because adobe tell that is not actualized but the administrator say that my death line will be on september 2015... what can i do please

    i can´t use my PH because adobe tell that is not actualized but the administrator say that my death line will be on september 2015... what can i do please

    Sign in, activation, or connection errors | CS5.5 and later
    Mylenium

  • How can we use    27" thunderbold screen with  macpro 2010 - 2011  model ?

    how can we use    27" thunderbold screen with  macpro 2010 - 2011  model ?
    regards
    paykom.com.tr
    orhan batur

    Unfortnately you cannot. Thunderbolt is an onboard chip that will require an updated Mac Pro. It is not a graphics card upgrade, but a full logicboard upgrade.
    Apple has not updated the Mac Pro in 580 days - as of this post. Hopefully one is right around the corner...but I've been hoping for that for over a year.

  • No exact match was found. Click the item(s) that did not resolve for more options. You can also use Select button to choose External Data.

    HI,
    I have SharePoint Online 2013 environment, i have created a external content type from wcf service. I want to use this as External Data column in document library. When i look for values in content type it populates and when i click any values and adds and
    then click saves it shows the below error
    No exact match was found. Click the item(s) that
    did not resolve for more options. You can also use Select button to choose External Data
    __fkc000950056003700kc000950056003700kc000e400f2001400kc000950056003700k830035004700160027004700d20057000700020064009600870056004600:
    No Matching Items
    Please help on this.
    varinder

    I don't understand the question exactly, could you restate it.  Sorry mate, I might just be braindead.
    But, as far as the issue, it is by design.  the column is a lookup columns which essentially ties to the external data.  if that data is removed, the column on your simple list becomes invalid and any edits of the simple list item will require
    it to be changed.
    are you wanting to make the ECT read only?  that's simple enough.  you can pop open SPD and edit the ECT, then remove the C/E/D operations (create/update/delete).  That will not, however make it read-only in any other systems that access that
    external data, as I assume its not just SP or else it wouldn't be external
    Christopher Webb | MCM: SharePoint 2010 | MCSM: SharePoint Charter | MCT | http://christophermichaelwebb.com

  • Cannot acces to the selection criteria of a local query in web browser

    We cannot access to the selection criteria of a local query in using the web browser
    It seems this issue is already known, a local query created with BW release 7 cannot be used with the web browser.
    But this is a blocking issue in our case because we cannot create another local query in using BW 3.X and if we are using the analyser with RRMX and Excel we cannot displayed more of 65000 rows due to Analyser R3.X or R7.
    That's why we want to use the web browser because we can export the extraction from the intranet in MS Excel 2007 without limitation of rows.
    Thanks in advance to find a solution asap

    Hi Mustafa,
    I checked your requirement but it is not possible to display first value as default value for a drop down list because the list will be generate when you click the drop down list. You can use a 'list box' instead of drop down list.
    Regards
    Basheer

  • In Oracle, Can i use if exits clause in a query?

    In Oracle, Can i use if exits clause in a query?
    For example, "Drop table if exists tablename"
    Is the above command valid in oracle?
    If not then is there any equivalent for if exists clause?

    Here is the SP code code that might help you to Drop a table if it exisit, whith out throwing an error if the table is not present.
    create or replace PROCEDURE DROP_TABLE(TabName in Varchar2)
    IS
    temp number:=0;
    tes VARCHAR2 (200) := TabName;
    drp_stmt VARCHAR2 (200):=null;
    BEGIN
    select count(*) into temp from user_tables where TABLE_NAME = tes ;
    if temp =1 then
    drp_stmt := 'Drop Table '||tes;
    EXECUTE IMMEDIATE drp_stmt;
    end if;
    EXCEPTION
    WHEN OTHERS THEN
    raise_application_error(-20001,'An error was encountered - '||SQLCODE||' -ERROR- '||SQLERRM);
    END DROP_TABLE;
    Call this SP in your Scripts by : CALL DROP_TABLE ('<Table Name>')
    Hope this Helps!
    Regards,
    Kaarthiik

  • How can I use a SCH-LC11 device in CHINA which bought from ebay. I am not Verizon customer but I prefer to using your 4G LTE Router . How can I get the unlock code? The device may have a bad ESN but I only use it in CHINA. Kindly looking forward your repl

    How can I use a SCH-LC11 device in CHINA which bought from ebay. I am not Verizon customer but I prefer to using your 4G LTE Router . How can I get the unlock code? The device may have a bad ESN but I only use it in CHINA. Kindly looking forward your reply. Thanks!

    It's good to read Antoniad's post.  It reassures me that I can use my new iPad as an international communication device which is the reason I purchased the thing.  However, I called Verizon today (my provider of cellular data) who told me that I can't just pop in a SIM card as you suggested.  He also said that he was from the "Pre-Pay" division of Verizon and he was certain that I couldn't do what I planned to do.  I was extremely disappointed as I had called Apple prior to buying the iPad and I read the algorhythm on the website for choosing an iPad before purchasing.  Those sources were quite specific and the information seemed clear.  I would be able to use my iPad to communicate through cellular connections while traveling on the road, literally, abroad.  I was told that I could pop in a data card wherever I was, just as you indicated in your message above, and voila I was good to go.  The Verizon rep definitively rained on that parade, but said that I might be able to do this if I have a "Post-Pay" account, a different area of Verizon.  I haven't had the chance to talk to this division yet, so I looked to Apple's Support for answers.  Maybe I will find out that I can use my iPad as an international communication device while traveling on the road afterall, however, it appears I may need a different type of account (Post-Pay), something I was never warned about. Can I switch to this kind of account?  I don't know.  I have to find out.  If you have any information about this issue, it would be good to share since I strongly suspect there are others who bought the iPad for the same purpose that I have.

  • Can i use a font such as Yuppy, Chalkboard which is basically included in iOS  for commercial purpose?

    hi!
    I make a e-book and it will be published on appstore and android market as application.
    I'm wondering about font.
    Can i use a font such as Yuppy, Chalkboard which is basically included in iOS  for commercial purpose like me?
    I bought a mountain lion on appstore.
    I look forward to hearing from apple whether it is lawful or not.
    Have a blessed day~:)

    Strangely, there isn't and end user license on Apple's site regarding iOS. But here's a look at the font agreement section from OS X Mountain Lion:
    E. Fonts. Subject to the terms and conditions of this License, you may use the fonts included with the Apple Software to display and print content while running the Apple Software; however, you may only embed fonts in content if that is permitted by the embedding restrictions accompanying the font in question. These embedding restrictions can be found in the Font Book/Preview/Show Font Info panel.
    So basically, you need to examine the fonts to see if there are notes on usage restrictions or limitations.

  • Can I use a OID rule for a Query SQL Lov of BIP?

    Hi. Can I use OID data (rules) for a query sql lov in BIP? Ex. filters users/store.
    Thank you.
    R.

    Hi,
    I didn't look at the example, but if you want to secure your application then you should use container managed security. Read this .
    Anyway, you could add this before return "good"; in your login_action()
    FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put("username", user);Then, you can access this from anywhere in the application by using #{sessionScope.username}.
    Pedja

Maybe you are looking for

  • HP Officejet Pro 8610 Add Printer issue on Mac

    I purchased the HP Officejet Pro 8610 and cannot get it successfully set up on my MacBook Pro (operating OS X 10.7.5).  During the "Add Printer" phase, I receive the following error message:  "The software for this printer is currently unavailable.  

  • Switcher needs help in buying

    Folks, I am planning to switch to a Mac this year for many common Windows reasons. I like the new intel iMac, but I have the following questions though: 1. Since this is going to be my first Mac, is it worth buying the iMac now or wait for few more m

  • HT5525 Help adding text to the bottom of iPhoto book pages?

    Hi - I am working on a deadline (of course) to get an iPhoto book done for my parents' anniversary. I have my photos placed, and have planned well to know how many characters can fit into each space below and next to photos in the text boxes provided

  • Open API App (Windows based) fails to open FMB on Unix file system

    My Open API, Windows based app, can successfully open and 'get' properties of FMBs stored in the Windows file system. However, it fails to load the FMB when the FMB resides on a networked Unix server. The same FMBs on Unix can be opened by the Window

  • PWA 2007: Progress field in the view "my assignments": I cant enter time in the days because appears locked

    Hi! I am having the following trouble in Project Server 2007(any help is much appreciated): In the view "my assignments", where the persons report the time worked each day in the projects, some days of some projects appear locked and dont allow to en