Query transaction

i am writing a stored procedure i have to put transaction in that as there are multiple quires .
create or replace
PROCEDURE usp_addAppointment_Mst
there i am passing 25 parameetrs
pAppid in number,
     pAppcode in VARCHAR,
     pAppdate in date,
     pEmpid in INT,
as
begin
1 query
INSERT INTO Appointment_Mst
     AppId, AppCode, AppDate, EmpId, DutyRosterId, FirstName, MiddleName, LastName...............
VALUES
pAppid, pAppcode, pAppdate, pEmpid, pDutyrosterid, pFirstname, pMiddlename, pLastname, .............
if 1 query runs fine then go to second query else roll back transaction
2 query
INSERT INTO Appointment_Dtls (AppDetailsId, AppId, SlotId,InsertedByUserID,InsertedON,InsertedMacName,InsertedMacID,InsertedIPAddress)
VALUES
(@pAppdetailsid, pAppid, pSlotid, pInsertedByUserID, pInsertedON,@pInsertedMacName,@pInsertedMacID,@pInsertedIPAddress)
if 2 query runs fine then go for 3 query else roll back transaction
3 query
     UPDATE Patient
     SET
     First_Name = pFirstname,
     Middle_Name = pMiddlename,
     Last_Name = pLastname,
     Gender = pSex,
     Age = pAge,
     Date_Of_Birth = pDOB,
WHERE PatientId = pPatientid
if 3 query runs fine then go for 4 query else roll back transaction
4 query
INSERT INTO BBDonorVisit
( VisitID, DonorID, DonorBBNo, VisitDate, VisitNo, VisitTime, BloodGroup, Weight, BloodPressureSys, Temperature )
VALUES ( v_pVisitid, v_pDonorid, v_pDonorbbno, v_pVisitdate, v_pVisitno, v_pVisittime, v_pBloodgroup, v_pVoluntarycardno, v_pDefer, v_pRejectionReason, v_pDeferReason, v_pPulse, v_pTemperature );
like wise some update quires are also there
end;
i have to put these in transaction my requirement is that if any one of the query fails it should rollback entire transaction
please somebody guide me in this thanks in advance

You can include all of your DML statements together.
If one statement, all subsequent transactions won't run and it get rollback.
If all executes successfully without errors, it will commit successfully.
below are some lines for your needs:
CREATE OR REPLACE PROCEDURE ....
BEGIN
1query;
2query;
3query;
4query;
COMMIT;
EXCEPTION
WHEN OTHERS THEN
ROLLBACK;
END;
Suresh.

Similar Messages

  • No user group created - Adhoc Query transaction error

    Hi there,
    Whenever I try to access the Adhoc Query transaction S_PH0_48000513 i get the error "No user group created". The required user groups are present in the system.
    Any idea why am I getting this error?
    Regards,
    Anjali.

    Hi Anjali,
    Pls check if the infoset of your query is assigned to the user group through SQ02-> Role/User gr. Assignment.
    Regards,
    Dilek

  • Query transaction that is 10 mins apart

    How do I query transactions that is 10 mins apart. These
    transactions are timestamped as they were entered

    chris,
    I dont know how far this query helps you but the below query gives you the time which is 10min before the sysdate.
    select to_char(sysdate -0.00694,'DD-MON-YY HH24:MI') from dual;
    =Murali Mohan=

  • SQ01 create query / transaction

    Hi,
    I have created a query in SQ01, and the output report should be linked to a given transaction code. This works ok in developmentsystem, but I cannot create the transaction code for the output report in the testsystem.
    I have tried to transport the transaction code, from the developmentsystem-->test, but the transport fails with error code 8.
    Anyone know how to solve this, so that I can link the report to a transaction?
    Thanks!
    Best regards
    Arne Jakob

    Hi,
    You cannot transport the queries directly ;
    ABAP Queries can be transported to different clients by the following two ways:
    1)     By using the standard program u2018RSAQR3TRu2019
    2)     By using the transport option available on the application bar in Transactions SQ02 or SQ03.
    The transports are to be made in the following order:
    1.     User Group transport
    2.     Infoset transport
    3.     Infoset and Query transport
    4.     Queries transport
    The transports are to be made in the specified order. The User Group is to be transported first, followed by the Infoset and then the Queries
    Hope this helps you
    Regards
    Shiva

  • Query transaction history infotype 768

    Hi!
    Is possible create a user query for history transaction history in infotype 768?
    I don't know what is the table.
    In infotype 0768 if we press "See transaction history" button we can see this records:
    Trans.ty.     PC no     Trans.date             Send.date             State                Error code
    PB          0             23.03.2011     08.04.2011     ENVIADO        
    PA          0             24.03.2011     08.04.2011     ENVIADO        
    But when I try to indentify de origin of this information with the technical information I can't find the table and field that I should query.
    How can I find the table and fields where this data are stored to query it?
    Kind regards,
    Julian.

    Hi Julian,
    .FDI History data is held in table T599SE. You have PERNR, TYPRO and ADDAT fields to help you identify your records (among others).
    Yes you can add it in your query but you would have to enhance your infoset and add some custom ABAP.
    Cheers.
    Antoine

  • ABAP Query (Transaction KOB1 and KSB1)

    Hallo Friends,
    I want to generate a query which will consist of some selected columns of the output list of the transactions KOB1 and KSB1 together. Using F1 and F9 to check the Table Fieldname where the contents of the list where selected, has not been so helpful because the contents where from SAP Structures.
    Can someone tell me the Tranparent tables (not structure) from where I can generate the query, which will include the contects of the list outputs of the above transactions ??
    Please see the select-options of the above transactions too.
    Blacky.

    Hello Blacky,
    Both transaction codes are attached to rpeort RKAEP000.
    Report RKAEP000 utlimatly uses FM K_LINE_ITEMS_SELECT_AND_LIST to select the data and display.
    So, put a break-point at the this FM in the report RKAEP000 to check what are the inputs being given to the FM in both T-codes.
    Regards,
    Naimesh Patel

  • Webi error for master data attributes if universe is on top of BI query

    Hi All,
    We are using BO XI R2 SP5 integrated with SAP BI 7.0.
    We have built a universe on top of a BI query and when we try to build a web intelligence report that includes master data attributes like Customer City,Customer Region etc BO throws the following error:
    Error 1:
    Database error: [SOFA Driver] : Error getting members for hierarchy (level=ZFI_I03/ZFI_I03_Q0003, member=[ZFI_I03___F172], opcode=[ZFI_I03___F172]) . System error in program CL_RSDM_READ_MASTER_DATA and form VALUEREAD-02- (see long text). Contact your Business Objects administrator or database supplier for more information. (Error: WIS 10901)
    For a universe built on a different BI query with master data attributes mentioned above,a different error occuring.
    Error 2:
    Your Web Intelligence session has timed out. Log out and log in again to InfoView. (Error: WIJ 77778)
    We have tried:
    1) We have executed the function module BAPI_MDPROVIDER_GET_DIMENSIONS with necessary inputs query/cube and we got correct output, like members, optional properties, selected properties and restrictions.But, still our problem remains same.
    2) Transaction u201CRSRTu201D and executed the query,transaction RSRV to check SID-tables and the related masterdata.
    Above steps we performed in response to SAP tickets 541052 / 2009,541131 / 2009 based on logs generated,but still the error persists.
    What is working:
    If a universe is built on top af an infocube directly, then there is no problem with master data attributes in webi report.
    Please let us know if you need more details to help us resolve this issue.

    Hi Naresh,
    based on the MDX you can identify that those are navigational attributes and thats why the issue is not happening when talking to the cube directly because when you connect to the cube directly the navigational attributes are not available.
    Take a look at note : 996197
    not sure if it will solve the problem because there are other notes when you search for the error message but this was most of the times the one that resolved the issue.
    the issue is in the BAPI functions
    Ingo

  • SAP Query restriction by Company

    Dear SAP Experts,
    I would like to ask an opinion of how to create a general solution for creating SAP queries regarding this requirement:
    1) Create a query via SAP Query (transaction SQ01)
    2) Use a pre-created infoset (VBRK-VBRP header-detail connection)
    3) Restrict users to see only the data (e.g invoices) where he is allowed to see (based on VBRK-VKORG)
    A question would be, how could I assign a SAP ECC user to a certain Sales Organization/Company so that you can have some sort of a master data of which company he belongs to for reporting/query purposes (in the end, which invoices he is allowed see)?
    Is there a customizable way of linking a user to sales organization/s so that in the end I can use this filter in the SAP Query? Also, is there a way that this is generally done so that for all other queries which require Sales Organization/Company filtering (e.g. VBAK, other Finance reports), this is done "on the fly"/customized?
    Your inputs are appreciated, thanks in advance.

    Hai
    If u r Experience Candidate for 2+ years .Company will  Sponcer the Certification wilth low Cost
    Around Rs 35000.(INR).
    https://websmp204.sap-ag.de/~sapidp/011000358700003517532005E
    http://www.sap.com/services/education/certification/global-certification-policy.epx
    http://www.sapcertification.info/viewpage.php?page_id=40
    http://sapcertification.info/news.php
    Assign Points if it is Useful
    Thank u
    Naveen

  • One more Problem with SAP query

    Hi All,
    I am having a problem with SAP query
    Execution of SAP query transaction is leading to Dump
    the dump says Field 'R01' contains no fields, syntax check on the program shows same error.
    When I tried regenerating the Query in SQ01
    " Query Specification cannot be use to generate list
    Ranked list contains only numeric fields
    Please help me

    Gianpiero Bucchieri wrote:
    > So its important to listening the following tables too: Faktura (invoice), Partner Role, Partnernumber and the requierements number. The table are EKKO EKPO AND VRKPA OR vbkd, but if I join this table the query doesn't listining any results. If I cancel this 3 or 4 table and I start the query, the listening are ok. 
    >
    I am not sure what business process you are describing here - is it some kind of third-party sales order? If so, your join is wrong.
    From VB E P, firled BANFN and BNFPO you can go to table EBAN, where in field EBELN you will find the number of the purchase order (if somebody already had an MRP+Me58 run over the PR) which will lead you to table EKKO, and EKPO.
    So what we have here (essentially is):
    VBAK -> VBAP -> VBEP -> EBAN -> EKKO -> EKPO
    But that only solves one of your problems - you still have a long way to go to get invoices, partner and partner roles into there and I am beginning to ask myself what exactly it is you want to evaluate.
    Care to explain?
    Edited by: Mylène Dorias on Apr 1, 2010 2:10 PM

  • ABAP Query - Differences in generated code after upgrade

    Hi all,
    We have upgraded to ECC 6. from 4.6C. We are experiencing differences between the behaviour of some queries in different systems. This can be as subtle as some of the output parameters not appearing on the selection screen (such as the options within the output format box, i.e. ABAP list, ABC analysis etc), to actual syntax errors in queries where there is no difference between the infosets and queries in the two systems.
    A pattern I have noticed is that there are big differences in the generated code behind the query transaction.
    In production, where we have the problems, the generated code contains a lot of include programs starting with /1BCDWB/, I am not sure what these are, but the generated code in the systems that work don't have these. I am not sure what is triggering the code to generate differently, but I think if I can find out then it will point me in the right direction.
    any help appreciated.
    Stephen

    Stephen,
    I have noticed the queries are generated with two different formats. One is very compact and has multiple different includes each for data, selection screen, various selection screen events, etc. Other is a single big non-modular program.
    We have also noticed generated program template gets reset to the non-modular kind, if additional code is added in the selection-screen code section of the infoset. They do not return to the original even after you undo the changes.

  • Calculation Field in Query

    Hi,
    I am devloping a query report of the confirmation details of process order.
    In which the execution start/finish date & time are confirmed during the confirmation process.
    The report of the same can be derived from COOISPI under operations.
    But, I want to calculate the duration on the basis of start/finish date & time. which is not available in standard COOISPI report or in table.
    I have created the query using the same tables as in COOISPI - operations. And now, I want to add an extra field which is not a part of the table. Also, how to assign a formula = (end date+end time)-(start date + start time)?
    I am not an ABAP person. I am just a simple PP/QM person. So, I don't know more about the same.
    Thanks in advance.
    Dipesh

    Hello Dipesh,
    You need to create an additional field.  Did you create an Infoset for this query (transaction code SQ02). 
    1.  After you create your table joins, select pushbutton labeled "Extras."  Select create icon, then enter field name and select radiobutton "Additional field" on popup box for Additonal information.  On popup box "Additional field" enter the new field text information, type and length.
    2.  You should see your new field in a list on the right-side of screen.  Select "CodingforAddition" icon.  Program your logic here.
    3.  Make sure you add your new field to a field group.  Generate your infoset. 
    4.  Call transaction SQ03 and assign your Infoset to a user group.
    5.  Call transaction SQ01 and create a query based on the Infoset you created.
    Kind Regards,
    Rae Ellen Woytowiez

  • Abap coding in SAP query (SQ01)

    Hi,
    By using the a table like for MSEG if i want to retrieve data for the movement type 101 (receipts from vendor), i can build a query using this table and retrieve data - my problem starts when the system shows individual line items instead of cumulated result as mentioned in the following example.
    Example :-
    for the date 01.07.2007 - i have 10 entries (101 movement) of quantity 1,2,3,4,5,6,7,8,9,10 against a vendor V1. - the query lists all the 10 entries.
    But what is required is the cumulated entry against the vendor like shown below
    vendor    receipt
    V1         55.
    What abap coding should be written (provide the sample code) and the where should it be written in the query transaction SQ01
    Regards,
    M.M

    Hi Magesh,
    If you do not wish to see the detail lines, then you do not need to create them.  Just create the Statistics portion only.
    If you wish to see 'summarized Vendor quantity by day', then you might sort on Vendor first, then posting date second.  Or, vice versa, depending on your business requirement.  I would think that you might also wish to include Material in the sort, since each Material is probably valued differently.
    For more info on creating statistics in SAP Query, refer to
    http://help.sap.com/erp2005_ehp_02/helpdata/en/d2/cb4256455611d189710000e8322d00/frameset.htm
       Regards,
       Bruce

  • Adding additional fields in Sql Query (SQ01)

    Hi..
    please tell me all the steps to use additional fields option in  sap query (transaction code: SQ01)? can i use mandt field as additional field?
    Thanks and Regards
    Sri.

    Hi,
    You can add it in infoset using extra button.
    Here you can add the filed and the respective code for this field and add this in SQ01 in oytput list.
    Thanks
    Ajay

  • Is SAP Query (SQ01) supported by Visual Composer?

    Do you know if it is possible to easily integrate a query developed in an ABAP backend system via SAP Query (transaction SQ01) in Visual Composer?
    Sergio

    Hi Jorn,
    I must go, but I copy you a Link from a presentation. I don't have the time to control it.
    Hope it helps.
    <a href="http://help.sap.com/saphelp_nw04/helpdata/en/2f/741a403233dd5fe10000000a155106/frameset.htm">sap.help.com</a>
    Best Regards,
    marcel

  • How to create parameter with multiple selection in a query (SQ02) ?

    Hi Exports
    Do you know how to create parameter with multiple selection in a query (transaction SQ02)?
    thanks.

    Hi
    i know how to create user parameter at SQ02,
    the question is how to create multiple selection parameter?

Maybe you are looking for

  • Cannot install SP1 on Windows 2008 R2 64bit 0x800f0826

    Hello, I'm having an error when I'm trying to deploy service pack 1 of Windows Server 2008 R2. I tryed install the SP1 in a workgroup machine and the results were successful. But when I'm trying to install in my Domain it doesn't work, I think that s

  • Need to count the number of times the Basic Finish data chages

    HI Expertes, I have a requirement I need to count number of times the Basic finish date chaged for PM work order. I went throug our forums I got some info like using a standard function module CHANGEDOCUMENT_READ_HDRS_ONLY CHANGEDOCUMENT_READ_HEADERS

  • Some features/options needed when using mobileme gallery in iframe

    hi@all i have built this iweb site and embedded my mobilemegallery like this: <iframe width="1280" height="900 " frameborder="0" src="http://gallery.me.com/friereida#100008&view=mosaic&sel=0" more attributes> </iframe> so what i need is: how can i ac

  • How do you un-istall a printer

    Ho wdo you un-install a printer

  • Unable to install EUL status workbooks??

    I am trying to install EUL status workbooks using EUL4.eex but i get the following error: ORA-02289 sequence does not exist I have already executed eul4.sql & eul4_apps.sql successfully. But i don't know what is missing there? I am using disco 4. App