Placing the text file in application server
Hi all,
I am uploading the text file into application server.
the line length is 1028 characters.But in application server i am not able to see whole line.it is showing only some data and reamaining data is not coming.
Please let em know how can we increase the line length in application server.
Regards,
Shoban
SE38 is the ABAP Editor transaction.
Use function module GUI_UPLOAD to create an upload the data.
*Use function module GUI_UPLOAD to create an upload the data.
Example Code >>>
REPORT zuploadtab .
PARAMETERS: p_infile LIKE rlgrap-filename
OBLIGATORY DEFAULT '/usr/sap/'..
*DATA: ld_file LIKE rlgrap-filename.
DATA: gd_file type string.
*Internal tabe to store upload data
TYPES: BEGIN OF t_record,
name1 LIKE pa0002-vorna,
name2 LIKE pa0002-name2,
age TYPE i,
END OF t_record.
DATA: it_record TYPE STANDARD TABLE OF t_record INITIAL SIZE 0,
wa_record TYPE t_record.
*Internal table to upload data into
DATA: BEGIN OF it_datatab OCCURS 0,
row(500) TYPE c,
END OF it_datatab.
*Text version of data table
TYPES: BEGIN OF t_uploadtxt,
name1(10) TYPE c,
name2(15) TYPE c,
age(5) TYPE c,
END OF t_uploadtxt.
DATA: wa_uploadtxt TYPE t_uploadtxt.
*String value to data in initially.
DATA: wa_string(255) TYPE c.
CONSTANTS: con_tab TYPE x VALUE '09'.
*If you have Unicode check active in program attributes then you will
*need to declare constants as follows:
*class cl_abap_char_utilities definition load.
*constants:
con_tab type c value cl_abap_char_utilities=>HORIZONTAL_TAB.
*AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_INFILE.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_infile.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
def_filename = p_infile
mask = ',*.txt.'
mode = 'O'
title = 'Upload File'(078)
IMPORTING
filename = p_infile
EXCEPTIONS
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
OTHERS = 5.
*START-OF-SELECTION
START-OF-SELECTION.
gd_file = p_infile.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = gd_file
has_field_separator = 'X' "file is TAB delimited
TABLES
data_tab = it_record
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 NE 0.
write: 'Error ', sy-subrc, 'returned from GUI_UPLOAD FM'.
skip.
endif.
Alternative method, where by you split fields at each TAB after you
have returned the data. No point unless you dont have access to
GUI_UPLOAD but just included for information
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = gd_file
filetype = 'ASC'
TABLES
data_tab = it_datatab "ITBL_IN_RECORD[]
EXCEPTIONS
file_open_error = 1
OTHERS = 2.
IF sy-subrc NE 0.
ELSE.
LOOP AT it_datatab.
CLEAR: wa_string, wa_uploadtxt.
wa_string = it_datatab.
SPLIT wa_string AT con_tab INTO wa_uploadtxt-name1
wa_uploadtxt-name2
wa_uploadtxt-age.
MOVE-CORRESPONDING wa_uploadtxt TO wa_record.
APPEND wa_record TO it_record.
ENDLOOP.
ENDIF.
*END-OF-SELECTION
END-OF-SELECTION.
*!! Text 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.
Edited by: Nikhil Jathar on Jan 9, 2008 7:38 AM
Similar Messages
-
Error in Downloading the Text file on Application Server
Hi All,
I am working on ECC6.0. I have written a program in whcih I am downloading the text file on
application server in UTF-8 format. However when I am opening this file in Excel I am getting
garbage value for some characters(as Excel does not support UTF-8 format). So now I
want to download the data on application server in text file in non unicode format(Like ANSI or
other non unicode format) which is supported by excel. When I am writing the code as
OPEN DATASET DN_FILE FOR OUTPUT IN LEGACY TEXT MODE it is giving me dump saying
CHARACTER CONVERSION FROM CODE PAGE '4102' to CODEPAGE '1100' NOT POSSIBLE.
Same in case if I add the code OPEN DATASET DN_FILE FOR OUTPUT IN LEGACY TEXT
MODE CODE PAGE '8000' is also giving dump.
So please let me know how can I download the file in non unicode format ?
Any help would be greatly appricated.
Thanks & Regards
Jitendra Gujarathi.OPEN DATASET l_filename FOR INPUT IN TEXT MODE ENCODING NON-UNICODE IGNORING CONVERSION ERRORS.
CHECK sy-subrc EQ 0.
DO.
CLEAR wa_file_content.
READ DATASET l_filename INTO wa_file_content.
IF sy-subrc EQ 0.
APPEND wa_file_content TO it_file_content.
ELSE.
EXIT.
ENDIF.
ENDDO.
CLOSE DATASET l_filename.
t_filedata[] = it_file_content[].
can you use like this. -
How to delete the Generated files from application server(open hub)?
hi experts,
when i try to execute process chain the DTP it is giving below dump. Exception CX_RSBK_REQUEST_LOCKED logged.
when i execute the DTP manually and trying to delete the previous request, it is giving for dump ITAB_DUPLICATE_KEY.
so to delete the generated file from application server, how to delete it for specific dates?
Information on where terminated
Termination occurred in the ABAP program "GPD6S3OE0BCVGC6L9DBNVYQARZM" - in
"START_ROUTINE".
The main program was "RSBATCH_EXECUTE_PROZESS ".
In the source code you have the termination point in line 2874
of the (Include) program "GPD6S3OE0BCVGC6L9DBNVYQARZM".
The program "GPD6S3OE0BCVGC6L9DBNVYQARZM" was started as a background job.
and when i check the dump it is point out at below code
" Populate the lookup table for 0STOR_LOC
SELECT * from /BI0/TSTOR_LOC
into CORRESPONDING FIELDS OF table L_0STOR_LOC_TEXT
FOR ALL ENTRIES IN SOURCE_PACKAGE WHERE
STOR_LOC = SOURCE_PACKAGE-STOR_LOC.
but the programme is syntactically correct only.
how to rectify the issue.
regards
venuscm
Edited by: venugopal vadlamudi on Sep 28, 2010 1:59 PMhi experts,
We have written start routine to get the storage location text and sending to File located at Application server through OPEN HUB.
here is the code written in the Transformations
In the global section
Text for 0STOR_LOC
DATA: l_0stor_loc_text TYPE HASHED TABLE OF /bi0/tstor_loc
WITH UNIQUE KEY stor_loc.
DATA: l_0stor_loc_text_wa TYPE /bi0/tstor_loc.
and in the code to get the text
" Populate the lookup table for 0STOR_LOC
*SELECT * from /BI0/TSTOR_LOC*
into CORRESPONDING FIELDS OF table L_0STOR_LOC_TEXT
FOR ALL ENTRIES IN SOURCE_PACKAGE WHERE
STOR_LOC = SOURCE_PACKAGE-STOR_LOC.
im sure there is problem with the Routine only. i think i need to change the code if so please provide me the modified one.
thanks
venuscm
Edited by: venugopal vadlamudi on Sep 29, 2010 9:37 AM -
Sending EMail "Text-File" from Application Server!
Hi Experts,
how can I sending a Text-File from Application Server via Email?
Is there existing a Function Modul?
With Kind regards
Ersin
Moderator message: sending emails = FAQ, please search before posting.
Edited by: Thomas Zloch on Nov 25, 2010 4:23 PMSTF (Search the forum)! This type of question has been asked...and answered....many times.
-
Problem with saving data in text file in Application server
Hello Experts,
I am trying to save a text file in application server.When I text file have less that 60000 (i.e 59999) records, it saves the file successfully, but if records in text file (saved in application server) is more than 60000 (i.e 60002), it creates a new file at the 60000th record with the continued records.
Can anyone please advise, why it is creating a new file if records are more that 60000. I tested it with 59000 records in my internal table and it is working fine. I have not given any restriction in my program to create a new file if records are more than 60000.
The logic I implemented is the following:
*Open file
open dataset g_accnt_file for output in text mode encoding utf-8.
if sy-subrc = 0.
clear g_header_record.
*Building header record for Accounting Validation file
concatenate gc_hdr_desc
gc_filetype
gc_sequence
gc_idntf_refresh
gc_cmpny_idntf
gc_accnt_id
sy-datum
sy-uzeit
gc_linde_group
sy-sysid
gc_not_used into g_header_record separated by
gc_deliminator.
transfer g_header_record to g_accnt_file.
*Move Cost center data to file to create a detail record for Accounting
*Validation file
loop at gt_csks into gs_csks.
*Remove leading Zeros
call function 'CONVERSION_EXIT_ALPHA_OUTPUT'
exporting
input = gs_csks-kostl
importing
output = gs_csks-kostl.
* Overlay gs_csks-kostl with space.
* SHIFT gs_csks-kostl RIGHT DELETING TRAILING gc_space.
*Prepare Cost Centre String
perform prepare_costcentre_string.
*Prepare detail record with Company Code & Cost Centre
perform prepare_detail_record.
clear:g_detail_record,gs_csks,g_coa.
endloop.
*Move Order data to file to create a detail record for Accounting
*Validation file
loop at gt_aufk into gs_aufk.
*Remove leading Zeros
call function 'CONVERSION_EXIT_ALPHA_OUTPUT'
exporting
input = gs_aufk-aufnr
importing
output = gs_aufk-aufnr.
* SHIFT gs_aufk-aufnr RIGHT DELETING TRAILING gc_space.
*Prepare Order String
perform prepare_order_string.
*Prepare detail record with Company Code & Order
perform prepare_detail_record.
clear:g_detail_record,gs_aufk,g_coa.
endloop.
*Move WBS data to file to create a detail record for Accounting
*Validation file
loop at gt_prps into gs_prps.
call function 'CONVERSION_EXIT_ABPSP_OUTPUT'
exporting
input = gs_prps-pspnr
importing
output = g_wbs_element.
* SHIFT g_wbs_element RIGHT DELETING TRAILING gc_space.
*Prepare WBS Element String
perform prepare_wbs_string.
*Prepare detail record with Company Code & WBS Element
perform prepare_detail_record.
clear:g_detail_record,gs_prps,g_coa.
endloop.
*Building trailer record for Accounting Validation file which will
*contain the total number of detail records in file
concatenate gc_trail_desc
g_total_count
into g_trailer_record
separated by gc_deliminator.
transfer g_trailer_record to g_accnt_file.
*Close file
close dataset g_accnt_file.
if sy-subrc = 0.
message s036(/lig/fi).
endif.
endif.
endform. " SELECT_DATA
Edited by: Matt on Sep 30, 2010 11:02 AM - added tagsHi Pankaj,
Can u check the concatenate statement with one more data. Check the no of lines for a single file.
concatenate gc_hdr_desc
gc_filetype
gc_sequence
gc_idntf_refresh
gc_cmpny_idntf
gc_accnt_id
sy-datum
sy-uzeit
gc_linde_group
sy-sysid
sy-subrc
gc_not_used into g_header_record separated by
gc_deliminator.
Regards,
Amitava -
Download text file from application server to client server.
Hi all,
I am facing a format issue while downloading text file from application server to the client machine.
The issue is that, say I have 6 to 10 lines in my text file in application server. but when i store it on the hard drive,
it shoes all the data in a single line. Where as i need to download data in same format as in application server.
Awaiting for your responses.
Regards,
JoseHi,
If we want to upload file data from the application server to the internal table, there is no function module or class static method which we can use, we must wirte the code by ourselves.
1. For the file data which has no seperator between field columns.
PARAMETERS p_file TYPE dxfile-filename.
START-OF-SELECTION.
OPEN DATASET p_file IN TEXT MODE ENCODING DEFAULT FOR INPUT.
DO.
READ DATASET p_file INTO gds_data.
IF sy-subrc <> 0.
EXIT.
ENDIF.
APPEND gds_data TO gdt_data.
ENDDO.
CLOSE DATASET p_file.2. For the file data which has tab separator between field columns.
DATA: gds_field_split type gts_data.
FIELD-SYMBOLS: <fs_field> TYPE gts_data.
PARAMETERS p_file TYPE dxfile-filename.
START-OF-SELECTION.
OPEN DATASET prf_file IN TEXT MODE ENCODING DEFAULT FOR INPUT.
DO.
READ DATASET p_file INTO gds_field.
SPLIT gds_field AT cl_abap_char_utilities=>horizontal_tab
INTO TABLE gdt_field_split.
LOOP AT gdt_field_split into gds_field_split.
gdf_index = gdf_index + 1.
ASSIGN COMPONENT gdf_index OF STRUCTURE
gds_data to <fs_field>.
IF sy-subrc = 0.
<fs_field> = gds_field_split.
ENDIF.
ENDLOOP.
APPEND gds_data TO gdt_data.
ENDDO.
CLOSE DATASET p_file.
Thanks & regards,
ShreeMohan -
How to Select the Latest file from Application Server?
Dear All,
I am working on object, which had requirement to Pick the file from application server.
The Application server contain the files in /temp/sms/ directory. The files are having the name Like smsqry_yyyymmddhhmmss.txt and I have to Pick the Latest file (Base on file name for eg. 'smsqry_20060713102333) from that all and after getting the file I have to delete the file from application server.
So How to do this.
Regardshi,
look function group EPSF-
esp. fm EPS_GET_DIRECTORY_LISTING
if you're looking fo OS-date and time
look here:Re: How do I convert MTIME to date and time?
A.
Message was edited by: Andreas Mann -
Downloading a text file from application server
Hi Freinds,
I am genarating a text file in our application server (Folder /usr/sap/dbi/) I need to download this text file in my destop pc or some other windows server.
What do I have to do? What is the procedure, Pls help.
If someone have sample code, pls send.
We are running SAP ECC5.0 on an iSeries (AS/400) Database DB2/400.
Regards
ThanuraHi,
try this:
REPORT ZGRO_TEST.
DATA: DATEI_A(30) TYPE C VALUE '/tmp/matnr.txt'.
DATA: DATEI_PC TYPE STRING VALUE 'C:\MATNR.TXT'.
DATA: ITAB TYPE TABLE OF MARA WITH HEADER LINE.
START-OF-SELECTION.
PERFORM DATEI_EINLESEN.
PERFORM DATEI_DOWNLOAD.
FORM DATEI_EINLESEN.
OPEN DATASET DATEI_A FOR INPUT IN TEXT MODE.
IF SY-SUBRC NE 0. STOP. ENDIF.
DO.
READ DATASET DATEI_A INTO ITAB.
IF SY-SUBRC <> 0. EXIT. ENDIF.
APPEND ITAB.
ENDDO.
CLOSE DATASET DATEI_A.
IF SY-SUBRC NE 0. STOP. ENDIF.
ENDFORM. "DATEI_EINLESEN
FORM DATEI_DOWNLOAD.
Datei downloaden
CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD
EXPORTING
FILENAME = DATEI_PC
FILETYPE = 'ASC'
CHANGING
DATA_TAB = ITAB[]
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
NOT_SUPPORTED_BY_GUI = 22
ERROR_NO_GUI = 23
OTHERS = 24.
IF SY-SUBRC NE 0. STOP. ENDIF.
ENDFORM. "DATEI_DOWNLOAD
Regards, Dieter -
Opening the Excel file from Application server
Hi All,
I had uploaded an excel file on the application server for using it in my program .
But when i am opening the uploaded file on the Application server it shows some special characters and those are also displayed on my report output while reading the file from the application server.
Please suggest how to get rid of those special characters.
my open data set statement is
OPEN DATASET pg_out2 FOR INPUT IN TEXT MODE ENCODING NON-UNICODE.Hi ,
if it a Excel file ..
do the following..
OPEN DATASET pg_out2 "appl file
FOR INPUT IN TEXT MODE
ENCODING DEFAULT.
IF sy-subrc EQ 0.
DO.
READ DATASET p_infile INTO w_temp.
* Condition To check when cursor reaches End Of file
IF sy-subrc EQ 0.
PERFORM f_split_appl_data.
ELSE.
EXIT.
ENDIF.
ENDDO.
CLOSE DATASET p_infile.
ELSE.
MESSAGE 'Error in opening file' type 'E'.
ENDIF.
FORM f_split_appl_data .
SPLIT w_temp AT ',' INTO : wa_inputfile-plannum ...... "Split at , for excel or CSV file formats at appl files
APPEND wa_inputfile TO t_inputfile.
ENDFORM. " F_SPLIT_APPL_DATA
Prabhudas -
Editing text file on application server
Hello,
I have created a utility in which I can move files from one folder to another. Now we also need a option by which I can edit text file on the server folders. Is there a function module by which I can edit text from application server ?
Regards,
Rajesh.With OPEN DATASET and READ you can load them into an internal table. Next put them on screen in lets say the text editor (enjoy SAP Controls). This is one way of doing this, other way would be:
Upload data with OPEN DATASET into internal table, download file to local drive (cl_gui_frontendservices=>gui_download), open it with notepad (for example) edit it and save. Next upload file into your program (cl_gui_frontendservices=>gui_upload) and download it to server again (OPEN DATASET and TRANSFER).
If available you can also use transaction CG3Z and CG3Y. -
Getting the latest file from application server
Hi,
I have to retrieve the latest file posted in R/3 from the application server to ISU which conatins the file name with timestamp.
regards
MacHi,
so use fm EPS_GET_DIRECTORY_LISTING
and sort corresp. table DIR_LIST
A. -
To Delete the uploaded file in Application Server
Hi Friends,
I developed an BSP Application displaying the results from ITAB though Iterator, for which , each row there is feature to upload a particular file in the Application Server, where I stored the file path into a database table field. .When I delete the the row, I am successfully get rid of the entire row including the file path.
My Question.
1. How to delete the uploaded file of the Application Server ?
Please mail me in this regard.
Regards
CSM ReddyHi,
you have the keyword and you have the documentation. What is your problem?
Search in the forums with keyword "delete dataset", there are lots of threads about this.
Example
Deletion of dataset in applicaiton server
deleting file from AL11 Tcode
Best regards
Renald -
Field Values being changed in the flat file on Application Server
Hi All,
I am loading a flat file(.CSV) from Application server. The file has some characteristic fields, for ex: CNUM of type Char, length 20. But it has got the value which is of 10 char length, say XYZ1234XAB. When I load the same fiel from client workstation, the load was successful but when I load it from Application server, the load has failed and the error is Invalid/Hex. characteristics for this record and many such records.
When I checked the file on the application server the value 'XYZ1234XAB' is being displayed as 'XYZ1234XAB #' and it is also being loaded with '#'. This is the cause of the error.
Why is the value being changed on the application server? What can I do to overcome this?
Thanks,
RPK.
Message was edited by:
RPKHi Ganesh,
I have already loaded data to my ODS and when activating it is giving error "Value 'XYZ123XABC #' (hex. '123456....') of characteristic CNUM contains invalid chara".
I also have some lower case char in some of the records for the same field. The file is huge and cannot change the file, infact I have many such files. Is there any other way to overcome this?
Thanks,
RPK -
Downloading internal table in excel file on application server
Hi,
I am trying to download ITAB into excel file on my application server . I am using FM 'SAP_CONVERT_TO_XLS_FORMAT' for that .
When I run the report I can see file getting generated on APP server but no ITAB data is saved in that excel.
After debugging I found that error code 'SAVE_DOCUMENT_FAILED' is retuned in above FM.
Could any one please suggest how to go about this?
Regards,
GaneshHi ganesh,
Please have a look into the below link
[Link1|How to Upload Excel file to Application Server]
[Link2|Error in Downloading the Text file on Application Server]
Hope this will be Helpful
Thanks
Kalyan -
Error Loading the file from application server
Hi Team,
I'm trying to load the .CSV file from application server and I'm getting the error message.
In the data package
Update to PSA --Green
Transfer Rule -- Green
Update Rule - error ABORT was set in the customer routine 9998
Error 1 in the update
Please help me to provide the solution.
But when I try to load the other files there are no issues. thanks.
Regards,
SenthilRaj
check the below links, which can helps to solve your issues
Flat file data load
flat file Data loading issue
Mahesh
Maybe you are looking for
-
How to get data from excel sheet present in the client(local) system?
hi, I have to upload the data from an excel sheet present in the local system(not on the server) to the table using webdynpro. i donot want to upload the excel file if it is necessary to upload the file then it should be on temporary basis and it sho
-
Problem with gridbaglayout in JPanel
Hello I am trying to display contact information in three serperate Jpanels on tabbbed panes.I would like to get help in configuring maybe just the pane of void showPane1().I need something like Searchlb | Combodropname1 firstnamelb | firstnametxt |
-
Email configuration error in OBIEE 11.1.1.6.2
Hi, I am getting the below error, while running the agent in obiee Eventually succeeded, but encountered and resolved errors... Number of skipped recipients: 3 of 4 AgentID: /users/weblogic/test agent [nQSError: 75025] Handshake failed when connectin
-
I'm editing in notation view (2/4 time) and i can't get the desired note pattern. I need a beamed sixteenth note (two sixteenth notes connected by two parallel bars at the top) and then a quarter note, and then an eigth note. whenever i try to put th
-
HP D110a - Is There a Fix or Up-date for Windows 7 (64)?
Not sure when the problem occured, but I keep losing connection to my HP D110a over the wireless network. I have checked all obvious things, but for some reason it keeps disconnecting. I have re-loaded the solution center software many times and it