Passing a table-field value in Crystal to a Store Procedure in SQL Server

I have been checking all over the interenet via searches and although some seem to come close to this, its still not what I want.
Essentially I need to pass value from Table-Field record (for each record read/selected) via a paramete to a Stored Procedure(SP) in SQL Server 2205/2008.  I do NOT want to be prompted for a value for this parameter each time the report is run, simple pass the value in which will be used along with other select criteria to bring back one value for the report to use in a calcuation per record.
The value of the parameter is a date, but I understand it would be better to pass it in as a varchar(8) - 'YYYYMMDD' - and then reconvert it inside the SP, as follows:
In Crystal Reports 2008 SP3, I have a formula defined as,
trans_date = ToText ({F1ARS_STMT_WS_TRAN.TRANS_DATEI}, 'YYYYMMDD')
and essential just want to pass this to the SP below ... i.e. trans_date  ---> @strTransDate
I then link the key fields [EXCH_RATE_TABLE_NAME] and [TRANS_CCY_CODE] to other tables in the Database Expert, and put [EXCH_RATE_AMT] on the report and use it to calculate what I want.
This works fine when the prompt comes up and I put in a proper date, but I don't what it to prompt, but simple pass the F1ARS_STMT_WS_TRAN.TRANS_DATEI in via the fornula/parameter and let teh SQL do the rest for each record selected..
CREATE PROCEDURE [dbo].sp_GET_EXCH_RATE_AMT (@strTransDate varchar(8))     --use format 'YYYYMMDD' to represent the date as a string.
     -- Add the parameters for the stored procedure here
     -- @TransDate datetime = now
AS
       declare @TransDate datetime
     set @TransDate = CONVERT(DATETIME, @strTransDate, 112)
BEGIN
     -- SET NOCOUNT ON added to prevent extra result sets from
     -- interfering with SELECT statements.
     SET NOCOUNT ON;
    -- Insert statements for procedure here
SELECT [EXCH_RATE_TABLE_NAME], [TRANS_CCY_CODE], [EXCH_RATE_AMT]
FROM [F1CCY_EXCH_RATE]
WHERE [MAJOR_CCY_CODE] = 'BBD'
AND   [START_DATEI] =
     SELECT MAX([START_DATEI])
     FROM [F1CCY_EXCH_RATE]
     WHERE [MAJOR_CCY_CODE] = 'BBD'
     AND   [START_DATEI] <= @TransDate
END
GO
GRANT EXECUTE ON sp_GET_EXCH_RATE_AMT TO PUBLIC
GO
Thanks for any help.  Can't tell the headache this has caused my both literally and figuratively.

Hello,
I moved your post to the Report Design forum. Lots of SQL help in here...
I believe the problem is due to you using a Parameterized Stored Procedure. The first thing CR has to do is connect to your DB source which requires the date parameter before it can run the query to add the date filter, it's the SP that is prompting for the parameter. Therefore the report has not run so it can't get the field value from the report until you fill in the info for the SP. Catch 22 problem.... Which came first, the Chicken or the Parameter....
The report will work as you have noted but I don't know of anyway to refresh unless parameter is filled in again....
Jason has a lot of great solutions when it comes to these dilemmas, Possibly using a Command Object may help but I believe you will still run into the same issue....
Only way I can think of is to not use a parameter in the SP and let CR do the filtering client side. Of course this means all data is coming back to the client PC as you are likely trying to find a work around for.
Thank you
Don

Similar Messages

  • Can I pass an array as an input parameter for a stored procedure on SQL Server 2000

    I am trying to pass an array to a stored procedure residing on my SQL Server 2000 database server. Is this even possible? If it is possible, what is the syntax for this?
    Any help would be greatly appreciated.
    Thanks

    I have passed arrays to and from a database using SQL and ActiveX, including to and from stored procedures, but I cannot recall the precise method used to do so. If memory serves, everything is in the form of a string. You need to do a lot of parsing and 'unparsing' to get this data into your stored procedure.
    You are left with a couple of options to get your data to the stored procedure. I recommend using SQL in LabVIEW wherever possible as it saves the amount of external code calls (and believe me, calling ActiveX procedures developed by someone else in Visual Basic is NOT much fun at all...). You can either send the array and other data to the stored procedure (you will find the syntax in the SQL references in LabVIEW help under SQL), or you can send
    the array to the database, and have the database then act upon the array.
    I strongly recommend making routines (subVIs) to handle these operations.
    Sorry I don't have the syntax, I don't have SQL installed on this machine. If you can't find the syntax in the help, please post here again.
    -Mike Du'Lyea

  • Passing Nested table or Vararray  from Java to Oracle store procedure

    I have some CSV file with arround 50,000 lines. I need to pass read those lines from Java to Oracle as a collection object.
    Pro & cons of both the options.
    Need some suggestions...
    Regards,
    Lokanath

    Hi,
    why not using External tables. Then you can in Oracle work it out by just using it as a normal table with all the profits.
    Herald ten Dam
    http://htendam.wordpress.com

  • How to Track the changes made to the custom table field value

    I want to track the changes made to the custom table field value in table maintenance generator.please help me it is very urgent
    Thanks & Regards,
    Kranti

    Hi Satya,
    These are the steps you've to do.
    1. Enable the change document flag in the data element level for the fields of the tables you want to monitor.
    2. Go to transaction SCDO. Create a new change object, and add your table to this object. After generation, you'll get a function module.
    3. Call this function module in the table maintainence generator screen, after the data is saved to the database table. This function module automaticallly writes the changes, with the old and new values, and the fields that were changed to the tables CDHDR and CDPOS.
    4. You can keep track of the changes made to the table by monitoring these tables.
    Regards
    Anil Madhavan

  • How to populate custom table field value into standard DFF

    Hi Gurus
    I am newbie to the OAF
    I have a requirement to populate the custom table field value into standard DFF. we enabled the DFF in ReqDistDFFOnAcct(po_req_distributions_all). On the requisition tab as soon as i click on the checkout button, the custom field value has to be shown in the requisition distributions DFF field along with the standard Columns like charge account, percent, qty and when we click on the next button, it has to hit the base table ie., po_req_distributions_all.
    the standard columns data is showing the screen. how to acheive this requirement programatically
    There is a EO for the req distributions table. please help me how to achevie this requirement.
    Any help woud be greatly appreciated.
    Thank You!
    Krishna

    Thanks Aj. Finally i made some progress....but i am getting an error in the inst_top OPMN folder 10/10/08 15:37:14 Error: <connector name="OracleASjms" path="OracleASjms.rar" /> will not be bootstrapped since corresponding module declaration was not found in application.xml. I cleared the cache, bounced the webserver. Could not able to understand what is this error
    Following is the code that i have written. I am not able to find out what is the error. please help me how to fix this error. there is no changes in the page and the value is not auto populating. the page is having the normal behaviour as the standard one.
    Thanks in Advance for your help...
    public class xxCheckoutDistsCO extends CheckoutDistsCO
    public void processRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processRequest(pageContext, webBean);
    String UnitId="";
    //First get the Application Module
    OAApplicationModule am = pageContext.getApplicationModule(webBean);
    OAViewObject vo = (OAViewObject)am.findViewObject("PoRequisitionLinesVO");
    String Reqlineid="";
    String Linenum="";
    String DeliverLoc="";
    if(vo.first() !=null)
    Reqlineid= vo.first().getAttribute("RequisitionLineId").toString();
    Linenum = vo.first().getAttribute("LineNum").toString();
    DeliverLoc = vo.first().getAttribute("DeliverToLocationId").toString();
    // if(pageContext.isLoggingEnabled(OAFwkConstants.STATEMENT))
    // pageContext.writeDiagnostics("TEST >", Reqlineid,1);
    // pageContext.writeDiagnostics("TEST >", Linenum,2);
    // pageContext.writeDiagnostics("TEST >", DeliverLoc,3);
    UnitId=null;
    String Querry="select amli_icx_oaf_utils.get_blding_unit_id (?,?,?) from dual";
    try
    PreparedStatement ps=am.getOADBTransaction().getJdbcConnection().prepareStatement(Querry);
    ps.setInt(1,Integer.parseInt(Reqlineid));
    ps.setInt(2,Integer.parseInt(Linenum));
    ps.setInt(3,Integer.parseInt(DeliverLoc));
    ResultSet rs=ps.executeQuery();
    // ps.execute();
    // am.getOADBTransaction().commit();
    while (rs.next())
    System.out.println(" Query Results ");
    UnitId= rs.getString(1);
    System.out.println(" first > ");
    rs.close();
    ps.close();
    catch(SQLException a)
    System.out.println(" Error "+a);
    System.out.println(" Second > ");
    System.out.println(" Third > "); ----the program is executing upto here...it is not setting the value after this.
    OAViewObject povo = (OAViewObject)am.findViewObject("PoReqDistributionsVO");
    if(povo.getCurrentRow()!=null ) --------If i remove this condition i am getting the nullpointer exception in page.....
    System.out.println(" Fourth > ");
    povo.getCurrentRow().setAttribute("Attribute12",UnitId);
    // if(pageContext.isLoggingEnabled(OAFwkConstants.STATEMENT))
    // pageContext.writeDiagnostics("TEST >", UnitId, 1);
    Thanks
    krishna

  • Tracking the changes made to the custom table  field value

    Hi all,
           can we track the changes made to the custom table field values. if yes..plz specify how it can be done.
    Example: if i changed the  value of field  'NAME' of table 'YYHCUSTOMER'. i would like to know the old value and the new value of the field. For this, I set the flag 'LOG DATA CHANGES' in the technical settings of the table 'YYHCUSTOMER'.

    -> try TA: SCU3
    regards Andreas

  • How to pass the FORM Fields value by Form Personalization

    Hi ALL,
    I want to pass form filds values in to procedure. I am calling this procedure through form personalization of that form..... But it's not accepting any form field's value there... when i am passing hardcoded vales procedure is executing fine...
    can any one suggest what to do???
    i tried with these syntax
    TEST_EMP_FP(:ADDR.ADDRESS_ID,'ABC')
    TEST_EMP_FP(${item.ADDR.ADDRESS_ID.value},'ABC')
    Regards
    Ravi

    Hi,
    Iam calling an SRS from forms personlization. Can any body tell me how to pass the Form field values as parameters to the Reports. (Example when they call this Concurrent request from Transact5ions screen, The invoice number should be defaulted in the report parameter).
    Regards,,
    Anil.

  • State machine custom task workflow how to pass one task field value to the next task field

    i am using ItemMetadata.xml to pass value from list to custom task first value its passing the but second value is showing as null
    plus how to pass one custom task value to the next custom task
    i.e one supervisor approver comments submitted field i want to see on department manager approval custom task which is the next approver from supervisor
    ows_firstfield=""
    ows_SecondField=""
    the above ows fields are from list
    in this i am unable to retrive the second value in the task form this is my first query?
    second query is that how can we pass one task field value to next approver task field value?
    any idea
    MCTS,ITIL

    What type of workflow is this?  IS this Visual Studio or SharePOint designer or third party (K2, Nintex, etc...)?  YOu should be able to get ahold of the task that was edited via the correlation token, and then grab any value you want from that
    task (wether it be a custom field or a standard worfklow task field). 
    It would help to know what you are using to build the workflow.
    Thanks!

  • Improve the performance in stored procedure using sql server 2008 - esp where clause in very big table - Urgent

    Hi,
    I am looking for inputs in tuning stored procedure using sql server 2008. l am new to performance tuning in sql,plsql and oracle. currently facing issue in stored procedure - need to increase the performance by code optmization/filtering the records using where clause in larger table., the requirement is Stored procedure generate Audit Report which is accessed by approx. 10 Admin Users typically 2-3 times a day by each Admin users.
    It has got CTE ( common table expression ) which is referred 2  time within SP. This CTE is very big and fetches records from several tables without where clause. This causes several records to be fetched from DB and then needed processing. This stored procedure is running in pre prod server which has 6gb of memory and built on virtual server and the same proc ran good in prod server which has 64gb of ram with physical server (40sec). and the execution time in pre prod is 1min 9seconds which needs to be reduced upto 10secs or so will be the solution. and also the exec time differs from time to time. sometimes it is 50sec and sometimes 1min 9seconds..
    Pl provide what is the best option/practise to use where clause to filter the records and tool to be used to tune the procedure like execution plan, sql profiler?? I am using toad for sqlserver 5.7. Here I see execution plan tab available while running the SP. but when i run it throws an error. Pl help and provide inputs.
    Thanks,
    Viji

    You've asked a SQL Server question in an Oracle forum.  I'm expecting that this will get locked momentarily when a moderator drops by.
    Microsoft has its own forums for SQL Server, you'll have more luck over there.  When you do go there, however, you'll almost certainly get more help if you can pare down the problem (or at least better explain what your code is doing).  Very few people want to read hundreds of lines of code, guess what's it's supposed to do, guess what is slow, and then guess at how to improve things.  Posting query plans, the results of profiling, cutting out any code that is unnecessary to the performance problem, etc. will get you much better answers.
    Justin

  • New install of SQL 2014 Std MSDN. Get "The SQL Server product key is not valid. To proceed, re-enter the product key values from the Certificate of Authenticity (COA) or SQL Server packaging."

    Trying to install a new version of SQL 2014 Std 64 or x86. Installing on Windows 8.1Pro 64bit machine.
    I get:
    "TITLE: SQL Server Setup failure.
    SQL Server Setup has encountered the following error:
    The SQL Server product key is not valid. To proceed, re-enter the product key values from the Certificate of Authenticity (COA) or SQL Server packaging.
    Error code 0x858C0017."
    I looked at the summary log and that is the only error.
    I made sure there were no other instances of SQL on this machine. Uninstalled all VS2013 and sql instances just in case. IF there is somewhere to check if a previous version or license is causing the issue, i would be glad to check.
    Any help would be appreciated.

    Hi,
    Please read this thread with similar issue
    http://social.msdn.microsoft.com/Forums/sqlserver/en-US/bdd94577-515c-49fa-be44-008eacece057/installing-sql-server-2012-on-a-new-vm-error-code-0x858c0017?forum=sqlsetupandupgrade
    Please mark this reply as answer if it solved your issue or vote as helpful if it helped so that other forum members can benefit from it
    My Technet Articles

  • Need Help in Field Symbol for Dynamically passing  table field value

    Hi All,
    In my internal table I am having data.
    I am dynamically forming table field name and substitute for the another table field name to pass DATA.
    but I am getting the Variable name insted of Value ie Data.
    I am using Field Symbol for this.
    data:
    Field-symbols <TS> type any.
    field1 type string.
    LOOP AT TABLEFIELDS INTO WA_TABLEFIELDS.
                READ TABLE  TEST  WITH KEY NAME = WA_TABLEFIELDS-FIELDNAME.
                IF SY-SUBRC = 0.
                  CONCATENATE 'WA_' WA_TABLEFIELDS-TABNAME '-' WA_TABLEFIELDS-FIELDNAME INTO  Field1.
                  Assign Field1 to <TS>.
                    ALL_VAL-VALUE = <TS>
    "After substituting the <TS>  into ALL_VAL-VALUE  field I need a DATA to be passed but the variable name is appending"*    
             APPEND ALL_VAL.
                ENDIF.
              ENDLOOP.
    kindly how to pass the value into the table.
    Thanks in advance.
    San

    Hi,
    pls assign a break point in
    CONCATENATE 'WA_' WA_TABLEFIELDS-TABNAME '-' WA_TABLEFIELDS-FIELDNAME INTO Field1.
    Assign Field1 to <TS>.
    ALL_VAL-VALUE = <TS>
       " Put a break point here and check for the value in <TS>.
    if <TS> contains value then create a work area for ALL_VAL AND PASS the Field-Symbol to that and then  append thw wa into the table...
    Hope this works out!!
    thanks

  • WebDynpro -  How to pass a single field value to BAPI table?

    Hello,
    I have just come from WebDynpro ABAP training and being a novice hit my first issue right away.
    I need to use BAPI - BAPI_CONTRACT_CREATEFROMDATA to create SD contract (I have used this BAPI to create a service call inside Webdynpro). I have two required fields: contract start and end dates. These fields passed in a table called CONTRACT_DATA_IN.
    When I use the fields from the structures or individual fields, all I need to do is just put them on the view, and when I hit my submit button they will be passed to the BAPI. They are a part of COMPONENTCONTROLLER context (I have also mapped them in View context), but tables are obviously different.
    Is there any way to pass data to tables as seamlessly without any code as for structures? Or do I need to write code to get the values from the input fields and then populate the table manually?
    Thanks,
    Alex

    Hi,
    Single customer contract creation use the struture-
    If you want to pass only one record then using the input fields for those 2 fields we can pass them to BAPI and then create the Customer Contract. This will work for only one record of customer contract.
    then we can directly read these input fields and pass to BAPI.
    Creating many customer contracts -
    For example, If you want to provide the group of records at a time and then you want to create the cusotmer contracts for so many records then you fill these fields and pass them to table then pass this table to the tables parameters of that BAPI.
    Here we need not create the Table UI element separate input fields would serve the purpose.
    Now we can create the batch of contracts for N customers.
    these input fields of a customer will be passed to table, then next set of input fields etc.
    For this create the Table UI element and fill all the records and then pass it to the Tables of the BAPI.
    Regards
    Lekha

  • How to pass custom z table field values to smartform

    hi i need to pass fields values from the table i created to already developed smartform..can anyone give me an example for this scenario

    Hi,
    You need to create an internal table in print program. Then fill the internal table using select statement. Now you need to declare One internal table in 'TABLES' tab of Form Interface in smartfrom.
    e.g.:
    IT_BKPF     LIKE     ZBKPF
    Now call the smartform in print program & pass the internal table(declared & filled in print prog) to the smartform.
    Ashven

  • How to use table field values as dynamic parameters on selection screen

    Hi,
    I need help on dynamic selection parameters.
    I need to display no. of parameters from the fields of a database table.
    Basically i want to pass field values of a table to selection screen and we can use those values as parameter on selection screen.
    If there are 10 entries in a table field( say field is field_name and entries are bukrs,kunnr etc.)
    I need to display as many parameters on screen as many values are there in field_name( In this case it is 10)
    SELECTION-SCREEN: BEGIN OF BLOCK b2 WITH FRAME TITLE text-t02.
    PARAMETERS:
                           p_bukrs(5) ,
                           p_kunnr(5) ,
    SELECTION-SCREEN END OF BLOCK b2.
    Thanx

    Hi,
    You can create it using Dynamic Program.Check this link below.
    [Creating Dynamic Programs|http://help.sap.com/saphelp_46c/helpdata/en/9f/db996135c111d1829f0000e829fbfe/content.htm]
    Hope this might help you.
    Thanks,
    Prashanth

  • How to pass a table of values as input to a BAPI

    I have a BAPI that is expecting a table as an input. How do I do that in Visual Composer 7.1.
    I am getting an error when I try to pass the multiple selected rows from a table.
    com.sap.mw.jco.JCO$Exception: (127) JCO_ERROR_FIELD_NOT_FOUND: Field null not a member of
    Please advise
    Thanks

    Hi,
    It sounds like a mapping problem. Just to make sure, check that all the table fields are mapped correctly (check them in the dynamic expression editor).
    Also, make sure that all the fields from the table are selected and mapped at the BAPI input. If there are fields you don't want to pass, you can pass =null to them.
    Best regards,
    Tal.

Maybe you are looking for

  • How to start oc4j 1.0.2.2.1

    it is stopped, but i don't know how to start it.

  • Sending/Receiving JMS message to WMQ from Automated Task

    Hi All, I am new to OSM and working on a POC for the implementation of OSM in our company. We have WebSphere MQ for messaging and want to use same for OSM implementation. We don't want to create bridges, foreign server etc configuration in weblogic,

  • Converting draft document to invoice document

    Hi everyone -- new SBO developer here, trying to come up to speed on the SDK.  I'm curious how you manage to "convert" an existing draft document (in my case, a draft A/R invoice) to an actual A/R invoice, and then add it at the same time.  Say, for

  • How do I download my Lightroom to a new device if my disc is broken

    And why in God's name can't any company have a damn phone number we can call anymore is beyond me!!!  I just want someone who knows what the hell to do with my problem and tell me what I need to do!!!  I have had Adobe Lightroom downloaded on my lapt

  • Est-il possible d'utiliser google map sous labview 2014

    Bonjour, Pour les besoins d'une application je souhaiterai intégrer google map pour y faire afficher un emplacement mais celui-ci sera mobile car l'utilisation ressemblera à un GPS. est-ce possible de faire sa? Merci d'avance, Cordialement R.D.