How to do rollback with sample code.
Hi all,
I have a requirement : we are updating the record by FM hr_maintain_masterdata in three table and if the record is get updated in two table but not in one table, it should do rollback . it should not allow to update the record in other tables also.
Kindly provide the sample code for the same.
Thanks in advance
Shweta
Edited by: shweta singh on Dec 20, 2008 1:39 PM
Hi,
Just type ROLLBACK WORK in the error handling code blocks. This works only, if the function module doesn't set an explicit COMMIT WORK in itself.
COMMIT WORK.
*Changes on your first table
CALL FUNCTION hr_maintain_masterdata
IF sy-subrc <> 0.
ROLLBACK WORK.
* EXIT or MESSAGE Statement
ENDIF.
*Changes on your second table
CALL FUNCTION hr_maintain_masterdata
IF sy-subrc <> 0.
ROLLBACK WORK.
* EXIT or MESSAGE Statement
ENDIF.
*Changes on your third table
CALL FUNCTION hr_maintain_masterdata
IF sy-subrc <> 0.
ROLLBACK WORK.
* EXIT or MESSAGE Statement
ENDIF.
Regards
Mark-André
Edited by: Mark-André Kluck on Dec 20, 2008 2:53 PM
Similar Messages
-
How to use TreeByKeyTableColumn (with sample code)
Hi Guys,
Can anyone tell me How to bind data with TreeByKeyTableColumn ? (with sample code). Is it possible to add checkbox with TreeByKeyTableColumn? Kindly aware me further in this regards....
Thanks,
RavinHi
Answering to following question
How to bind data with TreeByKeyTableColumn
Create the Context
Click on the Context tab of the view. Create a node name it as "AIR_LINES". Set the Cardinality as 0...N. Make it a Singleton Node. Give a method name in supply function column by name "GENERATE_TREE".
Then we will create attributes required for the tree column. We require 5 attributes
1. Attribute which contains the current level of the node. Create an attribute called "NODE_LEVEL" of type STRING.
2. Attribute which contains the parent level of the node. Create an attribute called "PARENT_LEVEL" of type STRING.
3. Attribute which contains the contents of the node. Create an attribute called "NODE_CONTENT" of type STRING.
4. Attribute which contains X or Space depending upon the node is expanded or not. Create an attribute called "EXPANDED" of type WDY_BOOLEAN.
5. Attribute which contains X or Space depending upon the type of the node, whether the node is a branch or a leaf. Create an attribute called "IS_LEAF" of type WDY_BOOLEAN.
Click on the layout tab of the view. Add UI element of type Table, give the name as 'Tree Table'. Bind the DATASOURCE property of the table to the AIR_LINES node of the view context.
Give heading to the table as "Booking Details".
Right click on table node crated and chose Insert Master Column.
Name it as "TREE_NODE" and chose TreeByKeyTableColumn from the dropdown
Bind the 4 properties with context attributes we have already created.
Expanded -> Expanded.
Is_leaf -> Is_leaf.
Parent_key -> Parent_level
Row_key -> Node_level
Give heading to the tree node in the text field.
Insert a cell editor in the tree column and chose the type as Text view.
Bind the text property of the text view to the NODE_CONTENT attribute of the context.
Similarly create a table column to display the second column i.e. Node type.
Right click -> Insert table column -> Give the heading in the text property of the header (Node Type).
Right click -> Insert Cell Editor -> Bind the text property to NODE_TYPE attribute of the context.
Click on the Methods tab of the view. You will find the method of type supply function which we created during the creation of node. Double click and write the following code.
METHOD generate_tree .
Ideally this code must go to a method of a class which will return four internal tables
start of Model code
TYPES : BEGIN OF ty_scarr, " Air line Table
carrid TYPE s_carr_id,
END OF ty_scarr.
TYPES : BEGIN OF ty_spfli, " Flight Connection Table
carrid TYPE s_carr_id,
connid TYPE s_conn_id,
END OF ty_spfli.
TYPES : BEGIN OF ty_sflight, " Flight Table
carrid TYPE s_carr_id,
connid TYPE s_conn_id,
fldate TYPE s_date,
END OF ty_sflight.
TYPES : BEGIN OF ty_sbook, " Flight Booking Table
carrid TYPE s_carr_id,
connid TYPE s_conn_id,
fldate TYPE s_date,
bookid TYPE s_book_id,
END OF ty_sbook.
DATA : lt_scarr TYPE TABLE OF ty_scarr.
DATA : lt_spfli TYPE TABLE OF ty_spfli.
DATA : lt_sflight TYPE TABLE OF ty_sflight.
DATA : lt_sbook TYPE TABLE OF ty_sbook.
DATA : ls_scarr TYPE ty_scarr.
DATA : ls_spfli TYPE ty_spfli.
DATA : ls_sflight TYPE ty_sflight.
DATA : ls_sbook TYPE ty_sbook.
SELECT carrid
FROM scarr
INTO TABLE lt_scarr
UP TO 2 ROWS.
IF lt_scarr[] IS NOT INITIAL.
SELECT carrid connid
FROM spfli
INTO TABLE lt_spfli
FOR ALL ENTRIES IN lt_scarr
WHERE carrid EQ lt_scarr-carrid.
IF lt_spfli[] IS NOT INITIAL.
SELECT carrid connid fldate
FROM sflight
INTO TABLE lt_sflight
FOR ALL ENTRIES IN lt_spfli
WHERE carrid EQ lt_spfli-carrid
AND connid EQ lt_spfli-connid.
For an additional level of branching
IF lt_spfli[] IS NOT INITIAL.
SELECT carrid connid fldate bookid
FROM sbook
INTO TABLE lt_sbook
FOR ALL ENTRIES IN lt_sflight
WHERE carrid EQ lt_sflight-carrid
AND connid EQ lt_sflight-connid
AND fldate EQ lt_sflight-fldate.
ENDIF.
ENDIF.
ENDIF.
End of Model code
Start of code for generation the tree
data declaration
DATA lt_table TYPE wd_this->elements_air_lines.
DATA ls_table LIKE LINE OF lt_table.
DATA lvl1_index TYPE string.
DATA lvl2_index TYPE string.
DATA lvl3_index TYPE string.
DATA lvl4_index TYPE string.
Level 1
LOOP AT lt_scarr INTO ls_scarr.
lvl1_index = sy-tabix.
condense lvl1_index.
create a row
ls_table-node_level = lvl1_index. " 1 st level
ls_table-parent_level = ''. " No parent
ls_table-node_content = ls_scarr-carrid.
ls_table-node_type = 'Air Line'.
ls_table-is_leaf = abap_false.
INSERT ls_table INTO TABLE lt_table.
clear ls_table.
Level 2
LOOP AT lt_spfli INTO ls_spfli.
lvl2_index = sy-tabix.
condense lvl2_index.
create a row
concatenate lvl1_index `.` lvl2_index into ls_table-node_level.
ls_table-parent_level = lvl1_index. " Parent 1 st level
ls_table-node_content = ls_spfli-connid.
ls_table-node_type = 'Flight Connection'.
ls_table-is_leaf = abap_false.
INSERT ls_table INTO TABLE lt_table.
clear ls_table.
Level 3
LOOP AT lt_sflight INTO ls_sflight.
lvl3_index = sy-tabix.
condense lvl3_index.
create a row
concatenate lvl1_index `.` lvl2_index `.` lvl3_index into ls_table-node_level.
concatenate lvl1_index `.` lvl2_index into ls_table-parent_level.
ls_table-node_content = ls_sflight-fldate.
ls_table-node_type = 'Flight'.
ls_table-is_leaf = abap_true.
INSERT ls_table INTO TABLE lt_table.
clear ls_table.
If you want an additional level it can be programmed like this
Level 4
*LOOP AT lt_sbook INTO ls_sbook.
lvl4_index = sy-tabix.
condense lvl4_index.
create a row
concatenate lvl1_index `.` lvl2_index `.` lvl3_index `.` lvl4_index into ls_table-node_level.
concatenate lvl1_index `.` lvl2_index `.` lvl3_index into ls_table-parent_level.
ls_table-node_content = ls_sbook-bookid.
ls_table-node_type = 'Booking'.
ls_table-is_leaf = abap_true. " as its the final level in our hier archy
INSERT ls_table INTO TABLE lt_table.
ENDLOOP.
ENDLOOP.
ENDLOOP.
ENDLOOP.
bind all the elements
node->bind_table(
new_items = lt_table
set_initial_elements = abap_true ).
ENDMETHOD. -
Look for JDeveloper Tutorial with samples code
Hello All ,
my name is Ron ,
i'm new user of JDeveloper i'm looking for a place to start a tutorial "How to use
the JDeveloper ? " with samples code .
from very basic use ( Hello world program ) to addvanced programming ( Like GUI Forms and Database )
please show me links where to start learning from
thanks in advanceThe tutorials in the JDeveloper help system are a very good place to start. Choose Help | Help Topics from the JDeveloper menu then click the Tutorials book in the Help navigator. The tutorials are also available on OTN, see:
http://otn.oracle.com:8877/jdeveloper/help/
You may also find the 'how to' documents and samples on OTN helpful:
Oracle9i JDeveloper How To Documents
http://otn.oracle.com/products/jdev/howtos/content.html
Oracle9i JDeveloper Sample Code
http://otn.oracle.com/sample_code/products/jdev/content.html
Hope this helps.
- jon -
Sun ejb tutorial compilation problem with sample code
I have been trying to follow the ejb tutorial off of Sun's web site. However, I get the following problem when I try to compile the sample code.
prompt>javac Demo.java
works fine
Prompt>javac DemoBean.java
works fine
Prompt>javac DemoHome.java
DemoHome.java:23: cannot resolve symbol
symbol : class Demo
location: interface ejb.demo.DemoHome
public Demo create() throws CreateException, RemoteException;
^
1 error
Prompt>
Can anyone help me out as I have tried several books which conveniently skip the part about compiling errors.
I noticed I don't have a CLASSPATH variable and then i created one with just '.' in it and that didn't work. any help would be appreciated as this is driving me crazy. Thanks.try to change the order of the exception.
first RemoteException and then CreateException -
How can I install the sample code in my pc?
I have installed Oracle 8.17 on my pc, my operating system is Win2000. But now I cannot install the sample code on OTN. the requirement is winNT, is that the problem? I think Win2000 should be okay. Who can give me some advice, thank you in advance!!!
Do what Ethmoid mentioned: publish your site to a folder on your hard drive and open the html file with a text or html editor like the free TextWrangler. That's the only way to view or edit the code created by iWeb when it publishes the website.
However, there is a website design application, Flux, that can open a published iWeb site and view the code and webpage simultaneously.
OT -
Do you know how to call RDF with java code?
Say me a tip!
Environment:
Linux, Reports 6i,java beans, jsp
My mission is to run a report with java code.
But I don't know how to.
Basic flow is :
On web browser, call jsp a program and
that jsp call a java module,
and the java module call a reports RDF with parameters
I don't need reponse message from rwcgi60 or rwrun60.hello,
the easiest way is to use the regular HTTP request to either the servlet or the CGI to run a report request from within a java-class.
regards,
the oracle reports team --pw -
How can I get the sample code for crawler plugins?
Hi,
One SES document mentioned that there are three sample crawler plugins, which reside in $ORACLE_HOME/search/sample/agent. However, I couldn't find them. Did I miss installing something? Can anyone share with me the sample code?
Thanks.
Jun GaoThe original 10.1.6 sample plugins are no longer distributed in 10.1.8.1 as there were a few problems with them. I would suggest you take a look at
Simple File Crawler
http://www.oracle.com/technology/products/oses/pdf/Buidling_Custom_CrawlersJan12_07.doc
Sourcecode here:
http://www.oracle.com/technology/products/oses/files/simplefilecrawlerpluginmanager.java
and here
http://www.oracle.com/technology/products/oses/files/simplefilecrawlerplugin.java
And the two crawlers under "Sample Code" on the OTN page:
http://www.oracle.com/technology/products/oses/index.html -
How to render audio with sample rate 48000hz using jmf
hi,
In my application i need to play the audio with jmf player with sampling rate 48000hz. but i found that jmf player plays the audio with sampling rate of 44100hz only.but my application needs to play the audio with sampling rate of 48000hz .please help me how to do this using jmf .
thanks in advance,hi,
In my application i need to play the audio with jmf player with sampling rate 48000hz. but i found that jmf player plays the audio with sampling rate of 44100hz only.but my application needs to play the audio with sampling rate of 48000hz .please help me how to do this using jmf .
thanks in advance, -
How to unlock iphone4 with the code
how to unlock iphone4 with the code
the page where i will put the codes is not coming up on itunes.
any help further. -
How do I deal with error code -8003 ?
When I try to empty my Trash with a certain app in it I get error code -8003. I can't find reference to that code anywhere and do not know how to clean up the trash.
"The operation can’t be completed because an unexpected error occurred (error code -8003)."Try using Trash It!
Possibly helpful articles:
The X Lab: Solving Trash Problems
You can't empty the Trash or move a file to the Trash
Error -8003 or other problems with emptying the OS X Trash -
How to avoid attachment with mail code
Hi ,
I have written a code for sending e-mail notification .Code is working fine as e-mail is triggered as expected but when mail is recieved an attachment comes along with it named attzurlm.dat. Plz provide pointers how to remove this attachment .
PFB the code
public String sendEmail( List<String> recipientList, String subject, String message , String from,String cc,String logoPath,Logger LOGGER) {
try{
functionName="sendEmail()";
//Set the host smtp address
Properties props = new Properties();
Utils util=new Utils();
//Fetching values from lookup
tcLookupOperationsIntf lookupIntf = Platform.getService(tcLookupOperationsIntf.class);
String smtpHost=util.getLookUpValueByKey("LookUp.EmailInfo","CG_EMAIL_SERVER",lookupIntf,LOGGER);
LOGGER.debug(functionName+ " SMTP Host Name :"+smtpHost);
props.put("mail.smtp.host", smtpHost);
props.put("mail.smtp.auth", "false");
// create some properties and get the default Session
Session session = Session.getDefaultInstance(props, null);
//session.setDebug(debug);
// create a message
Message msg = new MimeMessage(session);
//Check if cc is required
if (cc.length() != 0) {
InternetAddress ccAddress = new InternetAddress(cc);
msg.setRecipient(RecipientType.CC, ccAddress);
// set the from and to address
InternetAddress addressFrom = new InternetAddress(from);
msg.setFrom(addressFrom);
InternetAddress[] addressTo = new InternetAddress[recipientList.size()];
for (int iCountMail = 0; iCountMail < recipientList.size(); iCountMail++)
addressTo[iCountMail] = new InternetAddress(recipientList.get(iCountMail));
msg.setRecipients(Message.RecipientType.TO, addressTo);
// Setting the Subject and Content Type
msg.setSubject(subject);
msg.setText(message);
MimeMultipart multipart = new MimeMultipart("related");
// first part (the html)
BodyPart messageBodyPart = new MimeBodyPart();
String htmlText = "<br>"+ message + "<BR><BR><P align=\"left\">" + "<br><img src=\"cid:image\"><br><br>" + "</P>";
messageBodyPart.setContent(htmlText, "text/html");
multipart.addBodyPart(messageBodyPart);
messageBodyPart = new MimeBodyPart();
DataSource fds=null;
try{
fds= new FileDataSource(logoPath);
}catch(Exception exe){
LOGGER.debug("Function:+ sendEmial :logofile path is missing"+logoPath);
messageBodyPart.setDataHandler(new DataHandler(fds));
messageBodyPart.setHeader("Content-ID", "<image>");
multipart.addBodyPart(messageBodyPart);
// put everything together
msg.setContent(multipart);
Transport.send(msg);
LOGGER.info("Email sent to recipient :"+recipientList);
}catch(MessagingException msgExc){
LOGGER.error(functionName+" Error occurred while sending email:"+msgExc);
msgExc.printStackTrace();
return "ERROR";
}catch(Exception exception){
LOGGER.error(functionName+" Error occurred while sending email:"+exception);
exception.printStackTrace();
return "ERROR";
return "SUCCESS";
}Code Goes as below in curley braces :
public String sendEmail( List<String> recipientList, String subject, String message , String from,String cc,String logoPath,Logger LOGGER) {
try{
functionName="sendEmail()";
//Set the host smtp address
Properties props = new Properties();
Utils util=new Utils();
tcLookupOperationsIntf lookupIntf = Platform.getService(tcLookupOperationsIntf.class);
String smtpHost=util.getLookUpValueByKey("CG.LookUp.EmailInfo","EMAIL_SERVER",lookupIntf,LOGGER);
LOGGER.debug(functionName+ " SMTP Host Name :"+smtpHost);
props.put("mail.smtp.host", smtpHost);
props.put("mail.smtp.auth", "false");
// create some properties and get the default Session
Session session = Session.getDefaultInstance(props, null);
//session.setDebug(debug);
// create a message
Message msg = new MimeMessage(session);
//Check if cc is required
if (cc.length() != 0) {
InternetAddress ccAddress = new InternetAddress(cc);
msg.setRecipient(RecipientType.CC, ccAddress);
// set the from and to address
InternetAddress addressFrom = new InternetAddress(from);
msg.setFrom(addressFrom);
InternetAddress[] addressTo = new InternetAddress[recipientList.size()];
for (int iCountMail = 0; iCountMail < recipientList.size(); iCountMail++)
addressTo[iCountMail] = new InternetAddress(recipientList.get(iCountMail));
msg.setRecipients(Message.RecipientType.TO, addressTo);
// Setting the Subject and Content Type
msg.setSubject(subject);
msg.setText(message);
MimeMultipart multipart = new MimeMultipart("related");
// first part (the html)
BodyPart messageBodyPart = new MimeBodyPart();
String htmlText = "<br>"+ message + "<BR><BR><P align=\"left\">" + "<br><img src=\"cid:image\"><br><br>" + "</P>";
messageBodyPart.setContent(htmlText, "text/html");
multipart.addBodyPart(messageBodyPart);
messageBodyPart = new MimeBodyPart();
DataSource fds=null;
try{
fds= new FileDataSource(logoPath);
}catch(Exception exe){
LOGGER.debug("Function:+ sendEmial :logofile path is missing"+logoPath);
messageBodyPart.setDataHandler(new DataHandler(fds));
messageBodyPart.setHeader("Content-ID", "<image>");
multipart.addBodyPart(messageBodyPart);
// put everything together
msg.setContent(multipart);
Transport.send(msg);
LOGGER.info("Email sent to recipient :"+recipientList);
}catch(MessagingException msgExc){
LOGGER.error(functionName+" Error occurred while sending email:"+msgExc);
msgExc.printStackTrace();
return "ERROR";
}catch(Exception exception){
LOGGER.error(functionName+" Error occurred while sending email:"+exception);
exception.printStackTrace();
return "ERROR";
return "SUCCESS"; -
How to download iTunes with error code 24
I have tried the fixes from Windows and I have uninstalled everything to do with iTunes as I saw on another thread as well. So now I have no iTunes on my computer running Windows 7 and I still get the error code 2324 when trying to get the latest version of iTunes. Any other thoughts on how to fix so I can have iTunes? I am extremely frustrated.
With the Error 2, let's try a standalone Apple Application Support install. It still might not install, but fingers crossed any error messages will give us a better idea of the underlying cause of the issue.
Download and save a copy of the iTunesSetup.exe (or iTunes64setup.exe) installer file to your hard drive:
http://www.apple.com/itunes/download/
Download and install the free trial version of WinRAR suitable for your PC (there's a 32-bit Windows version and a 64-bit Windows version):
http://www.rarlab.com/download.htm
Right-click the iTunesSetup.exe (or iTunes64Setup.exe), and select "Extract to iTunesSetup" (or "Extract to iTunes64Setup"). WinRAR will expand the contents of the file into a folder called "iTunesSetup" (or "iTunes64Setup").
Go into the folder and doubleclick the AppleApplicationSupport.msi to do a standalone AAS install.
Does it install properly for you? If so, see if iTunes will launch without the error now.
If instead you get an error message during the install, let us know what it says. (Precise text, please.) -
How to compile and run sample code
Hi All,
I'm beginner in Javacard. I just installed javacard dev kit. I have followed the instruction to set up javacard environment (install javacard, install ant, set path)I
I tried to compile Hello World sample. But I got many error messages. It's because it doesn't recognize javacard.framework. It doesn't recognize javacard API that is used in HelloWorld.java
I think it's strange since I compile it under JC_HOME and I also have set up the paths (jdk, javacard, and ant).
Could anyone help me? Is there anything need to set?
Thanks.
dpiTried running the build.xml with ant from the sample directory?
So at the location of build.xml, type "ant".
Recommend using ant to compile, convert, scriptgen, concat different script files
together. Save you headache.
Edited by: kicklee on Aug 16, 2008 4:20 PM -
i´ve got this to link a time line to a url.... is that
correct?
to be clear i just need to open a "menu2.swf" related in what
page i´m ex. if i´m at ww.xxxxxxxxxx.com/clientes.html, i
needed flash to start a "menu2.swf" from frame 30 and playing
// AS3
var url:TextField = new TextField();
url.text = root.loaderInfo.parameters.clientes;
gotoAndPlay(30);
// AS3
var url:TextField = new TextField();
url.text = root.loaderInfo.parameters.sevicios;
gotoAndPlay(20);
i got this code for the html:
<script type="text/javascript">
var so = new SWFObject("flash/menu2.swf", "menu", "100",
"475", "9", "#FFFFFF");
so.addVariable("flashvars", value="url=clientes");
so.write("flashcontent");
</script>your parameter is url, not clientes and not sevicios. those
are the parameter values. -
Please give me a idea with sample code explainingBDC with TAB control
Hello,
Can anybody give me a idea of doing BDC with TAB control.
Regards
Mavehi, you need to show the BDC script in TAB control?
then you can reference to the screen of SHDB, maybe
thanks
Maybe you are looking for
-
I am unable to update the computer clock. Tried Sys Preferences--just get the spinning basketball.?
-
My external Hard Drive won't transfer files to Mac HD and causes Finder to crash
My external Hard Drive (Western Digital 2TB hard drive in a ICYBOX 2-bay USB 2.0 HD Dock) won't transfer files to the Mac HD. The transfer box comes up but stays at the 'estimating time' stage and remains like that. No matter how big the file/group o
-
After upgrading to Tiger, freeze after waking from sleep on PM G4
My experience with Tiger in the past week as not been great. The reason I upgraded was to get iSync 2.1, so that my Moto E815 phone could be sync'd with my OSX AddresBook and iCal. This wasn't possible with the latest version of Panther. So, I upgrad
-
How to create supplier DN in consumer for single master replication? sk
-
When I convert a 13 page ebook to pdf I receive this message: Cannot extract the embedded font 'HWNDJR+13gerjrwlenkqok' some characters may not display or print correctly. I check the downloaded pdf I just created and there are characters missing fro