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.
-Namdev
Sorry. 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
Similar Messages
-
Send xml file from sap to third party url through https
Hi,
I have a requirement to send the xml file from ecc to a 3rd party url through HTTPS. How can we achieve this using ABAP.
Client doesn't have XI enviroment. The client has provided the 3rd party url where the file needs to be uploaded.
Please help ! <removed by moderator>
Thanks in advance.
Regards,
Chitra.K
Edited by: Thomas Zloch on Sep 12, 2011 12:58 PMHi Chitra,
I had similar requirement and here is what I did: -
REPORT Z_HTTP_POST_TEST_AMEY.
DATA: L_URL TYPE STRING ,
L_PARAMS_STRING TYPE STRING ,
L_HTTP_CLIENT TYPE REF TO IF_HTTP_CLIENT ,
L_RESULT TYPE STRING ,
L_STATUS_TEXT TYPE STRING ,
L_HTTP_STATUS_CODE TYPE I ,
L_HTTP_LENGTH TYPE I ,
L_PARAMS_XSTRING TYPE XSTRING ,
L_XSTRING TYPE XSTRING ,
L_IS_XML_TABLE TYPE STANDARD TABLE OF SMUM_XMLTB ,
L_IS_RETURN TYPE STANDARD TABLE OF BAPIRET2 ,
L_OUT_TAB TYPE STANDARD TABLE OF TBL1024
MOVE 'https://<hostname>/xxx/yyy/zzz' TO L_URL.
MOVE '<XML as string>' TO L_PARAMS_STRING.
*STEP-1 : CREATE HTTP CLIENT
CALL METHOD CL_HTTP_CLIENT=>CREATE_BY_URL
EXPORTING
URL = L_URL
IMPORTING
CLIENT = L_HTTP_CLIENT
EXCEPTIONS
ARGUMENT_NOT_FOUND = 1
PLUGIN_NOT_ACTIVE = 2
INTERNAL_ERROR = 3
OTHERS = 4 .
"STEP-2 : AUTHENTICATE HTTP CLIENT
CALL METHOD L_HTTP_CLIENT->AUTHENTICATE
EXPORTING
USERNAME = 'testUser'
PASSWORD = 'testPassword'.
"STEP-3 : SET HTTP HEADERS
CALL METHOD L_HTTP_CLIENT->REQUEST->SET_HEADER_FIELD
EXPORTING NAME = 'Accept'
VALUE = 'text/xml'.
CALL METHOD L_HTTP_CLIENT->REQUEST->SET_HEADER_FIELD
EXPORTING NAME = '~request_method'
VALUE = 'POST' .
CALL METHOD L_HTTP_CLIENT->REQUEST->SET_CONTENT_TYPE
EXPORTING CONTENT_TYPE = 'text/xml' .
"SETTING REQUEST DATA FOR 'POST' METHOD
IF L_PARAMS_STRING IS NOT INITIAL.
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
EXPORTING
TEXT = L_PARAMS_STRING
IMPORTING
BUFFER = L_PARAMS_XSTRING
EXCEPTIONS
FAILED = 1
OTHERS = 2.
CALL METHOD L_HTTP_CLIENT->REQUEST->SET_DATA
EXPORTING DATA = L_PARAMS_XSTRING .
ENDIF.
"STEP-4 : SEND HTTP REQUEST
CALL METHOD L_HTTP_CLIENT->SEND
EXCEPTIONS
HTTP_COMMUNICATION_FAILURE = 1
HTTP_INVALID_STATE = 2.
"STEP-5 : GET HTTP RESPONSE
CALL METHOD L_HTTP_CLIENT->RECEIVE
EXCEPTIONS
HTTP_COMMUNICATION_FAILURE = 1
HTTP_INVALID_STATE = 2
HTTP_PROCESSING_FAILED = 3.
"STEP-6 : Read HTTP RETURN CODE
CALL METHOD L_HTTP_CLIENT->RESPONSE->GET_STATUS
IMPORTING
CODE = L_HTTP_STATUS_CODE
REASON = L_STATUS_TEXT .
WRITE: / 'HTTP_STATUS_CODE = ',
L_HTTP_STATUS_CODE,
/ 'STATUS_TEXT = ',
L_STATUS_TEXT .
"STEP-7 : READ RESPONSE DATA
CALL METHOD L_HTTP_CLIENT->RESPONSE->GET_CDATA
RECEIVING DATA = L_RESULT .
"STEP-8 : CLOSE CONNECTION
CALL METHOD L_HTTP_CLIENT->CLOSE
EXCEPTIONS
HTTP_INVALID_STATE = 1
OTHERS = 2 .
"STEP-9 : PRINT OUTPUT TO FILE
CLEAR : L_XSTRING, L_OUT_TAB[].
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
EXPORTING
TEXT = L_RESULT
IMPORTING
BUFFER = L_XSTRING
EXCEPTIONS
FAILED = 1
OTHERS = 2.
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
BUFFER = L_XSTRING
TABLES
BINARY_TAB = L_OUT_TAB .
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = 'C:AMEYHTTP_POST_OUTPUT.xml'
TABLES
DATA_TAB = L_OUT_TAB .
Also, following is the detailed link for use of HTTP_CLIENT class: -
http://help.sap.com/saphelp_nw70ehp1/helpdata/EN/1f/93163f9959a808e10000000a114084/content.htm
Also, in below link, you can ignore XI specific part and observe how its sending XML to external URL:-
(I know it describes call to SAP XI server's URL, but it can be used to call any URL)
http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/ae388f45-0901-0010-0f99-a76d785e3ccc
In addition to all above, following configs to be present at ABAP application server: -
1. The hostname used to URL should be present in SAP ABAP application server's 'hosts' file.
2. Security certificate (if available) for URL to be called must be installed in SAP ABAP application server.
Let me know if you achieve any progress with it... -
About "Upload and download files from ADF into blob type colum."
hi
Using JDeveloper 10.1.3.3.0 I have tried the example available for download from this blog post by Jakub Pawlowski:
"Upload and download files from ADF into blob type colum."
at http://kuba.zilp.pl/?id=1
First a thank you to Jakub for this interesting example.
I have a question about a PDF file that I uploaded using the example.
The file has a size of 10445518 bytes.
After I upload that file, the blob column has a value with a size of 10445516 bytes, 2 bytes less.
SQL> select file_name, dbms_lob.getlength(stored_file) from blob_table;
FILE_NAME
DBMS_LOB.GETLENGTH(STORED_FILE)
ADF-DeveloperGuide-4GL-B25947_01.pdf
10445516If I download that file using the example, it has the same size as the blob value, 10445516 bytes.
If I open the downloaded file, using Adobe Reader 8.1.1, it first shows this message:
"The file is damaged but is being repaired."
After that, there is not problem using the PDF file in Adobe Reader.
I have tried this with both Internet Explorer 6 and Firefox 2.0.0.11.
I have also tried this with other (smaller) files, and those upload and download correctly.
question:
Why are those 2 bytes lost during upload?
many thanks
Jan VerveckenHi!
I can only post you my code that works for me and as I said I had same problems but can't remember what solved them. My code:
public void fileUploaded(ValueChangeEvent event)
FacesContext fc = FacesContext.getCurrentInstance();
UploadedFile file = (UploadedFile) event.getNewValue();
if (file != null && file.getLength() > 0)
// here I have some messages written and a call to the method on AM to save the uploaded file to the DB
private BlobDomain newBlobDomainForInputStream(InputStream in)
throws SQLException, IOException
BlobDomain loBlob = new BlobDomain();
OutputStream out = loBlob.getBinaryOutputStream();
writeInputStreamToWriter(in, out);
in.close();
out.close();
return loBlob;
private static void writeInputStreamToWriter(InputStream in,
OutputStream out)
throws IOException
byte[] buffer = new byte[8192];
int charsRead = 0;
while ((charsRead = in.read(buffer, 0, 8192)) != -1)
out.write(buffer, 0, charsRead);
* Launch the upload - see fileUploaded() for actual upload handling.
* @return null navigation event - we stay on this page
public String UploadButton_action()
if (this.getMyInputFile().getValue() == null)
FacesContext context = FacesContext.getCurrentInstance();
FacesMessage message =
new FacesMessage(FacesMessage.SEVERITY_WARN, JSFUtils.getStringFromBundle("fileupload.emptyfielderror"),
null);
context.addMessage(this.getMyInputFile().getId(), message);
return null;
* Setter for inputFile UI Component.
* @param inputFile inputFile UI component
public void setMyInputFile(CoreInputFile inputFile)
this.myInputFile = inputFile;
* Getter for inputFile UI Component.
* @return inputFile UI component
public CoreInputFile getMyInputFile()
return myInputFile;
}fileUploaded is a valueChangeListener on inputFile and UploadButton_action is as the name says the action for upload button.
Hope this helps. If not, than your problem is probably not the same as mine was, although the message about file corrupted was the same.
Next thing you can check in this case is if your file exceeds max file upload size. I don't know the exact default value, but if the file is too long I think this upload logic will upload only a part of the file and save it to the DB which can also lead to the same file corrupted error.
You can set the max upload value in web.xml like this:
<context-param>
<!-- Maximum memory per request (in bytes) -->
<param-name>oracle.adf.view.faces.UPLOAD_MAX_MEMORY</param-name>
<!-- Use 5000K -->
<param-value>5120000</param-value>
</context-param>
<context-param>
<!-- Maximum disk space per request (in bytes) -->
<param-name>oracle.adf.view.faces.UPLOAD_MAX_DISK_SPACE</param-name>
<!-- Use 10,000K -->
<param-value>15360000</param-value>
</context-param> -
How to send a XML file from SAP to WEB SERVICE
Hi folks,
i m creating a XML file with purchase order data, while saving the purchase order.now i need to send this XML file to some WEB SERVICE i.e to some perticular address in WEB.
can anyone give the step by step procedure to do this web service configuration? it's really urgent.
points must be awarded.
Thanks & Regards
pabitraHi all,
i need to send some purchase order data from SAP to WEB SERVICE. while saving the purchase order, i want to send some data from SAP to WEB SERVICE ( a perticular address in WEB).
i want to see those datas in xml format in WEB.
Now i am using SAP 4.7 version. Is this web service configuration is possible or not?
In SE37, i can not see the CREATE WEB SERVICE option in utilitities--> More utilities menu.is it possible in 4.7???
can anyone give any suggestion ? it's very urgent.
Thnaks
pabitra -
Sending XML file from SAP to Windows Based file server with FTP function
Hi Gurus,
We are using SAP BW 3.0B version.
I need to convert data in ODS to XML format and send this XML file to remote server which is not a SAP application server, it is just a Window Based file server with FTP function..
By writing some ABAP code I have converted ODS data into XML format (which gets saved in my local system)
(Is that I need to put this file in Application Server to send it to the other servers? )
Now the thing is how I can send this file to that Windows Based file server.
plz suggest me.... what can be done......
Thanks in Advance
Madhusudhan
Edited by: Madhusudhan Raju on Dec 3, 2009 4:25 AMI dont think the above code support windows OS. Because I always execute this script via UNIX.
I think you can try this option, go to command prompt, goto the destination path where you have an XML file using cd....
ftp (destination servername), specify the username and password.
afterthat, use the command put and filename.
check whether the file had reached destination successfully or not.
For automation purpose, you can use the following script like
ftp: -s: test.txt (servername)
In test.txt,
UserName
Password
bin
cd /files
put file.xml
bye
Also, you can check in SM69, there will be some SAP external commands to automate the file transfer.
Thanks
Sat
http://support.microsoft.com/?kbid=96269 -
Hi All , validating the overlapped periods ,Uploading the xml file to sap
Hi All,
please provide me the logic for the following requirement: Its an urgent .
Upload Global exception periods via File:
A customized transaction will be created for uploading the global exception periods using
an excel file. User has to maintain the global exception periods in an excel sheet with the
below mentioned format and upload the file manually into the system. The global
exceptions are maintained at step of half hourly period with a factor value.
Please find the format followed for maintaining the global exception periods in the
excel sheet.
Date From Period From Date To Period To Factor value
06.02.2008 12 06.02.2008 14 1.2
07.02.2008 1 07.02.2008 2 1.4
07.02.2008 3 07.02.2008 4 1.2
07.02.2008 5 07.02.2008 6 1.6
07.02.2008 7 07.02.2008 8 1.1
Once user uploads the excel file and press execute button, file contents are downloaded
and the global exception periods are updated into ZLF_GEXCEPTION table. Please refer
the necessary table format for details.
During the upload of global exception periods, the periods are checked if it is overlapping
with the previously uploaded periods. For those overlapping periods, below method is
followed.
1. For e. g, If a below exception period is already uploaded,
Date From Period From Date To Period To Factor value
06.02.2008 12 06.02.2008 16 1.4
The new file contains the period which gets overlapped with the previous global
exception period.
Date From Period From Date To Period To Factor value
06.02.2008 14 06.02.2008 15 1.6
The overlapped periods are split accordingly,
Date From Period from Date to Period To Factor value
06.02.2008 12 06.02.2008 13 1.4
06.02.2008 14 06.02.2008 15 1.6
06.02.2008 16 06.02.2008 16 1.4
2.For e.g., Already existing period,
Date From Period From Date To Period To Factor value
06.02.2008 12 07.02.2008 16 1.3
New period,
Date From Period From Date To Period To Factor value
07.02.2008 5 07.02.2008 8 1.7
The Global exception periods are split into,
Date From Period From Date To Period To Factor value
06.02.2008 12 07.02.2008 4 1.3
07.02.2008 5 07.02.2008 8 1.7
07.02.2008 9 07.02.2008 16 1.3
If any error occurs while updating the global exception periods into ZLF_GEXCEPTION
table, then display LF-001 message given below the Error messages section. For the
successful updating of global exception periods to ZLF_GEXCEPTION table, then
display the message Successfully completed.
User will be provided an option to download the global exception periods into an excel
file. User has to provide the necessary location details where to download the file while
downloading.
Thanks&Regards.
BkHi All,
please provide me the logic for the following requirement: Its an urgent .
Upload Global exception periods via File:
A customized transaction will be created for uploading the global exception periods using
an excel file. User has to maintain the global exception periods in an excel sheet with the
below mentioned format and upload the file manually into the system. The global
exceptions are maintained at step of half hourly period with a factor value.
Please find the format followed for maintaining the global exception periods in the
excel sheet.
Date From Period From Date To Period To Factor value
06.02.2008 12 06.02.2008 14 1.2
07.02.2008 1 07.02.2008 2 1.4
07.02.2008 3 07.02.2008 4 1.2
07.02.2008 5 07.02.2008 6 1.6
07.02.2008 7 07.02.2008 8 1.1
Once user uploads the excel file and press execute button, file contents are downloaded
and the global exception periods are updated into ZLF_GEXCEPTION table. Please refer
the necessary table format for details.
During the upload of global exception periods, the periods are checked if it is overlapping
with the previously uploaded periods. For those overlapping periods, below method is
followed.
1. For e. g, If a below exception period is already uploaded,
Date From Period From Date To Period To Factor value
06.02.2008 12 06.02.2008 16 1.4
The new file contains the period which gets overlapped with the previous global
exception period.
Date From Period From Date To Period To Factor value
06.02.2008 14 06.02.2008 15 1.6
The overlapped periods are split accordingly,
Date From Period from Date to Period To Factor value
06.02.2008 12 06.02.2008 13 1.4
06.02.2008 14 06.02.2008 15 1.6
06.02.2008 16 06.02.2008 16 1.4
2.For e.g., Already existing period,
Date From Period From Date To Period To Factor value
06.02.2008 12 07.02.2008 16 1.3
New period,
Date From Period From Date To Period To Factor value
07.02.2008 5 07.02.2008 8 1.7
The Global exception periods are split into,
Date From Period From Date To Period To Factor value
06.02.2008 12 07.02.2008 4 1.3
07.02.2008 5 07.02.2008 8 1.7
07.02.2008 9 07.02.2008 16 1.3
If any error occurs while updating the global exception periods into ZLF_GEXCEPTION
table, then display LF-001 message given below the Error messages section. For the
successful updating of global exception periods to ZLF_GEXCEPTION table, then
display the message Successfully completed.
User will be provided an option to download the global exception periods into an excel
file. User has to provide the necessary location details where to download the file while
downloading.
Thanks&Regards.
Bk -
Commitment Interface from SAP to third party system!
When we created Purchase Requisition or Purchase Order, the commitment will be created. The third party system needs to track the commitment. So SAP needs to send the commitment to the third party system by this interface.
But when the Goods have been delivered, the commitment will be zero out and the actual will be posted to SAP. SAP needs to send the offsetting records to the third party system. In this way, the third party systems knows that how much commitments have been reduced.
My problem is that I cannot find the right table to record the offsetting entry. In the table COSP, I can identify the commitment by the Business Transaction -- RMBA and RMBE. But it did not record the offsetting entry. It just becomes zero when the goods have been delivered. But I have nothing from that table to send to the third party system.
Does anyone meet this problem before? Can you share some experience on this?
ThanksHi ,
As pointed ...above you can for a file to file scenario you can create just the Business service in integration Directory and create two file communication channels for sender and reciever under it.
However if it was file to idoc or file to rfc ..
then you need create ts web as abap ..identifying your R/3 system
System Name: <you can give a 3 character id here of r/3 system ...i.e like IDS>
System Home : <can be found in status of R/3 system>
Installtion Number : In transaction Slicense in R/3
Host Name : Same as System home can be specified.
Message Server: <3600+instance Number can be found in the log pad to the r/3 system itself >
associate a bussiness system with this ...create a product and a software component version ...In swcv in respository ..develop your object under it ...
Import this business system in Configuration ..and create your communication chanel under it.
Regards ,
Deepak -
Send PDF, EXCEL, MS Word from SAP to third party
Hi All,
My requirement is we have to upload docs from PC and send to third party system.
Now my doubt is how can we upload the docs like PDF , Excel, MS Word etc from PC to sap and send it to third party.
Thanks & Regards
Satyamkumar JhaHi Prabhudas,
Thanks for your inputs.
I have one more doubt.
If you open any delivery in VL03N transaction just below the Menu bar there is button called 'Services for Object'. using this we can attach any document to this Delivery.
Is there any way to attach this newly uploaded document using some Z program (referring tcode CG3Z ) to this delivery.
Regards
Satyam -
RFC or BAPI to get ECC CST LST from SAP to third party
Hi Friends,
I want to find out RFC or BAPI to get ECC,CST and LST No. number from SAP system to third party software accourding to Ship to party.Please healp me.Hi,
Thanks very much for your answer. In fact, table UVERS is empty both on SAP Wharehouse server and Netweaver, but you put me on the right way...
I finally found that table CVERS_REF was enough, but I don't have the version of the component like in the status window...
I doubt also I'm right using the RFC_READ_TABLE, but I don't know yet if a BAPI exists for what I'm looking for.
Regards
François MAESEELE -
Upload and download files from ADF into blob type colum
i have a question about Kuba's example ( http://kuba.zilp.pl/?id=1# )
after you have upload the word documents, and when u click on the downoad button that document is open... i want to know if it is possibile that afer you have download the document, you make some changes on it and then to save these changes on the database? any idea if this can be done? Thanks in advance :)If you download the entire application from that link, the create.sql file is included in the \DBModel\model\zilp\testcase\dbmodel folder
It's a rather complicated matter in my opinion. Download the app, open it in JDev and use debug-mode to go through it step by step, so you can try to understand everything that happens.
Good luck :) -
Is it safe to remove setup32/setup64 files from the uninstall\third party directory?
Found 2 setupfiles in the %PROGRAM FILES%\common files\adobe\installers\uninstall\thirdparty\{GUID}\Adobe Photoshop lightroom 5 ccm directory.
SAFE to get rid of them? living a limited c:\ SSD boot device... so gotta be thrifty... Thanks!Hi Raj,
The “Everyone” share access is a remnant of legacy Exchange functionality (pre-Exchange 5.0).
For Exchange 2003, we do not see any Microsoft Exchange 2003 dependencies upon those shares.
From the Exchange perspective, it is safe to remove the “Everyone” share permission.
However, there may be any 3rd party applications which still use Exchange 2003 in a legacy fashion, their ability to access proxy DLLs/addressing templates, and reading diagnostic logging pages may be hampered.
To mitigate such a risk, I suggest we can replace “Everyone” with “Authenticated Users” in order to bypass any audit concerns, yet still allow 3rd party applications to access those shares. Additionally, here is a KB descripted the detailed functions about
these shared folder:
http://support.microsoft.com//kb/812290
Regards,
Winnie Liang
TechNet Community Support -
How to create a proxy to retrieve the xml file from web services
Hi Every one,
We have a requirment where we receive a xml file from Kenexa, a third party HR tool using a middleware tool. from SAP side We have to create a proxy to retrieve the xml file from web services by initiating call through middleware tool i used earlier.
these are the steps i intend to follow to accomlish the requirement.
1) middleware tool has to initiate the call to kenexa web services to receive the xml file when it is available.
2) On SAP we need to create a ABAP Proxy service provider to middleware where this file can be received.
Can any one guide me how i can create a proxy to retrieve the xml file from web services by initiating call through other middlewre (its not PI).
Any help would be really great, i am not a ABAP developer, so please help me with this. Thanks.Thank for reply.
The computers are in different locations, but yes it's possible, the users in this enviroment are all local administrator of the machines, and we can distribute the script centrally from the DC automatically
Acrobat use Java, right? I'm not so expert in java, but something about it could not be so difficult to manage.
Do you know some place where i can get some info about JS and acrobat? -
Upload xml file from aplication server using read dataset, parser error.
Hi,
I would like to upload xml file from app. server but parser failed. If I upload this xml file from workstation (using ws_upload) it is correct. For uploading xml file from app. server I use open dataset... read dataset. In loop section I remove '#' char. How do You upload xml file from app server? What Could be incorrect.
I try to open dataset in binary mode, text mode...
TYPES: BEGIN OF xml_line,
data(255) TYPE c,
END OF xml_line.
DATA: gt_xml_table TYPE TABLE OF xml_line,
gs_xml_structure TYPE xml_line,
gv_xml_table_size TYPE i.
OPEN DATASET s FOR INPUT IN BINARY MODE.
IF sy-subrc <> 0.
MESSAGE e001(zet) WITH '....'.
ENDIF.
DO.
READ DATASET s INTO gs_xml_structure.
IF sy-subrc <> 0.
EXIT.
ELSE.
len = STRLEN( gs_xml_structure ).
len = len - 1.
check len > 0.
WRITE gs_xml_structure(len) TO gs_xml_structure.
APPEND gs_xml_structure TO gt_xml_table.
ENDIF.
ENDDO.You Can do this too
parameters: p_file like rlgrap-filename.
data: subrc like sy-subrc.
create object me.
REFRESH t_data.
* Open XML File
CALL METHOD me->CREATE_WITH_FILE
EXPORTING
filename = p_file
RECEIVING
retcode = subrc.
* Saves Data in an itab from XML File.
CALL METHOD me->get_data
IMPORTING
retcode = subrc
CHANGING
dataobject = t_data[].
Regards,
Claudio. -
How to store multiple files from SAp in to Application server?
Hi Guys,
Can anybody tell me how to store multiple files from SAP into Application server.in my application i have to get the data from SAP tables BSEG , BKPF , BSAK and BSIK that to daily i have to do.
Any Logic or Code for how to do is welcomed.
plz help me urgently.
Thanks,
GopiHi,
directories creates basis. If you have task to store data in application server you already should have information into which folder you have to do it. If you don't have this information because it is just for example training for next task then you can use your personal folder into which you have access. To get list of all available folders please look at attached code and form get_directories (you get the list of folders you see in transaction AL11). But don't forget: If you are using open dataset you have to have rights to access application folder!
Here you are code which I use to upload text files from local disc into application folder
Regards,
Karol
*& Report FILE_PC_TO_SAP
REPORT FILE_PC_TO_SAP.
DATA: BEGIN OF searchpoints OCCURS 100,
DIRNAME(200) TYPE c, " name of directory.
sp_name(100) TYPE c," name of entry. (may end with *)
END OF searchpoints.
DATA: BEGIN OF isearchpoints OCCURS 10,
dirname(75) TYPE c, " name of directory.
aliass(75) TYPE c, " alias for directory.
svrname(75) TYPE c, " svr where directory is availabl
sp_name(75) TYPE c, " name of entry. (may end with *)
sp_cs(10) TYPE c, " ContainsString pattern for name
END OF isearchpoints.
data: l_file type filetable.
data: l_rc type i.
data: itab type TABLE OF string.
data: g_tmp_file_path type rlgrap-filename.
data: wa_itab type string.
data: h_destin(100) type c.
data: dat type string.
INITIALIZATION.
perform get_directories.
START-OF-SELECTION.
parameters: in_file type string OBLIGATORY LOWER CASE.
parameters: destin(100) type c OBLIGATORY LOWER CASE.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = in_file
"FILETYPE = 'BIN'
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = ' '
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
TABLES
DATA_TAB = itab
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.
write: / 'Error during loading input file!'.
ENDIF.
if h_destin is INITIAL.
h_destin = in_file.
endif.
CONCATENATE destin h_destin into dat SEPARATED BY '/'.
*TRANSLATE dat TO UPPER CASE.
OPEN DATASET dat FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-SUBRC = 0.
loop at itab into wa_itab.
TRANSFER: wa_itab TO dat.
endloop.
CLOSE DATASET dat.
write: / 'File uploaded!'.
ELSE.
write: / 'Not possible to open dataset'.
ENDIF.
at selection-screen on value-request for in_file.
perform select_input_file_name.
loop at l_file into g_tmp_file_path.
move g_tmp_file_path to in_file.
h_destin = ''.
SPLIT g_tmp_file_path at '\' into table itab.
loop at itab into g_tmp_file_path.
h_destin = g_tmp_file_path.
endloop.
endloop.
at selection-screen on value-request for destin.
DATA: lt_dfies TYPE TABLE OF dfies.
DATA: lwa_dfies TYPE dfies.
CALL FUNCTION 'DDIF_FIELDINFO_GET'
EXPORTING
tabname = '/BI0/PCO_AREA'
lfieldname = 'CO_AREA'
IMPORTING
dfies_wa = lwa_dfies.
lwa_dfies-tabname = 'searchpoints'.
lwa_dfies-REPTEXT = 'Destination directory'.
lwa_dfies-LENG = 100.
lwa_dfies-INTLEN = 100.
lwa_dfies-OUTPUTLEN = 100.
lwa_dfies-fieldname = 'SP_NAME'.
APPEND lwa_dfies TO lt_dfies.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
RETFIELD = 'SP_NAME'
DYNPPROG = SY-REPID
DYNPNR = SY-DYNNR
DYNPROFIELD = 'destin'
VALUE_ORG = 'S'
TABLES
VALUE_TAB = searchpoints
FIELD_TAB = lt_dfies
EXCEPTIONS
PARAMETER_ERROR = 1
NO_VALUES_FOUND = 2
OTHERS = 3.
*& Form select_input_file_name
* text
form select_input_file_name.
* call function 'F4_FILENAME'
* exporting
* program_name = sy-repid
* dynpro_number = sy-dynnr
* field_name = 'PATH'
* importing
* file_name = g_tmp_file_path.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
EXPORTING
WINDOW_TITLE = 'Please choose a file'
"default_extension = '*.TXT'
"default_filename = 'C:\*.txt'
initial_directory = 'C:\'
file_filter = '*.*'
CHANGING
FILE_TABLE = l_file
RC = l_RC
EXCEPTIONS
FILE_OPEN_DIALOG_FAILED = 1
CNTL_ERROR = 2
ERROR_NO_GUI = 3
NOT_SUPPORTED_BY_GUI = 4
OTHERS = 5.
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. "select_input_file_name
*& Form WRITE_DB_HOME
* Write DB home directory
* no parameters
FORM write_db_home.
CASE sy-dbsys(3).
WHEN 'ORA'.
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_ORAHOME'
ID 'VALUE' FIELD searchpoints-dirname.
*--- C5056155 Start of ALV -------------------------------*
* PERFORM flip_flop(rsora000) USING cflag.
* WRITE: / 'DIR_ORAHOME', 30 searchpoints-dirname.
MOVE: 'DIR_ORAHOME' TO searchpoints-sp_name.
APPEND searchpoints.
*--- C5056155 End of ALV -------------------------------*
WHEN 'ADA'.
CALL 'C_GETENV' ID 'NAME' FIELD 'DBROOT'
ID 'VALUE' FIELD searchpoints-dirname.
*--- C5056155 Start of ALV -------------------------------*
* PERFORM flip_flop(rsora000) USING cflag.
* WRITE: / 'DIR_ADA_DBROOT', 30 searchpoints-dirname.
MOVE: 'DIR_ADA_DBROOT' TO searchpoints-sp_name.
APPEND searchpoints.
*--- C5056155 End of ALV -------------------------------*
WHEN 'INF'.
CALL 'C_GETENV' ID 'NAME' FIELD 'INFORMIXDIR'
ID 'VALUE' FIELD searchpoints-dirname.
*--- C5056155 Start of ALV -------------------------------*
* PERFORM flip_flop(rsora000) USING cflag.
* WRITE: / 'DIR_INF_INFORMIXDIR', 30 searchpoints-dirname.
MOVE: 'DIR_INF_INFORMIXDIR' TO searchpoints-sp_name.
APPEND searchpoints..
*--- C5056155 End of ALV -------------------------------*
WHEN 'DB6'.
CALL 'C_GETENV' ID 'NAME' FIELD 'INSTHOME'
ID 'VALUE' FIELD searchpoints-dirname.
IF sy-subrc = 0.
*--- C5056155 Start of ALV -------------------------------*
* PERFORM flip_flop(rsora000) USING cflag.
* WRITE: / 'DIR_DB2_HOME', 30 searchpoints-dirname.
MOVE: 'DIR_DB2_HOME' TO searchpoints-sp_name.
APPEND searchpoints.
*--- C5056155 End of ALV -------------------------------*
ELSE.
EXIT.
ENDIF.
WHEN OTHERS.
EXIT.
ENDCASE.
ENDFORM. " WRITE_DB_HOME
FORM get_directories.
* get the name and aliases of ALL userdefined directories
SELECT * FROM user_dir INTO isearchpoints
WHERE svrname = sy-uname.
MOVE isearchpoints-dirname to searchpoints-dirname.
MOVE isearchpoints-aliass to searchpoints-sp_name.
APPEND searchpoints.
ENDSELECT.
SELECT * FROM user_dir INTO isearchpoints
WHERE svrname = 'all'.
MOVE isearchpoints-dirname to searchpoints-dirname.
MOVE isearchpoints-aliass to searchpoints-sp_name.
APPEND searchpoints.
ENDSELECT.
* Get DB home
IF sy-dbsys(3) = 'ADA'.
PERFORM write_db_home.
ENDIF.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_ATRA'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_ATRA' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_BINARY'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_BINARY' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory $DIR_CCMS
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_CCMS'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_CCMS' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_CT_LOGGING'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_CT_LOGGING' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_CT_RUN'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_CT_RUN' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_DATA'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_DATA' TO searchpoints-sp_name.
APPEND searchpoints.
* Get DB home
IF sy-dbsys(3) = 'DB6'.
PERFORM write_db_home.
ENDIF.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_DBMS'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_DBMS' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_EXECUTABLE'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_EXECUTABLE' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_EXE_ROOT'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_EXE_ROOT' TO searchpoints-sp_name.
APPEND searchpoints.
*get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_GEN'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_GEN' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_GEN_ROOT'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_GEN_ROOT' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_GLOBAL'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_GLOBAL' TO searchpoints-sp_name.
APPEND searchpoints.
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_GRAPH_EXE'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_GRAPH_EXE' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_GRAPH_LIB'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_GRAPH_LIB' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_HOME'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_HOME' TO searchpoints-sp_name.
APPEND searchpoints.
* Get DB home
IF sy-dbsys(3) = 'INF'.
PERFORM write_db_home.
ENDIF.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_INSTALL'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_INSTALL' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_INSTANCE'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_INSTANCE' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_LIBRARY'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_LIBRARY' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_LOGGING'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_LOGGING' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the files written by the memory inspector
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_MEMORY_INSPECTOR'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_MEMORY_INSPECTOR' TO searchpoints-sp_name.
APPEND searchpoints.
* Get DB home
IF sy-dbsys(3) = 'ORA'.
PERFORM write_db_home.
ENDIF.
*get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_PAGING'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_PAGING' TO searchpoints-sp_name.
APPEND searchpoints.
*get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_PUT'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_PUT' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_PERF'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_PERF' TO searchpoints-sp_name.
APPEND searchpoints.
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_PROFILE'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_PROFILE' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_PROTOKOLLS'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_PROTOKOLLS' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_REORG'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_REORG' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_ROLL'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_ROLL' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_RSYN'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_RSYN' TO searchpoints-sp_name.
APPEND searchpoints.
* calculate directory for saphostagent (no sapparam available...)
IF ( sy-opsys(3) = 'WIN' ) OR ( sy-opsys(3) = 'Win' ).
DATA: windir_path(64), programfiles_path(64).
* hoping that ProgramFiles is set in service user environment
CALL 'C_GETENV' ID 'NAME' FIELD 'ProgramFiles'
ID 'VALUE' FIELD programfiles_path.
IF programfiles_path IS INITIAL.
* %ProgramFiles% not available. guess from windir
CALL 'C_GETENV' ID 'NAME' FIELD 'windir'
ID 'VALUE' FIELD windir_path.
* e.g. S:\WINDOWS ==> S:\Program Files
CONCATENATE windir_path(3) 'Program Files' INTO programfiles_path.
ENDIF.
CONCATENATE programfiles_path '\SAP\hostctrl'
INTO searchpoints-dirname.
ELSE.
* on UNIX, the path is hard coded
searchpoints-dirname = '/usr/sap/hostctrl'.
ENDIF.
MOVE: 'DIR_SAPHOSTAGENT' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_SAPUSERS'
ID 'VALUE' FIELD searchpoints-dirname.
IF searchpoints-dirname = '.'.
IF sy-opsys = 'Windows NT'.
searchpoints-dirname = '.\'.
ELSE.
searchpoints-dirname = './'.
ENDIF.
ENDIF.
MOVE: 'DIR_SAPUSERS' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_SETUPS'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_SETUPS' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_SORTTMP'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_SORTTMP' TO searchpoints-sp_name.
APPEND searchpoints.
*get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_SOURCE'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_SOURCE' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_TEMP'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_TEMP' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_TRANS'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_TRANS' TO searchpoints-sp_name.
APPEND searchpoints.
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_TRFILES'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_TRFILES' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_TRSUB'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_TRSUB' TO searchpoints-sp_name.
APPEND searchpoints.
* get the name of the current server.
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'rdisp/myname'
ID 'VALUE' FIELD searchpoints-dirname.
data: h_ind type i.
LOOP AT searchpoints.
h_ind = sy-tabix.
IF searchpoints-sp_name IS INITIAL.
DELETE searchpoints INDEX h_ind.
ENDIF.
ENDLOOP.
ENDFORM. -
How to upload Unicode encoding files from web?
Hi everyone,
I do not manage to upload Unicode encoding CSV files from web. Currently I use class CL_HTMLB_MANAGER to upload file from web. It works fine with ANSI encoding files, but file content is not uploaded correctly with Unicode encoding files. Especially I get innumerable characters u201C#u201D throughout the string that contains the file content (For example instead of u201CSAP CATALOG CSV 2.0u201D I get u201CÿþS#A#P# #C#A#T#A#L#O#G# #C#S#V# #2#.#0#u201D).
I did not find in forums a solution to my issue that is why I am now asking for your help.
How can I upload Unicode encoding files from web? Do you know another way to upload file from web that is Unicode compatible?
Remark: I tried to upload Unicode encoding files from SAP GUI using function module GUI_UPLOAD and upload is successful.
Here is the code that I currently used.
DATA: lr_event_ex TYPE REF TO if_htmlb_data,
fileupload TYPE REF TO cl_htmlb_fileupload,
lr_upload_model TYPE REF TO /ccm/cl_bsp_upload_model,
lr_error TYPE REF TO /ccm/cx_file_upload.
lr_event_ex = cl_htmlb_manager=>get_event_ex( runtime->server->request ).
IF lr_event_ex->event_name = 'fileUpload' AND lr_event_ex->event_type = 'upload'.
fileupload ?= lr_event_ex.
FREE lr_event_ex.
* get the model
lr_upload_model ?= me->get_model( model_id = 'mupl' ).
IF NOT fileupload->file_name IS INITIAL.
* upload data
TRY.
CALL METHOD lr_upload_model->upload_data
EXPORTING
iv_file_name = fileupload->file_name
CHANGING
cv_xcontent = fileupload->file_content.
CATCH /ccm/cx_file_upload INTO lr_error.
ENDTRY.
FREE fileupload.
ENDIF.
ENDIF.
Thank you in advance for helping me.
Best regards,
VanessaHi There,
Please check the details for the same.
Link: http://helpx.adobe.com/creative-cloud/help/sync-files.html#Sync or upload files
Troubleshoot sync:
Error: "Unable to sync files"
Creative Cloud File Sync | Known issues
Thanks,
Atul Saini
Maybe you are looking for
-
Once again! Sharing Music on different accounts on a single computer ?
Somewhere in this forum i got a hint on sharing playlists and music among different (family)users on a single computer. (How to share music... from "Buegie") But it didn't help!!! I have most of my music stored in folders and mp3-format long before i
-
Question about creating new tables using SQL script in WebLogic Server
Hi, I am new to WebLogic and I am following a book Java EE Development with Eclipse published by PACKT Publishing to learn Java EE. I have installed Oracle Enterprise Pack for Eclipse on the PC and I am able to log into the WebLogic Server Administr
-
hello, I want to add Image related to particular file to cell of the JTable, I already have name of the file in cell but want to display file or directory name with its related icon. i am using TableCellRenderer ,but don't know how to keep both filen
-
Steps in transactions&customizing to MTO scenario
Hi! I am fresher in sap pp. Can any body give the details transactional data and customizing for Make to Order scenario in discrete and REM. Thanks & Regards MDSFR
-
What is a single ton class?
What is a single ton class and in which type applications or context this class is going to be used?