Datas in Application Server file is not aligned
Dear all,
I have created a program in SE38 and transfer the data to the Application server file using Transfer statement.
The datas are transferd to Application Server file , but datas are not aligned.
In out Application server file thd datas are displaied one after another..
But i want to display the datas in single row.
I have include program for your reference.
With Regards,
Baskaran.
report zsutest34 message-id ztcpo.
DATA AND VARIABLES DECLARATION
data: begin of leban occurs 0.
include structure eban.
data end of leban.
data new(1).
SELECTION-SCREEN
selection-screen begin of block 001 with frame title text-001.
selection-screen skip 1.
parameters filename(128) default '
192.168.100.33\SAPMNT\IDS\dvebmgs00\data\santhosh.dat'. "\SYS\GLOBAL\testfile1.txt' LOWER CASE.
select-options ldat for sy-datum.
parameters lwerks type eban-werks.
selection-screen skip 1.
selection-screen end of block 001.
START-OF-SELECTION
select * from eban into leban where erdat in ldat and werks = lwerks.
append leban.
endselect.
sort leban by banfn bnfpo.
clear leban.
REGARDING DATASET
perform value1.
form value1.
open dataset filename for output in text mode encoding default. " MESSAGE D_MSG_TEXT.
data: l_msg(255) type c.
if sy-subrc ne 0.
message i001.
exit.
endif.
concatenate 'The following file was opened:'(002) filename into l_msg separated by space.
write: l_msg.
uline.
TRANSFORMING TO APPLICATION SERVER FILE
loop at leban.
transfer leban-banfn to filename.
transfer leban-bnfpo to filename.
transfer leban-ekgrp to filename.
transfer leban-matnr to filename.
transfer leban-werks to filename.
AT FIRST.
WRITE: /10 TEXT-001, 30 TEXT-002, 45 TEXT-003, 50 TEXT-004, 65 TEXT-005.
' ITEMNO GRP MATERIAL PLANT QTY ' COLOR = 2.
ENDAT.
at new banfn.
uline.
write:/1 'PRNO-',leban-banfn.
new = 'x'.
uline.
skip.
endat.
if new = 'x'.
WRITE:/ ' ITEMNO GRP MATERIAL PLANT QTY ' color = 2.
write:/14 leban-bnfpo, leban-ekgrp, leban-matnr, leban-werks, leban-menge.
clear new.
else.
write:/14 leban-bnfpo, leban-ekgrp, leban-matnr, leban-werks, leban-menge.
endif.
endloop.
DATASET CLOSING
close dataset filename.
endform.
wa_string type string
loop at leban.
concatenate leban-banfn
leban-bnfpo
leban-ekgrp
leban-matnr
leban-werks into wa_string
separated by CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.
transfer wa_string to filename.
endloop.
Similar Messages
-
Load ODS data to Application server file
Hi,
I need to upload ODS data to application server.
I can not use Open Hub service. I need to do the upload process in background as there is around 5 million data in ODS. Can anybody please guide
deepHi,
You can use Analytic Process Designer for your requirement.
Use 'RSANWB'.
It will allow you to select the source as DSO and also you can choose target as some logical path where you can define Application server path as Physical path. Use "FILE'
Also you can schedule the process in background.
Further you can refere to :
http://help.sap.com/saphelp_nw04/helpdata/en/49/7e960481916448b20134d471d36a6b/frameset.htm
Regards,
anil -
Dump while downloading data from Application Server File in 4.6 system
Hi,
When we are trying to upload data from Application Server to internal table using dataset statements, it is resulting in a dump. System we are using is 4.6c.
When we faced similar kind of issue in ECC version, we have used the statement, Ignoring Conversion Errors.
Please let me know how to handle this situation in 4.6 System.
Thanks for your inputs.
Regards,
PhaniHi All,
I am sorry. My question was wrong. It should be while uploading data from internal table to application server, if there are any special characters, it is going to dump.
I will let you know the dump details and code at the earliesst.
Sorry and Thanks again for your prompt response.
Regards,
Phani. -
Application Server : File writes only 255 characters
Hi Friends,
I am trying to writes data to application server file .
My line size is 1100 charqacters.
When I use open dataset for output in text mode encoding default
and transfer contents to file.
I am only able to write contents upto 255 characters.
Whatever is beyond that I do not see it in AL11.
Is there a way to write more than 255 characters.
I tried CG3Y to view files but it also shows only 255 characters.
Please help.Hi,
Just find the string length.
In 4.6C version there is a limit of 1500 characters i. e. U can transfer max of 1500 characters in a single transfer. For that we applied below solution. Check this it may help u.
l_len = strlen( p_data ).
DO.
IF l_len LT 1500.
TRANSFER p_data+l_offset(l_len) TO p_file.
MOVE 0 TO l_len.
ELSE.
TRANSFER p_data+l_offset(1500) TO p_file.
SUBTRACT 1500 FROM l_len.
ADD 1500 TO l_offset.
ENDIF.
CHECK l_len EQ 0.
EXIT.
ENDDO.
p_data has the content to be trasfered of around 6000 characters and the length is dynamic.
Also download the data using CG3Y with BIN to .txt file and see.
If problem is still there then paste ur code of OPEN DATASET, TRANSFER statements.
Try to open the file in TEXT MODE.
eg: OPEN DATASET l_file IN TEXT MODE.
Thanks,
Vinod.
Edited by: Vinod Reddy Vemuru on Jul 25, 2008 12:34 PM -
Sending internal table data to application server as an XML file
Hi All,
I am trying to send the internal table data to application server which should be stored in XML format.
I am using the following code:
DATA:
result TYPE xstring.
CALL TRANSFORMATION id
SOURCE tab = p_output-xsfdata
RESULT XML result.
OPEN DATASET l_xml_full_path FOR OUTPUT IN BINARY MODE.
TRANSFER result TO l_xml_full_path.
CLOSE DATASET l_xml_full_path.
And the content in the internal table is :
3C3F786D6C2076657273696F6E3D22312E30223F3E3C736620786D6C6E733D2275726E3A736
73796D206E616D653D22534653592D44415445223E30362F31302F323030393C2F73796D3E2
50617961626C653C6E65772D6C696E652F3E50617274206F6620746865204E616D653C6E657
.......and so on
With this a file is getting created on the application server, but the data is not correct. I am getting the data something like:
<?xml version="1.0" encoding="utf-8"?>
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0"><asx:values><TAB><item>
PD94bWwgdmVyc2lvbj0iMS4wIj8+PHNmIHhtbG5zPSJ1cm46c2FwLWNv
MDA6eHNmIj48c21hcnR4c2Y+PGhlYWRlcj48Z2VuZXJhbD48dmVyc2lvbj4xLjE0LjI8L3ZlcnNp
b24PGZvcm0WkJMX1NESU5WX0xfMzwvZm9ybT48bGFuZ3VhZ2U+RU48L2xhbmd1YWdlPjxkZXZp
Y2UUFJJTlRFUjwvZGV2aWNlPjxvdXRwdXQtZGV2aWNlPlNYU0Y8L291dHB1dC1kZXZpY2UPC9n
ZW5lcmFsPjxwYWdlIG5hbWU9IkZJUlNUIiBpZD0iMDAxIi8PC9oZWFkZXIPGRhdGEgeG1sOnNw
YWNlPSJwcmVzZXJ2ZSIgc3R5bGU9Ii9TTUIxMS9CTF9TRiI+PGdyYXBoaWNzIG5hbWU9IkNPTUxP
R08iIG9iam5hbWU9Ii9TTUI0MC9MRUFGIiBvYmplY3Q9IkdSQVBISUNTIiBpZD0iQk1BUCIgdHlw
ZT0iQkNPTCIgcGFnZT0iRklSU1QiIHBhZ2UtaWQ9IjAwMSIgcmVzb2x1dGlvbj0iMDEwMCIvPjx3
aW5kb3cgbmFtZT0iU0VOREVSIiBwYWdlPSJGSVJTVCIgcGFnZS1pZD0iMDAxIj48dGV4dCBuYW1l
PSJDT01BRERSIiBzdHlsZT0iL1NNQjExL0JMX1NGIiBvYmpuYW1lPSIvU01CMTEvQkxfU0VOREVS
IiBsYW5nPSJFTiIPHAgbmFtZT0iWlMiPkJhc2VsaW5lIENvbXBhbnk8L3APHAgbmFtZT0iWlMi
PjM0NzUgRGVlciBDcmVlazx0YWIvPlBob25lOjx0YWIvPisxICg2NTApIDg0OS00MDAwPC9wPjxw
IG5hbWU9IlpTIj5QYWxvIEFsdG8sIENBIDk0MzA0PHRhYi8+RmF4Ojx0YWIvPisxICg2NTApIDg0
OS00MjAwPC9wPjxwIG5hbWU9IlpTIj5VU0E8dGFiLz5JbnRlcm5ldDo8dGFiLz5odHRwOi8vd3d3
LnNhcC5jb208L3A+PC90ZXh0Pjwvd2luZG93Pjx3aW5kb3cgbmFtZT0iUEFHRSIgcGFnZT0iRklS
U1QiIHBhZ2UtaWQ9IjAwMSI+PHRleHQgbmFtZT0iUEFHRU5VTUJFUiIgc3R5bGU9Ii9TTUIxMS9C
TF9TRiIgbGFuZz0iRU4iPjxwIG5hbWU9IlROIj5QYWdlIDxzeW0gbmFtZT0iU0ZTWS1QQUdFIj4x
PC9zeW0IG9mIDxzeW0gbmFtZT0iU0ZTWS1KT0JQQUdFUyIvPjwvcD48cCBuYW1lPSJUTiIPA==</item>
<item>c3ltIG5hbWU9IlNGU1ktREFURSI+MDYvMTAvMjAwOTwvc3ltPiA8c
RSIMTQ6MDg6MDM8L3N5bT48L3APC90ZXh0Pjwvd2luZG93Pjx3aW5kb3cgbmFtZT0iTkFNRSIg
cGFnZT0iRklSU1QiIHBhZ2UtaWQ9IjAwMSI+PHRleHQgbmFtZT0iRk9STVVMQVJUSVRFTCIgc3R5
bGU9Ii9TTUIxMS9CTF9TRiIgbGFuZz0iRU4iPjxwIG5hbWU9IlROIj48Y2hyIG5hbWU9Ik1MIj48
c3ltIG5hbWU9IlRJVExFIj5JbnZvaWNlPC9zeW0PC9jaHIPC9wPjwvdGV4dD48L3dpbmRvdz48
d2luZG93IG5hbWU9IkJJTExUT1BBUlRZIiBwYWdlPSJGSVJTVCIgcGFnZS1pZD0iMDAxIj48dGV4
dCBuYW1lPSJXSU5ET1dfVEVYVCIgc3R5bGU9Ii9TTUIxMS9CTF9TRiIgbGFuZz0iRU4iPjxwIG5h
bWU9IlRIIj5CaWxsLVRvLVBhcnR5PC9wPjwvdGV4dD48YWRkcmVzcyBuYW1lPSJCSUxMQUREUkVT
UyIgYWRkcm51bWJlcj0iMDAwMDAyMjQyNyI+PHRleHQgbmFtZT0iQklMTEFERFJFU1MiIHN0eWxl
PSIvU01CMTEvQkxfU0YiIGxhbmc9IkVOIj48cCBuYW1lPSJUMiI+VGVjaCBJbmM8bmV3LWxpbmUv
Could anyone tell me the reason why am I getting the data in this way?
Thanks in advance,
Swapna.
Edited by: NagaSwapna Thota on Jun 10, 2009 5:44 PMHI,
Use this FM SAP_CONVERT_TO_XML_FORMAT to convert the data to XML format and then upload the convert data from the internal table to Application server. -
Wut 118 application server file abc.prn does not exist or is of zero length
dear members,
I am printing a character mode report which gives the following error:
"wut 118 application server file c:\abc.prn does not exist or is of zero length"
my code on when-button-pressed is here:
declare
repid REPORT_OBJECT;
v_rep VARCHAR2(200);
rep_status VARCHAR2(50);
report_name varchar2(100);
v_path varchar2(200);
rep_server varchar2(50);
BEGIN
select parameter into rep_server from mis where parameter_type = 'REPORT_SERVER';
report_name := 'C:\TEMP\abc.prn';
repid := find_report_object('reports');
SET_REPORT_OBJECT_PROPERTY(repid,REPORT_FILENAME,:global.report_path||'abc123.rdf');
SET_REPORT_OBJECT_PROPERTY(repid,REPORT_EXECUTION_MODE,BATCH);
SET_REPORT_OBJECT_PROPERTY(repid,REPORT_COMM_MODE,SYNCHRONOUS);
SET_REPORT_OBJECT_PROPERTY(repid,REPORT_DESTYPE,FILE);
SET_REPORT_OBJECT_PROPERTY(repid,REPORT_DESFORMAT,:global.report_path||'dflt.prt');
SET_REPORT_OBJECT_PROPERTY(repid,REPORT_DESNAME,report_name);
SET_REPORT_OBJECT_PROPERTY(repid,REPORT_SERVER,REP_SERVER);
PF_FGOWGPNO='||:FG_DISPATCH_M.FGOWGPNO||' PF_FISCAL_YEAR='||:FG_DISPATCH_M.XFISCAL_YEAR||:FG_DISPATCH_M.XFISCAL_YEAR||' P_USERNAME='||:DUMMY.USER);
PF_FGOWGPNO='||:FG_DISPATCH_M.FGOWGPNO||' PF_FISCAL_YEAR='||:FG_DISPATCH_M.XFISCAL_YEAR);
SET_REPORT_OBJECT_PROPERTY(repid,REPORT_OTHER,'paramform=no PF_FGOWGPNO='||:FG_WH_INTERCHANGE.FG_TRANSIT_ID||' PF_FISCAL_YEAR='||:FG_WH_INTERCHANGE.XFISCAL_YEAR||' PRINT_IT='||:DUMMY.PRINT_IT);
v_rep := RUN_REPORT_OBJECT(repid);
rep_status := REPORT_OBJECT_STATUS(v_rep);
WHILE rep_status in ('RUNNING','OPENING_REPORT','ENQUEUED') LOOP
rep_status := report_object_status(v_rep);
END LOOP;
IF rep_status = 'FINISHED' THEN
--WEB.SHOW_DOCUMENT('/reports/rwservlet/getjobid'||substr(v_rep,instr(v_rep,'_',-1)+1)||'?'||'server=repsrv10g','_blank');
NULL;
ELSE
message('Error when running report');
END IF;
exception
when others then
message(sqlerrm);
raise form_trigger_failure;
END;
declare
a boolean;
begin
a := webutil_file_transfer.as_to_client('c:\temp\abc.prn','c:\temp\abc.prn');
end;
begin
client_host('cmd start /c type c:\temp\abc.prn > prn');
exception
when others then null;
end;Regards:Disregard my last. I see what you are doing. You are using file transfer to move the file to the local machine. It was confusing because the paths are the same.
I would suggest adding a SYNCHRONIZE after the file transfer and before the attempt to print. It might even be a good idea to add some error handling code to verify that the file has been copied and can be found. This will allow you to better deal with situations where the file doesn't get written for some reason. WebUtil offers some functions to check for file existence and size.
Also, if you are using Java 7U21, this may cause some issues with your CLIENT_HOST call. -
Validate application server file
Hi,
I have to validate the application server file path on selection screen.
I am using following code :
form VALID_APP_FILEPATH using p_filpath TYPE FILENAME-FILEINTERN.
data : l_fname(60).
CALL FUNCTION 'FILE_GET_NAME'
EXPORTING
LOGICAL_FILENAME = p_filpath
OPERATING_SYSTEM = SY-OPSYS
IMPORTING
FILE_NAME = L_FNAME
EXCEPTIONS
FILE_NOT_FOUND = 1
OTHERS = 2.
IF SY-SUBRC ne 0.
MESSAGE 'Enter the valid file path'(e01) TYPE 'E'.
ENDIF.
endform. " VALID_APP_FILEPATH
but if i choose correct file path from F4 help also.
It displays error message.
Sy-subrc always equals 1.
Help me outHi,
I have implemented the code mentioned by you and am not having any problems even when I use F4 to get the fle name.
Pls recheck and get back if the error persists.
Reward if found helpful.
Warm Regards,
R Adarsh -
How to bring the data from application server to presentation server
hi,
i have one problem,i have written the program which will open the files in the application server when we run the program in the background(sm37),the same data from application server i want to bring into presentation server in the format of (.csv),how to bring the data from application to presentation server can any body help me on this topic.folowing is the code .
*& Report ZPFA_HIER_LOAD
REPORT ZFPA_HIER_LOAD.
*---- Declaration of Oracle connectioN
DATA con_name LIKE dbcon-con_name VALUE 'COMSHARE'.
DATA: MFL1(9),MFL2(5),MFL3(9),MFL4(2),MFL5(8) TYPE c.
DATA : mfilename type string.
data: begin of matab1 occurs 0,
MFL1(9) TYPE C,
MFL2(5) TYPE C,
MFL3(9) TYPE C,
MFL4(2) TYPE C,
MFL5(8) TYPE C ,
end of matab1 .
data: setid(8) type c.
data: begin of source occurs 0,
setid(8) type c,
end of source.
*PARAMETERS : p_pfile LIKE filename-FILEEXTERN.
*PARAMETERS : m_bsenty(8). " type c obligatory.
*mfilename = P_PFILE.
EXEC SQL.
SET CONNECTION :con_name
ENDEXEC.
EXEC SQL.
CONNECT TO :con_name
ENDEXEC.
EXEC SQL PERFORMING get_source.
SELECT set_id FROM UNIT_SET INTO
:setid
ORDER BY SET_ID
ENDEXEC.
start-of-selection.
LOOP AT SOURCE.
REFRESH matab1. CLEAR matab1.
EXEC SQL PERFORMING evaluate.
SELECT TO_CHAR(MEM_ID),TRIM(TO_CHAR(MEM_PID)) FROM UNIT_TREE INTO :MFL1,
:MFL5
where set_id = :SOURCE-SETID ORDER BY MEM_ID
ENDEXEC.
if SOURCE-SETID = '80000000'.
mfilename = '/tmp/aesorg'.
elseif SOURCE-SETID = '80000006'.
mfilename = '/tmp/Consolidation_Manager'.
elseif SOURCE-SETID = '80000010'.
mfilename = '/tmp/10org'.
elseif SOURCE-SETID = '80000012'.
mfilename = '/tmp/20org'.
elseif SOURCE-SETID = '80000018'.
mfilename = '/tmp/30org'.
elseif SOURCE-SETID = '80000025'.
mfilename = '/tmp/40org'.
Endif.
mfilename = '/usr/test.dat'.
************************This was i tried***********************
open dataset mfilename for output in text mode encoding default." IN
*TEXT MODE ENCODING DEFAULT.
if sy-subrc <> 0.
exit.
endif.
close dataset mfilename.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = MFILENAME
FILETYPE = 'ASC'
TABLES
data_tab = matab1
EXCEPTIONS
file_write_error = 1
invalid_type = 2
no_authority = 3
unknown_error = 4
OTHERS = 10.
loop at matab1 .
transfer matab1 to mfilename.
endloop.
clear matab1.
ENDLOOP.
loop at matab1 .
transfer matab1 to mfilename.
endloop.
close dataset mfilename.
MFL5 = '0'.
CLEAR MFL5.
FORM evaluate.
if MFL5 = -1.
MFL5 = ''.
ENDIF.
concatenate MFL1 ',' into MFL1.
concatenate MFL1 ',' into MFL3.
matab1-MFL1 = MFL1.
matab1-MFL2 = 'ZBUE,'.
matab1-MFL3 = MFL3.
matab1-MFL4 = ' ,'.
matab1-MFL5 = MFL5.
append matab1 .
CLEAR MFL1.
CLEAR MFL2.
CLEAR MFL3.
CLEAR MFL4.
CLEAR MFL5.
ENDFORM.
"evaluate
*& Form GET_SOURCE
text
FORM GET_SOURCE.
source-setid = setid.
append source.
clear source.
ENDFORM. "GET_SOURCEHi Rammohan,
You cannot use OPEN DATASET to transfer data from application server to presentation server.
You can do the following :
<b>Do 1st point in BACKGROUND</b>
1. Read the data file from application server into an internal table using OPEN DATASET
<b>Do 2nd point in Foreground</b>
2. Once you get the data into an internal table, then use FM GUI_DOWNLOAD to download it on presentation server
You cannot use the above 2 point together in Background because its not possible. Hence you need program it partially in background and partially in foreground.
Best regards,
Prashant -
Uploading the data from Application server to Database
Hi,
I am trying to upload tab delimited file from application server into database.
I have upload the file from presentation to application server by CGZ3
and i am able to see file in app server with #s and it appers in application server as
10140#A#E#120#abcd#
10146#M#P#300#a.b#
10152#M#P#200#dat123.com##
140#A#P#300#blicksat123.com#
10140#A#E#260#cust1at123.com##
And my notepad records looks like
10140 A E 120 abcd
10146 M P 300 a.b
10152 M P 200 dat123.com
140 A P 300 blicksat123.com
10140 A E 260 cust1at123.com
I am using open data set and read dataset to read the file as shown below
DATA:
l_htab TYPE c, " Horizontal tab
l_line(100) TYPE c. " Content in the file
l_htab = cl_abap_char_utilities=>horizontal_tab.
Open dataset
OPEN DATASET pp_afname FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc EQ 0.
DO.
Read dataset
READ DATASET pp_afname INTO l_line.
IF sy-subrc EQ 0.
SPLIT l_line AT l_htab
INTO fs_file-carrid
fs_file-autoind
fs_file-commtype
fs_file-resptime
fs_file-smtpaddr.
APPEND fs_file TO pt_afile.
ELSE.
EXIT.
ENDIF. " IF SY-SUBRC EQ 0.
ENDDO. " DO.
CLOSE DATASET pp_afname.
ELSE.
MESSAGE 'Problem in opening the App.Server file' TYPE con_msgtyp_i.
ENDIF. " IF sy-subrc EQ 0.
Load the data to the database
PERFORM load_data_to_database USING t_afile.
When i am trying to upload it is taking me to dump and the errpr analysis is like
"The program attempted to interpret the value "26 0 " as a number, but
since the value contravenes the rules for correct number formats,
this was not possible."
Any suggestions on this
Regards
VEnk@Hi,
Thats the line feed character. After reading the application server file, use this
data: lv_feed type c value CL_ABAP_CHAR_UTILITIES=>CR_LF.
loop at itab.
replace all occurrences of lv_feed in itab-field with space.
modify itab.
endloop.
Vikranth -
How can I download the data to Application Server and Network Drive
Hi Experts
I am having problem with download the data to Application Server and Network Drive in back ground. its working in foregorund but not in back ground.please suggest me . Thanks for advance.
Thanks & Regards
RaghavaHi Experts
I am using like this
P_Back is a check box on the selection-screen.
it_fihrst_out-its internal table
sy-batch -Program is running in the background
IF sy-batch IS INITIAL.
IF p_back = 'X'.
OPEN DATASET file_01 FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc = 0.
LOOP AT it_fihrst_out.
TRANSFER it_fihrst_out TO file_01.
ENDLOOP.
ENDIF.
CLOSE DATASET file_01.
CASE sy-subrc.
WHEN 0.
WRITE: / file_01, / 'successfully generated.'.
WHEN OTHERS.
WRITE: / file_01, 'Unexpected error occurred.'.
ENDCASE.
ELSE.
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
filename = file_01
filetype = 'ASC'
TABLES
data_tab = it_fihrst_out
EXCEPTIONS
file_open_error = 1
file_write_error = 2
invalid_filesize = 3
invalid_type = 4
no_batch = 5
unknown_error = 6
invalid_table_width = 7
gui_refuse_filetransfer = 8
customer_error = 9
OTHERS = 10.
CASE sy-subrc.
WHEN 0.
WRITE: / file_01, / 'successfully generated.'.
WHEN 2.
WRITE: / file_01, 'Output Error: File still open'.
WHEN OTHERS.
WRITE: / file_01, 'Unexpected error occurred.'.
ENDCASE.
ENDIF.
ELSE.
LOOP AT it_fihrst_out.
WRITE:/ it_fihrst_out.
ENDLOOP.
ENDIF.
This is the code . -
Error while accessing the application server file
Hello,
When I try to load the data from CSV file to PSA , I am getting following error message
"Error while accessing the application server file"
"Errors in source system"
I gave the right file path
I am not sure about this error message.
Thanks,Hi ram,
if you have more than one application server running in your BI system (see at transaction SM51) be aware that your infopackage will be executed on the right one. Each application server has its own file system and your job need to run on the server your file is stored on.
Also check if the os user of the SAP system itself (<sid>adm on Unix) has rights to read that file.
Bye
Frank -
Run Time Error while Transferring data to Application server
Hello Abaper's,
I have generated a XML data using the FM : " SAP_CONVERT_TO_XML_FORMAT ".
While transferring the data to a File on Application Server using the statement
DATA : wa_xmltab TYPE truxs_xml_line,
it_xmltab TYPE truxs_xml_table.
OPEN DATASET FNAME FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc EQ 0.
LOOP AT it_xmltab INTO wa_xmltab.
TRANSFER wa_xmltab TO FNAME. <<<<<<<<<<<<<< Getting Error here
ENDLOOP.
ELSE.
MESSAGE e004(zmsg5) WITH 'File FNAME not opened'.
ENDIF.
CLOSE DATASET FNAME.
The Run Time Error i am Facing is
Short text
The current statement is only defined for character-type data objects.
Error analysis
For the statement
"TRANSFER f TO ..."
only character-type data objects are supported at the argument position
"f".
In this case. the operand "f" has the non-character-type "TRUXS_XML_LINE". The
current program is a Unicode program. In the Unicode context, the type
'X' or structures containing not only character-type components are
regarded as non-character-type.
Regards
jvHello Volker Binder ,
Thank you . it's now transferring the data to Application sercver. I forgot to try using Binay mode,
Thers is one more problem. There are 10 Records in that internal table that is being converted to XML format,
but the XML data is showing only first 4 records.... the XML data format for the remaining data is not seen.
Actual No. of Records in Internal table :
matnr matkl meins
0-BUY1 012 PC
0-BUY2 012 PC
1 EA
2 012 L
3 01 EA
12 EA
23 001 ST
24 015` EA
28 010 EA
29 015` AU
XML Format for the above 10 fields is :
<?xml version="1.0"?><TY_MARA><TY_MARA><MATNR Datatype="C" Length="36">0-BUY1</MATNR><MATKL Datatype="C" Length="18">012</MATKL><MEINS Datatype="C" Length="6">PC
</MEINS>
</TY_MARA><TY_MARA><MATNR Datatype="C" Length="36">0-BUY2</MATNR><MATKL Datatype="C" Length="18">012</MATKL><MEINS Datatype="C" Length="6">
PC </MEINS>
</TY_MARA><TY_MARA><MATNR Datatype="C" Length="36">000000000000000001</MATNR><MEINS Datatype="C" Length="6">EA</MEINS>
</TY_MARA><TY_MARA><MATNR Datatype="C" Length="36">000000000000000002</MATNR
This 4th record data in XML is also incomplete..
The above XML format is generated only for 4 records out of 10 Records.
Please let me know , how can i increase the Size / Memory of the Application server file to accomodate for the reamining Records
Regards
Jv -
Application Server file to internal table
Hi,
How can i read the application server file into the internal table?? Which FM should i use??
Regards,
KitHi,
Open Dataset is used to read or write on to application server ... other than that i am not sure that there exists any way to do the same ... here is a short description for that
FILE HANDLING IN SAP
Introduction
Files on application server are sequential files.
Files on presentation server / workstation are local files.
A sequential file is also called a dataset.
Handling of Sequential file
Three steps are involved in sequential file handling
OPEN
PROCESS
CLOSE
Here processing of file can be READING a file or WRITING on to a file.
OPEN FILE
Before data can be processed, a file needs to be opened.
After processing file is closed.
Syntax:
OPEN DATASET <file name> FOR {OUTPUT/INPUT/APPENDING}
IN {TEXT/BINARY} MODE
This statement returns SY_SUBRC as 0 for successful opening of file or 8, if unsuccessful.
OUTPUT: Opens the file for writing. If the dataset already exists, this will place the cursor at the start of the dataset, the old contents get deleted at the end of the program or when the CLOSE DATASET is encountered.
INPUT: Opens a file for READ and places the cursor at the beginning of the file.
FOR APPENDING: Opens the file for writing and places the cursor at the end of file. If the file does not exist, it is generated.
BINARY MODE: The READ or TRANSFER will be character wise. Each time n characters are READ or transferred. The next READ or TRANSFER will start from the next character position and not on the next line.
IN TEXT MODE: The READ or TRANSFER will start at the beginning of a new line each time. If for READ, the destination is shorter than the source, it gets truncated. If destination is longer, then it is padded with spaces.
Defaults: If nothing is mentioned, then defaults are FOR INPUT and in BINARY MODE.
PROCESS FILE:
Processing a file involves READing the file or Writing on to file TRANSFER.
TRANSFER Statement
Syntax:
TRANSFER <field> TO <file name>.
<Field> can also be a field string / work area / DDIC structure.
Each transfer statement writes a statement to the dataset. In binary mode, it writes the length of the field to the dataset. In text mode, it writes one line to the dataset.
If the file is not already open, TRANSFER tries to OPEN file FOR OUTPUT (IN BINARY MODE) or using the last OPEN DATASET statement for this file.
IF FILE HANDLING, TRANSFER IS THE ONLY STATEMENT WHICH DOES NOT RETURN SY-SUBRC
READ Statement
Syntax:
READ DATASET <file name> INTO <field>.
<Field> can also be a field string / work area / DDIC structure.
Each READ will get one record from the dataset. In binary mode it reads the length of the field and in text mode it reads each line.
CLOSE FILE:
The program will close all sequential files, which are open at the end of the program. However, it is a good programming practice to explicitly close all the datasets that were opened.
Syntax:
CLOSE DATASET <file name>.
SY-SUBRC will be set to 0 or 8 depending on whether the CLOSE is successful or not.
DELETE FILE:
A dataset can be deleted.
Syntax:
DELETE DATASET <file name>.
SY-SUBRC will be set to 0 or 8 depending on whether the DELETE is successful or not.
Pseudo logic for processing the sequential files:
For reading:
Open dataset for input in a particular mode.
Start DO loop.
Read dataset into a field.
If READ is not successful.
Exit the loop.
Endif.
Do relevant processing for that record.
End the do loop.
Close the dataset.
For writing:
Open dataset for output / Appending in a particular mode.
Populate the field that is to be transferred.
TRANSFER the filed to a dataset.
Close the dataset.
chk a sampel
parameters: p_file like rlgrap-filename obligatory
default '/usr/sap/upload.xls'.
types: begin of t_data,
vbeln like vbap-vbeln,
posnr like vbap-posnr,
matnr like vbap-matnr,
werks like vbap-werks,
megne like vbap-zmeng,
end of t_data.
data: it_data type standard table of t_data,
wa_data type t_data.
open dataset p_file for output in text mode encoding default.
if sy-subrc ne 0.
write:/ 'Unable to open file:', p_file.
else.
do.
read dataset p_file into wa_data.
if sy-subrc ne 0.
exit.
else.
append wa_data to it_data.
endif.
enddo.
close dataset p_file.
endif.
And if you want to write on the file.
*--- open UNIX file
open dataset unixfile for output in text mode message w_msg.
if sy-subrc ne 0.
write: / 'Cannot open for writing:', unixfile, w_msg.
exit.
endif.
*--- write UNIX file
loop at it_file.
transfer it_file to unixfile.
endloop.
*--- close UNIX file
close dataset unixfile. -
Application Server file Validity
Hi Experts,
I have one query. I wanted to check the validity of file in application server. The scenerio is like in my selection screen I will provide application server file name.
I wanted to validate whether that file is existing or not. If file is not existing then I need to display an error message.
Can anybody will suggest me how I can achieve this requirement?
Thanks,
NehaHi Neha,
To access the files on Application server we use DATASET operationsd like open, read, close etc.
Now in your case use opendataset as:
open dataset ds_name for output in text mode encoding default.
IF sy-subrc NE 0.
//write your message here.
ENDIF.
CLOSE DATASET ds_name.
Where ds_name = logical path name of your file, or if you want to check for just one file, hard code the path.
Better practice is to use logical path name.
Also declare ds_name as
DATA: ds_name LIKE rfpdo-rfbifile.
Close dataset is used in case file exists you need to close it.
Revert back if you wantto know abt logical file name.
Regards,
Sana. -
FM to upload the Internal table data into application server.
Hi,
Could you please give me Function module to Upload the Internal table data into Application server ie., in Tcode AL11.
I know for downloading the Application server file into itab is "SUBST_GET_FILE_LIST" FM and using open dtaa set we get the data.
Regards,
deepthi.Hi Deepthi
Incase you are looking to upload data in the AL11 through a program , then you can make use of OPEN DATASET...CLOSE DATASET statements.
Here's the code snippet:
IF tb_alvdisplay[] IS INITIAL.
MESSAGE e999(/dcsea/zais_msg) WITH text-e01.
ELSE.
IF NOT cb_ufile IS INITIAL "Download to file
AND sy-pagno = 0. "Only down page headers for first page
PERFORM fm_concatenate_path_name USING p_path
p_file
CHANGING v_file.
*Open file for download.
PERFORM fm_open_file USING v_file .
ENDIF.
LOOP AT tb_alvdisplay.
IF NOT cb_ufile IS INITIAL.
*Passing the values of the respective headings to the structure.
ws_rec-vend_no = tb_alvdisplay-vendno.
ws_rec-vend_nm = tb_alvdisplay-vendnm.
ws_rec-title = tb_alvdisplay-vendtl.
ws_rec-add = tb_alvdisplay-add.
ws_rec-city1 = tb_alvdisplay-city1.
ws_rec-region = tb_alvdisplay-region.
ws_rec-country = tb_alvdisplay-country.
ws_rec-pobox = tb_alvdisplay-po.
ws_rec-phone = tb_alvdisplay-telf1.
ws_rec-extn = tb_alvdisplay-extn.
ws_rec-fax = tb_alvdisplay-telfx.
ws_rec-zterm = tb_alvdisplay-zterm.
ws_rec-remark = tb_alvdisplay-remark.
ws_rec-email = tb_alvdisplay-email.
*Passing the separator 'PIPE' to the structure.
ws_rec-sep01 = co_sep.
ws_rec-sep02 = co_sep.
ws_rec-sep03 = co_sep.
ws_rec-sep04 = co_sep.
ws_rec-sep05 = co_sep.
ws_rec-sep06 = co_sep.
ws_rec-sep07 = co_sep.
ws_rec-sep08 = co_sep.
ws_rec-sep09 = co_sep.
ws_rec-sep10 = co_sep.
ws_rec-sep11 = co_sep.
ws_rec-sep12 = co_sep.
ws_rec-sep13 = co_sep.
TRANSFER ws_rec TO v_file.
ENDIF.
AT LAST.
IF NOT cb_ufile IS INITIAL.
*Closing the DATASET file.
CLOSE DATASET v_file.
IF sy-subrc <> 0.
*Failure Message.
MESSAGE e999(/dcsea/zais_msg) WITH text-t04 text-t06.
ELSE.
*Success message.
MESSAGE s999(/dcsea/zais_msg) WITH text-t05.
ENDIF.
ENDIF.
ENDAT.
ENDLOOP.
ENDIF.
Also as Gautham suggested you can use tcode CG3Z or CG3Y incase you are looking to upload the data directly.
FInally, you can search SCN using the keywords, "Upload to AL11" and you'll get loads of results.
Hope this helps.
Harsh
Maybe you are looking for
-
Vendor down payment process at the time final payment
Hi all MY scenario I posted in F-48 down payment of Rs 50000 and assigned invoice for Rs 89000 in F-54. While clearing I entered Rs 50000 against the Down Payment and posted. Now I am posting payment for the balance amount i.e. Rs 39000 in F-58. I se
-
Hi Experts, I am doing a report on opening and closing stock with subcontractors and i am facing a problem in calculation of two fields manually. for eg: I am having MATNR (Finished goods) and its corresponding MATNR (raw materials) in another fi
-
Negative Condition checking in read statement
Hi, i have table, which i have to read, key on which i am going to read that will be determined dynamically. now i have to check the value for the key field is initial or not. i can't use a loop here as it doesn't allow me to mention where condition
-
Can i set the timing for individual photos in a slideshow
there are text pages that need to be read but not at a 4 second speed it has to be slower more time syncing to music i compose is a must can each individual photo have its own time i hope so or else they ruined a wonderful product with this limitatio
-
Data Pump takes too much time importing (13 hours)
Hi I need some help with an import that take around 13 hours finishing. This is the configuration; RAC - 2 nodes, 4 processors each OS HP UX DB Oracle 10.2.0.5.0 64 bits IMPDP parfile: USERID=xxx/xxx DUMPFILE=('DB_FULLEXPORT_01.dmp','DB_FULLEXPORT_02