Missing CRLF in file created on application server
Hello,
We have a requisite to create a file on the Application Server (AS/400) with CRLF at the end of every record. The records are stored in this structure:
- OUTPUT: CHAR655, text to export;
- LENGTH: NUMC4, length of the record (text to export).
To create the file I have the following code:
open dataset lv_filename
for output in text mode
encoding default
with windows linefeed.
loop at pt_output into ls_output.
try.
clear lv_length.
lv_length = ls_output-length.
transfer ls_output-output to lv_filename
length lv_length.
catch cx_root into gv_oref.
* TODO
endtry.
endloop.
I have two problems:
1º When I open the file in Notepad++ the records should have 500 caracters (lv_length = 500), but it has 502;
2º Only LF appears, not CRLF.
Can anyone help me please?
Regards.
Hello,
Strangest thing, when I test it with 255 characters it works fine (CR+LF):
clear lv_string.
ls_output-output+254(1) = cl_abap_char_utilities=>cr_lf.
lv_string = ls_output-output+0(255).
transfer lv_string to lv_filename
length 255.
When I try with 256 characters it doesn't work, at the end of each record I can only find LF:
clear lv_string.
ls_output-output+255(1) = cl_abap_char_utilities=>cr_lf.
lv_string = ls_output-output+0(256).
transfer lv_string to lv_filename
length 256.
Don't understand why...
Regards.
Similar Messages
-
How to get creation date of a file created in application server?
Dear experts ,
I have some txt files in a particular path in application server .Suppose path is - \\PMICHSAPLA30\INTERFACE\\BCD\CO\OTC\SALES_RPT\test.txt.
I want to fetch the creation date of this txt file - test.txt . I tried with fm - ADS2KIPUPL_GET_FILE_ATTRIBUTES , but this will give proper out put.
I need to get file creation date. If today I am creating file - abc.txt, so according to this file I should get today's date as creation date.
Please suggest me.BEGIN OF ty_file,
line(400) TYPE c, "File names
END OF ty_file,
This is the structure declaration.
l_v_unixcom would be ls -l \\PMICHSAPLA30\INTERFACE\\BCD\CO\OTC\SALES_RPT\test.txt
now call
CALL 'SYSTEM' ID 'COMMAND' FIELD l_v_unixcom
ID 'TAB' FIELD i_file[].
and see contents of i_file[] it should have the details, post results so we can help further -
ABEND while creating file in the application server
Dear All,
Please provide the solution for the following.
REPORT ZMAIN.
SELECT BKORM UP TO 1000
EXTRACT ext.
ENDSELECT
Imagine, now the extract file having 1000 Entries
Reading the above EXTRACT file
LOOP .
submit ZSUB.
ENDLOOP.
End OF Main Program----
REPORT ZSUB.
SELECT BKORM UPTO 500
EXTRACT ext.
ENDSELECT
Here for each submit of the ZSUB, it is creating one EXTRACT file in the application server. When it reaching to create 999, it is going for ABEND.
Can anybody provide the solution to avoid going for ABEND .
Is there any restriction to create extract files in the applciation server?
Thanks in advance.Instead of select/endselect, try to use a loop with internal tables..
There's no limit in the extracts you can do..
<removed by moderator>
Edited by: Thomas Zloch on Nov 2, 2010 5:20 PM - please do not ask for... -> Ok
Edited by: Roberto Vacca on Nov 2, 2010 5:29 PM -
Create a Document with an original file stored on application server
Hello,
I start with document managment system : i am able to create new document (CV01N) manually, add a local file and check-in this file.
Now we need to store file which are stored on the SAP Application Server.
Firstly, in the GUI of transaction CV01N, i don't know how to browse file on application server. All files i can't attach as original, are files i can access from my computer.
Is it possible to access also on application server files ?
Moreover, i have to define function module which have to
- Create a document (DMS)
- Attach an orginial file which is stored on application server
- Check-in the file
This function module will be called from a web application
I define this kind of function and run it correctly with a local file (stored on my computer) : i call BAPI "BAPI_DOCUMENT_CREATE2" and "BAPI_DOCUMENT_CHECKIN2"
But i don't how to do with a file stored on application server. I see also note 504692 and try a program like ZZUZTEST_TEST_CHECKIN which use FM CVAPI_DOC_CHECKIN but it return an error Error uploading E:\usr\sap\TD1\DVEBMGS00\data\FACTURE.txt" (this path and file exist on application server and is really the file i want to checkin)
Please could you confirm what i search, is possible or not.
If possible, could help me with some explanations and guidelines and perhaps a sample ?
Thank you very much.
Regards,
Eric
The function used
FUNCTION Z_TEST_CHECKIN.
Checkin the first original of a document info record *
from the application server and/or in the background *
data : w_host like BAPI_DOC_AUX-HOSTNAME.
data: lf_line(255).
data: ls_draw like DRAW,
ls_message_cvapi like messages,
lt_files_cvapi type standard table of CVAPI_DOC_FILE,
lt_files_cvapi_header like CVAPI_DOC_FILE.
data: lt_originals LIKE cvapi_doc_file OCCURS 0 WITH HEADER LINE,
vo_originals LIKE cvapi_doc_file OCCURS 0 WITH HEADER LINE.
ls_draw-dokar = 'ZFT'.
ls_Draw-doknr = '0000000000000004500000032'.
ls_Draw-dokvr = '00'.
ls_Draw-doktl = '000'.
Read Originals contained in the document info record
CALL FUNCTION 'CVAPI_DOC_GETDETAIL'
EXPORTING
pf_batchmode = 'X'
pf_hostname = ' '
pf_dokar = ls_draw-dokar
pf_doknr = ls_draw-doknr
pf_dokvr = ls_draw-dokvr
pf_doktl = ls_draw-doktl
pf_active_files = 'X'
IMPORTING
psx_draw = ls_draw
TABLES
pt_files = vo_originals
EXCEPTIONS
not_found = 1
no_auth = 2
error = 3
OTHERS = 4.
IF sy-subrc <> 0.
WRITE 'Error returned by CVAPI_DOC_GETDETAIL'. "#EC NOTEXT
EXIT.
ENDIF.
Check if we can really access the file from the application server
read table vo_originals index 1.
open dataset vo_originals-filename for input in text mode ENCODING DEFAULT.
if not sy-subrc is initial.
message e500(26) with vo_originals-filename 'not found'.
endif.
read dataset vo_originals-filename into lf_line.
if not sy-subrc is initial.
message e500(26) with vo_originals-filename 'read error'.
endif.
lt_originals = vo_originals.
lt_originals-STORAGE_CAT = 'SAP-SYSTEM'.
append lt_originals.
w_host = sy-host.
CALL FUNCTION 'CVAPI_DOC_CHECKIN'
EXPORTING
PF_DOKAR = ls_draw-dokar
PF_DOKNR = ls_draw-doknr
PF_DOKVR = ls_draw-dokvr
PF_DOKTL = ls_draw-doktl
PS_DOC_STATUS =
PF_FTP_DEST = 'SAPFTPA'
PF_HTTP_DEST = 'SAPHTTPA'
*PF_HOSTNAME = w_host
PS_API_CONTROL =
PF_REPLACE = ' '
PF_CONTENT_PROVIDE = 'SRV'
IMPORTING
PSX_MESSAGE = ls_message_cvapi
TABLES
PT_FILES_X = lt_originals
PT_COMP_X =
PT_CONTENT =
IF ls_message_cvapi-msg_type CA 'EA'.
ROLLBACK WORK.
MESSAGE ID '26' TYPE 'I' NUMBER '000'
WITH ls_message_cvapi-msg_txt.
ELSE.
COMMIT WORK and wait.
ENDIF.
ENDFUNCTION.This is a bit tricky. I spent lots of hours about this .
You have to set PF_HOSTNAME with your name of your AS and gives the path to the file on the server.
You wrote
*PF_HOSTNAME = w_host
But beware: if you have more thän one AS you have to fix one AS for upload or you have to find the servers name of the file. A better way can be to share one folder by each AS.
You also have to decide between HTTP or FTP.
You wrote:
PF_FTP_DEST = 'SAPFTPA'
PF_HTTP_DEST = 'SAPHTTPA'
You must define only one ! Then you have to check your settings in SM59 about working right.
Pls rate, if this was helpful.
Regards,
Markus -
File not created in application server
Hi All,
I have to create a file in the application server for this i have coded as
OPEN DATASET G_PATH2 FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
when i am creating the file in the foreground, it is creating the file, but the same thing when i am setting the back ground job for the program in which i have to create the file using OPEN DATASET, i am not able to create the file. I am getting the error message "File /usr/sap/BI_ARF/ABC.txt is not downloaded to Application Server" in my job log.
Pls help to resolve the issue.
Thanks,
RajuHi,
Refer:
Re: Creating a file on the application server.
Re: creating a new file in application server
Hope they help you.
Regards,
Tarun -
Urgent :- Unable to deploy EAR file in Oracle application server
Hello folks,
I am trying to deploy an application containing jsps and servlets
packaged into EAR using ant. However when am trying to do so by using
the Deploy EAR option in the Enterprise manager, it throws the
following error -
"Invalid J2EE application file specified - Jar file:
/var/tmp/jar47241.tmp is missing its standard xml descriptor located at
META-INF/ejb-jar.xml"
I suspect that something could be wrong with regards to the way the ear
file has been created.
Please if someone could pin point the problem and help me understand
the the above error message , it will be of great help to me and I d
really appreciate this.
Many Thanks,
Ramn.Hello,
I try to deploy an ear file (contains jar and war files) in Oracle Application server in linux, but the time is so long. The same file I deploy in a OAS in windows and the deploy time was 2 minutes, but in linux I leave the hole night and the session close and the deploy in unable.
I don't know if I need configure an especial option in the OAS in Linux, how I can load my ear file.
The OAS in windows was installed with oc4j options only, but the OAS in linux was full installation
Please help me....
Thanks. -
How to see the file at the application server
HI TO ALL SDNERS ,
THIS IS MY CODE WHERE TO CHECK THE DOWNLOADED FILE AT THE APPLICATION SERVER.IN TCODE AL11 I HAVE SEEN THERE IS NO FILE GETTING CREATED.WHEN TRANSFERRING THE SY-SUBRC VALUE IS ZERO.
Program Name : ZME11_BDC.
Title : PURCHASE INFORMATION RECORD LOAD PROGRAM
Program Objective : THIS PROGRAM READS IN THE PURCHASE
INFORMATION FILE. IT CREATES A BDC SESSION TO
USE TO LOAD THE PURCHASE INFORMATION RECORDS
INTO SAP using the ME11 Transaction.
REPORT ZME11_BDC no standard page heading MESSAGE-ID ZHNC line-size 55.
constants declaration
constants: c_x value 'X',
c_sess type apqi-groupid value 'zcustomer',
c_xd01 type tstc-tcode value 'ME11'.
DECLARING VARIABLES
DATA: V_MSG(255),
V_ERREC TYPE I,"NO OF FAILED RECORDS
V_LINES."NO OF RECORDS
FLAG DECLARATIONS
DATA: FG_DATA_EXIST VALUE 'X',"CHECK FOR DATA
FG_SESSION_OPEN VALUE ''.
STRUCTURES AND INTERNAL TABLE DECLARATIONS
TYPES :BEGIN OF TY_PIR,
LIFNR TYPE EINA-LIFNR,
MATNR TYPE EINA-MATNR,
EKORG TYPE EINE-EKORG,
WERKS TYPE EINE-WERKS,
VERKF TYPE EINA-VERKF,"sales person
TELF1 TYPE EINA-TELF1,"telephone
URZLA TYPE EINA-URZLA,"country
REGIO TYPE EINA-REGIO,"region
APLFZ(5),"plan deleivery time
EKGRP TYPE EINE-EKGRP,"purchase group
NORBM(13),
NETPR(13),
END OF TY_PIR.
DATA : IT_PIR TYPE TABLE OF TY_PIR,
WA_PIR LIKE LINE OF IT_PIR.
DATA: BEGIN OF IT_BDCDATA.
INCLUDE STRUCTURE BDCDATA.
DATA END OF IT_BDCDATA.
DATA : BEGIN OF IT_BDCMSG.
INCLUDE STRUCTURE BDCMSGCOLL.
DATA END OF IT_BDCMSG.
SELECTION SCREEN
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETER : FNAME TYPE RLGRAP-FILENAME.
SELECTION-SCREEN END OF BLOCK B1.
AT SELECTION ON VALUE REQUEST
AT SELECTION-SCREEN ON VALUE-REQUEST FOR FNAME.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = SYST-CPROG
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = ' '
IMPORTING
FILE_NAME = FNAME.
START OF SELECTION
START-OF-SELECTION.
PERFORM F_GET_DATA USING FNAME
CHANGING IT_PIR.
PERFORM F_GENERATE_DATASET USING FNAME
CHANGING IT_PIR WA_PIR.
*& Form F_GET_DATA
text
-->P_V_FNAME text
<--P_IT_PIR text
FORM F_GET_DATA USING P_FNAME LIKE FNAME
CHANGING P_IT_PIR LIKE IT_PIR.
DATA: LV_FILE TYPE STRING.
LV_FILE = FNAME.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = LV_FILE
FILETYPE = 'DAT'
HAS_FIELD_SEPARATOR = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
IMPORTING
FILELENGTH =
HEADER =
TABLES
DATA_TAB = P_IT_PIR
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
IF P_IT_PIR IS INITIAL.
FG_DATA_EXIST = ''.
ENDIF.
ENDFORM. " F_GET_DATA
*& Form F_GENERATE_DATASET
text
-->P_V_FNAME text
<--P_IT_PIR text
FORM F_GENERATE_DATASET USING P_V_FNAME LIKE FNAME
CHANGING P_IT_PIR LIKE IT_PIR
P_WA_PIR LIKE WA_PIR.
MESSAGE I001(ZHNC).
*OPENING FILE AT THE APPLICATION SERVER FOR WRITING
OPEN DATASET FNAME FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
IF SY-SUBRC EQ 0.
MESSAGE I002(ZHNC).
LOOP AT P_IT_PIR INTO P_WA_PIR.
SPLIT P_WA_PIR AT '*' INTO P_WA_PIR-LIFNR
P_WA_PIR-MATNR
P_WA_PIR-EKORG
P_WA_PIR-WERKS
P_WA_PIR-VERKF
P_WA_PIR-TELF1
P_WA_PIR-URZLA
P_WA_PIR-REGIO
P_WA_PIR-APLFZ
P_WA_PIR-EKGRP
P_WA_PIR-NORBM.
*TRANSFER THE FILE FROM INTERNAL TABLE TO APPLICATION SERVER
MESSAGE I003(ZHNC).
TRANSFER P_WA_PIR TO FNAME.
ENDLOOP.
*CLOSING THE FILE AT THE APPLICATION SERVER
CLOSE DATASET FNAME.
ENDIF.Hello,
I made a similar program. You can have a look at it.
*& Form write_to_app_server
text
--> p1 text
<-- p2 text
FORM write_to_app_server.
To get filename
PERFORM get_filename.
To write into the application server
OPEN DATASET g_filename_with_path FOR OUTPUT IN TEXT MODE.
IF sy-subrc = 0.
LOOP AT <l_table> INTO <l_line>.
TRANSFER <l_line> TO g_filename_with_path.
ENDLOOP.
CLOSE DATASET g_filename_with_path.
ELSE.
CLOSE DATASET g_filename_with_path.
ENDIF.
To send mail
PERFORM send_mail.
ENDFORM. " write_to_app_server
*& Form get_filename
text
--> p1 text
<-- p2 text
FORM get_filename.
DATA : l_log_path TYPE filepath-pathintern
VALUE 'Y28M_DOWNLOADS_BACKGROUND' .
CALL FUNCTION 'FILE_GET_NAME_USING_PATH'
EXPORTING
client = sy-mandt
logical_path = l_log_path
operating_system = sy-opsys
file_name = p_fname
IMPORTING
file_name_with_path = g_filename_with_path
EXCEPTIONS
path_not_found = 1
missing_parameter = 2
operating_system_not_found = 3
file_system_not_found = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " get_filename
You may find it useful.
Regards,
Karuna. -
Creation of xml file in r3 application server (AL11)
Hi All
I need to create xml file in r3 application server (AL11) using PI.Can we achieve this using file adapter or we need to proceed with proxy. As I tried with file adapter with FTP transport protocol. Its giving the error as "Unable to create new pooled resource:FTPEx:Login incorrect".
Thanks in advance
Regards,
KartikeyaHi
need to create xml file in r3 application server (AL11) using PI.Can we achieve this using file adapter or we need to proceed with proxy.
To generate file at AL11 file directory use File adapter. Proxy is not required for this
Its giving the error as "Unable to create new pooled resource:FTPEx:Login incorrect".
1. Check with the Login credentials for the FTP service.
2. FTP User you use in communication channel must have 777 access to FTP location.
Thanks
Gaurav -
Error while extracting XML file from the application server
Hi ,
I am writing a XML file into the application server, after which when i try to extract the file to the local server using the report - RFASLDPC ,
the file is extracted, but with a '#' symbol at the first position.
Because of which the XML File does not open. But after i open the file in notepad and manually delete the '#' symbol and then reopen the file, it works fine.
Is there any way to remove the '#' symbol while extracting itself ??
Thanks in advance,
Vikas.Select the option "No Character Set Conversion" in stead of Code page 1100.
However, I still have troubles -> the downloaded xml file misses a space on several places. This causes errors too. -
How to run ear file in java application server
i want how to run .ear file in java application server
1. i m created ear file
2. i m created jar file (bean,home,remote)
3.i m created war file(in the form of jsp)
but till now i couldnt run ear file
how to run
please hel meYou must create :
1.Jar file
2.War file
And then put them into an ear file
Exemple : myapp.ear contains
myappEJB.jar
myappWEB.war
META-INF/application.xml
and application.xml looks like this :
<application xmlns="http://java.sun.com/xml/ns/j2ee" version="1.4"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com /xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/application_1_4.xsd">
<display-name>myapp</display-name>
<description>Demo application</description>
<module>
<ejb>myappEJB.jar</ejb>
</module>
<module>
<web>
<web-uri>myappWAR.war</web-uri>
<context-root>/myapp</context-root>
</web>
</module>
</application>Good luck -
Hi,
I have downloaded a XML file to the application server.....
File is created but i am not able to open the file there....
Plz advice ....how to open it.....
Regards.Use Notepad. Drag and drop in notepad.
Aman -
File transfer into application server
Hi folks.
I need to retrieve header records from table MCHB and RESB and transfer it into file.
Again for the corresponding header record, i need to transfer item records retrived from table MKOL and LFA1 as well.
One file each is to be create per plant.
But,i am not able to get item data into file.
My coding....
LOOP AT i_mchb INTO wa_mchb.
l_clabs = wa_mchb-clabs.
SHIFT l_clabs LEFT DELETING LEADING space.
Summarize requirement quantity
LOOP AT i_resb INTO wa_resb.
wa_sum-charg = wa_resb-charg.
wa_sum-bdmng = wa_resb-bdmng.
COLLECT wa_sum INTO i_sum.
SORT i_sum BY charg.
ENDLOOP.
READ TABLE i_sum INTO wa_sum WITH KEY charg = wa_mchb-charg.
IF sy-subrc EQ 0.
l_bdmng = wa_sum-bdmng.
SHIFT l_bdmng LEFT DELETING LEADING space.
ENDIF.
Calculation on Available quantity
l_avqty = l_bdmng - l_clabs.
SHIFT l_avqty LEFT DELETING LEADING space.
AT NEW werks.
*Creation of file
PERFORM sub_create_file.
Open File on the application server for processing
OPEN DATASET g_file_name FOR OUTPUT IN TEXT MODE
ENCODING DEFAULT.
IF sy-subrc NE 0.
*Display error message
MESSAGE i055 WITH g_file_name.
" Error in opening file
LEAVE LIST-PROCESSING.
ENDIF.
ENDAT.
Transfering data to file
CONCATENATE c_header "Header indentification
wa_mchb-matnr " Material number
wa_mchb-werks " Plant
wa_mchb-lgort " Storage location
wa_mchb-charg " Batch number
l_clabs " Valuated stock-unrestricted use
l_bdmng " Requirement quantity
l_avqty " Avalable quantity.
INTO l_record.
TRANSFER l_record TO g_file_name.
CLEAR: l_clabs,
l_bdmng,
l_avqty,
l_record.
READ TABLE i_mkol INTO wa_mkol WITH KEY matnr = wa_mchb-matnr
werks = wa_mchb-werks
lgort = wa_mchb-lgort
charg = wa_mchb-charg
BINARY SEARCH.
IF sy-subrc EQ 0.
l_tabix = sy-tabix.
LOOP AT i_mkol INTO wa_mkol FROM l_tabix.
*Population of consignment stock-unrestricted use
l_slabs = wa_mkol-slabs.
SHIFT l_slabs LEFT DELETING LEADING space.
READ TABLE i_lfa1 INTO wa_lfa1 WITH KEY lifnr = wa_mkol-lifnr.
sy-subrc check not done
CONCATENATE c_item " Item identification
l_slabs
" Consignment stock-unrestricted use
wa_mkol-lifnr " Vendor account number
wa_lfa1-name1 " Vendor name
INTO l_record.
TRANSFER l_record TO g_file_name.
CLEAR: l_slabs,
l_record.
ENDLOOP.
ENDIF.
AT END OF werks.
Close File
CLOSE DATASET g_file_name.
CLEAR g_file_name.
ENDAT.
ENDLOOP.Hi,
Yes thats correct. When using AT NEW. The field in internal table after the WERKS field will have ASTERSIK .
So before AT NEW. Assign the work area to another work area. Eg.
WA_mchb1 = wa_mchb.
Later on i.e. After ENDAT use everywhere WA_MCHB1 and not not WA_MCHB.
This will solve the problem.
wa_sum-charg = wa_resb-charg.
wa_sum-bdmng = wa_resb-bdmng.
COLLECT wa_sum INTO i_sum.
SORT i_sum BY charg.
ENDLOOP.
READ TABLE i_sum INTO wa_sum WITH KEY charg = wa_mchb-charg.
IF sy-subrc EQ 0.
l_bdmng = wa_sum-bdmng.
SHIFT l_bdmng LEFT DELETING LEADING space.
ENDIF.
Calculation on Available quantity
l_avqty = l_bdmng - l_clabs.
SHIFT l_avqty LEFT DELETING LEADING space.
<b>clear wa_mchb_new.</b>
<b>wa_mchb_new = wa_mchb.</b>
AT NEW werks.
*Creation of file
PERFORM sub_create_file.
Open File on the application server for processing
OPEN DATASET g_file_name FOR OUTPUT IN TEXT MODE
ENCODING DEFAULT.
IF sy-subrc NE 0.
*Display error message
MESSAGE i055 WITH g_file_name.
" Error in opening file
LEAVE LIST-PROCESSING.
ENDIF.
ENDAT.
Transfering data to file
CONCATENATE c_header "Header indentification
<b>wa_mchb_new-matnr " Material number
wa_mchb_new-werks " Plant
wa_mchb_new-lgort " Storage location
wa_mchb_new-charg " Batch number</b>l_clabs " Valuated stock-unrestricted use
l_bdmng " Requirement quantity
l_avqty " Avalable quantity.
INTO l_record.
TRANSFER l_record TO g_file_name.
CLEAR: l_clabs,
l_bdmng,
l_avqty,
l_record.
READ TABLE i_mkol INTO wa_mkol WITH KEY matnr = <b>wa_mchb_new-matnr
werks = wa_mchb_new-werks
lgort = wa_mchb_new-lgort
charg = wa_mchb_new-charg</b>BINARY SEARCH.
IF sy-subrc EQ 0.
l_tabix = sy-tabix.
LOOP AT i_mkol INTO wa_mkol FROM l_tabix.
*Population of consignment stock-unrestricted use
l_slabs = wa_mkol-slabs.
SHIFT l_slabs LEFT DELETING LEADING space.
READ TABLE i_lfa1 INTO wa_lfa1 WITH KEY lifnr = wa_mkol-lifnr.
sy-subrc check not done
CONCATENATE c_item " Item identification
l_slabs
" Consignment stock-unrestricted use
wa_mkol-lifnr " Vendor account number
wa_lfa1-name1 " Vendor name
INTO l_record.
TRANSFER l_record TO g_file_name.
CLEAR: l_slabs,
l_record.
ENDLOOP.
ENDIF.
AT END OF werks.
Close File
CLOSE DATASET g_file_name.
CLEAR g_file_name.
ENDAT.
ENDLOOP.
Best regards,
Prashant
PS : Please reward all helpful answers
Message was edited by: Prashant Patil
Message was edited by: Prashant Patil -
Excel file creation on application server
Gurus,
I have seen a lot of threads on excel file creation in application server, but failed to see if anyone had a solution.
Problem: In background execution I need to create an excel sheet on application server, the data would be contained in internal table, The FM like WS_DOWNLOAD etc..cannot support these as they have GUI component.
All the documentation that I have been through states to use dataset which saves the file in.csv or txt format seperated by delimiter, is it possible to save as a true excel file.
same as this thread:
Re: Excel download in Application Server
let me know,
Thanks in advance .* Write column headers, if required
IF column_headers = 'X'.
* ... override field names with LABELS_IN, if specified
IF NOT labels_in[] IS INITIAL.
DESCRIBE TABLE labels_in LINES num_lines.
IF num_lines > num_fields.
RAISE too_many_labels.
ELSEIF num_lines < num_fields.
RAISE too_few_labels.
ENDIF.
ASSIGN COMPONENT 1 OF STRUCTURE labels_in TO <f>.
LOOP AT fields_in.
READ TABLE labels_in INDEX sy-tabix.
fields_in-name = labels_in-name.
MODIFY fields_in.
ENDLOOP.
ENDIF.
* ...write column headers to file...
position = 0.
LOOP AT fields_in.
IF fixed_length NE space.
*** INSERT: DAR was here for Issue 17817 --------------- dar012009 ---v
field_len = STRLEN( fields_in-name ).
*** INSERT: DAR was here for Issue 17817 --------------- dar012009 ---^
DO fields_in-len TIMES.
offset = sy-index - 1.
* IF sy-index > 15. dar012009
IF sy-index > field_len. "dar012009
line_out+position(1) = space.
ELSEIF fields_in-name+offset(1) NE space.
line_out+position(1) = fields_in-name+offset(1).
ELSE.
line_out+position(1) = space.
ENDIF.
position = position + 1.
ENDDO.
ELSE.
CONCATENATE line_out fields_in-name INTO line_out
SEPARATED BY delimiter.
ENDIF.
ENDLOOP.
IF fixed_length EQ space.
SHIFT line_out LEFT DELETING LEADING delimiter.
ENDIF.
IF no_write IS INITIAL. "dar041505
TRANSFER line_out TO file_out.
ENDIF. "dar041505
data_out = line_out. APPEND data_out. "dar041505
ENDIF.
* Write lines to file...
LOOP AT data_in.
CLEAR line_out.
position = 0.
DO num_fields TIMES.
ASSIGN COMPONENT sy-index OF STRUCTURE data_in TO <f>. -
Opening a file stored at application server
Experts,
I have put a document on application server using DATASET .
Now I want to open the same file from there only.
ho to do that.
Thnx in Advance
ChetanHi Chetan ,
U can use following code to open the file u created in application server.
1.
data: <dataset_name>(25) value '.\tmp\file_sarang_01.txt'.
open dataset <dataset_name> for input in text mode encoding UTF-8
read dataset <dataset_name> into itab_wa.
Append itab_wa to itab.
close dataset <dataset_name>
loop at itab.
write: itab-field1 , itab-field2 .
endloop.
2. U can use transaction CG3Y , to save file from application server to presentation server directly.(A short cut for u)
I hope this solves ur problem
Reagrds.
Note: Reward if useful -
Renaming a file on the application server
Hi all,
I create a file on the Application server which I want to rename means a program.
I would like to add the system stamptime at the time the program is running.
sample:
original name:
file.csv
final name:
file_20060626123000.csv
does somebody have an ABAP program to do that ? other ideas?
Thanks in advance,
FedeXThanks for the answers,
I do not what I doing wrong in my sample....
I am using this logical path and logical file in an InfoSpoke..
and I get the error:
"could not open file on application server"
My definitions are:
Logical PATH : Z_PATH_TEST
Syntax Group ->UNIX
<P=DIR_HOME>/<FILENAME>
( I am sure DIR_HOME is set correcty on SAP Directories)
Logical FILE NAME : Z_NAME_TEST
Physical Name :File1_<DATE>.csv
Data Format : ASC
Logical Path: Z_PATH_TEST
What could be wrong here?... Thanks again
FedeX
Maybe you are looking for
-
My phone is not working properly help
hello people i got my cuz's old phone which is the curve 8900 and it totally lost all signal and i couldnt get it back until i asked a professional about it and i got it back. she said i should update the software but it i cant find a update for it.
-
HT201302 how to see my contacts in icloud
hello How can I see my contacts in my icloud?
-
Iphoto vs. aperture keywording search
I'm currently making the switch to aperture. In iphoto, when you have photos tagged with people like "larry" and "bob" and want to find photos with both of them, you can search "larry bob". This will show all photos with both of them in it. I can't s
-
Separation Of Albums in Cover Flow
It appears random that some of my albums "separate" in cover flow, even albums I've bought from iTunes. It may split into 2 albums, or as many as 6, in my experience. It looks like this: http://i188.photobucket.com/albums/z68/renegadofunk93/Picture1-
-
Full mesh VPN solution for on MPLS network with PE and CPEs
Hi, We are trying to evaluate some best solution for Hub-Spoke mesh vpn solution in a MPLS network. The VPN hub router will be in PE router and all the VPN spoke will be in CPE. Can someone please let us know what will be the best vpn solution, we un