Trying to add some security to uploading .DWF files from my application
My application uses the LDAP authentication scheme, and its working great.
But my application also provides a link to Floor Plans that are stored on the files system in DWF format.
The link is on the directory path which is an attribute to the record.
Part of the directory path is masked because the files on my system are located in the Document Root. (Thats fine).
But the link can be copied and pasted into any browser without any means of validation or security.
We like our LDAP authentication scheme, but I need to secure these files.
I've found something in the Pro Oracle Application Express book that sounds promising, but I don't know how to apply it.
In Chapter 9, File Storage, and the Standard upload section, I read about the "WWV_FLOW_API.SET_SECURITY_GROUP_ID" procedure. This procedure accepts the numeric value of the Workspace. If I could somehow use this procedure along with a condition for UpLoading the file that might work.
Can anyone give me some ideas here?
The example the book gives is this EXEC WWV_FLOW_API.SET_SECURITY_GROUP_ID(99999nnnnnn);
where (99999nnn..) is the same numeric id as SELECT &WORKSPACE_ID. from dual;
I appreciaate any ideas!
bounce
Similar Messages
-
Upload tab-delimited file from the application server to an internal table
Hello SAPients.
I'm using OPEN DATASET..., READ DATASET..., CLOSE DATASET to upload a file from the application server (SunOS). I'm working with SAP 4.6C. I'm trying to upload a tab-delimited file to an internal table but when I try load it the fields are not correctly separated, in fact, they are all misplaced and the table shows '#' where supposedly there was a tab.
I tried to SPLIT the line using as separator a variable with reference to CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB but for some reason that class doesn't exist in my system.
Do you know what I'm doing wrong? or Do you know a better method to upload a tab-delimited file into an internal table?
Thank you in advance for your help.Try:
REPORT ztest MESSAGE-ID 00.
PARAMETER: p_file LIKE rlgrap-filename OBLIGATORY.
DATA: BEGIN OF data_tab OCCURS 0,
data(4096),
END OF data_tab.
DATA: BEGIN OF vendor_file_x OCCURS 0.
* LFA1 Data
DATA: mandt LIKE bgr00-mandt,
lifnr LIKE blf00-lifnr,
anred LIKE blfa1-anred,
bahns LIKE blfa1-bahns,
bbbnr LIKE blfa1-bbbnr,
bbsnr LIKE blfa1-bbsnr,
begru LIKE blfa1-begru,
brsch LIKE blfa1-brsch,
bubkz LIKE blfa1-bubkz,
datlt LIKE blfa1-datlt,
dtams LIKE blfa1-dtams,
dtaws LIKE blfa1-dtaws,
erdat LIKE lfa1-erdat,
ernam LIKE lfa1-ernam,
esrnr LIKE blfa1-esrnr,
konzs LIKE blfa1-konzs,
ktokk LIKE lfa1-ktokk,
kunnr LIKE blfa1-kunnr,
land1 LIKE blfa1-land1,
lnrza LIKE blfa1-lnrza,
loevm LIKE blfa1-loevm,
name1 LIKE blfa1-name1,
name2 LIKE blfa1-name2,
name3 LIKE blfa1-name3,
name4 LIKE blfa1-name4,
ort01 LIKE blfa1-ort01,
ort02 LIKE blfa1-ort02,
pfach LIKE blfa1-pfach,
pstl2 LIKE blfa1-pstl2,
pstlz LIKE blfa1-pstlz,
regio LIKE blfa1-regio,
sortl LIKE blfa1-sortl,
sperr LIKE blfa1-sperr,
sperm LIKE blfa1-sperm,
spras LIKE blfa1-spras,
stcd1 LIKE blfa1-stcd1,
stcd2 LIKE blfa1-stcd2,
stkza LIKE blfa1-stkza,
stkzu LIKE blfa1-stkzu,
stras LIKE blfa1-stras,
telbx LIKE blfa1-telbx,
telf1 LIKE blfa1-telf1,
telf2 LIKE blfa1-telf2,
telfx LIKE blfa1-telfx,
teltx LIKE blfa1-teltx,
telx1 LIKE blfa1-telx1,
xcpdk LIKE lfa1-xcpdk,
xzemp LIKE blfa1-xzemp,
vbund LIKE blfa1-vbund,
fiskn LIKE blfa1-fiskn,
stceg LIKE blfa1-stceg,
stkzn LIKE blfa1-stkzn,
sperq LIKE blfa1-sperq,
adrnr LIKE lfa1-adrnr,
mcod1 LIKE lfa1-mcod1,
mcod2 LIKE lfa1-mcod2,
mcod3 LIKE lfa1-mcod3,
gbort LIKE blfa1-gbort,
gbdat LIKE blfa1-gbdat,
sexkz LIKE blfa1-sexkz,
kraus LIKE blfa1-kraus,
revdb LIKE blfa1-revdb,
qssys LIKE blfa1-qssys,
ktock LIKE blfa1-ktock,
pfort LIKE blfa1-pfort,
werks LIKE blfa1-werks,
ltsna LIKE blfa1-ltsna,
werkr LIKE blfa1-werkr,
plkal LIKE lfa1-plkal,
duefl LIKE lfa1-duefl,
txjcd LIKE blfa1-txjcd,
sperz LIKE lfa1-sperz,
scacd LIKE blfa1-scacd,
sfrgr LIKE blfa1-sfrgr,
lzone LIKE blfa1-lzone,
xlfza LIKE lfa1-xlfza,
dlgrp LIKE blfa1-dlgrp,
fityp LIKE blfa1-fityp,
stcdt LIKE blfa1-stcdt,
regss LIKE blfa1-regss,
actss LIKE blfa1-actss,
stcd3 LIKE blfa1-stcd3,
stcd4 LIKE blfa1-stcd4,
ipisp LIKE blfa1-ipisp,
taxbs LIKE blfa1-taxbs,
profs LIKE blfa1-profs,
stgdl LIKE blfa1-stgdl,
emnfr LIKE blfa1-emnfr,
lfurl LIKE blfa1-lfurl,
j_1kfrepre LIKE blfa1-j_1kfrepre,
j_1kftbus LIKE blfa1-j_1kftbus,
j_1kftind LIKE blfa1-j_1kftind,
confs LIKE lfa1-confs,
updat LIKE lfa1-updat,
uptim LIKE lfa1-uptim,
nodel LIKE blfa1-nodel.
DATA: END OF vendor_file_x.
FIELD-SYMBOLS: <field>,
<field_1>.
DATA: delim TYPE x VALUE '09'.
DATA: fld_chk(4096),
last_char,
quote_1 TYPE i,
quote_2 TYPE i,
fld_lth TYPE i,
columns TYPE i,
field_end TYPE i,
outp_rec TYPE i,
extras(3) TYPE c VALUE '.,"',
mixed_no(14) TYPE c VALUE '1234567890-.,"'.
OPEN DATASET p_file FOR INPUT.
DO.
READ DATASET p_file INTO data_tab-data.
IF sy-subrc = 0.
APPEND data_tab.
ELSE.
EXIT.
ENDIF.
ENDDO.
* count columns in output structure
DO.
ASSIGN COMPONENT sy-index OF STRUCTURE vendor_file_x TO <field>.
IF sy-subrc <> 0.
EXIT.
ENDIF.
columns = sy-index.
ENDDO.
* Assign elements of input file to internal table
CLEAR vendor_file_x.
IF columns > 0.
LOOP AT data_tab.
DO columns TIMES.
ASSIGN space TO <field>.
ASSIGN space TO <field_1>.
ASSIGN COMPONENT sy-index OF STRUCTURE vendor_file_x TO <field>.
SEARCH data_tab-data FOR delim.
IF sy-fdpos > 0.
field_end = sy-fdpos + 1.
ASSIGN data_tab-data(sy-fdpos) TO <field_1>.
* Check that numeric fields don't contain any embedded " or ,
IF <field_1> CO mixed_no AND
<field_1> CA extras.
TRANSLATE <field_1> USING '" , '.
CONDENSE <field_1> NO-GAPS.
ENDIF.
* If first and last characters are '"', remove both.
fld_chk = <field_1>.
IF NOT fld_chk IS INITIAL.
fld_lth = strlen( fld_chk ) - 1.
MOVE fld_chk+fld_lth(1) TO last_char.
IF fld_chk(1) = '"' AND
last_char = '"'.
MOVE space TO fld_chk+fld_lth(1).
SHIFT fld_chk.
MOVE fld_chk TO <field_1>.
ENDIF. " for if fld_chk(1)=" & last_char="
ENDIF. " for if not fld_chk is initial
* Replace "" with "
DO.
IF fld_chk CS '""'.
quote_1 = sy-fdpos.
quote_2 = sy-fdpos + 1.
MOVE fld_chk+quote_2 TO fld_chk+quote_1.
ELSE.
MOVE fld_chk TO <field_1>.
EXIT.
ENDIF.
ENDDO.
<field> = <field_1>.
ELSE.
field_end = 1.
ENDIF.
SHIFT data_tab-data LEFT BY field_end PLACES.
ENDDO.
APPEND vendor_file_x.
CLEAR vendor_file_x.
ENDLOOP.
ENDIF.
CLEAR data_tab.
REFRESH data_tab.
FREE data_tab.
Rob -
Error while uploading the file from Allpcation server in LSMW-7th step
Hi Experts,
what should be the specific CODE PAGE should be maintained while uploading the file from application server in LSMW-7th Step
Thanks in advance,
KSRHi
I mean that there is any seperate CODE PAGE which comes at the bottom of screen while uploading the file from the application server in 7th step.
Is there any specific CODE PAGE to be maintained...
Thanks in advance
Oarsk -
I just made the switch to mac. I am have installed all the new PS6 CC and bridge and I am now trying to add some presets to my ACR but when I search for the folder to place them it is not there. From what I researched it says it should be under camera library/application support/adobe/camera raw/settings but I can only get to library/application support/adobe/ and then there are two different camera raw options I have checked both and there are not settings folder. If anyone can help me please thanks
Apple most likely has the same poor taste that Microsoft does when it come to defaults. Microsoft likes to hide things like settings, preset, folders etc from normal users think the dumb or something else. If Apple also hide things you will have to make some system setting changes that will allow Finder to do it job and find it for you.
-
I am trying to add some new software and am told I have an incorrect software that I already confirmed is correct. Can anyone help???
Please confirm you are actually running the ancient OS 8.6.
What software is this? -
Trying to add goggle analytics widget to muse files
Trying to add goggle analytics widget to muse files. When "master page" is referred to is adobe referencing the masters (at the bottom of the plan section) or are they referring to all the pages build on the original master.
Also, if applying the analytic code only (not widget), same question as above. Each and every page or just the base master pages. I added it to master page/page properties/metadata but it completely messed up the code.
THIS IS INSTRUCTION FROM Add Google Analytics | Exchange | Adobe Muse CC
"Just drag the item your master pages (place it at the top and out of the content area) enter you google tracking code ID number and your done. "
ANY IDEA WHAT "AT THE TOP" means? OUT OF CONTENT AREA? Are they referring to the "desktop area" outside the perimeters of the website width?
Thanks!You're not giving us much to go on. Go to your Google WebMaster account & grab the GA tracking code. Re-insert it into some test pages. Analytics reporting may not show anything for several days.
Nancy O. -
I'm trying to download internet security and an error of microsoft windows applications are not supported on OS x keeps coming up
That's because you must be trying to download a Windows application, and they do not run on a Mac unless you are running Windows on the Mac.
Helpful Links Regarding Malware Protection
An excellent link to read is Tom Reed's Mac Malware Guide.
For adware removal see The Safe Mac » Adware Removal Guide and The Safe Mac » Adware Removal Tool.
Also, visit The XLab FAQs and read Detecting and avoiding malware and spyware.
See these Apple articles:
Mac OS X Snow Leopard and malware detection
OS X Lion- Protect your Mac from malware
OS X Mountain Lion- Protect your Mac from malware
OS X Mavericks- Protect your Mac from malware
About file quarantine in OS X
If you require anti-virus protection Thomas Reed recommends using ClamXAV. (Thank you to Thomas Reed for this recommendation.)
From user Joe Bailey comes this equally useful advice:
The facts are:
1. There is no anti-malware software that can detect 100% of the malware out there.
2. There is no anti-malware that can detect anything targeting the Mac because there
is no Mac malware in the wild, and therefore, no "signatures" to detect.
3. The very best way to prevent the most attacks is for you as the user to be aware that
the most successful malware attacks rely on very sophisticated social engineering
techniques preying on human avarice, ****, and fear.
4. Internet popups saying the FBI, NSA, Microsoft, your ISP has detected malware on
your computer is intended to entice you to install their malware thinking it is a
protection against malware.
5. Some of the anti-malware products on the market are worse than the malware
from which they purport to protect you.
6. Be cautious where you go on the internet.
7. Only download anything from sites you know are safe.
8. Avoid links you receive in email, always be suspicious even if you get something
you think is from a friend, but you were not expecting.
9. If there is any question in your mind, then assume it is malware. -
I have been using Lightroom 4.4 successfully for over 2 years. Just tried to import some new photos after a vacation and the application crashes when I click "import" every time. Tried restarting computer. Version says it is up to date.
How do I get formal support for this from Adobe?Thanks for the response. The application was crashing. A Windows message was displayed showing "Lightroom.exe has stopped working", "Windows can check online for a solution the problem.". Etc.
I just launched Lightroom to check the exact message for this reply - and the Import worked. It had failed dozens of times before. -
I'm trying to put some tunes on my daughters Ipod from my Itunes but cant copy them Help please
I'm trying to put some tunes on my daughters Ipod from my Itunes but cant copy them Help please
- For iTunes purchares:
iTunes Store: Transferring purchases from your iOS device or iPod to a computer
- For other music you need a third-party program like one of those discussed here:
newer copy -
Can't upload any files from my mac to the Internet
I am new to Macbook, and this obviously never happened before
So, the problem is:
I can't upload any files from my Mac anywhere (Facebook, Instagram, etc)
I can't attach files to e-mails.
any files that are on my desktop, folders - they just turn in grey and I can't choose them.
The only way I can do it is by going to "ALL FILES" where I have to search through all the files that are on my Mac
Keep in mind that this is a glitch, because earlier it was all fine and normal
To see what I mean I am uploading a skreen shot of attemp of uploading files to Fb.
Can anybody help? Can it be some sort of virus?Okay I had the same problem but I figured it out. When you go to choose file, all the links are greyed out. Use two fingers simulatiously and click down on the file you want, then choose "quick look" from the option menu. This will open a preview of your document and make the open button usable. Close the preview, and then select the open button.
The site I was trying to use says it only supports IE, so maybe that is what causes the problem.
Hope it works for you! -
Hi, can I upload Pages files from my iPad to Google Sites?
I set up a File Cabinet page, and when I touch "Add file," it only allows me to select files from my Photo Stream. I'd like to be able to select files from my Pages documents.
I am trying to use Sites for my students' ePortfolio, and the only way I can manage to get files onto the file cabinet is to export it to an app which will, in turn, save it as a photo. This process will be a monster when I'm trying to get a bunch of freshmen to upload their portfolio artifacts from Pages.
iPad implementation has been very frustrating for my school--I wish they had laptops!
Thanks!PS -- I really did search the community for this topic. I apologize if it's a repeated question.
-
Upload a file to the application top using File Upload feature of OAF
Hi,
I am facing some problem when trying to upload a file from my desktop to the application directory (e.g. AR TOP).
I do not want to use the fnd_lob table,want to load the file to that directory directory, is it possible using OAF file upload?Refer the following code
* Method used to write the contents (data) from an Oracle BLOB column to
* an O/S file. This method uses one of two ways to get data from the BLOB
* column - namely using Streams. The other way to read data from an
* Oracle BLOB column is to use getBytes() method.
* @throws java.io.IOException
* @throws java.sql.SQLException
public void readBLOBToFileStream()
throws IOException, SQLException {
FileOutputStream outputFileOutputStream = null;
InputStream blobInputStream = null;
String sqlText = null;
Statement stmt = null;
ResultSet rset = null;
BLOB image = null;
int chunkSize;
byte[] binaryBuffer;
int bytesRead = 0;
int bytesWritten = 0;
int totBytesRead = 0;
int totBytesWritten = 0;
try {
stmt = conn.createStatement();
outputBinaryFile2 = new File(outputBinaryFileName2);
outputFileOutputStream = new FileOutputStream(outputBinaryFile2);
sqlText =
"SELECT image " +
"FROM test_blob " +
"WHERE id = 2 " ;
rset = stmt.executeQuery(sqlText);
rset.next();
image = ((OracleResultSet) rset).getBLOB("image");
// Will use a Java InputStream object to read data from a BLOB (can
// also be used for a CLOB) object. In this example, we will use an
// InputStream to read data from a BLOB.
blobInputStream = image.getBinaryStream();
chunkSize = image.getChunkSize();
binaryBuffer = new bytechunkSize;
while ((bytesRead = blobInputStream.read(binaryBuffer)) != -1) {
// Loop through while reading a chunk of data from the BLOB
// column using an InputStream. This data will be stored
// in a temporary buffer that will be written to disk.
outputFileOutputStream.write(binaryBuffer, 0, bytesRead);
totBytesRead += bytesRead;
totBytesWritten += bytesRead;
outputFileOutputStream.close();
blobInputStream.close();
conn.commit();
rset.close();
stmt.close();
System.out.println(
"==========================================================\n" +
" INPUT STREAMS METHOD\n" +
"==========================================================\n" +
"Wrote BLOB column data to file " + outputBinaryFile2.getName() + ".\n" +
totBytesRead + " bytes read.\n" +
totBytesWritten + " bytes written.\n"
} catch (IOException e) {
System.out.println("Caught I/O Exception: (Write BLOB value to file - Streams Method).");
e.printStackTrace();
throw e;
} catch (SQLException e) {
System.out.println("Caught SQL Exception: (Write BLOB value to file - Streams Method).");
System.out.println("SQL:\n" + sqlText);
e.printStackTrace();
throw e;
--Prasanna -
Help please to Upload a file from my PC to server's KM
Hello:
I can't Upload correctly a file from my local PC to a KM of the server.
My problem is after that I've uploaded any file from my PC to KM, sometimes when I open or download it from the KM appears blank, and when I try another way to write the file (out.write()) I've uploaded a bad file that can't be downloaded or opened it. I can't get the file Data of the file for uploading, I need to set it with the fileResource (I tried with fileResource.read(false))
I use a FileUpload in my view.
<b>My Context:</b>
File (node)
|----fileResource (com.sap.ide.webdynpro.uielementdefinitions.Resource)
|----fileData (binary)
|----fileName (String)
wdDoInit(){
IPrivateUploadDownloadKMView.IFileElement fileBind = wdContext.createFileElement();
wdContext.nodeFile().bind(fileBind);
IWDAttributeInfo attInfo = wdContext.nodeFile().getNodeInfo().getAttribute("fileData");
ISimpleTypeModifiable type = attInfo.getModifiableSimpleType();
onActionSubir(){
IPrivateUploadDownloadKMView.IFileElement fileElement = wdContext.currentFileElement();
IWDResource resource = fileElement.getFileResource();
fileElement.setFileName(resource.getResourceName());
fileElement.setFileData(fileData);
byte[] fileData=new byte[resource.read(false).available()];
fileElement.setFileData(fileData);
fileName = fileElement.getFileName();
try{
File file = new File(fileName);
FileOutputStream out = new FileOutputStream(file);
out.write(fileElement.getFileData());
out.close();
fin = new FileInputStream(fileName);
fin.read();
Content content = new Content(fin,null, -1);
IResource newResource = folder.createResource(fileElement.getFileName(),null, content);
catch(Exception e){
IWDMessageManager mm = wdControllerAPI.getComponent().getMessageManager();
mm.reportWarning("error: "+e.getMessage());
Can you help me?, any sugestions to solve my problem or improve my code?
Regards
Jonatan.If you have got the permission to access <b>content management</b> in portal appliction server consle,then click on content management >select the KM Repository and clik on it.Then right click on <b>folder</b>>new-->upload.After clicking the upload option one page will be open and then you can browse your local file and upload to the KM Repository.
-
Issue with uploading XML file from application server into internal table
i Need to fetch the XML file from the application server and place into internal table and i am getting error message while using the functional module SMUM_XML_PARSE and the error message is "line 1 col 1-unexpected symbol; expected '<', '</', entity reference, character data, CDATA section, processing instruction or comment" and could you please let me know how to resolve this issue?
TYPES: BEGIN OF T_XML,
raw(2000) TYPE C,
END OF T_XML.
DATA:GW_XML_TAB TYPE T_XML.
DATA: GI_XML_TAB TYPE TABLE OF T_XML INITIAL SIZE 0.
DATA:GI_STR TYPE STRING.
data: GV_XML_STRING TYPE XSTRING.
DATA: GI_XML_DATA TYPE TABLE OF SMUM_XMLTB INITIAL SIZE 0.
data:GI_RETURN TYPE STANDARD TABLE OF BAPIRET2.
OPEN DATASET LV_FILE1 FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF SY-SUBRC NE 0.
MESSAGE 'File does not exist' TYPE 'E'.
ELSE.
DO.
* Transfer the contents from the file to the work area of the internal table
READ DATASET LV_FILE1 INTO GW_XML_TAB.
IF SY-SUBRC EQ 0.
CONDENSE GW_XML_TAB.
* Append the contents of the work area to the internal table
APPEND GW_XML_TAB TO GI_XML_TAB.
ELSE.
EXIT.
ENDIF.
ENDDO.
ENDIF.
* Close the file after reading the data
CLOSE DATASET LV_FILE1.
IF NOT GI_XML_TAB IS INITIAL.
CONCATENATE LINES OF GI_XML_TAB INTO GI_STR SEPARATED BY SPACE.
ENDIF.
* The function module is used to convert string to xstring
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
EXPORTING
TEXT = GI_STR
IMPORTING
BUFFER = GV_XML_STRING
EXCEPTIONS
FAILED = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE 'Error in the XML file' TYPE 'E'.
ENDIF.
ENDIF.
IF GV_SUBRC = 0.
* Convert XML to internal table
CALL FUNCTION 'SMUM_XML_PARSE'
EXPORTING
XML_INPUT = GV_XML_STRING
TABLES
XML_TABLE = GI_XML_DATA
RETURN = GI_RETURN.
ENDIF.
READ TABLE GI_RETURN TRANSPORTING NO FIELDS WITH KEY TYPE = 'E'.
IF SY-SUBRC EQ 0.
MESSAGE 'Error converting the input XML file' TYPE 'E'.
ELSE.
DELETE GI_XML_DATA WHERE TYPE <> 'V'.
REFRESH GI_RETURN.
ENDIF.Could you please tel me why the first 8 lines were removed, till <Soap:Body and also added the line <?xml version="1.0" encoding="UTF-8"?> in the beggining .
Becuase there will be lot of XML files will be coming from the Vendor daily and that should be uploaded in the application server and should update in the SAP tables based on the data in the XML file.
what information i need to give to vendor that do not add the first 8 lines in the XML file and add the line in the beggining <?xml version="1.0" encoding="UTF-8"?> ??????
Is there any other way we can do with out removing the lines? -
Uploading xml file from application server
HI everybody guys having promblem reading xml file from application server.Here is the solution. the sample program is below.
TYPE-POOLS: ixml. "iXML Library Types
*TABLES : rbkp.
TYPE DECLERATIION
TYPES: BEGIN OF type_tabpo,
ebeln TYPE ekko-ebeln, "PO document number
ebelp TYPE ekpo-ebelp, "PO line item
END OF type_tabpo.
TYPES: BEGIN OF type_ekbe,
belnr TYPE rbkp-belnr, "Invoice document
gjahr TYPE rbkp-gjahr, "fiscal year
END OF type_ekbe.
TYPES: BEGIN OF type_invoice,
belnr TYPE rbkp-belnr, "PO document number
gjahr TYPE rbkp-gjahr, "Fiscal Year
rbstat TYPE rbkp-rbstat, "invoice status
END OF type_invoice.
TYPES: BEGIN OF t_xml_line, "Structure for holding XML data
data(256) TYPE x,
END OF t_xml_line.
INTERNAL TABLE DECLERATIION
DATA: gi_tabpo TYPE STANDARD TABLE OF type_tabpo,
gi_ekbe TYPE STANDARD TABLE OF type_ekbe,
gi_invoice TYPE STANDARD TABLE OF type_invoice,
gi_bapiret2 TYPE STANDARD TABLE OF bapiret2.
DATA: l_ixml TYPE REF TO if_ixml,
l_streamfactory TYPE REF TO if_ixml_stream_factory.
l_parser TYPE REF TO if_ixml_parser,
l_istream TYPE REF TO swif_ixml_istream,
l_document TYPE REF TO if_ixml_document,
l_node TYPE REF TO if_ixml_node,
l_xmldata TYPE string.
*DATA: l_elem TYPE REF TO if_ixml_element,
l_root_node TYPE REF TO if_ixml_node,
l_next_node TYPE REF TO if_ixml_node,
l_name TYPE string,
l_iterator TYPE REF TO if_ixml_node_iterator.
DATA: l_xml_table TYPE TABLE OF t_xml_line, " XML Table of the structure
l_xml_line TYPE t_xml_line, " Record of structure t_xml_line
l_xml_table_size TYPE i. " XML table size
DATA: l_filename TYPE string.
WORK AREA DECLARATION
DATA: gw_tabpo TYPE type_tabpo,
gw_ekbe TYPE type_ekbe,
gw_invoice TYPE type_invoice,
gw_bapiret2 TYPE bapiret2.
BEGIN OF SELECTION SCREEN
SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
PARAMETERS: p_file TYPE pathintern LOWER CASE DEFAULT '/usr/sap/tmp/'.
Validation of XML file: Only DTD included in XML document is supported
SELECTION-SCREEN END OF BLOCK blk1.
INTIALISATION.
INITIALIZATION.
SELECTION SCREEN VALIDATION
AT SELECTION-SCREEN.
To validate p_file is not initial
PERFORM sub_validate_file.
PERFORM sub_validate_path.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
Request for filename for xml file from the application server
PERFORM sub_get_filename_appl USING p_file.
START OF SELECTION SCREEN
START-OF-SELECTION.
PERFORM sub_fetch_po_details.
PERFORM sub_get_invoice.
PERFORM sub_rel_invoice.
END OF SELECTION SCREEN
END-OF-SELECTION.
*& Form sub_validate_file
To Validate the file
FORM sub_validate_file .
IF p_file IS INITIAL.
MESSAGE e000. "specify the file path
ENDIF.
ENDFORM. " sub_validate_file
*& Form sub_get_filename_appl
form sub_get_filename_appl USING l_fname TYPE any.
DATA: l_fname TYPE filename-fileintern. " File name
*GET THE FILENAME FROM THE APPLICATION SERVER
CALL FUNCTION '/SAPDMC/LSM_F4_SERVER_FILE'
EXPORTING
directory = l_fname
filemask = '*'
IMPORTING
serverfile = l_fname
EXCEPTIONS
canceled_by_user = 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.
ENDFORM. " sub_get_filename_appl
*& Form sub_fetch_po_details
To fetch the PO details from the application server
Format of file is XML
FORM sub_fetch_po_details .
TYPE DECLERATIION
l_ixml = cl_ixml=>create( ).
Creating a stream factory
l_streamfactory = l_ixml->create_stream_factory( ).
PERFORM get_xml_table.
LOOP AT gi_tabpo INTO gw_tabpo.
WRITE:/ gw_tabpo.
ENDLOOP.
ENDFORM. " sub_fetch_po_details
*& Form get_xml_table
Read from the xml file
FORM get_xml_table .
Local variable declarations
DATA: l_len TYPE i,
l_len2 TYPE i,
l_tab TYPE tsfixml,
l_content TYPE string,
l_str1 TYPE string,
c_conv TYPE REF TO cl_abap_conv_in_ce,
l_itab TYPE TABLE OF string.
l_filename = p_file.
code to upload data from application server
OPEN DATASET l_filename FOR INPUT IN BINARY MODE.
IF sy-subrc <> 0.
WRITE:/ 'invalid file path'.
ENDIF.
DO.
READ DATASET l_filename INTO l_xml_line.
IF sy-subrc EQ 0.
APPEND l_xml_line TO l_xml_table.
ELSE.
EXIT.
ENDIF.
ENDDO.
CLOSE DATASET l_filename.
code to find the table size
DESCRIBE TABLE l_xml_table.
l_xml_table_size = ( sy-tleng ) * ( sy-tfill ).
*code to convert hexadecimal to XML
LOOP AT l_xml_table INTO l_xml_line.
c_conv = cl_abap_conv_in_ce=>create( input = l_xml_line-data
replacement
= space ).
c_conv->read( IMPORTING data = l_content len = l_len ).
CONCATENATE l_str1 l_content INTO l_str1.
ENDLOOP.
l_str1 = l_str1+0(l_xml_table_size).
SPLIT l_str1 AT cl_abap_char_utilities=>cr_lf INTO TABLE l_itab.
LOOP AT l_itab INTO l_str1.
REPLACE ALL OCCURRENCES OF cl_abap_char_utilities=>horizontal_tab IN
l_str1 WITH space.
ENDLOOP.
CALL TRANSFORMATION ('ID') " code to put in internal table
SOURCE XML l_str1
RESULT tab = gi_tabpo[].
ENDFORM. " get_xml_tableHi Raja,
I tried the same. But it not populating the table and giving an error message in the return table "line 1 col 1-unexpected symbol; expected '<', '</', entity reference, charac".
I can't find any ' ; ' in the XML file. What could be the possible reason of error?
Maybe you are looking for
-
How to disable checking for updates for Shockwave plug-in?
SOS: how can I disable checking for updates (and reporting that there is one) for a Shockwave object on a web page? I have a client with an older Shockwave version, and it's a royal pain for each user to be told there's a newer veriosn and do you wan
-
When I try to access my emails the screen opens but doesn't show any emails
When I try to access my emails the screen opens but doesn't show any emails
-
Handling of Fortran language extensions
One place where Sun Fortran needs work is in management of language extensions. For example, it seems that it is not possible to exclude the generic REALLOC() extension function, meaning that it is not possible to have a generic subroutine interface
-
Backed up on the cloud, I have my latest data, however on my iphone I have Notes data that is not in the cloud. How can I merge the Notes with the data on the cloud so that everything is the latest information and data ? Thanks
-
Problem importing from network drive???HELP
I have all my photos on a networked drive (pc network) I want to be able to access the photos from my ibook wihtout putting them on the internal mac HD (would fill it in no time flat). When I try to import the files i get an error "The volume for "@#