Problem in creating a file on Application Server
Hi,
I am facing an issue while creating a file on the application server.
I am creating a file with sales data from SAP and saving it on the application server.
At the end of this operation, I am calling a Unix script to push this file from SAP to an external system.
The issue I am facing is - at every month end, when I run a job for creating the file (its a custom program which is scheduled to run periodically), I get a strange scenario where a BLANK FILE gets created on the application server even though the data tables are not blank.
Also the user id gets changed to UID = 1400 when I run this job for the first time when a BLANK FILE gets created.
When I delete this file and run the job again, though, the file gets created WITH DATA.
The user name remains DEVADM (Dev Admin), as it should be for the scheduled jobs.
What could be the possible reasons for this?
Please help me in this direction.
Thank you.
Regards,
Keerthi
Hi,
You are using OPEN DATASET ? And what is the sy-subrc ?
Can you post some lines of your code?
Best regards,
Leandro Mengue
Similar Messages
-
Create Excel file in application server but the field value is incorrect
Hi Experts,
i am facing a problem when create excel file in application server using OPEN DATASET command.
the internal table have 4 field and one of those field contains 19 digit number --> ICCID.
the code running well, successfully create EXCELfile in application server but the problem is SAP only copy exactly first 15 digit numeric only and the rest became zero 0
Example :
the field value in internal table is 8962118800000447654 but when i opened in the excel file the value became 8962118800000440000.
and if i add alphabet like a8962118800000447654 then it is correct.
is there is anything wrong with my code?
here is my code
CONSTANTS: c_tab TYPE abap_char1 VALUE cl_abap_char_utilities=>horizontal_tab. "Tab Char
Data : begin of lt_zdsdmmdt00005 occurs 0,
SERNR (18) type c,
MSISDNl(20) type c,
BOX1 (20) type c,
ICCID(30) type c,
end of lt_zdsdmmdt00005.
data : ld_temp(100) type c.
i_file = '/usr/sap/DM/test_excel.xls'.
open dataset i_file for output in legacy text mode.
loop at lt_zdsdmmdt00005.
move lt_zdsdmmdt00005-ICCID to ld_iccid .
concatenate lt_zdsdmmdt00005-sernr lt_zdsdmmdt00005-MSISDN lt_zdsdmmdt00005-BOX1 ld_iccid
into ld_temp separated by c_tab.
transfer ld_temp to i_file.
endloop.
close dataset i_file.
Best Regard,
Akbar.Hi Naveen,
thanks for your reply,
i already tried and the result still the same. any idea?
Best Regard,
Akbar. -
Problem while dowloading the file from Application Server
Dear Experts,
I am facing the Problem while downloading the file from Application server.
We done the automatic function while saving the invoice, this will create an idoc, and this idoc is written in the Application Server.
I am running the Transaction AL11 and select the record, and from menu --> List, i am downloading into TXT format.
But for some segments, the length is long, and so the last 3 to 4 fields values are not appearing in the File. Even though i am unable to view the values in the file before downloading. But i can view in IDOC.
Please help me to solve this issue.
Thanks & Regards,
Srinibut our user will use the Txn. AL11 and they will download from there
Educate the user On a serious note, tell him this is not how data from app server should be downloaded. You can ask him to talk to the basis team to provide him access to the app server folder where the file is being stored.
I can set the Variant and put this in background, But always the file name will be change, Like we use Time stamp in the File name.
You can't automate this process by scheduling in BG mode. This is because the in BG mode you can't dwld the file to presentation server.
Hope i'm clear.
BR,
Suhas -
Unable to create a file in Application Server using OPEN DATASET stattement.
I am unable to create a file in Application Server using the following statement.
OPEN DATASET filename FOR OUTPUT
IN TEXT MODE ENCODING DEFAULT
MESSAGE msg.
The message I'm getting is "Permission Denied". I have checked authorisation using SU53 which says "The last authorization check was successful". Please help.You can use following code to capture the error.
TRY.
OPEN DATASET filename FOR OUTPUT IN BINARY MODE MESSAGE V_MSG.
CATCH CX_ROOT
INTO EXCEPTION.
CALL METHOD O_EXCEPTION ->IF_MESSAGE~GET_TEXT
RECEIVING
RESULT = V_MSG.
MESSAGE v_msg
TYPE 'E'.
ENDTRY.
You can capture error in v_msg.
Following are the exceptions for the same:
Exceptions
Catchable Exceptions
CX_SY_FILE_OPEN
Cause: The file is already open.
Runtime Error: DATASET_REOPEN
CX_SY_CODEPAGE_CONVERTER_INIT
Cause: The desired conversion is not supported. (Due to specification of invalid code page or of language not supported in the conversion, with SET LOCALE LANGUAGE.)
Runtime Error: CONVT_CODEPAGE_INIT
CX_SY_CONVERSION_CODEPAGE
Cause: Internal error in the conversion.
Runtime Error: CONVT_CODEPAGE
CX_SY_FILE_AUTHORITY
Cause: No authorization for access to file
Runtime Error: OPEN_DATASET_NO_AUTHORITY
Cause: Authorization for access to this file is missing in OPEN DATASET with addition FILTER.
Runtime Error: OPEN_PIPE_NO_AUTHORITY
CX_SY_PIPES_NOT_SUPPORTED
Cause: The operating system does not support pipes.
Runtime Error: DATASET_NO_PIPE
CX_SY_TOO_MANY_FILES
Cause: Maximum number of open files exceeded.
Runtime Error: DATASET_TOO_MANY_FILES Non-Catchable Exceptions
Cause: An attempt was made to open a pipe that is already open.
Runtime Error: DATASET_PIPE_POSITION
Hope that will help you.
Please reward if useful. -
Creating a file on application server that exceeds 10 Million charecters
Hello All,
We have custom IDocs which carry Strings of 1062 characters in each of their segments.
Now the requirement is to create a single string file out of these idocs data.
It is expected that each of these IDocs can go up to having more than 70,000 segments.
So, now when this is concatenated into one single string it can go upto 7 Million charecters.
My questions are:
1. Can we create a text file with so many charecters in a single line or is there any limitation for this ?
2. I have found a datatype CHAR30000, using which i'm currently concatnating around 30 segment data and then writing onto the file. Now once I wrote a single line, how can I set the pointer to End of line ?
3. Is there any limitation in ABAP to create such a long string text file using method mentioned above ?
Thanks for responding back!!
-SriNo, It should be something like below.. for writing the file onto application server , which aint working though...
*Writing output data into the file.
lw_endofline = 30000.
OPEN DATASET p_fileop FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
LOOP AT int_output INTO wa_output.
TRANSFER wa_output-sdata TO p_fileop.
"SET DATASET p_fileop POSITION lw_endofline.
SET DATASET p_fileop POSITION lw_endofline.
lw_endofline = lw_endofline + 30000.
ENDLOOP.
CLOSE DATASET p_fileop. -
OPEN DATASET create .txt file in application server
Hi,
I'm trying to create a .txt into application server. Code as follows:-
OPEN DATASET gv_filestatus FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc <> 0.
WRITE: 'File cannot be opened.'.
ENDIF.
LOOP AT gt_pdfstatus INTO gw_pdfstatus.
TRANSFER gw_pdfstatus TO gv_filestatus.
ENDLOOP.
CLEAR gw_pdfstatus.
CLOSE DATASET gv_filestatus.
But I got the error "GW_PDFSTATUS" cannot be a table, a reference, a string, or contain any of these objects. GW_PDFSTATUS is a work area with 5 fields of different type. I know that I can transfer table type of TLINE but I'm not sure how to convert my internal table gt_pdfstatus as TLINE.
Please advise. Thanks.When transfering data to a file, you should convert the data to type char and then transfer it to the file.
So, you would need to declare a structure with 5 fields of type c with the corresponding length of the original structure.
Then move the corresponding fields of work are gw_pdfstatus to the character type structure. And then transfer the new structure to the file (gv_filestatus in your case).
"for example if all the fields in the gw_pdfstatus are of lenght 10, then declare a structure as follows
data : begin of file_wa,
f1(10) type c,
f2(10) type c,
f3(10) type c,
f4(10) type c,
f5(10) type c,
end of file_wa.
OPEN DATASET gv_filestatus FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc 0.
WRITE: 'File cannot be opened.'.
ENDIF.
LOOP AT gt_pdfstatus INTO gw_pdfstatus.
move-corresponding gw_pdfstatus to file_wa. " Add this
TRANSFER file_wa TO gv_filestatus. " Change this line
ENDLOOP.
CLEAR gw_pdfstatus.
CLOSE DATASET gv_filestatus.
Hope this helps.
KR,
Advait -
Create XML file on application server (unix directory) from internal table
Hallo everybody,
I have got the following problem:
I am working with <u><b>release 4.6C</b></u> and have got to create XML files from HR master data and organizational data respectively.
This takes place in 3 steps:
1. Collect the data in an internal table
2. Convert the data to XML format using the function module 'SAP_CONVERT_TO_XML_FORMAT'
3. Download the data
If I download the converted data, which are in an internal table, to the presentation server via the function module WS_DOWNLOAD and open it with the Internet Explorer, everything is ok.
If I download the converted data to the application server, i.e. into a unix directory via
open dataset, loop at internal table, transfer working area to file, close dataset
and then try to open it, this is not possible, because after the last tag some unreadable characters, e.g. a square, appear that arent supposed to be there. Thats what my colleagues told me, for I havent got access to the server.
I have no idea where these characters come from and how I can get rid of them. I guess that either I have to modify (how?) the table with the converted data before the download or I have to use another way to convert the data. For the second way I would probably have to work with an XML class or an XML interface. Unfortunately II am not an expert in working with classes so sample coding would have to be rather detailed.
Heres some more information about how I work with the conversion function module:
call function 'SAP_CONVERT_TO_XML_FORMAT'
exporting
i_field_seperator = lv_field_seperator
i_line_header = lv_line_header
i_filename = lv_xml_file
i_appl_keep = ' '
i_xml_doc_name = lv_xml_doc_name
importing
pe_bin_filesize = lv_result
tables
i_tab_sap_data = gt_data
changing
i_tab_converted_data = lt_tab_converted_data
exceptions
conversion_failed = 1
others = 2.
lv_field_seperator = X.
lv_xml_doc_name = Personalstammdaten Publikation
lv_result: type i
gt_data: fields: PERNR, PERSG, PERSK etc.
types:
begin of truxs_xml_line,
data(256) type x,
end of truxs_xml_line.
types:
truxs_xml_table type table of truxs_xml_line.
data:
lv_tab_converted_data type truxs_xml_line,
lt_tab_converted_data type truxs_xml_table
open dataset lv_xml_file for output in binary mode.
loop at lt_tab_converted_data into lv_tab_converted_data.
transfer lv_tab_converted_data to lv_xml_file.
endloop.
close dataset lv_xml_file
lv_xml_file: /usr/users/.../.../Personendaten_2004-11-02.xml
Hope the information is detailed enough! Otherwise let me know. Thank you in advance.
Message was edited by: Johannes SchwehmHi Raja,
tried the "TEXT" mode, but that didn't help.
There are still characters after the last tag, that are not supposed to be there including a date that is not
the creation date of the file.
Thank you for your help.
Regards
Johannes -
Create excel file on application server
Hi experts,
Is it possiblel to create an excel file on the application server in a background process ?
We have an windows nt application server.
I tried with open dataset ..but i didn't work 100% good.
has anybody any sample ?
Thanks.I m using an csv file as tabdelimited .
data: htab(1) type c.
htab = cl_abap_char_utilities=>horizontal_tab.
the file is downloaded as excel , but if i open the file i see the content of a row always in the first column.
Types : begin of ty_test,
name1 type char10,
name2 type char10,
end of ty_test.
Data : it_test type table of ty_test,
wa_test type ty_test,
wa_row type string.
data: htab(1) type c.
htab = cl_abap_char_utilities=>horizontal_tab.
wa_test-name1 = 'name1'.
wa_test-name2 = 'name2'.
append wa_test to it_test.
clear wa_test.
open dataset <filename> for output in text mode
encoding default.
loop at it_test into wa_test.
conatenate wa_test-nam1 wa_test-name2 into wa_row separated by htab.
transfer wa_row to <filename>.
endloop.
close dataset.
Edited by: Moo Yac on Jul 2, 2009 11:48 AM -
Creating a File in Application Server
Hi i have some data in the internal table itab. which contains few fields. Some of the fields are blanks and some contains data. Now i am transfering this internal table to file which is in Application Server. When i trnasfer itab to file, blank fields are concatenated by next field.
Explanation:
itab contains fallwoing data:
field1 field2 field3 field4 field5
uu kk nn ii
when i transer this to file it is coming as fallows
field1 field2 field3 field4 field5
uu kk nn ii
how can i solve this problem
Thanx in Advance
Subhani.Hi Subhani,
This probelm can be fixed very easily. All you need to do is to use Offsets while writing to the file from internal table. This is done as follows:
DATA: gv_string(217) TYPE c, " Holds text to display
Loop at <itab> into <wa>.
gv_string+0(5) = <wa>-<fieldname>
gv_string+10(5) = <wa>-<fieldname>
do this for all the fileds.
Endloop.
Note: In the above code snipet, 0(5) represents 'Starting for the 0th position, reserve 5 characters and print it there. Use this for all the fields of your internal table. Based on the size of the field(s) of the itab, allocate the space accordingly.
<b>PLZ REWARD POINTS IF HELPFUL</b> -
Problem deploying Creator War file in Application Server 8.1
I want to get my Creator app created using Linux to run on a Windows XP machine running Sun Java System Application Server 8.1.
I thought this would be straight forward as this is the server used in the IDE and both come with PointBase. No such luck.
The app starts up but trying to go to the login page which has a database connection I get HTTPStatus 500 exception
javax.servlet.ServletException: javax.faces.FacesException: javax.faces.FacesException: Can't instantiate class: 'myproject.Login : javax.faces.FacesException: java.sql.SQLException: JdbcRowSetXImpl (connect): (JNDI) Unable to connect: Signon not found
Signon is the PointBase database name and I can ping the database connection.
Is there a step by step How-to to get a Creator app running on SJSAS 8.1 on an external machine?
I used admin console to set up JDBC resources and connection pools and edited the sun-web.xml file to include
<sun-web-app xmlns="http://java.sun.com/xml/ns/j2ee">
<context-root>/myproject</context-root>
<resource-ref>
<res-ref-name>jdbc/Signon</res-ref-name>
<jndi-name>jdbc/Signon</jndi-name>
</resource-ref>and the web.xml file includes
<resource-ref>
<description>Rave generated DataSource Reference</description>
<res-ref-name>jdbc/Signon</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>Can anyone tell me what I've missed out?
Thanks in advance for any suggestions.
JohnHi,
Please take a look at the sample application JAAS Authentication at
http://developers.sun.com/prodtech/javatools/jscreator/ea/jsc2/learning/tutorials/index.html
Hope this may help you
regards
MJ -
Authorization for the user to write/read/create a file in application serve
Hi experts.
I am uploading some data to a file in a folder in application server, created in AL11 tcode.
In my program i need to restrict the unauthorized users to create/write/read a file in app server.
I dont know how to do this.
Kindly give me the code, please it wil be helpfull for you all.
I dont know how to use the auth object or function module, to do this.
Is the basis/security people need to do something.
Kindly revert me back ASAP.
KKOr use AUTHORITY_CHECK_DATASET function module before the open data set
This function module allow you to check the user's authorization to access files (with the key words OPEN DATASET, READ DATASET, TRANSFER and DELETE DATASET). A check should be performed before opening a file.
The authorization check is performed uwing the authorization object S_DATASET.
Description of function parameters:
PROGRAM: Name of the ABAP/4 program that contains the file access. If no program name is specified, the system assumes the current program.
ACTIVITY: Access type. The possible values are:
READ: Read file
WRITE: Change file
READ_WITH_FILTER: Read file with filter function
WRITE_WITH_FILTER: Change file with filter function
DELETE: Delete file
FILENAME: Name of accessed file
Example
Notes
The values to be passed as the ACTIVITY are defined as constants in the TYPE-POOL SABC. -
Problem in uploading file from Application Server
Hi everyone,
i got a problem in uplaoding a file from application server.i am having two folder (one folder name is current and another one is processed)in application server. In current folder i am having N no of files.I want to upload all the files names into one internal table and i want to process one by one file.After processing each file the file should be moved to processed folder and the files should not exist in current folder.All these process must be done everyday.Please rectify my problem asap.Ramesh,
Take authorization from basis guy.
Use the below code to get the list of files from require directory
*& Report ZDIRFILES *
REPORT ZDIRFILES .
PARAMETER: p_fdir type pfeflnamel DEFAULT '/usr/sap/tmp'.
data: begin of it_filedir occurs 10.
include structure salfldir.
data: end of it_filedir.
*START-OF-SELECTION
START-OF-SELECTION.
Get Current Directory Listing for OUT Dir
call function 'RZL_READ_DIR_LOCAL'
exporting
name = p_fdir
tables
file_tbl = it_filedir.
Now in internal table "it_filedir" will have all your files.
For moving and deleting
report zrich_0001.
Parameters: d1 type localfile default '/usr/sap/TST/SYS/fld1/Data1.txt',
d2 type localfile default '/usr/sap/TST/SYS/fld2/Data1.txt'.
data: begin of itab occurs 0,
rec(20) type c,
end of itab.
data: wa(20) type c.
start-of-selection.
open dataset d1 for input in text mode.
if sy-subrc = 0.
do.
read dataset d1 into wa.
if sy-subrc <> 0.
exit.
endif.
itab-rec = wa.
append itab.
enddo.
endif.
close dataset d1.
open dataset d2 for output in text mode.
loop at itab.
transfer itab to d2.
endloop.
close dataset d2.
delete dataset d1.
Check below FM if required
To move the file to archive directoryuse FMs 'PFL_COPY_OS_FILE'
To Delete 'EPS_DELETE_FILE'.
Don't forgot to reward if useful -
Creating a new file in application server
hai,
please rectify this, how to create a file in application server ?
can any one forward a sample code for creating a file in application server.
hazamHi Hazam,
Please check the below code.
Data : P_UFILE(60) " Unix File name
TYPE C
value '/emn_R3/hr/ben_age25_dep'.
CLEAR GD_SUBRC.
<b>OPEN DATASET</b> GD_FILE FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
IF SY-SUBRC <> 0.
GD_SUBRC = SY-SUBRC.
gs_error-pernr = gs_0021-pernr.
gs_error-ename = gd_ename.
gs_error-mess
= 'Can not open File:'(017) + gd_file.
append gs_error to gt_error.
clear gs_error.
* CLEAR GD_MSG1.
* CONCATENATE 'Can not open File:'(017)
* GD_FILE
* INTO GD_MSG1.
* WRITE : / GD_MSG1.
ELSE.
LOOP AT GT_BODY INTO GS_BODY.
<b>TRANSFER</b> GS_BODY TO GD_FILE.
ENDLOOP.
<b>CLOSE DATASET</b> GD_FILE.
ENDIF.
Hope this will help you.
Thanks&Regards,
Siri.
Message was edited by: Srilatha T -
Japanese character problem while downloading file to application server
Hello All,
We are facing a strange problem while downloading a file to application server when file contains japanese text.
We are downloading vendor and customer information in a flat file format on application server. When the login language is EN program show ouput in a properly formatted manner.
When the login language is JA (japanese) program does download file with customer vendor data. I can see the description is japanese language but the formatting is gone for a toss.
We are facing similar issue with other programs downloading files on the application server.
I am using OPEN DATASET........ENCODING DEFAULT. and working on unicode enabaled ECC 6.0 system
Quick help appriciated.
Thanks!Hi
Sometimes this also happens because of your desktop setting.Make sure that your OS also supports the JAPANESSE language.
Ask your technical support team to enable them in your desktop.
Thanks & Regards
Jyo -
FTP without creating files on Application server
hello everyone,
in an internal table i have around 100 records each of length around 3500 chararters. i want to send this data to the client via ftp in the form of txt file. since the lenght of each record exceeds 1000 bytes, i thought of sending the data directly to the ftp server without creating the file on the application server. is this feasible. please provide the necessary steps to achieve this.Hi,
The FTP involves a lot of complexity but you can do the SCP(secure copy) instead. And what u can do is first create a file on application server and then u can delete it...
the sample code is below..
#!/bin/ksh
scp <filename> <destination>
rm -f <filename>
Maybe you are looking for
-
How to submit a Concurrent Request Set from OAF
All, I understand we can submit a concurrent program from OAF using oracle.apps.fnd.cp.request.ConcurrentRequest.submitRequest( String pApplication, String pProgram, String pDescription, Str
-
how do i merge icloud ifo/backup to itunes info/backup. i want to use itunes rather than icloud or how do i transferitunes music (from computer) to my phone which is backed up from icloud
-
Open link in new tab loads the new page and moves to the bottom
I am using the latest update of Safari and had this happening in the previous version also. When I CMD+Click a link to load it in a new tab the new tab opens behind the active one (my choice of preferences) and when I click to make the new tab active
-
File Name after donwload from BLOB
dear experts, i'm a newbie in programming, just started this month.. i got problem where after i download from blob (oracle) the file name will be the same as the java class that i use to download it. How can i make the file name as it real file name
-
Error unable to allocate system resources
Hi, In LabWindows/CVI I want to create a buffer of shorts, but when I run the program I get the message unable to allocate system resources. When I create the buffer with chars I don't get that error.. What to do? Thnks