Err with scheduling an abap program using open dataset
issue: have an abap program which uses "open dataset ... for input ..." to read the file.
- with manual ly running it, receive the following message "dataset_not_open".
- with scheduling it, receive same message
attempting to run an abap program as part of a process chain (ie scheduling a background job) in BI.
the abap performs the following fxns:
1) read a file on the server
2) removes delimiter, renames it
3) rewrites the file onto the server
initially used ws_upload for reading and ws_download for writing the file.
- both fxns worked fine if it is run manually --> but failed as a background (part of process chain)
- note 7925 states can't use ws_upload, download for background jobs
-so switched to "open dataset"
Any suggestions as to why the "open dataset" does not work is greatly appreciated it.
B.A.
Thank you for all responses. here is more info about the err message:
sy-subrc = 8
'invalid argument'
I looked up the invalid argument in note 99155 --> due to "The destination file is no longer available during repeated file access. " So, the following steps were taken:
- file was regenerated and
- file was placed on the server to be read
have the following code:
OPEN DATASET FILENAME FOR OUTPUT IN TEXT MODE encoding default
MESSAGE D_MSG_TEXT.
also have tried the following:
OPEN DATASET d1 for input in text mode encoding default.
open dataset d1 for output in text mode encoding NON-UNICODE..
open dataset d1 for output in text mode encoding utf-8.
none had worked. system --> status shows no unicode.
THanks again for any suggestions.
Similar Messages
-
Scheduling an ABAP Program Using Process Chains
hi experts,
I have an ABAP program which downloads ODS data to a flat file
i am trying to schedule this using process chains
can some body give me some hints on this
as when i try to schedule this using the process type ABAP program
the chain is activated and starts ok but it is completed without
downloading the file.
the process gets finished without any errors. kindly help me
thanksHi dear,
maybe you already read this doc...
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/3507aa90-0201-0010-6891-d7df8c4722f7
Maybe it can be useful to check your procedure...
Bye,
Roberto -
Running abap programs using the macros
In our DP implementation we have faced several issues in the extraction of the data from the demand planning to one of the legacy system. We have written the ABAP program and would be using the read planning book bapi. I wanted to run the ABAP program using the macro could some one please let me know what is the structure of the macro builder that is used to fire the ABAP program. this is being fired from the macros as some comparison is to be done to run the macro.
Hi,
Some more information on macro function
REPORT_SUBMIT()
REPORT_SUBMIT( 'program_name' ; <'job_name'> ; <'job_number'>; <'newmode'>) causes the specified program to be executed. Use the optional arguments, job name and job number, if you wish the program to run in the background. If you set the argument 'newmode', the results are displayed in a new window.
Hope this will helps you.
Regards,
Sunitha. -
Does we need to Create a file Before using Open dataSet
Hi Guys,
Can any body tell me whether we have to create a File before using Open dataset for writing files in Application Server.
Can anybody write a program for EKPO table to store it in application Server using OpendatasSet ?Is there any specific care we have to take for Executing pgm in Background?
I wrote the pgm for Foreground using GUI- Download.
PGM.
select * into table it_ekpo from ekpo .
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename ='c:\EKPO.xls'
filetype = 'ASC'
WRITE_FIELD_SEPARATOR = 'X'
TABLES
data_tab = it_ekpo
*fieldnames = l_heading
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3 .
Plzzzzzzzzz Make the changes for existing Pgm.any help is awarded with points.Its Urgent.
Thanks,
Gopi.Hi Guys,
Thanks for ur immediate response.I am sending the code just confirm me whether is correct r not?
DATA : wa_EKPO_file TYPE file_table-filename.
select * into table it_ekpo from ekpo .
OPEN DATASET wa_EKPO_file FOR OUTPUT "Write to appl. server
IN TEXT MODE
ENCODING DEFAULT. "Open dataset Return code
IF sy-subrc = 0.
LOOP at IT_EKPO into WA_EKPO.
TRANSFER wa_ekpo to wa_ekpo_file.
ENDLOOP.
ENDIF.
I want write the data into SPREAD Sheet .Can u guys tell me how to write into Spread Sheet using Open data Set.
Thanks,
Gopi. -
Fetch excel file from app. server using open dataset...
Hello Experts,
Our functional consultant is asking me if it possible to get an excel file from the
application server file using OPEN dataset and in background mode? If yes, Please tell me on how to do this.
Thank you guys and take care!Hi Viraylab,
to download this the procedure:
you can use the FM 'EXCEL_OLE_STANDARD_DAT ' for this purpose.
this FM 'EXCEL_OLE_STANDARD_DAT' can be used to start Excel with a new sheet and transfer data from an internal table to the sheet.
Here are some of the parameters:
file_name: Name and path of the Excel worksheet file e.g. ?C:TEMPZTEST?
data_tab: Name of the internal table that should be uploaded to Exvcel
fieldnames: Internal tabel with column headers
How to build the field names table:
data: begin of i_fieldnames occurs 20,
field(60), end of i_fieldnames.
i_fieldnames-field = ?This is column 1?. append i_fieldnames-field.
i_fieldnames-field = ?This is column 2?. append i_fieldnames-field.
to upload follow this:
OPEN DATASET dsn FOR INPUT IN BINARY MODE.
DO.
READ DATASET dsn INTO itab-field.
IF sy-subrc = 0.
APPEND itab.
ELSE.
EXIT.
ENDIF.
ENDDO.
[/code]Rob
or Try this function module.
FILE_READ_AND_CONVERT_SAP_DATA
pass 'XLS' to I_FILEFORMAT..
Dont forgot to Reward me points .....All the very best....
Regards,
Sreenivasa sarma K. -
How to open a pdf file using OPEN DATASET
Im trying to convert a pdf into binary format. So im trying to read the contents of the pdf into a XSTRING. Using the FM 'SCMS_XSTRING_TO_BINARY' i can convert the XSTRING to binary format.
How to open a pdf file using OPEN DATASET and transfer its contents in a XSTRING variable.
What i've tried is....
DATA: f_name type string value 'C:\rep_output_pdf.pdf',
x1 type xstring,
LT_DATA TYPE STANDARD TABLE OF X255.
OPEN DATASET f_name FOR input IN BINARY MODE.
READ DATASET f_name INTO x1.
CLOSE DATASET f_name.
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
BUFFER = x1
TABLES
BINARY_TAB = LT_DATA.
Im getting a short dump .
Short text: The file is not open.
Plz help me out.Hello Rajesh,
You are trying to do use OPEN DATASET with a local file. NOT POSSIBLE
You have to have the file in the app server to use OPEN DATASET.
BR,
Suhas -
Download file using open dataset
Hi all,
I download a .CSV file to sap server using open dataset. I have a column which stores a number with length upto 30 char. I get the output in this format '2.34234E+25' for '23423423423423400000000000' in that particular column.
Please send your suggestions to solve this issue.
Rajesh.Do you want to use the csv file in Excel or in another application.
If you display the CSV file created by open dataset using Notepad, you will probably see the 30 digit number. This is fine for many applications, but not Excel!
Excel cannot store a 30 digit number internally. Try entering a 30 digit number into an Excel cell and see what happens - it is converted to scientific format with only 14 decimal places.
If you need to see the number in Excel, you need to have it displayed as Text and not a number. There are a few options:
1. Put a character at the start of the field
2. Don't use CSV, but use OLE to start Excel and put the data in the cell with text format (complicated I know).
3. Save as a file with a .txt extension, open in Excel, and in the Text import wizard (step 3) specify that the column data format is Text
Michael -
Hi preventing parallel processing for a program treating open dataset
Hi
Has anyone come into a situation where he had to do an inbound interface
(i.e using open dataset by scanning all the file in AL11)
how do you treat program running in parallel in this situation.
what i mean is that if the same program is doing an open dataset and treating the same file in al11. Then inconsistencies may occur
is there a way to lock a program that is running that is triggering an error message "Hi,
I too faced a similar situation and this is what I implemented.
Whenever your programs starts processing a particular AL11 File, Create a New Flag File in the Same Directory.
Say if my file name is usr\bin\ABC.DAT, before OPEN DATASET command on this file, I would create a new file usr\bin\ABC.DAT.FLAG!!!.
After the processing ABC.DAT is done, I delete the Flag File.
In the mean time, If some other program, (or for that matter the same program) executes in a different session and tries to open the same file, we can check for the existence of the FLAG FILE.
So the code is as follows.
CHECK for the Existence of FLAG FILE.
If FLAG FILE Exists, STOP. " another session is processing it.
ELSE.
CREATE FLAG FILE.
OPEN DATASET, and rest others.
CLOSE DATASET.
ENDIF.
Hope this helps.
Thanks,
Surya -
Create an Excel File Using OPEN DATASET Command
Hey, everyone.
How can I create an Excel file by using OPEN DATASET command ??
The file is created but the columns are no seperated like thay should.
I need to seperate the internal table's fields with a comma - How can I do it ?
Here's my code:
OPEN DATASET filename1 FOR OUTPUT IN TEXT MODE.
IF SY-SUBRC = 0.
LOOP AT gt_vend_info into gwa_vend_info.
TRANSFER gwa_vend_info TO filename1.
IF SY-SUBRC <> 0.
EXIT.
ENDIF.
ENDLOOP.
ENDIF.
Thanks in advance.Hi Beki,
REPORT ZTESTAA.
TYPE-POOLS:TRUXS.
DATA: BEGIN OF ITAB OCCURS 0,
VBELN LIKE VBAP-VBELN,
POSNR LIKE VBAP-POSNR,
END OF ITAB.
DATA:
ITAB1 TYPE TRUXS_T_TEXT_DATA.
SELECT VBELN
POSNR
UP TO 10 ROWS
FROM VBAP
INTO TABLE ITAB.
CALL FUNCTION 'SAP_CONVERT_TO_CSV_FORMAT'
EXPORTING
I_FIELD_SEPERATOR = ';'
TABLES
I_TAB_SAP_DATA = ITAB
CHANGING
I_TAB_CONVERTED_DATA = ITAB1
EXCEPTIONS
CONVERSION_FAILED = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO WITH SY-MSGV1
SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
OPEN DATASET filename1 FOR OUTPUT IN TEXT MODE.
IF SY-SUBRC = 0.
LOOP AT gt_vend_info into gwa_vend_info.
TRANSFER gwa_vend_info TO filename1.
IF SY-SUBRC <> 0.
EXIT.
ENDIF.
ENDLOOP.
ENDIF.
the above code give CSV format file, all fields will be separated by ';'
Regards
vijay -
Problem in accessing application server file using open dataset
Hi All,
I am trying to access application server file using open dataset command, its working fine for normal path which imention. But when i am giving path of XI server file, its not working. How to access XI server file using open dataset. Please let me know.
Thanks in advance.
Regards,
VishalHi Vishal,
You need to verify if the location where you are trying to save the file is in the same server of SAP. In case that the location is in other server you need to map that directy into the same server of SAP.
You need to point always to a location in the same server of SAP, in order that the open dataset could work.
Regards,
Eric -
Transfering the data using OPEN DATASET
Hi all,
I am trying to get the data using OPEN DATASET to down load the data and using TRANSFER i am transfering.
i got strucked while i am downloading.
Please send coding how to use open dataset and transfer.
Thanks in advance
VenkatHi ,
you can try this code frangment.
open the file to be created on application server.
OPEN DATASET app_path FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc NE 0.
MESSAGE e001(zs) .
ELSE.
get header data
PERFORM get_data_header.
*transfer data to application server file.
TRANSFER v_header TO app_path.
get segment data
PERFORM get_data_segment.
*transfer data to application server file.
TRANSFER v_segment TO app_path.
*clear work areas and local variables.
PERFORM clear_local.
get trailer record.
PERFORM get_data_trailer.
*transfer data to application server file.
TRANSFER v_trailer TO app_path.
ENDIF.
CLOSE DATASET app_path.
regards,
Sumit. -
ABAP Program using Selection Screen in Process Chain
Hi,
I have included an ABAP Program in the Process Chain.
The ABAP Program takes a selection screen value from user before execution.
I have created a variant for both the ABAP Process (YPV_ABC) and a variant for the Selection Screen (YPV_XYZ).
The ABAP Program executes perfectly well in SE 38.
I get the following message when I execute the Process Chain.
"Status Change of Process ABAP YPV_ABC.
Save Status and Trigger Events if Appropriate "
When I click Yes, the ABAP Process becomes red.
These are error messages in the log
516 - Job started
550 - Step 001 started (program RSPROCESS, variant &0000000012961, user ID ALEREMOTE)
25 - Could not ascertain code page
546 - Job cancelled after system exception ERROR_MESSAGE
My questions are:
1) Is it possible to use an ABAP Program which has a user input screen in Process Chain?
2) Could you please help with the above error?1) Is it possible to use an ABAP Program which has a user input screen in Process Chain?
ABAP programs, with variants established for selection screens, are possible. We use them quite extensively for setting triggers to allow Process Chain to continue after an Interrupt Process has been hit.
2) Could you please help with the above error?
I'm not quite sure what could be causing this. When you tested this program in SE38, did you test it with the same variant for the selection screen and did you execute it in background? -
Problem in bacground scheduling of ABAP program
hi,
i am writing code for bw.Following is the code.same following program i am trying to execute through bacground process,but it is not ececuting,it is nt generating any files in background.can any body help on this topic,its urgent.
*& Report ZPFA_HIER_LOAD
*& This program is directly fetch the data from Comshare Unit_tree table
*& Will create a text file logical directory
*& Author :Shirisha Bandi.
*& Date :20.08.2006
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 = 'C:\aesorg.csv'.
elseif SOURCE-SETID = '80000006'.
mfilename = 'C:\Consolidation_Manager.csv'.
elseif SOURCE-SETID = '80000010'.
mfilename = 'C:\10org.csv'.
elseif SOURCE-SETID = '80000012'.
mfilename = 'C:\20org.csv'.
elseif SOURCE-SETID = '80000018'.
mfilename = 'C:\30org.csv'.
elseif SOURCE-SETID = '80000025'.
mfilename = 'C:\40org.csv'.
Endif.
mfilename = '/usr/test.dat'.
************************This was i tried***********************
open dataset mfilename for output 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.
clear matab1.
ENDLOOP.
loop at matab1 .
transfer matab1 to mfilename.
endloop.
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
good
i dont think there is any prob in your code , here with i am giving a link which ll give you better idea about the background scheduling, so that you can implement properly in your requirement.
http://help.sap.com/saphelp_nw04/helpdata/en/73/69ef3d55bb11d189680000e829fbbd/content.htm
thanks
mrutyun^ -
ABAP program using infotypes and FM
Hi all,
I have to work on abap -HR module, which is using infotypes, BDC, FM, internal tables.. As I am new in this and no more idea. So can you please share some document and some simple program, so that I can understand the HR modules with respective to ABAP and can work.
Your help will be appreciated.
Thankshi ram,
check these links...
http://www.sap-basis-abap.com/saphr.htm
http://www.sap-basis-abap.com/books.htm
http://www.sapbrain.com/TUTORIALS/FUNCTIONAL/HR_tutorial.html
http://www.sapdevelopment.co.uk/hr/hrhome.htm
http://planetsap.com/index.htm
http://www.atomhr.com/library_full.htm
http://www.sap-basis-abap.com/saphr.htm
http://help.sap.com/saphelp_erp2005/helpdata/en/60/d8d8c7576311d189270000e8322f96/frameset.htm
http://www.sapfriends.com/sapstuff.html
http://www.sap-basis-abap.com/saphr.htm
http://searchsap.techtarget.com/originalContent/0,289142,sid21_gci1030179,00.html?track=NL-142&ad=500911#Transactions
http://help.sap.com/saphelp_47x200/helpdata/en/4f/d5275f575e11d189270000e8322f96/content.htm
http://help.sap.com/saphelp_47x200/helpdata/en/4f/d5275f575e11d189270000e8322f96/content.htm
http://www.saptips.com/Previews/SAPtipsAugust-September2004TableOfContents.pdf
http://searchsap.techtarget.com/originalContent/0,289142,sid21_gci1030179,00.html?track=NL-142&ad=500911#Transactions
http://help.sap.com/saphelp_46c/helpdata/en/4f/d528be575e11d189270000e8322f96/frameset.htm.
http://www.sap-basis-abap.com/saphr.htm.
http://www.sapgenie.com/faq/hr.htm
http://www.sapgenie.com/workflow/scenarios.htm
http://www.sap-img.com/human/hr-faq.htm
http://www.sapdevelopment.co.uk/hr/hrhome.htm
http://www.sapgenie.com/mysap/mysap_hr.htm
Re: remunaration statement -
Urgent: Calling ABAP Program using JMS
Hi,
I have a scenario where legacy system pass some messages to ABAP Program and this program can handle one message at a time (written in that way).
Now the receiver communication channel is configured to access J2SE adapter. This J2SE adapter stores the message on R/3 system and triggers the ABAP program located in R/3 system.
Now when multiple messages are coming at a time in SAP-XI and processed successfully and handover to J2SE adapter. But J2SE adapter triggers the ABAP program for all messages. And here is the problem. ABAP program is not supporting multi - threading.
my idea is to use JMS adapter...can you guys suggest me how to achieve result and how to configure JMS or any other adapter to call ABAP Program so that only one message will pass to ABAP program at a time.
Regards,
Gourav KhareHi,
First find out where your ABAP program the data written.You need to write it into and spool then only you can see it.
Transaction SP01, you can use the FM 'GET_PRINT_PARAMETERS' in your abap program to write to spool.
Thanks,
Ravi
Maybe you are looking for
-
Delay due to selecting sysdate from dual
Our application accessing dummy table dual frequently for getting current date and time. But some times this could reduce our database performance. How could we overcome this problem. ASH report_ Top Events_ latch: library cache 29.87 "5015
-
Gifting a customized wish list
I am not sure how to make this work with the latest version of iTunes. I have created the list from my wishlist but there is no option to gift the list. Can someone tell me what I am missing?
-
Why can't iTunes disable a stolen iPod?
-
Problems opening Captivate 5 file
I have Captivate 4 and I am trying to open a Captivate 5 file. I keep getting the error Exception in module EDOMParseError converter.dll at 00100DDC. What does this mean and how do I open this file? Thanks
-
Im trying to pass into a function the schema name as a parameter but get error re table does not exist when trying to compile so basically i wanna do a select of the same column name and table but accross different schemas so i created function as be