Upload .doc, .xml files in ABAP
Hi everybody,
I want to save some files in my database, but I don't have a clue, where to start...
Anybody knows how to upload files? Maybe you know functions or something like that?
And what's the datatype I need in my database to save files in there?
Best regards and thanks for your help!
Patrick
You can use GUI_UPLOAD
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = 'C:.filepathcsv' -
> File stored folder and File name
FILETYPE = 'ASC'
TABLES
DATA_TAB = itab -
> Internal Table
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
Kanagaraja L
Edited by: Kanagaraja Lokanathan on Jun 29, 2009 2:47 PM
Similar Messages
-
Hi,
Is there any way to upload an XML file into ABAP WD?
I just saw a blog for Java WD.
<a href="/people/johann.marty/blog/2006/10/03/create-a-web-dynpro-tree-from-an-xml-file:///people/johann.marty/blog/2006/10/03/create-a-web-dynpro-tree-from-an-xml-file
Is there a similar facility in ABAP WD?
Regards,
Haresh.hey u can do this by using CALL Transformation id.. command..
here is the example code where i wrote this to convert it DATA to XML format...it may help u..
DATA : BEGIN OF l_xml_tab OCCURS 0,
a(100) TYPE c,
END OF l_xml_tab.
DATA : xml_out TYPE string .
DATA : lw_xml_tab LIKE LINE OF l_xml_tab.
XML
CALL TRANSFORMATION id "('ID')
SOURCE tab = gt_outtab[]
RESULT XML xml_out.
Convert to TABLE
CALL FUNCTION 'HR_EFI_CONVERT_STRING_TO_TABLE'
EXPORTING
i_string = xml_out
i_tabline_length = 100
TABLES
et_table = l_xml_tab.
OPEN DATASET p_lgfil1 FOR OUTPUT IN BINARY MODE.
LOOP AT l_xml_tab INTO lw_xml_tab.
TRANSFER lw_xml_tab TO p_lgfil1.
ENDLOOP.
CLOSE DATASET p_lgfil1. -
Upload an XML file into the Internal table
Hi Guys,
I want to know, how to upload an xml file into the Internal table through ABAP programmingyou just wanted to load the xml file into internal table (as a table of binary strings)or load the xml data mapped to itab row columns
for the first one you can simply use gui_upload
and for the second one you need to load the xml file using gui_upload and use XLST program to transform into an itab
Regards
Raja -
Uploading an XML file from SAP into third party URL
Hi,
I need to Upload an XML file from sap into Third party URL. Can any body tell me the possible ways in SAP to achieve this task. Also explain me the proceedure.
Thanks in advance.
-NamdevSorry. If they only said HTTP/HTTPS and didn't say explicitly web service, it means they don't want it.
One thing I'm not sure is, do you have an URL at the third-party system that you need to contact, or should you provide one at your SAP system that they will contact?
If it is the first one, to send an HTTP request to a given URL using ABAP, you'll find an example here: [SAP Library: Example Program: Executing an HTTP Request|http://help.sap.com/saphelp_nw70/helpdata/en/1f/93163f9959a808e10000000a114084/frameset.htm]
Sandra -
Upload any XML file to internal table
Hi,
I'm writing a FM to upload any XML file (Which means I don't know the structure) to a internal table.
I tried to use FM 'GUI_UPLOAD' and CALL TRANSFORMATION ('ID'). But the problem is that, the RESULT tab of CALL TRANSFORMATION ('ID') needs to define the structure of the table for the corresponding XML file, otherwise it will not work. For example, I want to get the result table like this:
CALL TRANSFORMATION ('ID')
SOURCE XML xmlupl
RESULT tab = <tab>.
Then it will give me a run time error 'CX_XSLT_FORMAT_ERROR' because I didn't give a specific structure for <tab>.
Any solution for my situation?
Thanks.Where is your XLST file for the call transformation ID
From ABAP to XML you can do it as dynamic, but XML to ABAP you need a XLST to convert.
otherwise please look at this
a® -
How to upload an XML file into another system
Hi friends,
I have a requirement where I need to upload an XML file into one system
which has been downloaded using another system.
I have tried using the method ' cl_gui_frontend_services=>gui_upload'
to upload the file but it is going for dump.
I have used the method ' w_xml->import_from_file' also,
but it is also going for dump ,because both methods are using the same FM
' GUI_UPLOAD'.
Can any one suggest on this.
Regards,
Bhargavi.D"Here is the Explaination for uploading the XML Format file to sap " through ABAP Program ....
1. Basically you simply have to convert the XML file into the proper IDoc format. There are many ways to achieve this. One solution would be to convert it externally to SAP, e.g. via VB Script or with an XSLT transformation. Or you use the built in SAP functions for importing an IDoc from an XML stream.
2. Uploading a file is either done via GUI_UPLOAD or via the usual way of reading a file from the application server (Open dataset. Read dataset) But what do you mean by "send to external system"? Do you want to convert an IDoc into XML? Then you simply define an XML port with WE21 to send the IDoc out.
Here is an example of code that loads an XML from file and posts it as an IDoc. Please keep in mind that the XML has to be in its canonical format as described in the interface repository: ifr.sap.com (choose the template of the desired IDoc from there as an example).
data: data_tab type table of char1024.
data: XML_STREAM type string.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = 'D:test.xml'
* FILETYPE = 'ASC'
* HAS_FIELD_SEPARATOR = ' '
* HEADER_LENGTH = 0
* READ_BY_LINE = 'X'
* DAT_MODE = ' '
* CODEPAGE = ' '
* IGNORE_CERR = ABAP_TRUE
* REPLACEMENT = '#'
* CHECK_BOM = ' '
* IMPORTING
* FILELENGTH =
* HEADER =
TABLES
DATA_TAB = DATA_TAB
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'CONVERT_TABLE_TO_STRING'
EXPORTING
I_TABLINE_LENGTH = '1024'
IMPORTING
E_STRING = XML_STREAM
TABLES
IT_TABLE = DATA_TAB[].
write: / xml_stream color col_total.
data: CONTENT_LENGTH type string.
data: CONTENT_TYPE type string.
data: REMOTE_ADDR type string.
CALL FUNCTION 'IDOC_INBOUND_XML_VIA_HTTP'
EXPORTING
XML_STREAM = XML_STREAM
CONTENT_LENGTH = content_type
CONTENT_TYPE = content_type
REMOTE_ADDR = remote_addr
EXCEPTIONS
NO_IDOCS_SAVED = 1
TAG_ERROR = 2
NO_DATA_RECEIVED = 3
NO_IDOCS_RECEIVED = 4
SEGMENT_ERROR = 5
IDOC_WAS_SEND_SECOND_TIME = 6
OTHERS = 7
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
write: / sy-subrc color COL_NEGATIVE.
ENDIF.
reward points if it is usefull.......
Girish -
hi experts ,
how to upload a given xml file into sap. any simple code.
prakash.Hi,
If you want to upload the XML file and you have the ABAP proxy generated,then
you could use the sproxy transaction and select the namespace and interface for which you want to execute the XML file.
Best Regards,
Arun -
Store/persist XML file on ABAP stack
Hi everybody,
as the ABAP Database is a relational DB, I wonder where to store a XML file. Is there a dedicated table?
Thanks
Regards Mario
Edited by: Mario Müller on Sep 10, 2008 2:21 AMhi
try with this function module SMUM_XML_PARSE for parsing xml document into a table structure
also check this document for how an abap prog take xml and convert into an abap internal table
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/f50dcd4e-0501-0010-3596-b686a7b51492
convert an xml file into abap internal table using sap dom approach
XML DOM Processing in ABAP part II - Convert an XML file into an ABAP table using SAP DOM Approach.
regards
kummari -
Simple Transformation to deserialize an XML file into ABAP data structures?
I'm attempting to write my first simple transformation to deserialize
an XML file into ABAP data structures and I have a few questions.
My simple transformation contains code like the following
<tt:transform xmlns:tt="http://www.sap.com/transformation-templates"
xmlns:pp="http://www.sap.com/abapxml/types/defined" >
<tt:type name="REPORT" line-type="?">
<tt:node name="COMPANY_ID" type="C" length="10" />
<tt:node name="JOB_ID" type="C" length="20" />
<tt:node name="TYPE_CSV" type="C" length="1" />
<tt:node name="TYPE_XLS" type="C" length="1" />
<tt:node name="TYPE_PDF" type="C" length="1" />
<tt:node name="IS_NEW" type="C" length="1" />
</tt:type>
<tt:root name="ROOT2" type="pp:REPORT" />
<QueryResponse>
<tt:loop ref="ROOT2" name="line">
<QueryResponseRow>
<CompanyID>
<tt:value ref="$line.COMPANY_ID" />
</CompanyID>
<JobID>
<tt:value ref="$line.JOB_ID" />
</JobID>
<ExportTypes>
<tt:loop>
<ExportType>
I don't know what to do here (see item 3, below)
</ExportType>
</tt:loop>
</ExportTypes>
<IsNew>
<tt:value ref="$line.IS_NEW"
map="val(' ') = xml('false'), val('X') = xml('true')" />
</IsNew>
</QueryResponseRow>
</tt:loop>
</QueryResponse>
</tt:loop>
1. In a DTD, an element can be designated as occurring zero or one
time, zero or more times, or one or more times. How do I write the
simple transformation to accommodate these possibilities?
2. In trying to accommodate the "zero or more times" case, I am trying
to use the <tt:loop> instruction. It occurs several layers deep in the
XML hierarchy, but at the top level of the ABAP table. The internal
table has a structure defined in the ABAP program, not in the data
dictionary. In the simple transformation, I used <tt:type> and
<tt:node> to define the structure of the internal table and then
tried to use <tt:loop ref="ROOT2" name="line"> around the subtree that
can occur zero or more times. But every variation I try seems to get
different errors. Can anyone supply a working example of this?
3. Among the fields in the internal table, I've defined three
one-character fields named TYPE_CSV, TYPE_XLS, and TYPE_PDF. In the
XML file, I expect zero to three elements of the form
<ExportType exporttype='csv' />
<ExportType exporttype='xls' />
<ExportType exporttype='pdf' />
I want to set field TYPE_CSV = 'X' if I find an ExportType element
with its exporttype attribute set to 'csv'. I want to set field
TYPE_XLS = 'X' if I find an ExportType element with its exporttype
attribute set to 'xls'. I want to set field TYPE_PDF = 'X' if I find
an ExportType element with its exporttype attribute set to 'pdf'. How
can I do that?
4. For an element that has a value like
<ErrorCode>123</ErrorCode>
in the simple transformation, the sequence
<ErrorCode> <tt:value ref="ROOT1.CODE" /> </ErrorCode>
seems to work just fine.
I have other situations where the XML reads
<IsNew value='true' />
I wanted to write
<IsNew>
<tt:value ref="$line.IS_NEW"
map="val(' ') = xml('false'), val('X') = xml('true')" />
</IsNew>
but I'm afraid that the <tt:value> fails to deal with the fact that in
the XML file the value is being passed as the value of an attribute
(named "value"), rather than the value of the element itself. How do
you handle this?Try this code below:
data l_xml_table2 type table of xml_line with header line.
W_filename - This is a Path.
if w_filename(02) = '
open dataset w_filename for output in binary mode.
if sy-subrc = 0.
l_xml_table2[] = l_xml_table[].
loop at l_xml_table2.
transfer l_xml_table2 to w_filename.
endloop.
endif.
close dataset w_filename.
else.
call method cl_gui_frontend_services=>gui_download
exporting
bin_filesize = l_xml_size
filename = w_filename
filetype = 'BIN'
changing
data_tab = l_xml_table
exceptions
others = 24.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif. -
Creating an xml file from abap code
Hello All,
Please let me know which FM do I need to execute in order to create an XML file from my ABAP code ?
Thanks in advance,
Paul.This has been discussed before
XML files from ABAP programs -
Create XML file from ABAP with SOAP Details
Hi,
I am new to XML and I am not familiar with JAVA or Web Service. I have searched in SDN and googled for a sample program for creating XML document from ABAP with SOAP details. Unfortunately I couldn't find anything.
I have a requirement for creating an XML file from ABAP with SOAP details. I have the data in the internal table. There is a Schema which the client provided and the file generated from SAP should be validating against that Schema. Schema contains SOAP details like Envelope, Header & Body.
My question is can I generate the XML file using CALL TRANSFORMATION in SAP with the SOAP details?
I have tried to create Transformation (Transaction XSLT_TOOL) in SAP with below code. Also in CALL transformation I am not able to change the encoding to UTF-8. It's always show UTF-16.
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" version="1.0">
<xsl:template match="/">
<SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP:Header>
<CUNS:HeaderInfo>
<CUNS:InterfaceTypeId>10006</InterfaceTypeId>
<CUNS:BusinessPartnerID>11223344</BusinessPartnerID>
<CUNS:SchemaVersion>1.0</SchemaVersion>
<CUNS:DateTime>sy-datum</DateTime>
</CUNS:HeaderInfo>
</SOAP:Header>
<SOAP:Body>
<xsl:copy-of select="*"/>
</SOAP:Body>
</SOAP:Envelope>
</xsl:template>
</xsl:transform>
In ABAP program, I have written below code for calling above Transformation.
call transformation ('Z_ID')
source tab = im_t_output[]
result xml xml_out.
call function 'SCMS_STRING_TO_FTEXT'
exporting
text = xml_out
tables
ftext_tab = ex_t_xml_data.
Please help me how to generate XML file with SOAP details from ABAP. If anybody have a sample program, please share with me.
Is there any easy way to create the XML file in CALL Transformation. Please help.
ThanksTry ABAP forum, as it seems not to be PI related.
-
Transforming XML File to abap structure
Hello,
I am working in a new project for making an input interface.
The problem to resolv is :
1>Reading an XML file on a unix Server
2>Transforming this file in abap structure with the instruction
call transformation.
Format of the input file :
<LISTEART>
<ART code="A01" label="Designation A01"/>
<ART code="A02" label="Designation A02"/>
<ART code="A03" label="Designation A03"/>
<ART code="A04" label="Designation A04"/>
<ART code="A05" label="Designation A05"/>
</LISTEART>
Format of the abap structure :
DATA : BEGIN OF ws_art,
code(4) TYPE c,
label(3) TYPE c,
END OF ws_art.
DATA : wt_art LIKE ws_art OCCURS 0 WITH HEADER LINE.
is it possible to transform the input file to an internal table
with the call transformation ?
CALL TRANSFORMATION transfo
SOURCE XML xml_string
RESULT para = result.
Somebody can explain me how to create links between xml file
and abap structure ?
with regards
JLuc Ledoux
[email protected]Hi,
try like this.
TYPES: BEGIN OF day,
name TYPE string,
work(1) TYPE c,
END OF day.
DATA: BEGIN OF week,
day1 TYPE day,
day2 TYPE day,
day3 TYPE day,
day4 TYPE day,
day5 TYPE day,
day6 TYPE day,
day7 TYPE day,
END OF week.
DATA xml_string TYPE string.
DATA result LIKE week.
week-day1-name = 'Monday'. week-day1-work = 'X'.
week-day2-name = 'Tuesday'. week-day2-work = 'X'.
week-day3-name = 'Wednesday'. week-day3-work = 'X'.
week-day4-name = 'Thursday'. week-day4-work = 'X'.
week-day5-name = 'Friday'. week-day5-work = 'X'.
week-day6-name = 'Saturday'. week-day6-work = ' '.
week-day7-name = 'Sunday'. week-day7-work = ' '.
CALL TRANSFORMATION ...
SOURCE root = week
RESULT XML xml_string.
CALL TRANSFORMATION ...
SOURCE XML xml_string
RESULT root = result.
Regards,
Vijay -
How to upload an excel file using ABAP.
Hi,
Can anyone please help me in understanding how to upload an excel file using ABAP.
Thanks!!http://diocio.wordpress.com/2007/02/12/sap-upload-excel-document-into-internal-table/
check the link
TYPES: Begin of t_record,
name1 like itab-value,
name2 like itab-value,
age like itab-value,
End of t_record.
DATA: it_record type standard table of t_record initial size 0,
wa_record type t_record.
DATA: gd_currentrow type i.
*Selection Screen Declaration
PARAMETER p_infile like rlgrap-filename.
*START OF SELECTION
call function ALSM_EXCEL_TO_INTERNAL_TABLE
exporting
filename = p_infile
i_begin_col = 1′
i_begin_row = 2′ Do not require headings
i_end_col = 14′
i_end_row = 31′
tables
intern = itab
exceptions
inconsistent_parameters = 1
upload_ole = 2
others = 3.
if sy-subrc <> 0.
message e010(zz) with text-001. Problem uploading Excel Spreadsheet
endif.
Sort table by rows and colums
sort itab by row col.
Get first row retrieved
read table itab index 1.
Set first row retrieved to current row
gd_currentrow = itab-row.
loop at itab.
Reset values for next row
if itab-row ne gd_currentrow.
append wa_record to it_record.
clear wa_record.
gd_currentrow = itab-row.
endif.
case itab-col.
when 0001′. First name
wa_record-name1 = itab-value.
when 0002′. Surname
wa_record-name2 = itab-value.
when 0003′. Age
wa_record-age = itab-value.
endcase.
endloop.
append wa_record to it_record.
*!! Excel data is now contained within the internal table IT_RECORD
Display report data for illustration purposes
loop at it_record into wa_record.
write:/ sy-vline,
(10) wa_record-name1, sy-vline,
(10) wa_record-name2, sy-vline,
(10) wa_record-age, sy-vline.
endloop. -
Error when Uploading _fmb.xml files
Hi...
I'm a newbie in Apex. I'm trying to create a migration project (ie migrating Oracle Forms 6i/10g to xml via Apex). I've converted the *.fmb files to _fmb.xml using frmf2xml.bat utility. My problem is when I tried to upload the _fmb.xml, this error appears:
+1 error has occurred+
+•Select the Forms File you want to upload. For Forms Modules, upload the XML file which is generated by the Forms2XML conversion tool, containing the information of your Forms Module. (Go to error)+
the error message is - javascript:apex.jQuery('#P3_FORMS_XML_FILE').focus();void(0)
the url returns: http://localhost:8080/apex/wwv_flow.accept
I've also tried to upload any type of file but it still returns the same error message. Please, anyone can help me...
Thanks.when i tried the online workspace as in http://apex.oracle.com/pls/apex/, i successfully created the migration project. But still failed to do it locally. Obviosly my locally setup Apex is having problem uploading the _fmb.xml files. Where have i gone wrong? Could anyone please help me?
-
How to upload a XML file to Servlet
Hi,
I am new to Java, I have to upload an XML file to java/j2ee server. The web server running on the server is "Tomcat 4.1". My new requirement is I have to upload an "Input.XML" file, can you please tell me how to upload an XML file. If any samples appriciated very soon.
Thanks & Regards,Hi!
On the client side, the client's browser must support form-based upload. Most modern browsers do, but there's no guarantee. For example,
<FORM ENCTYPE='multipart/form-data'
method='POST' action='/myservlet'>
<INPUT TYPE='file' NAME='mptest'>
<INPUT TYPE='submit' VALUE='upload'>
</FORM>
The input type "file" brings up a button for a file select box on the browser together with a text field that takes the file name once selected. The servlet can use the GET method parameters to decide what to do with the upload while the POST body of the request contains the file data to parse.
When the user clicks the "Upload" button, the client browser locates the local file and sends it using HTTP POST, encoded using the MIME-type multipart/form-data. When it reaches your servlet, your servlet must process the POST data in order to extract the encoded file. You can learn all about this format in RFC 1867.
Unfortunately, there is no method in the Servlet API to do this. Fortunately, there are a number of libraries available that do. Some of these assume that you will be writing the file to disk; others return the data as an InputStream.
You can see more things about Servlet on this website [http://pedrofao.blogspot.com|http://pedrofao.blogspot.com].
Maybe you are looking for
-
Hi, I am very new to Portal. I have downloaded the par file and imported to the Netweaver developer studio. But it is showig more that hunderd errors for com.sapportal.htmlb class. I dont have this class. How to get this class place this in plug
-
ESS and MSS objects translation and localization
Hello, we are implementing ESS on our ERP system and I have problem with translation of standard objects in ESS (pages, worksets, iviews). If I copy standard objects into new map, change default language on user to english, I can edit and rename obje
-
Hi Team i am facing some issue in my scenario. In my scenario, i have to pick a file from FTP location and process tht file in PI and after that the proxy does it work, and fater this again i have to place tht file in the FTP location. My doubt here
-
IPhoto 11 duplicates photo when modify it with photoshop
Hi friends! I have a problem: now with iphoto 11 when I modify a photo with photoshop a new foto appears in iphoto library ( with iphoto 9 the original photo was updated and not duplicated! ). This is a problem for me ! Can I change this setting/ err
-
Creating user as good as sysadmin but with read only privs
Hi Folks I want to creating user as good as sysadmin but having only read only privs how can we do this.