Data retrival from XML nodes
Hello all
I have a xml file somthing like this
- <lbs-server>
- <location-results>
- <error>
<number>12</number>
<information>Invalid credentials</information>
<system method="NULL" />
</error>
</location-results>
- <server-time>
<date>13</date>
<month>6</month>
<year>2006</year>
<hour>15</hour>
<minute>10</minute>
<second>4</second>
</server-time>
<server-interface>1.0.5 uguduwa</server-interface>
</lbs-server>
Can i use somthing like getNodeValue(lbs-server/location-results/error/number) to retrive the error number from the above structure. if this is possible or alternative please explain with a sample code cause i am bit new to this techonlogy.
Thanks in advance
Prash
To retrive the error number from the XML file, you can use JDOM API, and say:
Document doc = builder.build(XML_File_Name);
Element root = doc.getRootElement();
Element lr_elt = root.getChild("location-results");
Element error_elt = lr_elt.getChild("error");
Element number_elt = error_elt.getChild("number");
String your_value = number_elt.getText();
JDom has features of both SAX & DOM Parsers. You can find more info on Jdom at :
http://www.javaworld.com/javaworld/jw-05-2000/jw-0518-jdom.html
http://www.oreilly.com/catalog/jenut2/chapter/ch19.html#AUTOID-14859
Similar Messages
-
Apply spry functions on data uploaded from xml?
Hi,
I am trying to "simplify" my personal pages so I have only 1
html page and everything else is taken from xml through spry
framework (guys ... I love it .. super work)
But currently I am stuck on one issue:
Step 1
I replace the html parts -> I just put the html code to
xml node inside CDATA and call spry:setrow
Step 2
I would like to use the spry:detailregion /
spry:repeatchildren in the code that is inside CDATA ... but here I
am not successful yet
Is this possible? Or can you give me some hint/other
direction (I woul love to stay with XML and do not want to use the
Tabs)
You can check it here
http://doma.princ.biz/test-ajax/index.html
- (it is slow) click on Hudba and you will see what I ment. The xml
is music.xml so you can check the structure.
Thank you very much for help.Hi,
little update - I put the "final" state together with using
the tabs - it is not best solution because the page reads lots of
data on the load. But it is the state I would like to reach by
using xml some how
http://doma.princ.biz/test-ajax/index-tab.html
See the left menu and the changes in the middle and on the
right side.
The menu Hudba and then the accordion works now.
Any idea how to get the same stuff without spry tabs?
Thank you very much
Jiri
(using spry 1.4 - do not know if 1.5 will be help
here) -
Question about insert date value from xml file
I want insert value into table from xml file. Every time I inserted value of date type into the table, I got the unpasable error message as following:
oracle.xml.sql.OracleXMLSQLException: Exception 'java.text.ParseException:Unpars
eable date: "2000-04-19 00:00:00.0"' encountered during processing ROW element
Thanks for anyone that can fix my problem or give me any suggestion.
email: [email protected]<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by matmnwx:
I want insert value into table from xml file. Every time I inserted value of date type into the table, I got the unpasable error message as following:
oracle.xml.sql.OracleXMLSQLException: Exception 'java.text.ParseException:Unpars
eable date: "2000-04-19 00:00:00.0"' encountered during processing ROW element
Thanks for anyone that can fix my problem or give me any suggestion.
email: [email protected]<HR></BLOCKQUOTE>
Use:
OracleXMLSave sav = new OracleXMLSave(conn,tabName);
sav.setDateFormat(<hier the date format in the XML-File>); -
Data Load from XML file to Oracle Table
Hi,
I am trying to load data from XML file to Oracle table using DBMS_XMLStore utility.I have performed the prerequisites like creating the directory from APPS user, grant read/write to directory, placing the data file on folder on apps tier, created a procedure ‘insertXML’ to load the data based on metalink note (Note ID: 396573.1 How to Insert XML by passing a file Instead of using Embedded XML). I am running the procedure thru below anonymous block to insert the data in the table.
Anonymous block
declare
begin
insertXML('XMLDIR', 'results.xml', 'employee_results');
end;
I am getting below error after running the anonymous block.
Error : ORA-22288: file or LOB operation FILEOPEN failed”
Cause : The operation attempted on the file or LOB failed.
Action: See the next error message in the error stack for more detailed
information. Also, verify that the file or LOB exists and that
the necessary privileges are set for the specified operation. If
the error still persists, report the error to the DBA.
I searched this error on metalink and found DOC ID 1556652.1 . I Ran the script provided in the document. PFA the script.
Also, attaching a document that list down the steps that I have followed.
Please check and let me know if I am missing something in the process. Please help to get this resolve.
Regards,
SankalpThanks Bashar for your prompt response.
I ran the insert statement but encountered error,below are the error details. statement.
Error report -
SQL Error: ORA-22288: file or LOB operation FILEOPEN failed
No such file or directory
ORA-06512: at "SYS.XMLTYPE", line 296
ORA-06512: at line 1
22288. 00000 - "file or LOB operation %s failed\n%s"
*Cause: The operation attempted on the file or LOB failed.
*Action: See the next error message in the error stack for more detailed
information. Also, verify that the file or LOB exists and that
the necessary privileges are set for the specified operation. If
the error still persists, report the error to the DBA.
INSERT statement I ran
INSERT INTO employee_results (USERNAME,FIRSTNAME,LASTNAME,STATUS)
SELECT *
FROM XMLTABLE('/Results/Users/User'
PASSING XMLTYPE(BFILENAME('XMLDIR', 'results.xml'),
NLS_CHARSET_ID('CHAR_CS'))
COLUMNS USERNAME NUMBER(4) PATH 'USERNAME',
FIRSTNAME VARCHAR2(10) PATH 'FIRSTNAME',
LASTNAME NUMBER(7,2) PATH 'LASTNAME',
STATUS VARCHAR2(14) PATH 'STATUS'
Regards,
Sankalp -
How convert date/time from xml in xdp(Designer)?
Hi, i want to convert date/time format from xml in Designer, date/time value in xml is NOT in common format YYYY-MM-DD (if is in a common format i can do this with pattern)
I have a "DateTime" Field in Xdp can get from Xml date and time:
In XML <DateTime>DD-MM-YYYY</DateTime> i want to convert in XDP in DateTime Field in "DD-April-YYYY"
Can i do this?You can do this way..
Bind the date field to your XML tag.
Set the display pattern for the date field.
In the initialize event of the date field place the following code.
Set JavaScript as language.
var dtStr = this.rawValue;
var pos1=dtStr.indexOf("-");
var pos2=dtStr.indexOf("-",pos1+1);
var strMonth=dtStr.substring(0,pos1);
var strDay=dtStr.substring(pos1+1,pos2);
var strYear=dtStr.substring(pos2+1);
//Assign the formatted value to the Date field.
this.rawValue = strYear + "-" + strMonth + "-" + strDay;
Thanks
Srini -
Data Import from XML Format file
I want to import data from XML file format.Can i do it ? If yes then please give me more details in the step.
Pl read the below link.
It will be helpful.
SAP Business One Application
Jeyakanthan -
Hi There!
We have an XML that we read into an XMLtype - and at a time we want to display it in a normal date type....
Its formatted as this: '2007-02-20T09:30:47.0Z' (Zero 0) - I guess it means no timezone in some ISO 86* standard
select TO_date('2007-02-20T09:30:47.0Z','YYYY-MM-DD"T"HH24:MI:SS.??????') from dual;
I have trie to find a format for reading it ... do you have an idea?
regards
MetteSorry, forgot to say that some of the dates in the XML field is in this format
'2007-02-20T09:30:47+100 ...... (yyyy-mm-dd"T"hh:mi:ssstzhtzm)
/Mette -
XML data upload from .xml file
Hi,
Can anyone let me know is ther any way how I can upload the data from .xml file into Oracle Table.
Note: I just want to upload the data from xml file; not entire .xml file.
I have data like as below in test.xml file and I want to upload the data only into TEST_EMP table:
<?xml version = '1.0'?>
<ROWSET>
<ROW num="1">
<TABLE_NAME>DEPT</TABLE_NAME>
<TABLESPACE_NAME>USERS</TABLESPACE_NAME>
</ROW>
<ROW num="2">
<TABLE_NAME>EMP</TABLE_NAME>
<TABLESPACE_NAME>USERS</TABLESPACE_NAME>
</ROW>
<ROW num="3">
<TABLE_NAME>BONUS</TABLE_NAME>
<TABLESPACE_NAME>USERS</TABLESPACE_NAME>
</ROW>
<ROW num="4">
<TABLE_NAME>SALGRADE</TABLE_NAME>
<TABLESPACE_NAME>USERS</TABLESPACE_NAME>
</ROW>
<ROW num="5">
<TABLE_NAME>BHAVESH_EMP</TABLE_NAME>
<TABLESPACE_NAME>USERS</TABLESPACE_NAME>
</ROW>
</ROWSET>
Any help would be highly appreciated!!
Thanks... BhaveshOne way is to use sql* loader...
http://download-west.oracle.com/docs/cd/B19306_01/appdev.102/b14259/xdb25loa.htm -
Data retrival from standard transaction with in a report
hi all,
i have a requirement like i need to pass the selection screen selections to a standard transaction ca80 and need to get the material list from there to my report for furthur processing. is it possible with bdc or a bapi for this.
can anyone please help urgent its eating my brain. points awarded for solution
thanks in advance
anupamahi deep kammula,
this is a sample code for your query just check. it may help you.
all the best.
reward me points if usefull.
Sample HR Reports - Allocate Petrol Allowance
Two ABAP HR Programs, which are interconnected, the first takes employee numbers which should not be given Petrol allowance and the other program gives the petrol allowance to employees.
FIRST PRG
REPORT ZPETROL_EXCLUDE .
TABLES SSCRFIELDS.
SELECTION-SCREEN BEGIN OF SCREEN 100.
SELECTION-SCREEN SKIP 9.
PARAMETERS NUMBER(200) TYPE C.
SELECTION-SCREEN SKIP 2.
SELECTION-SCREEN:
BEGIN OF LINE,
PUSHBUTTON 2(10) TEXT-001 USER-COMMAND PROC,
END OF LINE.
SELECTION-SCREEN END OF SCREEN 100.
CALL SCREEN 100.
AT SELECTION-SCREEN.
CASE SSCRFIELDS.
WHEN 'PROC'.
SET PARAMETER ID: 'NUM' FIELD NUMBER.
CALL TRANSACTION 'ZP_PALLOWANCE'.
LEAVE TO SCREEN 0.
ENDCASE.
SECOND PRG
REPORT ZPR_PETROL_ALLOWANCE NO STANDARD PAGE
HEADING .
*-- Infotypes
INFOTYPES : 0000, "Actions
0002, "Personal Data
0008. "Basic pay details
*-- Tables
TABLES : PERNR, "Standard Selections for HR Master Data Reporting
PC207, "Payroll Results: Results Table
PCL1, "HR Cluster 1
PCL2, "HR Cluster 2
T510, "Pay scales
T549A, "Payroll areas
T549Q, "Payroll Periods
PA0002. "Personal details
*-- Internal Tables
*-- Internal Table Declaration For Holding The Data
DATA: BEGIN OF INT_PETROL OCCURS 0,
PERNR LIKE PA0008-PERNR, "Personnel Number
TRFST LIKE PA0008-TRFST, "Pay Scale Level
NAME(40), "Name of Employee
PALLOWANCE TYPE P DECIMALS 2, "Petrol Allowance Amount
END OF INT_PETROL.
DATA: BEGIN OF PA0015_DATA OCCURS 0,
PERNR LIKE PA0015-PERNR,
BETRG LIKE PA0015-BETRG,
END OF PA0015_DATA.
DATA:BEGIN OF INT_PETROL2 OCCURS 0,
PERNR LIKE PA0008-PERNR, "Personnel Number
VORNA LIKE PA0002-VORNA, "First Name
NACHN LIKE PA0002-NACHN, "Last Name
TRFST LIKE PA0008-TRFST, "Pay Scale Level
NAME(40), "Name of Employee
PALLOWANCE TYPE P DECIMALS 2, "Petrol Allowance Amount
END OF INT_PETROL2.
DATA : TITLE TYPE LVC_TITLE.
DATA: BEGIN OF PER_NO OCCURS 0,
PERNR LIKE PA0008-PERNR,
TRFST LIKE PA0008-TRFST,
END OF PER_NO.
DATA: BEGIN OF MSG OCCURS 0,
MSG1(100) TYPE C,
END OF MSG.
DATA: FLAG TYPE I VALUE '0',
DIS_FLAG TYPE I VALUE '0'.
DATA: INT_PETROL3 LIKE STANDARD TABLE OF INT_PETROL2 INITIAL SIZE 0
WITH HEADER LINE.
DATA: INT_PETROL1 LIKE STANDARD TABLE OF INT_PETROL INITIAL SIZE 0 WITH
HEADER LINE.
DATA: WA_PET_ALLOWANCE TYPE ZBPETROL_ALL. "WORKAREA FOR INSERTING
VALUES.
*DATA: P_LGART1 LIKE T512T-LGART VALUE '0010'. "CHANGE WAGE TYPE HERE
DATA: P_LGART1 LIKE T512T-LGART VALUE '0077'. "CHANGE WAGE TYPE HERE
DATA: BEGIN OF INT_0015 OCCURS 0,
PERNR(038),
BEGDA(010),
BETRG(018),
END OF INT_0015.
*-- Internal Table To Store Error Records.
DATA: E_INT_0015 LIKE INT_0015 OCCURS 0 WITH HEADER LINE.
*-- Batch Input Data of Single Transaction
DATA: BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
*-- Internal Table For Export and Import Payroll Results
DATA: INT_RGDIR LIKE PC261 OCCURS 0 WITH HEADER LINE,
LGTXT LIKE T512T-LGTXT.
DATA: BEGIN OF EMP_NO OCCURS 0,
PERNR(4) TYPE C,
END OF EMP_NO.
DATA: BEGIN OF EMP_NO1 OCCURS 0,
PERNR TYPE I,
END OF EMP_NO1.
DATA EMPNO LIKE STANDARD TABLE OF EMP_NO INITIAL SIZE 0.
DATA EMPNO1 LIKE STANDARD TABLE OF EMP_NO1 INITIAL SIZE 0 WITH HEADER
LINE.
DATA LEN1 TYPE I.
DATA: ERR LIKE MESSAGE.
DATA TEMP_NUM(200) TYPE C.
*-- Includes
*-- International Include
INCLUDE RPC2CD09. "Cluster CD data definition
INCLUDE RPC2CA00. "Cluster CA Data-Definition
INCLUDE RPPPXD00. "Data Definition buffer PCL1/PCL2 Buffer INCLUDE RPPPXD10.
"Common part buffer PCL1/PCL2 INCLUDE RPPPXM00. "Buffer Handling routine
*-- Country Specific Include
INCLUDE PC2RXIN0. "Cluster IN data definition
INCLUDE RPC2RX09.
*-- ALV Declaration
TYPE-POOLS : SLIS.
DATA: INT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
INT_EVENTS TYPE SLIS_T_EVENT,
INT_LAYOUT TYPE SLIS_LAYOUT_ALV,
WS_EVENTS TYPE SLIS_ALV_EVENT,
WS_REPID LIKE SY-REPID.
*-- Initialization
INITIALIZATION.
WS_REPID = SY-REPID.
*-- At Selection-Screen
START-OF-SELECTION.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(30) TEXT-002.
SELECTION-SCREEN POSITION 33.
PARAMETERS: P_RATE TYPE P DECIMALS 2.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK B1.
SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-003.
SELECTION-SCREEN BEGIN OF BLOCK B3.
PARAMETERS: P_UPLOAD AS CHECKBOX,
P_FG RADIOBUTTON GROUP G1,
P_BG RADIOBUTTON GROUP G1.
SELECTION-SCREEN END OF BLOCK B3.
SELECTION-SCREEN BEGIN OF BLOCK B4.
PARAMETERS: P_DI AS CHECKBOX.
SELECTION-SCREEN END OF BLOCK B4.
SELECTION-SCREEN END OF BLOCK B2.
AT SELECTION-SCREEN.
*-- Wate Type Text
SELECT SINGLE LGTXT INTO LGTXT FROM T512T WHERE SPRSL = 'E' AND
MOLGA = '40' AND LGART = P_LGART1 .
*-- Data Retrieval From Logical Database PNP
GET PERNR.
PROVIDE PERNR FROM P0000 VORNA NACHN FROM P0002 BETWEEN PN-BEGDA AND
PN-ENDDA.
INT_PETROL1-PERNR = P0000-PERNR.
CONCATENATE P0002-VORNA P0002-NACHN INTO INT_PETROL1-NAME SEPARATED
BY SPACE.
ENDPROVIDE.
*-- Clear Data
CLEAR: RGDIR, INT_RGDIR.
REFRESH: RGDIR, INT_RGDIR.
*-- Read All The Payroll Runs For An Employee
CD-KEY-PERNR = PERNR-PERNR.
RP-IMP-C2-CU.
CHECK RP-IMP-CD-SUBRC EQ 0.
*-- Clear Data
REFRESH: RT.
Read IN Cluster.
LOOP AT RGDIR WHERE FPBEG >= PN-BEGDA AND FPEND <= PN-ENDDA.
MOVE-CORRESPONDING RGDIR TO INT_RGDIR.
APPEND INT_RGDIR.
CLEAR INT_RGDIR.
ENDLOOP.
Read the last record.
SORT INT_RGDIR BY SEQNR DESCENDING.
READ TABLE INT_RGDIR INDEX 1.
RX-KEY-SEQNO = INT_RGDIR-SEQNR.
RX-KEY-PERNR = PERNR-PERNR.
RP-IMP-C2-IN.
CHECK RP-IMP-IN-SUBRC EQ 0.
READ TABLE RT WITH KEY LGART = P_LGART1.
IF SY-SUBRC = 0.
INT_PETROL1-PALLOWANCE = RT-BETRG.
ENDIF.
APPEND INT_PETROL1.
CLEAR INT_PETROL1.
SELECT TRFST PERNR
INTO CORRESPONDING FIELDS OF TABLE PER_NO
FROM PA0008
WHERE TRFST LIKE 'L%'
AND BET01 > 0.
SORT PER_NO.
DELETE ADJACENT DUPLICATES FROM PER_NO.
*-- END-OF-SELECTION.
END-OF-SELECTION.
LOOP AT INT_PETROL1.
READ TABLE PER_NO WITH KEY PERNR = INT_PETROL1-PERNR.
IF SY-SUBRC = 0.
INT_PETROL-TRFST = PER_NO-TRFST.
MODIFY INT_PETROL1 FROM INT_PETROL TRANSPORTING TRFST.
ENDIF.
ENDLOOP.
SORT INT_PETROL1.
DELETE ADJACENT DUPLICATES FROM INT_PETROL1.
CONCATENATE 'From' ' : ' PN-BEGDA6(2) '.' PN-BEGDA4(2) '.' PN-
BEGDA+0(4)
' To' ' : ' PN-ENDDA6(2) '.' PN-ENDDA4(2) '.' PN-ENDDA+0(4)
INTO TITLE.
IF P_DI = 'X'. "TO DISPLAY PETROL ALLOWANCE ONLY
IF PNPTIMRA = 'X'. "CHECK OTHER PERIOD CHECKED
DIS_FLAG = 1.
ENDIF.
IF PNPTIMR9 = 'X'. "CHECK TO SEE CURRENT PERIOD SELECTED
CASES - NO RATE GIVEN, RATE GIVEN
CURRENT PERIOD UPLOADED BUT PAYROLL NOT WRITTEN SO NO RESULT FROM LDB
SELECT RATE INTO P_RATE FROM ZBPETROL_ALL WHERE BEGDA = PN- BEGDA AND ENDDA = PN-ENDDA.
ENDSELECT.
IF SY-DBCNT = 0.
MESSAGE I455(0) WITH 'NO PETROL RATE EXSISTS'.
ELSE.
FLAG = 1.
ENDIF. "OF SY-DBCNT
IF P_RATE > 0 AND FLAG = 1. " PETROL RATE EXSISTS.
SELECT PERNR SUM( BETRG ) INTO TABLE PA0015_DATA
FROM PA0015
WHERE BEGDA BETWEEN PN-BEGDA AND PN-ENDDA
GROUP BY PERNR.
SELECT APERNR ATRFST BVORNA BNACHN
INTO CORRESPONDING FIELDS OF TABLE INT_PETROL3
FROM PA0008 AS A
INNER JOIN PA0002 AS B ON BPERNR = APERNR
WHERE A~TRFST LIKE 'L%'
AND A~BET01 > 0.
SORT INT_PETROL3.
DELETE ADJACENT DUPLICATES FROM INT_PETROL3.
REFRESH INT_PETROL1.
LOOP AT INT_PETROL3 INTO INT_PETROL2. "loop to transport
employee name
CONCATENATE INT_PETROL2-VORNA INT_PETROL2-NACHN INTO
INT_PETROL2-NAME SEPARATED BY SPACE.
MODIFY INT_PETROL3 FROM INT_PETROL2 TRANSPORTING NAME.
ENDLOOP.
LOOP AT INT_PETROL3 INTO INT_PETROL2. "loop to transport
one
table to another table
READ TABLE PA0015_DATA WITH KEY PERNR = INT_PETROL2-PERNR.
IF SY-SUBRC = 0.
INT_PETROL-PERNR = INT_PETROL2-PERNR.
INT_PETROL-TRFST = INT_PETROL2-TRFST.
INT_PETROL-NAME = INT_PETROL2-NAME.
INT_PETROL-PALLOWANCE = PA0015_DATA-BETRG.
APPEND INT_PETROL TO INT_PETROL1.
ENDIF.
ENDLOOP.
DIS_FLAG = 1.
ENDIF. "P_RATE > 0 AND FLAG = 1.
IF P_RATE > 0 AND FLAG = 0. "CURRENT PERIOD AND DATA NOT UPLOADED
SELECT APERNR ATRFST BVORNA BNACHN
INTO CORRESPONDING FIELDS OF TABLE INT_PETROL3
FROM PA0008 AS A
INNER JOIN PA0002 AS B ON BPERNR = APERNR
WHERE A~TRFST LIKE 'L%'
AND A~BET01 > 0.
SORT INT_PETROL3.
DELETE ADJACENT DUPLICATES FROM INT_PETROL3.
REFRESH INT_PETROL1.
LOOP AT INT_PETROL3 INTO INT_PETROL2. "loop to transport
employee name
CONCATENATE INT_PETROL2-VORNA INT_PETROL2-NACHN INTO
INT_PETROL2-NAME SEPARATED BY SPACE.
MODIFY INT_PETROL3 FROM INT_PETROL2 TRANSPORTING NAME.
ENDLOOP.
PERFORM GET_VALUE. "TO CONVERT THE FIRST SCREEN PERNR INTO
NUMBER FORMATE
LOOP AT INT_PETROL3 INTO INT_PETROL2. "loop to transport
one
table to another table
READ TABLE EMPNO1 WITH KEY PERNR = INT_PETROL2-PERNR.
IF SY-SUBRC <> 0.
INT_PETROL-PERNR = INT_PETROL2-PERNR.
INT_PETROL-TRFST = INT_PETROL2-TRFST.
INT_PETROL-NAME = INT_PETROL2-NAME.
APPEND INT_PETROL TO INT_PETROL1.
ENDIF.
ENDLOOP.
PERFORM CAL_ALLOWANCE.
ENDIF. " OF P_RATE > 0
DIS_FLAG = 1.
ENDIF. " OF CURRENT PERIOD CHECK.
ENDIF. " OF CHECK DISPLAY.
*----BDC
IF P_UPLOAD = 'X'.
IF PNPTIMRA = 'X'. "CHECK OTHER PERIOD CHECKED
MESSAGE I455(0) WITH 'Petrol Allowance cannot be uploaded'.
LEAVE SCREEN.
ENDIF.
IF P_RATE > 0.
IF P_RATE > 0 OR P_RATE = 0.
IF PNPTIMR9 = 'X'. "CHECK TO SEE CURRENT PERIOD SELECTED
WA_PET_ALLOWANCE-BEGDA = PN-BEGDA.
WA_PET_ALLOWANCE-ENDDA = PN-ENDDA.
WA_PET_ALLOWANCE-RATE = P_RATE.
WA_PET_ALLOWANCE-CURR = 'INR'.
INSERT INTO ZBPETROL_ALL VALUES WA_PET_ALLOWANCE.
SELECT A~PERNR A~TRFST B~VORNA B~NACHN
INTO CORRESPONDING FIELDS OF TABLE INT_PETROL3
FROM PA0008 AS A
INNER JOIN PA0002 AS B ON B~PERNR = A~PERNR
WHERE A~TRFST IN ('L1' , 'L2' , 'L3')
AND A~BET01 > 0.
SORT INT_PETROL3.
DELETE ADJACENT DUPLICATES FROM INT_PETROL3.
REFRESH INT_PETROL1.
LOOP AT INT_PETROL3 INTO INT_PETROL2. "loop to transport
employee name
CONCATENATE INT_PETROL2-VORNA INT_PETROL2-NACHN INTO
INT_PETROL2-NAME SEPARATED BY SPACE.
MODIFY INT_PETROL3 FROM INT_PETROL2 TRANSPORTING NAME.
ENDLOOP.
PERFORM GET_VALUE. "TO CONVERT THE FIRST SCREEN PERNR INTO
NUMBER FORMATE
LOOP AT INT_PETROL3 INTO INT_PETROL2. "loop to transport
one
table to another table
READ TABLE EMPNO1 WITH KEY PERNR = INT_PETROL2-PERNR.
IF SY-SUBRC <> 0.
INT_PETROL-PERNR = INT_PETROL2-PERNR.
INT_PETROL-TRFST = INT_PETROL2-TRFST.
INT_PETROL-NAME = INT_PETROL2-NAME.
APPEND INT_PETROL TO INT_PETROL1.
ENDIF.
ENDLOOP.
PERFORM CAL_ALLOWANCE.
DIS_FLAG = 1.
SORT INT_PETROL1.
LOOP AT INT_PETROL1.
MOVE: INT_PETROL1-PERNR TO INT_0015-PERNR,
INT_PETROL1-PALLOWANCE TO INT_0015-BETRG.
CONCATENATE PN-ENDDA6(2) PN-ENDDA4(2) PN-ENDDA+0(4) INTO
INT_0015-BEGDA SEPARATED BY '.'.
APPEND INT_0015.
CLEAR INT_0015.
ENDLOOP.
LOOP AT INT_0015.
PERFORM F_BDCDATA.
IF P_FG = 'X'.
CALL TRANSACTION 'PA30' USING BDCDATA MODE 'A' UPDATE 'S'.
ELSE.
CALL TRANSACTION 'PA30' USING BDCDATA MODE 'N' UPDATE 'S'.
ENDIF.
*-- Handling Error records.
IF SY-SUBRC <> 0.
*-- Handling Error Messages
PERFORM ERROR_MSG.
MOVE-CORRESPONDING INT_0015 TO E_INT_0015.
APPEND E_INT_0015.
CLEAR E_INT_0015.
ENDIF.
REFRESH BDCDATA.
ENDLOOP.
*-- Downloading Error Records.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = 'C:\Errors.Txt'
FILETYPE = 'ASC'
TABLES
DATA_TAB = E_INT_0015.
*-- Downloading Error Messages.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = 'C:\Err_Msg.Txt'
FILETYPE = 'ASC'
TABLES
DATA_TAB = MSG.
ENDIF. " FOR CURRENT PERIOD
ENDIF.
ELSE.
MESSAGE I455(0) WITH 'Enter Petrol Rate'.
LEAVE TO SCREEN 0.
ENDIF. " FOR PETROL RATE
ENDIF. " FOR UPLOAD
IF DIS_FLAG = 1.
INT_LAYOUT-SUBTOTALS_TEXT = TEXT-004.
INT_LAYOUT-TOTALS_TEXT = TEXT-004.
INT_LAYOUT-ZEBRA = 'X'.
PERFORM FILL_FIELDCAT.
PERFORM GET_EVENTS_ALV.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = WS_REPID
IS_LAYOUT = INT_LAYOUT
IT_FIELDCAT = INT_FIELDCAT[]
I_DEFAULT = 'X'
I_SAVE = 'X'
IT_EVENTS = INT_EVENTS
TABLES
T_OUTTAB = INT_PETROL1
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
*& Form GET_VALUE
text
FORM GET_VALUE.
GET PARAMETER ID: 'NUM' FIELD TEMP_NUM.
IF TEMP_NUM <> ''.
LEN1 = STRLEN( TEMP_NUM ).
PERFORM GET_PERNR.
APPEND TEMP_NUM TO EMPNO.
LOOP AT EMPNO INTO EMP_NO.
CALL FUNCTION 'CHECK_AND_CONVERT_NUMERICS'
EXPORTING
DFELD = ' '
DMZEI = ','
DTYPE = 'STRING'
DYPNO = ' '
EFELD = EMP_NO-PERNR
FNAME = ' '
PROGR = ' '
IMP_DECIMALS = '0'
IMPORTING
ERROR =
IFELD = EMP_NO1-PERNR
MESSG = ERR
MSGLN =
IF ( ERR-MSGID = '' ).
APPEND EMP_NO1 TO EMPNO1.
CLEAR EMP_NO1-PERNR.
ELSE.
MESSAGE I455(0) WITH 'Could not convert employee number'.
LEAVE TO SCREEN 0.
ENDIF.
ENDLOOP.
ENDIF.
ENDFORM. "GET_VALUE
*& Form GET_PERNR
text
FORM GET_PERNR.
SPLIT TEMP_NUM AT ',' INTO EMP_NO TEMP_NUM.
APPEND EMP_NO TO EMPNO.
CLEAR EMP_NO.
SEARCH TEMP_NUM FOR ','.
IF SY-SUBRC = 0.
PERFORM GET_PERNR.
ENDIF.
ENDFORM. "GET_PERNR
*& Form ERROR_MSG
text
--> p1 text
<-- p2 text
FORM ERROR_MSG.
IF SY-SUBRC <> 0.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
LANG = SY-LANGU
IMPORTING
MSG = MSG-MSG1.
APPEND MSG.
CLEAR MSG.
ENDIF.
ENDFORM. "ERROR_MSG
*& Form F_BDCDATA
text
FORM F_BDCDATA.
PERFORM BDC_DYNPRO USING 'SAPMP50A' '1000'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=INS'.
PERFORM BDC_FIELD USING 'RP50G-PERNR'
INT_0015-PERNR.
PERFORM BDC_FIELD USING 'RP50G-TIMR6'
'X'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'RP50G-CHOIC'.
PERFORM BDC_FIELD USING 'RP50G-CHOIC'
'0015'.
PERFORM BDC_DYNPRO USING 'MP001500' '2000'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'Q0015-BETRG'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
PERFORM BDC_FIELD USING 'P0015-LGART'
'0077'. "CHANGE WAGE TYPE HERE
ALSO
PERFORM BDC_FIELD USING 'Q0015-BETRG'
INT_0015-BETRG.
PERFORM BDC_FIELD USING 'P0015-WAERS'
'INR'.
PERFORM BDC_FIELD USING 'P0015-BEGDA'
INT_0015-BEGDA.
PERFORM BDC_DYNPRO USING 'MP001500' '2000'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'P0015-LGART'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=UPD'.
PERFORM BDC_FIELD USING 'P0015-LGART'
'0077'. "CHANGE WAGE TYPE HERE
ALSO
PERFORM BDC_FIELD USING 'Q0015-BETRG'
INT_0015-BETRG.
PERFORM BDC_FIELD USING 'P0015-WAERS'
'INR'.
PERFORM BDC_FIELD USING 'P0015-BEGDA'
INT_0015-BEGDA.
ENDFORM. "F_BDCDATA
*& Form BDC_DYNPRO
text
-->P_0732 text
-->P_0733 text
FORM BDC_DYNPRO USING VALUE(P_0732) TYPE C
VALUE(P_0733) TYPE C.
CLEAR BDCDATA.
BDCDATA-PROGRAM = P_0732.
BDCDATA-DYNPRO = P_0733.
BDCDATA-DYNBEGIN = 'X'.
APPEND BDCDATA.
ENDFORM. " BDC_DYNPRO
*& Form BDC_FIELD
text
-->P_0755 text
-->P_0756 text
FORM BDC_FIELD USING VALUE(P_0755) TYPE C
VALUE(P_0756) TYPE C.
CLEAR BDCDATA.
BDCDATA-FNAM = P_0755.
BDCDATA-FVAL = P_0756.
APPEND BDCDATA.
ENDFORM. " BDC_FIELD
*& Form CAL_ALLOWANCE
text
FORM CAL_ALLOWANCE.
LOOP AT INT_PETROL1 INTO INT_PETROL.
IF INT_PETROL-TRFST = 'L1'.
INT_PETROL-PALLOWANCE = P_RATE * 100. "CHANGE TO SELECT WHEN
DISPLAY
ELSEIF INT_PETROL-TRFST = 'L2'.
INT_PETROL-PALLOWANCE = P_RATE * 150.
ELSEIF INT_PETROL-TRFST = 'L3'.
INT_PETROL-PALLOWANCE = P_RATE * 150.
ELSEIF INT_PETROL-TRFST = 'L4'.
INT_PETROL-PALLOWANCE = P_RATE * 200.
ELSEIF INT_PETROL-TRFST = 'L5'.
INT_PETROL-PALLOWANCE = P_RATE * 250.
ENDIF.
MODIFY INT_PETROL1 FROM INT_PETROL TRANSPORTING PALLOWANCE.
ENDLOOP.
ENDFORM. "CAL_ALLOWANCE
*& Form FILL_FIELDCAT
text
--> p1 text
<-- p2 text
FORM FILL_FIELDCAT.
INT_FIELDCAT-COL_POS = 1.
INT_FIELDCAT-TABNAME = 'INT_PETROL1'.
INT_FIELDCAT-FIELDNAME = 'PERNR'.
INT_FIELDCAT-SELTEXT_L = TEXT-005.
INT_FIELDCAT-OUTPUTLEN = 10.
INT_FIELDCAT-KEY = 'X'.
APPEND INT_FIELDCAT.
CLEAR INT_FIELDCAT.
INT_FIELDCAT-COL_POS = 2.
INT_FIELDCAT-TABNAME = 'INT_PETROL1'.
INT_FIELDCAT-FIELDNAME = 'NAME'.
INT_FIELDCAT-SELTEXT_L = TEXT-006.
INT_FIELDCAT-OUTPUTLEN = 25.
INT_FIELDCAT-KEY = 'X'.
APPEND INT_FIELDCAT.
CLEAR INT_FIELDCAT.
INT_FIELDCAT-COL_POS = 3.
INT_FIELDCAT-TABNAME = 'INT_PETROL1'.
INT_FIELDCAT-FIELDNAME = 'TRFST'.
INT_FIELDCAT-SELTEXT_L = TEXT-007.
INT_FIELDCAT-OUTPUTLEN = 5.
INT_FIELDCAT-KEY = 'X'.
APPEND INT_FIELDCAT.
CLEAR INT_FIELDCAT.
INT_FIELDCAT-COL_POS = 4.
INT_FIELDCAT-TABNAME = 'INT_PETROL1'.
INT_FIELDCAT-FIELDNAME = 'PALLOWANCE'.
INT_FIELDCAT-SELTEXT_L = TEXT-008.
INT_FIELDCAT-OUTPUTLEN = 16.
INT_FIELDCAT-KEY = 'X'.
APPEND INT_FIELDCAT.
CLEAR INT_FIELDCAT.
ENDFORM. " FILL_FIELDCAT
*& Form GET_EVENTS_ALV
text
--> p1 text
<-- p2 text
FORM GET_EVENTS_ALV.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 1
IMPORTING
ET_EVENTS = INT_EVENTS[]
EXCEPTIONS
LIST_TYPE_WRONG = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
READ TABLE INT_EVENTS INTO WS_EVENTS WITH KEY NAME =
SLIS_EV_TOP_OF_PAGE.
IF SY-SUBRC = 0.
WS_EVENTS-FORM = 'TOP'.
MODIFY INT_EVENTS FROM WS_EVENTS INDEX SY-TABIX.
ENDIF.
ENDFORM. " GET_EVENTS_ALV
*& Form TOP-OF-PAGE
text
FORM TOP.
*-- ALV Declarations
DATA: WS_HEADER TYPE SLIS_T_LISTHEADER,
WA_HEADER TYPE SLIS_LISTHEADER.
*-- Title
WA_HEADER-TYP = 'H'.
WA_HEADER-INFO = TEXT-009.
APPEND WA_HEADER TO WS_HEADER.
CLEAR WA_HEADER.
WA_HEADER-TYP = 'H'.
WA_HEADER-INFO = TITLE.
APPEND WA_HEADER TO WS_HEADER.
CLEAR WA_HEADER.
WA_HEADER-TYP = 'H'.
WA_HEADER-INFO = ' '.
APPEND WA_HEADER TO WS_HEADER.
CLEAR WA_HEADER.
WA_HEADER-TYP = 'H'.
WA_HEADER-INFO = ' '.
APPEND WA_HEADER TO WS_HEADER.
CLEAR WA_HEADER.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = WS_HEADER
I_LOGO = 'LOGO'.
ENDFORM. "TOP-OF-PAGE
regards
karthik
Edited by: KARTIKEYA (EDS-VZG) on May 5, 2008 1:41 PM -
Select Between two date ranges from xml file
Hi ,
I have a column date_ with datatype VARCHAR2(150) it stores
data as
05/19/2010 11:23 AM
05/20/2010 12:23 PM
05/22/2010 11:23 AM
05/25/2010 11:23 AM
i have to select all the rows between 05/19/2010 and 05/22/2010 how to do that this column is in xml fileI have a table wit two fields
Field1 is integer and field2 is xmltype
in the xmltype i store an xml file
<ParentNode>
<Node>
<Cat>1</Cat>
<Date>05/19/2010 11:23 AM </Date>
</Node>
<Node>
<Cat>2</Cat>
<Date>05/20/2010 12:23 PM </Date>
</Node>
<Node>
<Cat>3</Cat>
<Date>05/22/2010 11:23 AM </Date>
</Node>
</Parentnode>
I am using teh below query to retrive teh result
SELECT T.Feild1, XML.* FROM Tablename T,
XMLTable( 'Parentnod/Node' PASSING T.Feild2 COLUMNS Cat NUMBER PATH 'Cat' ,
DATE_ VARCHAR2(100) PATH 'Date'
)XML where cat >1;
now i have to do teh same to select the rows between two date range 05/19/2010 and 05/21/2010
hope i am able to make teh question simple -
Fetching multiple values from XML node
Hi,
I have the below XML string / Data stored in one of a table column. I am trying to extract the values of ITEM_NAME node. using the query :
select extractvalue(xml_data, '/BILL/BILL_DTL/RECORD/ITEM_NAME') from XMLTable;
If i use this query i am getting the error as : ORA-19025 EXTRACTVALUE returns value of only one node
XML String / XML data
<BILL>
.....<BILL_NO>1000</BILL_NO>
.....<SRNO>3456</SRNO>
.....<BILL_DTL>
........<RECORD>
...........<LINE_NO>1</LINE_NO>
...........<ITEM_NAME>TOYOTA COROLLA</ITEM_NAME>
........</RECORD>
........<RECORD>
..........<LINE_NO>2</LINE_NO>
..........<ITEM_NAME>NISSAN CEDRIC</ITEM_NAME>
.......</RECORD>
.....</BILL_DTL>
</BILL>
The structure of the table is given below.
SQL> DESC XMLTABLE;
Column_Name ---------------Type
DOC_ID -------------------------NUMBER
XML_DATA --------------------XMLTYPE
What will be the query to fetch the values from the ITEM_NAME node.
Thanks & RegardsA late answer but just to show that it can be done with XMLTable (the built-in Oracle function) when you expect to return multiple rows from one input.
WITH XMLTable AS
(SELECT XMLTYPE('<BILL>
<BILL_NO>1000</BILL_NO>
<SRNO>3456</SRNO>
<BILL_DTL>
<RECORD>
<LINE_NO>1</LINE_NO>
<ITEM_NAME>TOYOTA COROLLA</ITEM_NAME>
</RECORD>
<RECORD>
<LINE_NO>2</LINE_NO>
<ITEM_NAME>NISSAN CEDRIC</ITEM_NAME>
</RECORD>
</BILL_DTL>
</BILL>') xml_data
FROM dual
SELECT item_name
FROM XMLTable,
XMLTable('/BILL/BILL_DTL/RECORD'
PASSING xml_data
COLUMNS
item_name VARCHAR2(25) PATH 'ITEM_NAME'
Returns
ITEM_NAME
TOYOTA COROLLA
NISSAN CEDRIC -
Flash Builder 4.5 SDK Problem while reading/saving Data/Text from XML
Hi,
I'm working on a FLASH BUILDER 4.5 Project. Previously I was working on FLEX 3 with SDK 3. Now I have shifted my Project to FLASH BUILDER 4.5 with SDK (Apache Flex 4.11).
In this project, I have few links with me, clicking on which opens a TAB, and the respective Link data (XML DATA) loads into the Respective TAB. I'm using Flash Builder 4.5 currently and Apache Flex 4.11 SDK. When I use Previous Version of SDK (SDK 3), then the Data loads fine... but when I use higher version SDK (4.6 or 4.11), then the data starts to break, for instance:
When I click on link, i.e. CLICK FOR THE VERY FIRST TIME, the Data Shows like:
<P ALIGN="LEFT">Link 1 body text comes here</P>
Again, when I click on the same link for SECOND time, the Data Shows like:
<P ALIGN="LEFT"><P ALIGN="LEFT">Link 1 body text comes here</P></P>
Again, when I click on the same link for THIRD time, the Data Shows like:
<P ALIGN="LEFT"><P ALIGN="LEFT">&lt;P ALIGN=&quot;LEFT&quot;&gt;Link 1 body text comes here&lt;/P&gt;</P></P>
I got stuck inot this issue very badly. Any help would be apreciated.
Thanks in advance.
IMAGE 1 (FIRST CLICK)
IMAGE 2 (SECOND CLICK)
IMAGE 3 (THIRD CLICK)
IMAGE 4 (FOURTH CLICK)
THANKSHello everyone -
Since I last posted an interesting update happened. I tested my Flex application again, it is calling a Jetty Server that returns a JSON object, in different BROWSERS. I disabled HTTPS for now, and the crossdomain.xml policy file is wide open for testing (ie. allowing every request to return data). So the app accessing the data using HTTP only. Browsers - IE, Opera, Firefox and Chrome. Each browser contained the SAME application, revision of the Flash Player (10.3.183.10 debugger for firefox, chrome, opera, safari PC; 11.0.1.129 consumer version in IE9,) take a look at the screen shot (safari not shown although the result was the same as IE and chrome)
Note that Opera and Firefox returned successful values (i.e. successful JSON objects) using the same code generated from the Data Services Wizard. Chrome, IE and, Safari failed with an Internal error. So I am left wondering - WHY? Is it something with the Flash Player? the Browsers? the Flex SDK? Any thoughts are appreciated. Again, the code is found in the original thread above. -
Flash Builder 4 List controls trimming spaces from XML node values
I'm trying to migrate my Flex 3 application to Flash builder 4. One issue that I have is that one of my datasources returns a list of cities and regions. To get the regions to display in the correct order in Flex 3, a space was added to to their name in the database (ie. "West", "Northwest" are stored in the database as " West" and " Northwest" so that when sorted by the sql query they would appear at the top and gets translated to XML to fill in a list box or combo box in my Flex 3 application. I have functions that take that selected city or region value from the combo box and queries the database for various performance metrics. In migrating to Flash Builder 4, I noticed that the spaces in the region names no longer appear in the combo boxes. When I show the data in a datagrid, the spaces are still there but when populating a combo box or list box, the leading space gets trimmed. This is an issue since if a user selects the value "West", it doesn't find it in the database since it is listed as " West". This wasn't an issue in Flex Buider 3. Is there a work around or parameter that I can set to force the combo box or list box to show the data as-is versus having it trim off the leading spaces for my regions?
Also, a stupid question, in Flex 3, you were able to find the select value of a combo box by using comboBox.text. What is the equivalent in Flash Builder 4? Do I need to do comboBox.selectedItem.Region.toString() now or is there a shortcut to pull the text from the combo box?I think you want this:
private function onLoadPortfolioData(event:ResultEvent):void
var obj:XMLList = event.result.img as XMLList;
if (obj.length > 0)
_imgCollection = new XMLListCollection(obj);
pictureList.dataProvider = _imgCollection;
If this post answers your question or helps, please mark it as such. Thanks!
http://www.stardustsystems.com
Adobe Flex Development and Support Services -
Hi,
Can any one tell me how to retrive the partial payment accounting documents from BSEG table as I
Can't use REBZG field of BSEG which is not a primary key ?
Regards,
Krishnam RajuHi
U need to get all payments and check if they are partial payment.
I don't know which kind of items (vendor or customer) u need to control, but if u need to check the customer payments:
- A) Select the payments from cleared items (BSAK table)
- B) Check if the field REBZG is filled
Max -
Data retrival from standard transaction
hi all,
i have to get the material list from stadard t-code ca80 i have debugged the program and the whole material list is in tmapl internal table so if any one can find me a solution thats ll be very helpful. and points are rewarded
thanks in advance
anupamahi,
You can call transaction and send the data to it.
call transaction mm01 and skip first screen.
set parameter ID 'MAT' FIELD P_matnr.
Here you are passin gthe selection screen parameters to the standard transaction MM01 and skip the screen..
you start recording like in BDC and execute it here.
so you will be having the data in the internal table that you can update in the Database table.
Regards,
Madhavi
Maybe you are looking for
-
No longer able to use previous method for adding tracks and orginizing my library :(
I use to add a few mp3's to my library then sort the library by date added to see the just added tracks at the top [most recent] of that view, well that don't always work since itunes 11. Can anyone explain please? or even offer an alternate method?
-
Order Configuration Suggestions
I have decided on a 15" MacBook Pro. Now I must decide on the configuration to order. I intend to use it for multimedia - itunes, photos, and home video and Internet Surfing. I am not into gaming. This will be my personal machine strictly for home us
-
Hi, I have enabled Auditing but nothing is getting written into it. I can see under CMS>Settings> Auditing is Enabled and when I see the default folder /app/boe/bobje/Data/Auditing I can see the TXT files getting created but with 0KB. Why nothing is
-
How can I listen to music on YouTube and still be on other apps?
I used to be able to listen to music on YouTube but our of know where it just stopped working and will only let me "multitask" if I'm on safari. Thank you if you have anything that can help.
-
Milestone Configs in Project progress
Hi Friends, Pls. Send me the Usage of Milestone in Project progress and Milestone trend analysis. What are all the config. has to do? Looking for your speedy response. Regards Prabu K