Validating file/folder path from application server.
Hi All ,
I have used the FM '/SAPDMC/LSM_F4_SERVER_FILE' to open F4 help for application server. Now I want to validate the folder or file returned by the FM.
Can anyone help on this?
Thanks
Shilpa
HI Shilpa,
Us this FM
F4_DXFILENAME_TOPRECURSION
Hope this will help you.
Regards,
Vijay
Similar Messages
-
Dynamic selection of file in infopackage from application server
Hi,
We have a infopackage in Process chain which runs daily. In the infopackage 'EXTRACTION' tab , input file is from application server. The file we get daily is not unique.
As an example file name is not like 'UNIQUE.CSV' . It varies daily and carries a date and time stamp like UNIQUE_DATE_TIME.CSV
I think we can have a routine to handle this. can someone help me with the routine/code?
Thank you all.Hi,
1. Create Two Floders in AL11 i.e. in Apllication Server. Eg Name it F1 and F2.
2. First dump the .csv files into Folder F1 using some Programs or Manualy (Name xyz.csv).
3. Then load the data using InfoPackage (here IN infoPackage, Extraction Tab you need to select Adapter = Load Text File from Application Server and then give the correct path from Folder F1), through PC.
4. At the end of the load, attach a simple Program to Move the xyz.csv file from Folder F1 to Folder F2.
5. So next day the file will come to Folder F1 and the it will loaded to Cube/DSO and at the end it will move to Folder F2.
Else you can use simple one or two lines of UNIX/WINDOWS (depends on your OS) script to move the file from Folder F1 to Folder F2 , once you load is over.
While moving the file from Folder F1 to Folder F2 you can append the date at the end of the file and then move to Folder F2, it is use full for future reference.
See Blogs and Article, similar logic...
https://wiki.sdn.sap.com/wiki/display/profile/Surendra+Reddy
How to transfer the Data from SAP-System to Non-SAP system without additional Cost/License
/people/surendrakumarreddy.koduru/blog/2009/03/11/how-to-transfer-the-data-from-sap-system-to-non-sap-system-without-additional-costlicense
To Check the Files/Reports in Application Server and Trigger Mail Alerts.
http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/4096bf2d-bcea-2b10-4ab4-e0683830d9b2&overridelayout=true
1. Create Three Floders in AL11 i.e. in Apllication Server. Eg Name it F1, F2 and F3.
2. First dump the .csv files into F1. (Name xyz.csv).
3. Then using UNIX/WINDOWS (depends on your OS) script , first check the file is there are not in F1, if yes then rename the file with date and time or date and transfer the files from F1 to F2 i.e xyz06032010.csv.
4. Then Create a small ABAP program to check the file in F2, if it is there then Trigger the Event, and using that event you execute teh PC.
5. Then using UNIX/WINDOWS (depends on your OS) script , transfer the files from F2 to F3 i.e xyz06032010.csv.
6. Next day morning F1 and F2 are empty and F3 is having the backup files.
So use this method, I used the similar logic and it is working fine.
Timinings are importent i.e what time you need to dump the fule in F1 and what time you need to run UNIX/WINDOWS (depends on your OS) script , transfer the files from F1 to F2 and what time UNIX/WINDOWS (depends on your OS) script , transfer the files from F2 to F3.
Thanks
Reddy -
How to upload a file in bdc from application server
how to upload a file in bdc from application server
Hi
Check if this is useful and reward.
PERFORM UNIX_UPLOAD.
FORM unix_upload.
DATA : lv_string(600) TYPE c.
lv_string = p_fname. "p_fname is the filename in path
OPEN DATASET lv_string FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc <> 0.
MESSAGE 'File Not Found' TYPE 'I'.
LEAVE PROGRAM.
ENDIF.
DO .
READ DATASET lv_string INTO gs_gfile.
IF sy-subrc NE 0 .
EXIT.
ENDIF.
APPEND gs_gfile TO gt_gfile .
CLEAR gs_gfile .
ENDDO.
CLOSE DATASET lv_string.
CLEAR lv_string.
DATA: lc_split TYPE c VALUE cl_abap_char_utilities=>horizontal_tab.
LOOP AT gt_gfile INTO gs_gfile .
SPLIT gs_gfile AT lc_split INTO
gs_ipfile-field1
gs_ipfile-field2.
ENDLOOP.
ENDFORM. "unix_upload
here gs_ipfile is the same structure as your input file to upload
and
gs_gfile is the work area of the internal table containing characters as :
TYPES : BEGIN OF ygs_gfile ,
data(600) ,
END OF ygs_gfile .
*Internal table declaration for input file as text
gt_gfile TYPE STANDARD TABLE OF ygs_gfile INITIAL SIZE 0 ,
*Work area declaration for input file
gs_gfile TYPE ygs_gfile .
Thanks and Regards
A Swarna -
Reading file in pattern from Application server
Hello Experts,
I want to search file from Application server.
I have certain pattern for the file. eg. OEDERS_.DAT or ORDERS_OPEN..
How can I search the file for pattern from the application server?
Ex.
Suppose my file name is ORDER_SENT.DAT, this file should be returned.
Suppose my file name is ORDER+SENT.DAT, this file should be returned with error.
Regards,
RHThe FM EPS_GET_DIRECTORY_LISTING is not resulting result properly.
I have below files on server.
AMODPROT.PC1
AMODPROT.PC6
CMODACT.PC1
CMODACT.PC6
IMODPROT.PC1
IMODPROT.PC6
N070703.PC2
SAPRUPGM.PC6
TMS_TEST.PC1
TMS_TEST.PC2
TMS_TEST.PC6
UMODPROT.PC6
I use *.PC6 in mask parameter of FM EPS_GET_DIRECTORY_LISTING , And it returned 0 files, where as there are 6 files.
Did I missed anything in mask parameter?
Regards,
RH -
Process for Flat file delta load from Application server to transactional??
I want to do a flat file extraction in delta loads from application server and that should be loaded into a transactional cubes scheduling a process chain.
Can any one help with ABAP code and step by step process for this?
Thank you
DeviHi Devi,
As per your explaination, you want to load a list of files from application server using process chain.
You can do this with below steps.
1) Create a Event and call event to run Process chain multiple times.
2) Put all filenames in a file say, source-File
3) Write a rooting to read filename from Source-File and trigger InfoPackage
4) At the end of the process chain create new customized program which will delete first line from Source-File so that it will take next file in next run as well as delete currently loaded file. Once this is done trigger event again to start process chain again.
Regards,
Ganesh -
Displaying pdf files in Portal from application server.
Hi,
I have a requirement where i will give a link on the portal for Provident Fund related data. When the user clicks on the link, i have to retrieve his pdf file from the folder stored on the application server and display it in portal. Could you please tell me how to do it?
Also can we use Knowledge Management for it? If yes, how to do it?Hi,
This can be done by
1. Store the pdfs in the server like userid.pdf. Or you can add the year also the the file name. The files can be in the same appserver. No need for KM.
2. Create a Webdynpro application where the WD automatically reads user ids of the person logged in (IUser).
3. In the Webdynpro code create a LinkToURL element with the user id you got in step one. This will make sure that somebody cannot see others file.
Regards
Srini -
File open error from Application Server
Hello friends,
I am able to open a file from the foreground mode.
However when i run the program in background am unable to open it.
OPEN DATASET fp_asfile FOR INPUT IN TEXT MODE ENCODING DEFAULT.
I have alos tried to change the user with the back groung user ID. but it again failed.
Can any one tell me why.
SterHi,
Ok..go to SM51 in your system...and then check how many application servers are there..
if there are more than one..do the following..
In the background mode...the program might be running in a different application server....than the one which you used in the your foreground session..
check this..
1)
In your foreground session...go to system -> status...get the application server..
2)
when you define the job in SM36...there is a field in the initial screen.."Exec. Target"...which says in which application server you want to run this job...Give the application server that you got from step 1...Then release the job...now your program should work fine..
Thanks,
Naren -
Reading File from Application Server using Read Dataset
Hi,
i am trying to read excel file from Application Server and has multiple records in that based on structure below. but when i execute its giving me error message.here is the code, can sumone suggest me on this please ??
FORM f_data_upload .
DATA:
l_filename TYPE string, "file name
l_wa_string TYPE string. "file record
l_filename = p_inp_as. "File path from Application Server
OPEN DATASET l_filename FOR INPUT IN TEXT MODE ENCODING DEFAULT.
DO.
IF sy-subrc <> 0.
EXIT.
ENDIF.
Read the data from the file in Application server.
READ DATASET l_filename INTO l_wa_string.
IF sy-subrc = 0.
SPLIT l_wa_string AT cl_abap_char_utilities=>horizontal_tab
INTO w_data-tcode
w_data-matnr
w_data-mtart
w_data-werks
w_data-vkorg
w_data-vtweg
w_data-lgort
w_data-meins
w_data-maktx
w_data-spart
w_data-kosch
w_data-mstae
w_data-brgew
w_data-ntgew
w_data-groes
w_data-matkl
w_data-prdha
w_data-mstde
w_data-mtpos_mara
w_data-gewei
w_data-spart
w_data-mstav
w_data-mstdv
w_data-dwerk
w_data-taxkm
w_data-versg
w_data-kondm
w_data-ktgrm
w_data-mtpos
w_data-mtvfp
w_data-tragr
w_data-ladgr
w_data-herkl
w_data-ekgrp
w_data-webaz
w_data-dismm
w_data-beskz
w_data-prctr
w_data-bklas
w_data-bwtty
w_data-vprsv
w_data-verpr
IN CHARACTER MODE.
APPEND w_data TO i_data.
CLEAR w_data.
ENDIF.
ENDDO.
CLOSE DATASET l_filename.
Error Message while executing
What happened?
At the conversion of a text from codepage '4110' to codepage '4102':
- a character was found that cannot be displayed in one of the two
codepages;
- or it was detected that this conversion is not supported
The running ABAP program 'ZHDI_LOMM_VEHI_MAT_MASS_CREATE' had to be terminated
as the conversion
would have produced incorrect data.
The number of characters that could not be displayed (and therefore not
be converted), is 449. If this number is 0, the second error case, as
mentioned above, has occurred.
Error analysis
An exception occurred that is explained in detail below.
The exception, which is assigned to class 'CX_SY_CONVERSION_CODEPAGE', was not
caught in
procedure "F_DATA_UPLOAD" "(FORM)", nor was it propagated by a RAISING clause.
Since the caller of the procedure could not have anticipated that the
exception would occur, the current program is terminated.
The reason for the exception is:
Characters are always displayed in only a certain codepage. Many
codepages only define a limited set of characters. If a text from a
codepage should be converted into another codepage, and if this text
contains characters that are not defined in one of the two codepages, a
conversion error occurs.
Moreover, a conversion error can occur if one of the needed codepages
'4110' or '4102' is not known to the system.
If the conversion error occurred at read or write of screen, the file
name was '/usr/sap/interfaces/conversion/pioneer/ddm/data/test_data1.xls'.
(further information about the file: "X 549
24064rw-rw----200812232135082008122307293120081223072931")
Please help me
Thank YouWoah ... perfect guru
but data looks like all junk characters ? its filling with special characters, hashes # and other characters but not with Excel data.. any idea ??
Temesh
Edited by: New2Sap Abap on Dec 24, 2008 6:42 AM -
How to upload .CSV file from Application Server
Hi Experts,
How to upload .CSV file separated by ',' from Application server to an internal table.
Invoice No,Cust No,Item Type,Invoice Date,days,Discount Amount,Gross Amount,Sales Amount,Customer Order No.,Group,Pay Terms
546162,3233,1,9/4/2007,11,26.79,5358.75,5358.75,11264,HRS,11
546163,2645,1,9/4/2007,11,3.07,305.25,305.25,10781,C,11
Actually I read some already answered posts. But still I have some doubts.
Can anybody please send me the code.
Thanks in Advance.Hi Priya,
Check this code
Yhe logic used here is as follows,
Get all the data into an internal table in the simple format ie: a row with one field contains an entire line
After getting the data, we split each line of the table on every occurrence of the delimiter (comma in your case)
Here, I have named the fields as field01, field02 etc, you could use your own names according to your requirement
parameters: p_file(512).
DATA : BEGIN OF ITAB OCCURS 0,
COL1(1024) TYPE C,
END OF ITAB,
WA_ITAB LIKE LINE OF ITAB.
DATA: BEGIN OF ITAB_2 OCCURS 0,
FIELD01(256),
FIELD02(256),
FIELD03(256),
FIELD04(256),
FIELD05(256),
FIELD06(256),
FIELD07(256),
FIELD08(256),
FIELD09(256),
FIELD10(256),
FIELD11(256),
FIELD12(256),
FIELD13(256),
FIELD14(256),
FIELD15(256),
FIELD16(256),
END OF ITAB_2.
DATA: WA_2 LIKE LINE OF ITAB_2.
OPEN DATASET p_FILE FOR INPUT IN TEXT MODE ENCODING NON-UNICODE.
IF SY-SUBRC = 8.
WRITE:/ 'File' , p_FILE , 'cannot be opened'.
LV_LEAVEPGM = 'X'.
EXIT.
ENDIF.
WHILE SY-SUBRC <> 4.
READ DATASET p_FILE INTO WA_ITAB.
APPEND WA_ITAB TO ITAB.
ENDWHILE.
CLOSE DATASET p_FILE.
LOOP AT ITAB INTO WA_ITAB.
SPLIT WA_ITAB-COL1 AT ',' " where comma is ur demiliter
INTO WA_2-FIELD01 WA_2-FIELD02 WA_2-FIELD03 WA_2-FIELD04
WA_2-FIELD05 WA_2-FIELD06 WA_2-FIELD07 WA_2-FIELD08 WA_2-FIELD09
WA_2-FIELD10 WA_2-FIELD11 WA_2-FIELD12 WA_2-FIELD13 WA_2-FIELD14
WA_2-FIELD15 WA_2-FIELD16.
APPEND WA_2 TO ITAB_2.
CLEAR WA_2.
ENDLOOP.
Message was edited by:
Kris Donald -
Downloading more than 1 file from Application server
Hi Gurus,
I have a requirement in which I have to execute my program once in every 15 minutes which will check if there are any files present in application server. Is so I have to retreive the files to SAP from Application server.
Now I have couple of issues in doing so.
1. How to find the number of files present in that directory?
2. How to retreive more than 1 file at a time from the directory.
Its bit urgent.
Cheers,
Naveen
NOTE: Points will be awarded to every useful answer.hi,
hope this FM can help.
PARAMETER: p_file type pfeflnamel DEFAULT '/usr/sap/tmp'.
data: begin of it_filedir occurs 10.
include structure salfldir.
data: end of it_filedir.
START-OF-SELECTION.
Get Current Directory Listing for OUT Dir
call function 'RZL_READ_DIR_LOCAL'
exporting
name = p_file
tables
file_tbl = it_filedir.
List of files are contained within table it_filedir
loop at it_filedir.
write: / it_filedir-NAME.
endloop.
rgds
Umakanth -
Sending an Email by taking excel sheet from Application Server.
Hi.
I Searched in SDN related 'Sending an Email by taking excel sheet from Application Server'.
But i didnt get. I got sending mails from local pc.
Can some bdy provide me sample code how to send mail with an attachment. the attached file should get from Application Server
Regards,
RenuHi,
For writing data to app server from internal table:
https://www.sdn.sap.com/irj/scn/wiki?path=/display/snippets/prog%252bon%252bopen%252bdataset%252binput
https://www.sdn.sap.com/irj/scn/wiki?path=/display/snippets/prog%252bon%252bopen%252bdataset%252boutput
Checkout this wiki for sending XL in mail attachment:
https://www.sdn.sap.com/irj/scn/wiki?path=/display/snippets/multiple%252battachment%252bon%252be_mail
Thanks,
Krishna -
Logical path for getting a Flat file from application server
Hi All,
We have loaded some .csv files to application server, what is the logical path we have to mention in the infopackage scheduler screen? please guide me how to give the path for getting a flat file from application server.
Thanks,
Sairam.Hi Sairam,
I hope you know which location you have saved in the Application server.
Now if you go to the Infopackage and click on the "External Data" tab, there you will see Radio Buttons for
1) Client Workstation
2) Application Server
Choose the second radio button, then in the Field "Name of the File" you will be able to use the F4 help and browse AL11 transaction through this option. You can then choose the File.
Hope this helps
Regards,
Praveen. -
Place file in central instance(AIX/UNIX) from Application server in Windows
Hi guys,
We have the central instance running in AIX and app servers in AIX/UNIX as well. now we want to replace the app server by windows server.
so central instance remain as AIX/unix server and app server becomes Windows NT.
then how can i place a file in my central instance while using this Windows based app server... because open dataset with forward slash (/usr/sap/) will be not be interpretated by windows,
so i used logical file name.. and kept both windows and unix path..
unix path as /usr/sap/tmp/<File_Name>
and windows path as
servername\usr\sap\tmp\ and even tried with
usr\sap\tmp\
nothing worked.. when i used open dataset fetching the path from logical path, it ways unable to open the file..Hi,
you can't directly open file on central instance if you are not connected to it. You have access only to files which are on application server which you are connected to. If you want to have a folder which will be accessible from all application servers then you need to map folder on application server to folder on central instance.
To solve the issue with different paths for different operating systems you can use transaction FILE. Here you can define a logical filename where you can configure different paths for different syntax groups such as UNIX or WINDOWS NT. You can use FM FILE_GET_NAME to get valid path for application server.
Cheers -
How to download a file from application server in webdynpro
Hi Experts,
I am trying to download a file through Web Dynpro file download UI element..The file is stored in application server in binary format ..in my code i am reading the file in binary mode,converting Binary File into Xstring(Using FM SCMS_BINARY_TO_XSTRING) ..getting its Mime type and binding the UI element properties (data with XString, Mime type and file name) with respective context attributes..But the problem is file is getting opened but Junk data is getting displayed on it..Not sure where i am making the mistake.Hi Lukas,thanks for the reply..please find the code
here '/tmp/accenturedocs' is the folder name on application server,and zdocs_list_tab is the table that contains file URL.File upload is on the BSP page (custom logic to upload the file ) where they are storing local file path in ztable.Same i am extracting in my code to get File URL.
DATA: i_file TYPE rlgrap-filename .
DATA:v_path TYPE zlist.
DATA:i_datatab TYPE STANDARD TABLE OF tbl1024,
wa_datatab TYPE tbl1024.
DATA file TYPE string.
DATA dot_offset TYPE i.
DATA extension TYPE mimetypes-extension.
DATA mimetype TYPE mimetypes-type.
SELECT SINGLE description
FROM zdocs_list_tab
INTO v_path.
CONCATENATE '/tmp/accenturedocs' v_path INTO i_file.
FIELD-SYMBOLS <hex_container> TYPE x.
OPEN DATASET i_file FOR INPUT IN LEGACY BINARY MODE.
IF sy-subrc NE 0.
MESSAGE e999(00) WITH 'Error opening file' .
ENDIF.
ASSIGN wa_datatab TO <hex_container> CASTING.
DO.
READ DATASET i_file INTO <hex_container>.
IF sy-subrc = 0.
APPEND wa_datatab TO i_datatab.
ELSE.
EXIT.
ENDIF.
ENDDO.
CLOSE DATASET i_file.
DATA:l_count TYPE i,
l_len TYPE i.
DESCRIBE TABLE i_datatab LINES l_count.
READ TABLE i_datatab INTO wa_datatab INDEX l_count.
l_len = XSTRLEN( wa_datatab-line ).
l_len = l_len + ( l_count - 1 ) * 1022.
DATA: v_xstring TYPE xstring.
CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
EXPORTING
input_length = l_len
IMPORTING
buffer = v_xstring
TABLES
binary_tab = i_datatab
EXCEPTIONS
failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
ENDIF.
file = i_file.
" Find out file name extension
FIND FIRST OCCURRENCE OF REGEX '\.[^\.]+$' IN file MATCH OFFSET
dot_offset.
ADD 1 TO dot_offset.
extension = file+dot_offset.
" Get mime type
CALL FUNCTION 'SDOK_MIMETYPE_GET'
EXPORTING
extension = extension
IMPORTING
mimetype = mimetype.
DATA lv_file_content TYPE wd_this->element_context-file_content.
get element via lead selection
lo_el_context = wd_context->get_element( ).
set single attribute
lo_el_context->set_attribute(
name = `FILE_CONTENT`
value = v_xstring ).
same way i am assigning file name and file mime type to context attributes.
please suggest where is the mistake. -
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
-
Sharing content from MacBook to TV.
I have Apple TV. I can share content via iTunes by pointing it to Apple TV. How can I do the same for content coming through Safari (i.e. PBS.org for example)? When I run a video I don't get the apple TV icon with the video control informatin
-
Applet works in IDE but not in browser
I have an applet that is supposed to read some data through COM port. Problem is that altough it works well in Eclipse IDE it fails without error in browser. It stops working in the point where its supposed to create instance of class that deals with
-
Attachment name while sending mail
i want to give attachenemt name as order.pdf while sending the mail with attachment ,i am using SO_DOCUMENT_SEND_API1 function module to send the mail with attacnment
-
I got a new computer. i want to install itunes on it and use that instead of the one on my old computer?
-
I just had my Nano replaced, so it's music library is no more. I have a new computer because the old one is too sick to use. How do I get my library to the new computer if I don't have any music on the Ipod and no library to draw from on the old comp