How we create a flat file on the application server
hi,
how we create a flat file on the application servere,this file have the header data and corresponding item data also.
i.e. how we use the AT NEW and ATEND. statement in this file creation.
pls send me some code related to this.
thanks,
vipin
Hi Grafl,
Chk this link
Folder creation in AL11 using ABAP program
try this code.This works on UNIX servers
data: unixcom like rlgrap-filename.
data: begin of tabl occurs 500,
line(400),
end of tabl.
dir = unixcom = 'mkdir mydir'. "command to create dir
"to execute the unix command
call 'SYSTEM' id 'COMMAND' field unixcom
id 'TAB' field tabl[].
<b>Reward Points if Useful</b>
Regards
Gokul
Similar Messages
-
Moving of flat file from the application server after upload.
Hi All,
I am uploading data from a flat file placed on the application server by a BDC program.
After the BDC has created the session i want to transfer the flat file from that folder to another folder on the application server by changing the name of the flatfile.
Can any one suggest the best way of doing this particular scenario?
Thanks in advance.
Regards
Satish Nair.Here is a sample program.
report zrich_0001.
data: d1 type localfile value '/usr/sap/TST/SYS/Data1.txt',
d2 type localfile value '/usr/sap/TST/SYS/Data2.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.
Regards,
Rich Heilman -
Creating a flat file in the IDOC format
Hi everybody,
Need help.....urgently. Can somebody please tell me how to create a flat file in the IDOC format? I am creating a bill of lading/Documentary payments (EDI 858) and can't figure out a way to write the data generate through the report in a flat file in IDOC format. My deadline is right around the corner and I need help.
Thanks,
MHi Minal,
I still don't understand your question.
So, you have a report which selects data and puts it into an internal table. This part looks fine.
You want to create a flat file? Ok, to create a flat file on the application server then use the commands OPEN DATASET, TRANSFER, and CLOSE DATASET. To create a flat file on the presentation server then use the FM GUI_DOWNLOAD (or the GUI class, I forgets its name for the moment).
In both cases you should build up an internal table which has the exact structure required for your (EDIFACT?) EDI message, and then use the appropriate method to write the file.
If the following steps are manual then there is nothing more for you to do.
I don't see any need to use Idoc technology, or make any reference to it in your solution.
I hope that helps. If not, please be more specific when asking your questions.
Brad -
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 -
How to create a flat files and how i used this
hi Guys and gals,
I am david. I want to know how to create a flat files. I don't know about it also. pls explain it and also pls help me to create a flat files. If u have any program for creating pls send me.
I want to know about retrive the datas from flat files and also insert a record into it.
pls guide me
i need this immediately
davidvoid newMethod() throws Exception {
// Reading from a flat file
String data;
BufferedReader br = new BufferedReader(new FileReader("c:\filename1.txt"));
while ((data = br.readLine()) != null) {
System.out.println(data);
// Writing to a flat file
BufferedWriter bw = new BufferedWriter(new FileWriter("c:\filename2.txt"));
bw.write("sample data");
// After writing the data close the file
bw.close();
} -
HOw to create a Batch file for java application and whats the use of this ?
HI,
How to create a Batch file for java application ?
And whats the use of creating batch file ?
Thanks in advanceFirst of all, you're OT.
Second, you can find this everywhere in the net.
If you got a manifest declaring main class (an classpath if needed), just create a file named whatever.bat, within same directory of jar file, containing:
javaw -jar ./WhateverTheNameOfYourJarIs.jar %*By the way, assuming a Windows OS, you can just double click the jar file (no batch is needed).
Otherwise use:
javaw -cp listOfJarsAndDirectoriesSeparedBySemiColon country/company/application/package/className %*Where 'country/company/application/package/' just stands for a package path using '/' as separator instead of '.'
Don't specify the .class extension.
Javaw only works on Windows (you asked for batch, I assumed .BAT, no .sh), in Linux please use java.exe (path may be needed, Windows doesn't need it 'cause java's executables are copied to system32 folder in order to be always available, see PATH environment variable if you don't know what I'm talking about) and use ':' as classpath (cp) separator.
The '%***' tail is there in order to pass all parameters, it only works on Windows, refer to your shell docs for other OSs (something like $* may work).
This way you have a command you can call to launch your code (instead of opening NetBeans just to see your app working). You could schedule tasks on it or just call it in any command prompt (hope you know what it is 'cause there have been people in this very same forum with no clue about it, if not just hold the 'Windows button' and press 'R', then type 'cmd' and run it).
Finally add dukes and give 'hem away.
Bye. -
How to create a Batch file for java application ?
HI,
How to create a Batch file for java application ?
And whats the use of creating batch file ?
Thanks in advance[http://static.springsource.org/spring-batch/]
Assuming you want to develop a batch application rather than actually just create a .bat file .. -
How to create a war file of web application
Hi Techies
How to create a war file of the web application?
And plz tell me the utilities used for it.hi,
To compress a 'abc' web application into a "Web Archive" file named abc.war, follow the steps below:
1> Open a command prompt and cd to the application's dir:
<TOMCAT_HOME>\webapps\abc
2> Use the java archive command 'jar' to bundle up your application:
jar -cvf abc.war *
3> Move this to any other server and work with it!! :)
-- Abdel Raoof Olakara
http://olakara.googlepages.com -
How to Rename the file in the application server?
Hi friends.
How to Rename the file in the application server? via abap program so pls kindly let me know thr any function module is there.
Thanks
With Regards
I.Muthukumar.Dont think there is any quick fix way of doin this, however you can use the following sequence of dataset ops to get what you need:
READ DATASET - retrieve contents of current AS file
TRANSFER DATASET - create a new file on AS with the contents read in READ
DELETE DATASET - delete the original file on AS (if TRANSFER above is successful)
Hope this approach helps.
Cheers,
Aditya -
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. -
How to delete a local file in the presentation server.
Hi All,
How to delete a local file in the presentation server. As we do using 'delete dataset dsn' in application server. How can i achieve this. My requirement is after uploading file using gui_upload, i want to delete that source file. Please let me know, how can i achieve this.
Thanks in advance.
Regards,
Vishaldata: l_rc type i.
data: f_name type string.
move 'c:\YourFile.txt' to f_name.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_DELETE
EXPORTING
FILENAME = f_name
CHANGING
RC = l_rc
EXCEPTIONS
FILE_DELETE_FAILED = 1
CNTL_ERROR = 2
ERROR_NO_GUI = 3
FILE_NOT_FOUND = 4
ACCESS_DENIED = 5
UNKNOWN_ERROR = 6
NOT_SUPPORTED_BY_GUI = 7
WRONG_PARAMETER = 8
others = 9
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF. -
How to create Default Schema from within the application
Hi friends
I am creating users using the following within my application using this syntax
BEGIN
APEX_UTIL.CREATE_USER
(:P124_USER_ID, :P124_USER_NAME,:P124_USER_FIRST_NAME,:P124_USER_LAST_NAME,' ',:P124_USER_EMAIL_ID,'xxxx');
END;
The default workspace for the user is set as blanks. I would like to set it to be the default workspace as per the current logged in user.
Can you help me with the syntax for this
thank you in advance
LaxmiLaxmi,
The subject of the post is "How to create Default Schema from within the application".
But your question asks how to set the "default workspace" for a newly created user.
Those are different questions and not the ones I think you need answered.
Let me answer this question "How can you set the default schema for an account when creating the account and set it to the same value used for the default schema attribute of the administrator account used to authenticate to the currently running application?".
In the apex_util.create_user call use named parameter notation and fetch the information about the currently logged-in user first, e.g.,declare
l_workspace varchar2(256);
l_user_name varchar2(256);
l_first_name varchar2(256);
l_last_name varchar2(256);
l_web_password varchar2(256);
l_email_address varchar2(256);
l_start_date varchar2(256);
l_end_date varchar2(256);
l_employee_id varchar2(256);
l_allow_access_to_schemas varchar2(256);
l_person_type varchar2(256);
l_default_schema varchar2(256);
l_groups varchar2(256);
l_developer_role varchar2(256);
l_description varchar2(256);
begin
apex_util.fetch_user (
p_user_id => apex_util.get_current_user_id,
p_workspace => l_workspace,
p_user_name => l_user_name,
p_first_name => l_first_name,
p_last_name => l_last_name,
p_web_password => l_web_password,
p_email_address => l_email_address,
p_start_date => l_start_date,
p_end_date => l_end_date,
p_employee_id => l_employee_id,
p_allow_access_to_schemas => l_allow_access_to_schemas,
p_person_type => l_person_type,
p_default_schema => l_default_schema,
p_groups => l_groups,
p_developer_role => l_developer_role,
p_description => l_description);
apex_util.create_user(
p_user_id => :P124_USER_ID,
p_user_name => :P124_USER_NAME,
p_first_name => :P124_USER_FIRST_NAME,
p_last_name => :P124_USER_LAST_NAME,
p_email_address => :P124_USER_EMAIL_ID,
p_web_password => 'xxxx',
p_default_schema => l_default_schema);
end;Scott -
How do upload a file to the application server into a directory?
hi to all,
i want to upload file into the database..i need upload the file into the application server and save it to a directory..is there any way?where i can read about this?any information?
ashwinyHello,
First, we need to determine the terms we are using, in order to avoid confusion. We (including the documentation) are using "upload" to describe storing the file on the server, and "download" to pull it from the server into local machine.
You can use the "File Browse" item to upload any file you need from your local machine and into a database table. The default APEX configuration (in the dads.conf file) stored the uploaded file in a table called wwv_flow_file_objects$. In your application, you can access this table using a view called APEX_APPLICATION_FILES.
After you uploaded a file, any user can access it, using the download procedure described in the reference I gave you. The download procedure gives you an option to store the download file anywhere you need, using the "Open/Save" dialog box.
I believe this is covering everything you need. If you still having problems, please consider posting the relevant application pages on apex.oracle.com. It will be easier to understand and help you.
Regards,
Arie. -
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 from the Application server
Hi gurus,
I am working on a scenario where I need to get a file from the application server and for this I need to ask user to enter the location and that too at the selection screen and then I need to read this location using open data set and read data set in my program , once I am done with this I need to do some other validations. so can you please help me out how to achieve this.
Thanks
Rajeev GuptaHi
Declare the selection screen with file as parameter so that the user enter the application server file..
the use the OPEND DATASET as mentioned in below code and process
Refer this:
http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3ca6358411d1829f0000e829fbfe/frameset.htm
ABAP code for uploading a TAB delimited file into an internal table. See code below for structures.
*& Report ZUPLOADTAB * &----
*& Example of Uploading tab delimited file *
REPORT zuploadtab .
PARAMETERS: p_infile LIKE rlgrap-filename
OBLIGATORY DEFAULT '/usr/sap/'..
DATA: ld_file LIKE rlgrap-filename.
*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.
*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.
*START-OF-SELECTION
START-OF-SELECTION.
ld_file = p_infile.
OPEN DATASET ld_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc NE 0.
ELSE.
DO.
CLEAR: wa_string, wa_uploadtxt.
READ DATASET ld_file INTO wa_string.
IF sy-subrc NE 0.
EXIT.
ELSE.
SPLIT wa_string AT con_tab INTO wa_uploadtxt-name1
wa_uploadtxt-name2
wa_uploadtxt-age.
MOVE-CORRESPONDING wa_uploadtxt TO wa_upload.
APPEND wa_upload TO it_record.
ENDIF.
ENDDO.
CLOSE DATASET ld_file.
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.
Regards
Anji
Maybe you are looking for
-
I need to Change my Apple ID on my I-Phone 4 to a new E-Mail Address, What can I do to Change it.
-
Display of change documents: Material BOM
Hi, Using transaction CS80, I wish to display the changes made to a material BOM. However I could not see any output although I know I have made quite a lot of changes to that material BOM. Am I missing some config or data set-up?? Thanks in advance
-
Update custom field in VA01/VA02 after message V1152
Hi experts, The consultant wants the following issue: Whenever a sales order is saved, if the error V1152 raises, I new field in additional Tab B must be filled. I knwo where this error raises but not how to check this error in user exit SAVE_DOCUMEN
-
Does this happen to any of u often???
my AE wireless connection goes away often, and sometimes it comes back automatically, sometimes i will need to unplug the AE to restart it. and when the connection goes away on my powerbook, it's still green light on AE, everything seems fine on AE..
-
Hello. I was wondering...if I purchase a tv show or series can I burn them to a dvd and then watch them on a dvd player or only on a computer. Trying to see if it is worth it to buy a dvd set of a series or buy it from iTunes. Thanks.