Calling multiple records from SP

Hi,
I tried to use a CallabaleStatement to call an SP that would return multiple records but wasn't successful.
The Problem is the 'cstmt.executeQuery()' statement returns NULL. How to solve this?
I have tested the SP and it works fine. Pls help! And thanks. (Btw, I am using JDBC:ODBC driver and accessing Oracle database.)
Below are the methods that I used to set the IN parameters and the methods I used to register OUT parameters:-
ResultSet rs = null;
//call to the SP.
CallableStatement cstmt = con.prepareCall("{ call artmovby_date (?,?,?,?,?,?) }");
//based on the SP, the following set methods are used.
cstmt.setInt (1, pLanguage);
cstmt.setString (2, pCustomerCode);
cstmt.setString (3, pStartDate);
cstmt.setString (4, pEndDate);
//based on the SP, the following are the JDBC
// types registered for OUT parameters
cstmt.registerOutParameter(5, java.sql.Types.NUMERIC, 0);
cstmt.registerOutParameter(6, java.sql.Types.OTHER);
//using executeQuery since the SP
//contains 'select' statement only.
try { rs = cstmt.executeQuery(); } catch (Exception e) { e.printStackTrace(); }
Below is the information of the package and SP created in the database:-
CREATE OR REPLACE PACKAGE FetchData is
-- The purpose of the package is just define the recordset.
Define Record Types
TYPE ArtMoveOneRecTyp is RECORD
( Article SDGPOS.ARTNR%TYPE,
Shipment_No SDGPOS.SDGNR%TYPE,
Customer_Ref SDGPOS.KUNDENREF%TYPE,
Shipment_Date SDG.BELDATUM%TYPE,
In_Or_Out SDGPOS.FUNKTION%TYPE,
Quantity1 SDGPOSMG.MENGE%TYPE,
Quantity2 SDGPOSMG.MENGE%TYPE,
LineNr SDGPOS.NR%TYPE,
UnitLoad1 SDGPOSMG.RANG%TYPE,
UnitLoad2 SDGPOSMG.RANG%TYPE);
-- Define PL/SQL Table --
TYPE ArtMoveRecTyp IS TABLE OF ArtMoveOneRecTyp
INDEX BY BINARY_INTEGER;
END FetchData;
create or replace procedure artmovby_date
language IN number,
customerid IN varchar2,
startdate IN varchar2,
enddate IN varchar2,
p_size out number,
p_array out FetchData.ArtMoveRecTyp
) is
cursor get_art_mov_by_date
(p_language number,
p_customerid varchar,
p_startdate varchar,
p_enddate varchar) is
SELECT P.ARTNR, P.SDGNR, P.KUNDENREF, SDG.BELDATUM, P.FUNKTION,
M1.MENGE, M2.MENGE, P.NR, M1.RANG, M2.RANG
FROM
SDG,
SDGPOS P,
SDGPOSSTATUS S,
STATI_TEXTE ST,
ARTIKEL A,
LHM,
LHMTEXTE L,
MONITURENST MO, MONITURENTEXTE MOT,
SDGPOSMG M1, ARTMENGENEINH AE1, EINHEITENTEXTE E1,
SDGPOSMG M2, ARTMENGENEINH AE2, EINHEITENTEXTE E2
WHERE
P.KUNDENNR = S.KUNDENNR(+)
AND P.FUNKTION = S.FUNKTION(+)
AND P.SDGNR = S.SDGNR(+)
AND P.NR = S.SDGPOSNR(+)
AND 'J' = S.AKTIV(+)
AND 'SDGPOS' = ST.TYP(+)
AND p_language = ST.SPRACHE(+)
AND S.STATUS = ST.STATUS(+)
AND S.FUNKTION = ST.FUNKTION(+)
AND P.KUNDENNR = A.KUNDENNR(+)
AND P.ARTNR = A.NR(+)
AND P.LHMNR = LHM.NR(+)
AND P.LHM = L.NR(+)
AND p_language = L.SPRACHE(+)
AND P.MONITUR = MO.NR(+)
AND MO.NR = MOT.NR(+)
AND p_language = MOT.SPRACHE(+)
AND P.KUNDENNR = M1.KUNDENNR(+)
AND P.FUNKTION = M1.FUNKTION(+)
AND P.SDGNR = M1.SDGNR(+)
AND P.NR = M1.SDGPOSNR(+)
AND 1 = M1.RANG(+)
AND P.KUNDENNR = AE1.KUNDENNR(+)
AND P.ARTNR = AE1.ARTNR(+)
AND 1 = AE1.RANG(+)
AND AE1.MGEHNR = E1.NR(+)
AND p_language = E1.SPRACHE(+)
AND P.KUNDENNR = M2.KUNDENNR(+)
AND P.FUNKTION = M2.FUNKTION(+)
AND P.SDGNR = M2.SDGNR(+)
AND P.NR = M2.SDGPOSNR(+)
AND 2 = M2.RANG(+)
AND P.KUNDENNR = AE2.KUNDENNR(+)
AND P.ARTNR = AE2.ARTNR(+)
AND 2 = AE2.RANG(+)
AND AE2.MGEHNR = E2.NR(+)
AND p_language = E2.SPRACHE(+)
AND SDG.NR = P.SDGNR(+)
AND SDG.KUNDENNR = P.KUNDENNR(+)
AND SDG.FUNKTION = P.FUNKTION
AND ( P.KUNDENNR = p_customerid )
AND ( SDG.BELDATUM BETWEEN TO_DATE( p_startdate ,'DD/MM/YYYY' )
AND TO_DATE( p_enddate , 'DD/MM/YYYY' ))
AND S.STATUS >= 35
ORDER BY P.ARTNR ASC, SDG.BELDATUM ASC;
begin
p_size :=0;
open get_art_mov_by_date (language, customerid, startdate, enddate);
loop
fetch get_art_mov_by_date into p_array(p_size);
exit when get_art_mov_by_date%NOTFOUND;
p_size := p_size +1;
end loop;
close get_art_mov_by_date;
end;
/

like for other structure we set occurence as 0 to unbound if we wanna send multiple messages ...
If you want to send multiple records u r occurence must be 0 to unbound in RFC also..
check that for your RFC ?
Regards
Rao
Edited by: PT Rao on Jun 12, 2008 5:13 PM
Edited by: PT Rao on Jun 12, 2008 5:17 PM

Similar Messages

  • Call multiple screens from LSMw

    Hi
    i want to call multiple screens from lsmw
    I need to call a three transaction from LSMW wich are subzequent steps for data entry.
    1) first tcode to be called is eprodcust which creates some master data and using this master data and some fields of data creatd i need to call two more tcodes first iq01 to create meter and save then eg31 tcod to feed data.
    Please suggest where in lsmw can i give options for suc hscnerio and call of subsequent screens.
    regards
    Edited by: Prieti_V on Nov 8, 2011 8:28 PM

    Hi Priti ,
    we have few options to handle such cases , to avoid Locked Problems what you can do is
    -->write BDC program within LSMW to create installation ( this will be created within step of 11 Convert Data ).
    -->Based on the above BDC results ,run another BDC within LSMW to create Device.( this will be created within step of 11 Convert Data ).
    -->third BDC records , let SAP do it thru LSMW or can you do it convert data step itself.
    this approch needs lots of codes , so in worst case and if you dont want to break the loadings the follow this.
    *Better to find any BAPI which will do creation of installation ,devices
    regards
    Prabhu

  • Displaying the selected multiple records from node using onleadselect event

    Hi all,
    How to display the selected multiple records from node to node using onleadselect event.
    i came to know tht to fulfill this requirement i need to use the method get_selected_elements,
    how to use this method in my event??
    sree

    Hi Sree,
    Try below code..
    DATA : lo_nd_it_lips TYPE REF TO if_wd_context_node,             // This is first node
                 lo_el_it_lips TYPE REF TO if_wd_context_element,
                 ls_it_lips TYPE wd_this->Element_it_lips,
                 lt_it_lips TYPE wd_this->Elements_it_lips.
               DATA: wa_temp TYPE REF TO if_wd_context_element,
                lt_temp TYPE wdr_context_element_set.
    * navigate from <CONTEXT> to <IT_LIPS> via lead selection
          lo_nd_it_lips = wd_context->path_get_node( path = `ZRETURN_DEL_CHANGE.CHANGING_3.IT_LIPS` ).
          CALL METHOD lo_nd_it_lips->get_selected_elements
            EXPORTING
                INCLUDING_LEAD_SELECTION = ABAP_true
            RECEIVING
              set = lt_temp.
          DATA lo_nd_pack_mat TYPE REF TO if_wd_context_node.          //Second Node
          DATA lo_el_pack_mat TYPE REF TO if_wd_context_element.
          DATA ls_pack_mat TYPE wd_this->Element_pack_mat.
          DATA lt_pack_mat TYPE wd_this->Elements_pack_mat.
    * navigate from <CONTEXT> to <PACK_MAT> via lead selection
          lo_nd_pack_mat = wd_context->get_child_node( name = wd_this->wdctx_pack_mat ).
          lo_nd_pack_mat->get_static_attributes_table( importing table = lt_pack_mat ).
          LOOP AT lt_temp INTO wa_temp.
            CALL METHOD wa_temp->get_static_attributes
              IMPORTING
                static_attributes = ls_it_lips.
                  ls_pack_mat-vbeln = ls_it_lips-vbeln.
                  ls_pack_mat-material = ls_it_lips-matnr.
                  ls_pack_mat-vgbel = ls_it_lips-vgbel.
                    append ls_it_lips to lt_unpack.
                  CLEAR ls_pack_mat.
           ENDLOOP.
    Cheers,
    Kris.

  • How can I call multiple records(40) at same time as webservice ?

    Hi All
      My scenario is some thing like calling SOAP(Webservice) to Rfc(BAPI)
      Thing is how can i call multiple records at the same time using the SOAP
       adapter i.e i need to make a request to BAPI and in the BAPI response
       based on the fields, i need to send to different records....it is Sync call
    Can any explain me how to implement this scenario ?
    Regards
    Kiran lvs

    HI,
    Please see the below link
    http://help.sap.com/saphelp_nw04/helpdata/en/42/ed364cf8593eebe10000000a1553f7/content.htm
    Regards
    Chilla..

  • How to select multiple records from a TREE in the table

    HI,
    I have a tree structure which is in the table.When I open the node of the tree,all the subnodes are coming as one-one records in the table.I want to slect multiple record from this table.I applied onLeadSelect for this table,I can select only 1 record from the table.
    Can any one plz suggest me how to select multiple records from the table so that I can get all the data of those selected record.
    Regards
    -Sandip

    Rashmi/Kukku,
    First of all, Thanks for your help!
    Is there any other way in which we can access tables other than using BAPIs or RFCs?
    In my case, there is a table structure which has to be updated with values after validating a key. i don't think there is any RFC available now. do i need to create bapi/rfc for that?
    Krishna Murthy

  • Creating multiple records from 1 record in the source file for Import DM

    Hi Experts,
    Today I am working on an interface/import where I want to get the following result:
    Source file contains a records like:
    Account, Entity, DriverX
    Sales,EntityA,ZZ
    The BPC appset contains the 2 dimensions Account and Entity next to CostCenter dimension. The DriverX field in the source file is just additional information in the source file. However based on this DriverX we need to determine what CostCenter to choose but we also need to have the same record assigned to a second record in BPC.
    Following my example, based on DriverX value I need to create 2 records:
    Account, Entity, CostCenter,
    Sales,EntityA,CC1
    Sales,EntityA,CC2
    I don't have a problem assigning the record to 1 CostCenter based on DriverX value but I have a problem creating my second record. Does any of you have had the same "challenge" and if so would you like to share the solution for this?
    Best regards,
    Johan
    PS: I am working on SAP BPC, version 7.0 Microsoft version.

    Hi Greg,
    Many thanks for your answer. And yes this would be a solution. However I just simplified my case as the decision to create an second record and where to post is depending on more than 1 field in the source.
    But I will keep it in mind, because I also can opt for a solution to store data differently in BPC fac-tabels which will help me to use script logic.
    If it is not possible to create multiple records from a single records in the standard functionality in the Transformation and/or Conversion file, I have to create a custom DTSX or change my way of storing data.
    Anyone else who is having an alternative idea like Greg came up with?
    Please let it know!
    Best regards,
    Johan

  • Can we call multiple Smartforms from single Driver Prog?

    Hi all,
    Can we call multiple smartforms from single Driver Program. Here Driver program is custom Program.
    I want to give Print Parameter only once and output should get printed one after the another smartform in same order of smarforms were called.
    If yes, then how?
    Thanks in advance.

    Yes, you can do this in your Smartform driver program.
    Each time you call you Smartform function module you will need to change the values in structure OUTPUT_OPTIONS slightly.
    On the first call set TDNEWID to X.
    After this, set it to space
    On the last form set TDFINAL to X.
    This will put all of the output into one spool request, in the order they are called in the program.
    Regards,
    Nick

  • Posting  multiple records from file to idoc

    Hi Exerts,
       i have done scenario to post one record from file to IDOC, to post multiple records from file to idoc what are the options to be modified in the scenario.
    thanks,
    dhanush

    Hi Dhanush,
      You need to change the occurance of idoc to 0 to unbounded ie need to opt idoc packaging.
      Just download the xsd of you idoc to the desktop and change the occurance tag as "<xsd:element name="IDOC" type="COND_A.COND_A02" maxOccurs="unbounded" />" and then reimport it into External definition and use it in your message mapping and then map it with you source structure.
    Regards,
    Prasanthi.

  • Allow multiple records from this table to be displayed in the form is greyed out.

    I'm trying to add a second table to my main data source in an InfoPath 2010 form (database template), but the option to allow multiple records from this table to be displayed in the form is greyed out and I can't select it.
    Can someone please tell me how to correct this? I'm guessing that there might have to be something change in MS SQL because on other occasions I've have not encountered this problem when adding a second table.
    Any help would be greatly appreciated.
    Thanks.

    So I've found a work around, but I still don't know why I'm having the problem in the first place.
    I've been trying to relate the two tables by using the primary key in the parent table to a view of the child table that also includes primary key in the parent, e.g. the ORDER ID in the order table relating to the ORDER ID in the view of the order detail
    table. For whatever reason whenever I did that InfoPath prohibited the data source from returning multiple order details.
    My work around is to use views of both the order table and order details table that include the customer ID and to relate the two table in InfoPath using the customer ID. Now I get a data source that allows multiple order detail records. In order to get
    just the order details that I want that relate to a particular order, I use a rule that sets the order id in both the order and order details query data sets before executing the query (as opposed to just the order data set).
    Hope that's a clear explanation.

  • Delete Multiple Records from Item Master

    Hi,
    We received wrong master data which has been uploaded and two groups have to be deleted. All the items in those particular groups have also to be deleted. Can anyone suggest how to delete multiple records from Item Master?
    Currently I am navigating through each Item and doing a Right Click + Remove. It is very painful given the huge number of records.
    Regards
    Sudatt

    Hi Sudatt.....
    I recommend you not to run any kind of delete or update SQL query as it harms DB.
    You can create your own front end application with the help of any technical consultant which can be
    achieved very easily. Else such problems create a big problem during upgradation to next version.......
    Regards,
    Rahul

  • Update multiple records from a list

    Just trying to find some tutorials on how to update multiple
    records from 1
    page of checkboxes
    easiest example is hotmail
    i would like to be able to give my clients the ability to
    delete or update
    multiple records from 1 page... mind you that this type of
    update woudl only
    be for simple status changes, flags that need to be changed
    and so on...
    Delete... well if they made it to this page they are already
    sure and have
    been warned that they are going to delete the records..
    where can i find such a tutorial on how to complete multiple
    record updates
    or deletes from 1 form...
    thanks

    Server model and software below.
    And hotmail has nothing to do with anything.. its an example
    of what i would
    like to be able to do...
    If you log into hotmail. you have the option to check all the
    emails you
    want to delete.
    well thats what i want to do with my clients sites...
    Each record would have its own checkbox, they select the
    records they want
    to delete or update and they hit submit to process there
    request.
    Using ASP, SQL2005 and DW8
    "bregent" <[email protected]> wrote in
    message
    news:f21upb$nop$[email protected]..
    > >Just trying to find some tutorials on how to update
    multiple records from
    > >1
    >>page of checkboxes
    >
    > What server model?
    >
    >>easiest example is hotmail
    >
    > What does hotmail have to do with this.

  • Insert multiple records from web dynpro

    Hi,
    How to insert multiple records from web dynpro applications to SAP backend system ?
    Thanks,
    sowmya

    Hi soumya..
       if want to multiple row selected  then save into the Sap back End..
       value node--table.
    Backend value node=table_bapi_input;
       back end internal table --tableback.
    int size=wdcontext.nodeTable().size();
    int lead=wdcontext.nodeTable().getLeadSelection();
    table_bapi_input in=new table_bapi_input();
    wdcontext.nodetable_bapi_input().bind(in);
       for(int i=size-1;i>0;i--){
    tableback set=new tableback()
    if(lead==i || wdcontext.nodeTable().ismultiSelection(i)){
    set.setName(wdContext.nodeTable().getTableElementAt(i).getName();
    in.addZc_input(set);
    wdContext.currenttable_bapi_inputElement().modelobject().excute();
    wdContext.nodeOutput().invalidate();
    thanks
    jati

  • Call Multiple Files From Single ColdFusion Scheduled Task

    Our host only allows us to have 5 scheduled tasks per account but we need to run cfml applications to import data for multiple sites (at least 15 processes).  What I'd like to do is combine all the 'sample requests' for all sites into ONE scheduled task that will run them one after another thus cutting back on the number of scheduled tasks needed.
    We're using ColdFusion to connect to a MySQL DB to gather all sample requests. First the app retrieves all the unflagged records from a remote db then begins looping through all the returned records. On the each loop, the app 'scrubs' the data by properly formatting phone numbers, fixing address abbreviations, etc. Next the app saves the scrubbed data to a local MS SQL table then starts the loop over on the next row. Lastly the app sends out an email saying it has completed successfully.
    What I'm trying to do is Create a New Parent App that will run as a scheduled task to do the following:
    - New Parent App Runs as Scheduled Task and calls/includes first of X sample request app files
    - New Parent App runs first sample request app as described above (which can take up to a minute to process)
    - Parent app waits until after first sample request app completes, then Parent App goes on to second sample request app, etc.
    - After all sample requests are complete New App sends completion email with date and time
    The problem I'm having is getting the scheduled task to wait for apppage1.cfm to finish before loading apppage2.cfm and so on. Can you give me a simple codeset that accomplishes this?
    I've attached a sample of the include page the needs to complete before moving on!

    Our approach is a bit more comprehensive.
    First, we (meaning my co-workers) wrote a custom tag that does something like this:
    <cftry>
    <cfinclude the template>
    <cfcatch>
    log any errors
    Then our actual scheduled job go like this:
    set a really long timeout (and none of the actual jobs can have their own timeout)
    set some variables
    use the custom tag for each job we want to run
    send mail if any errors occurred.

  • Multiple records from IDOC should be processed one by one Thru Web service

    Hi Experts,
    I have a requirement where in the idoc (custom one) will collect data from R/3 system at the frequency of One hour and send them to XI and from XI i need to call the Web serice which would post only one record at a time. In this case how should i manage by mapping. Its something like records from a Table needs to be posted sequentially thry Web service at the receiving end..
    Thanks for your replies in advance.
    Regards,
    Rajesh

    Hi,
    Please see the below links
    /people/pooja.pandey/blog/2005/07/27/idocs-multiple-types-collection-in-bpm - Collection of IDoc to Single File
    /people/stefan.grube/blog/2006/09/18/collecting-idocs-without-using-bpm - collecting IDocs without BPM
    /people/michal.krawczyk2/blog/2005/12/04/xi-idoc-bundling--the-trick-with-the-occurance-change - IDOC bundling
    idocs - /people/sravya.talanki2/blog/2005/08/24/do-you-like-to-understand-147correlation148-in-xi
    Idoc - Multiple - interfaces - Idoc to multiple interfaces in XI
    Multiple mappings into one Im - Multiple message mappings in one integration scenario
    Multiple Idocs
    How to send Multiple Idocs?
    Regards
    Chilla..

  • How to get multiple records from internal table through BDC

    PERFORM DYNPRO USING:
      'X'  'SAPMM61L'  '0500',
      ' '  'BDC_OKCODE'  '=NEWC',
      'X'  'SAPMM61L'  '0500',
      ' '  'BDC_CURSOR'  'PLPTU-PLWRK(01)',
      ' '  'BDC_OKCODE'  '=TAKE',
      ' '  'PLPTU-PLWRK(01)' '2531'. (2531 is a plant)
    This is the recording used to get plant via BDC of MS31.
    Using this code i can get only single plant...
    If i want to get multiple plants from an internal table,how i can change this code?
    Since it is a recording i cant put this code in LOOP..ENDLOOP.
    Suggest any method for doing this....
    Awaiting for ur reply...

    Hi,
    While recording also record the scroll down button.
    The you can place different plant in the BDC using loop and endloop
    Regards
    Arun

Maybe you are looking for

  • Difference between bex user exit and macros in functionality?

    Hi all, I need to create a report on material master data. I created an infoset on 0material and 0mat_plant. In the requirem ent, I have a report containing different material numbers followed by attributes in each row. the final column in each row s

  • Will reinstalling my operating system affect my iPod Touch?

    Will reinstalling windows, which will involve uninstalling iTunes and reinstalling iTunes once windows is installed, affect my data on iPod including apps, songs etc?

  • INI: XOQ-01600: OLAP DML error "ORA-4030: out of process memory" OLAP PGA S

    Hi All , While executing the cube generation I am getting an error. Anybody knows the reason ? I have amended the olap_page_pool_size to 200MB and it doesn't help at all . INI: error creating a definition manager, Generic at TxsOqConnection::generic<

  • Best Practice for Initial Load

    Hello, what is the best way of doing the initial load? is there a best practice somwhere that tells you what should be imported first? I want to understand the order ex, 1. load Lookups, 2. Hierarchies, 3. taxonomy and attributes last the main table

  • Problems with widespread

    I have downloaded Firefox so I can play games on facebook as I was having trouble of the widespread, since downloading i still having problems, there is no scroll bar down the bottom to see the whole picture, is there anyone who can help me please