How to check whether a node exist in a Particular Level. (xmltype)
hi,
please help me to check whether a particular node exists in one level.
for eg
I have the following xml
<map>
<entry>
<key>
heading1
</key>
<map>
<entry>
<key> sub1 heading1</key>
<value> sub1 heading1 value </value>
</entry>
<entry>
<key> sub2 heading1 </key>
<value> sub2 heading1 value </value>
</entry>
</map>
</entry>
<entry>
<key>
heading2
</key>
<map>
<entry>
<key> sub1 heading2</key>
<value> sub1 heading2 value </value>
</entry>
<entry>
<key> sub2 heading2 </key>
<value> sub2 heading2 value </value>
</entry>
</map>
</entry>
</map>i need to check how many heading exists in this xml.
I am checking like
i:=1;
l_section := ip_xml.extract('//map/entry');
WHILE l_section.existsnode('entry[' || i|| ']') = 1 LOOP
// extract the key name within entry tag
// print the key name.
i:=i+1;
end loop;but iam getting all the key name like
heading1
sub1 heading1
sub2 heading1
heading2
sub1 heading2
sub2 heading2
I need only heading1 and heading2. how can I check whether a particular node exist in particular level.
first level , second level etc. Please help
but iam getting all the key nameThat's because you're using a descendant axis : //map/entry
SQL> DECLARE
2
3 ip_xml xmltype := xmltype('<map>
4 <entry>
5 <key>
6 heading1
7 </key>
8 <map>
9 <entry>
10 <key> sub1 heading1</key>
11 <value> sub1 heading1 value </value>
12 </entry>
13 <entry>
14 <key> sub2 heading1 </key>
15 <value> sub2 heading1 value </value>
16 </entry>
17 </map>
18 </entry>
19 <entry>
20 <key>
21 heading2
22 </key>
23 <map>
24 <entry>
25 <key> sub1 heading2</key>
26 <value> sub1 heading2 value </value>
27 </entry>
28 <entry>
29 <key> sub2 heading2 </key>
30 <value> sub2 heading2 value </value>
31 </entry>
32 </map>
33 </entry>
34 </map>');
35
36 BEGIN
37
38 for r in (
39 select heading, headno
40 from xmltable( '/map/entry/key'
41 passing ip_xml
42 columns heading varchar2(30) path '.'
43 , headno for ordinality )
44 )
45 loop
46 dbms_output.put_line('Heading '||r.headno||' = '||r.heading);
47 end loop
48 ;
49
50 END;
51 /
Heading 1 =
heading1
Heading 2 =
heading2
PL/SQL procedure successfully completed
Similar Messages
-
How to check whether a file exist in the program folder or not?
Hi guys,
how to check whether a file exist in the program folder or not? Let is say i recieve a file name from user then i want to know if the file is there not and act on that base.
abdulLook at the class java.io.File and the .exists() method:
http://java.sun.com/j2se/1.4/docs/api/java/io/File.html -
How to check whether portal user exists or not using UM API.
Hi Experts,
Let us say i need to create an user account "PortalUser",i know how to create an user,setting first name,lastname,password for that.
but here before creating the portal user, i need to check whether that user exists or not.If user already exists ,then i need to skip the below for creating the user.
IUserFactory userFact = UMFactory.getUserFactory();
IGroupFactory groupFact = UMFactory.getGroupFactory();
IRoleFactory roleFact = UMFactory.getRoleFactory();
IUser tuser = userFact.getUserByLogonID("PortalUser");
IUserMaint newUser = userFact.newUser("PortalUser");
newUser.setFirstName("PortalUser");
newUser.setLastName("Test");
newUser.setEmail("PortalUser.Testatgmaildotcom");
//Locale PortalLanguage = new Locale(Lang.toLowerCase(), "");
Locale PortalLang=new Locale("en");
newUser.setLocale(PortalLang);
newUser.save();
newUser.commit();
IUserAccount userAcc = UMFactory.getUserAccountFactory().newUserAccount("PortalUser", newUser.getUniqueID());
userAcc.setPassword("test1test$");
userAcc.save();
userAcc.commit();
Thanks in advance.
Thanks
Sony.Hi,
Try this code,
IUserFactory factory = UMFactory.getUserFactory();
IUser user = factory.getUserByLogonID(userId);
lastName = user.getLastName();
firstName = user.getFirstName();
refer this pdf,its very helpful
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/events/webinars-nw-rig/using%20the%20user%20management%20api%20with%20ep%20applications%20-%20webinar%20powerpoint.pdf
Regards,
Sunaina Reddy T -
How to check whether transport path exist between two systems in sld??
Hi,
I have two systems namely 'A' and 'B' and created business systems for both of them.Then i created transport path between the two systems.How i check whether what i have done is right in SLD.<b>WRT to CMS</b>
am not sure with this but u can try:
1. Start CMS: http://<host>:<J2EE Engine http port>/webdynpro/dispatcher/sap.com/tcSLCMS~WebUI/Cms.
2. Goto lansdscape configurator and check there
Message was edited by:
Prabhu S -
How to check whether a Record Exists or not in Ztable
Hi all,
I have Req like this
In ZTable i have 2 fields * Legacy System , Legacy Material No*
Environment Value is coming in one of the field in Idoc
The logic is if the Environment Value is UK and a Record Exists on the ZTable for Legacy Sysyetm = Leg1 means i have send Legacy Material No , else Send 01
Please suggest me the process for this
REgards
Vamsi
Edited by: Vamsi Krishna on May 19, 2009 5:31 PMHi Michal / Aamir,
Thanks for your replies.
The ZTable is at R/3 side only, iam using RFC Lookup for this, but iam bit confuse on how to construct the logic to check whether there is a record Exists or not on Ztable
Logic shld be If the Environment value is UK and a record exists on the Ztable for Legacy system "ABC" means then send Legacy material number else send 01
In Table we will have the fields Legacy System Legacy Material No & Environment value is coming from Idoc itself( Ex: UK or US)
Regards -
How to check whether a table exists in database
test9997 is table already made in database with 3 columns :1st-varchar,2nd-number,3rd-number
declare
var1 varchar2(20);
var2 number(20);
var3 number(20);
begin
plvar1 :='this is again pl/sql';
plvar2 := 12;
plvar3 := 13;
IF (???? condition for existence of table say test1111??????) then
create table test1111(
var1 varchar2(20);
var2 number(20);
var3 number(20);
insert into test1111(plvar1,plvar2,plvar3);
else
insert into test1111(plvar1,plvar2,plvar3);;
end if;
end;
in the above code i want to check existence of a table and insertion or updation will be based on it after creation if it doesnt exist.
how to do it
please help asapYou're in the wrong forum (this one is for issues with the SQL Developer tool). You'll get more answers in the SQL And PL/SQL forum.
Have fun,
K. -
How to check whether a file exists or not
i am in an image uploading utility. i hav succesfully uploaded the image to the server directory (say /uploads). but when displaying the uploaded image, i wanna show the picture only if the image exits (bcoz for some records there is no image). so i hav used this code
if(new File("uploads/1.jpg").exists())
out.print("image exists");
but its not working for me. i got it working fine when i give the full path "D:/Tomcat/webapps/diary/admin/uploads/1.jpg". but i think giving this absolute path is not an efficient method bcoz its a web application, bcoz i may not be able get the absolute path always. so how can i do this by specifieing the relative path
help me ASAP if u can
aleensHaii ameen
This is one way to rectify your problem..
if(new File("uploads/1.jpg").exists())
out.print("image exists");
instead of this u can write like
<%
ServletConfig cf=getServletConfig();
ServletContext c=cf.getServletContext();
if(new File(c.getRealPath("uploads")+"/test.txt").exists())
out.print("image exists");
%>If u are not clear of what it is done let me know..i will xplain to you furthur...
Happy New Year
Shanu -
How to check whether file exist or not?
hello,
i wanted to know that how can i check whether a file exist or not independent of underlying Operating system?
please help .
Thank you.Use exists() on a File instance.
-
How to check whether the Application Server directory exits or not
Hi,
I have a selection screen in which I give the Application server file name(UNIX file) as input. Here, I would like to check whether the Server directory exists or not.
Let us say, the path I gave in the selection screen is /usr/sap/tmp/testfile.txt . Here, the file name is testfile.txt and the server directory is /usr/sap/tmp . I would like to check whether this directory /usr/sap/tmp exists in the server or not. I am not bothered about the file name as I am going to write data into the file. I am mainly concerned about whether the directory exists in the server or not. and one more thing... this is the Application Server path not the Local path.
Can anyone help me on the same how to check whether the server directory exists or not.
Thanks in advance.
Best Regards,
Pradeep.Also you can use the FM EPS_GET_DIRECTORY_LISTING for this purpose.
Store the directory name
l_dpath = p_file+0(l_no).
Validate the directory of the application server
CALL FUNCTION 'EPS_GET_DIRECTORY_LISTING'
EXPORTING
dir_name = l_dpath
TABLES
dir_list = l_i_dlist
EXCEPTIONS
invalid_eps_subdir = 1
sapgparam_failed = 2
build_directory_failed = 3
no_authorization = 4
read_directory_failed = 5
too_many_read_errors = 6
empty_directory_list = 7
OTHERS = 8.
If any problem occurs with the directory then display proper
error message
IF sy-subrc <> 0.
Display error message
MESSAGE e018 WITH 'Problem with directory entered'(008).
ENDIF. " sy-subrc <> 0
Regards,
Joy. -
How to check whether a field contains at least one numeric value
how to check whether a field contains at least one numeric value..
Hi,
I hope that this code will works.
constants:
c_digit_grp TYPE char11 VALUE '0123456789', " Digit group
* Data Declaration
data :
str type string.
* if you want check entire string and pass entire string
if str CA c_digit_grp.
* write your logic ---this block will execute atleast one numeric value exists in the string
Endif.
Regards
Bhupal Reddy -
JavaScript: How to check if a file exists.
Hello Everybody,
Can you tell me how to check if a file exists using JavaScript and Internet Explorer.
Browsing on this website I could read about the command "f.exists()" and it was necessary to include "java.io.*".
Should I use this same command and should I include the same files? Or are there other files and other commands?
Thanks in advance.sorry ya. there is no command to check whether a file exists using javascript. The following code says the object name and value. But it can't say whether the file exists in the harddisk or .. Javascript cannot access database and system resources. If the file exists or not can be checked through the application (ASP, CFML, ..) you are using.
-
R12.1.1 staging complete! How to check whether the stage is Good
Hi Gurusl,
I have completed staging R12.1.1 for Hp unix B.11.31. I want to know how to check whether the stage is good for installation or whether it is corrupted. Is there any metalink note or script from where we can check it. Ur help will be highly appreciated. Thanks in advance
regards,Hi,
Please refer to (Note: 802195.1 - MD5 Checksums for R12.1.1 Rapid Install Media).
Regards,
Hussein -
Please help me how to check a material does existed group code in system (w
Hi all,
Please help me...
I have inputted quantity for tx MC 94 but when I input them into tx MC94, I met a message " Structure not yet maintained for this conbination characterstics". Step by step to show a error message as below:
Step 1: Launch MC 94
step 2: Enter Planning
Step 3: Enter Prod.Code. Material (ex: enter material code :0101010260008, this code is existed Prod.Code )
Step 4: Click on "Inactive Version " button
==> A error message is showed.
Please help me how to check a material does existed group code in system (which table to check it)?
How to record the message" Structure not yet maintained for this conbination characterstics" to catch up it in my program?
Thank in advance.Karenloria,
1. Check in MC8C, which Infostructure is used for Planning type "Planning" or the one you are entering in the intial screen of MC94.
2. Using transaction MC63 for the infostructure identified in step 1, check the planning hierarchy maintained. If this product is not maintined maintain using MC62.
You can also check using SE16 transction the current infostructe records(Plan) for the table name = infostructure identified in step 1.
Regards,
Prasobh -
How to check whether follow on document is created for sc or po,is there any table or fm available?
Hello Venu
Check FM: BBP_PD_SC_GETDETAIL and BBP_PD_PO_GETDETAIL table E_HEADER_REL
Check this: SRM Shopping cart and PO tables link
Regards -
How to check whether there r new txt files in a folder n file creation date
How to check whether there r new text files in a specified folder and what is the date of creation of the text file.........?
Hi
I have been searching for a solution to find the date of creation of a file for over 6 months now but haven't found it. So I presume that it is not possible though I havent found any authentication of my assumption in any document.
Cheers!
Shailesh
Maybe you are looking for
-
I did an application using Traditional NI-DAQ (PCI6033E) now I´ve a PCI6224, it only can use with NI-DAQmx. My aplication is Multithreading. I use three threads. A thread is dedicate for data acquisition is the main thread, the second is dedicated fo
-
Hi All, The Screen painter (SE51) is not displaying with Graphical Layout editor,though i have selected the Graphical Layout editor check box (From Utilities->Screen Painter> set the Graphical Layout Editor check box also marked ) . Though i am
-
One Message Two Possibles receivers (iDoc or BAPI) in an System
Hi All, My Scenario is: JDBC - > BAPI or IDOC the legacy system sends customers to SAP XI... and those customers could be old or new... so... in my interface... I ask with a RFC LookUp.. if the customer exists or have to create a new one. for create
-
Could I still use the "find my mac"-app if I downgraded from OSX Lion to Snow Leopard?
In the beginning of 2012, I had the great misfortune of getting robbed and all my recording equipment was stolen, including my macbook pro 17" running on OSX Snow Leopard. I was able to buy a new macbook, same as the old one, but with the OSX Lion.
-
HT4623 want to unlock iphone to other network providers need help
trying to unlock iphone so i am able to use any other network but ive tried and i just cant seem to do it does anyone know other ways of unlocking the phone need hel please