‎2007 Oct 30 8:08 AM
hi all,
i have developed a bdc program using call tr method , it is processed in N mode ( background), it is running well when i m executing immediately but when i have scheduled it at a specific time it is showing error
is it possible to schedule a bdc program when uploading file from presentation server
‎2007 Oct 30 10:26 AM
Hi pankaj,
While you are scheduling a job... the process goes in background..
it is not possible to use GUI_UPLOAD while uploading from background.
so while scheduling a job.. it is mandatory that you need to upload from presentation server.
if you want to upload from background you need to use
the open dataset command..to open the file to be uploaded ..
‎2007 Oct 30 8:49 AM
Hi Pankaj,
Its not possible to Upload a file from Presentation Server while the Program is Scheduled.
If you are Scheduling a Program, then you have get data from Application Server & Presentation server will throw error.
Reward Point if its helpful.
Regards,
Anbalagan
‎2007 Oct 30 10:26 AM
Hi pankaj,
While you are scheduling a job... the process goes in background..
it is not possible to use GUI_UPLOAD while uploading from background.
so while scheduling a job.. it is mandatory that you need to upload from presentation server.
if you want to upload from background you need to use
the open dataset command..to open the file to be uploaded ..
‎2007 Oct 30 10:32 AM
hi ,
also the syntax for that is
the syntax for OPEN DATASET is something like this.
OPEN DATASET w_file_name IN LEGACY BINARY MODE
BIG ENDIAN
FOR OUTPUT/INPUT.
But this will create a file on the application server only. It wil not be able to access the files from the local file system.
It will work in background but with the above mentioned limitation.
a sample program is
For checking it file exists:
&----
*& Form sub_validate_appl_file
&----
-->P_FILE text
----
This routine is used to check the file existence on application
server. First check is whether entered file is directory or not
and second check is for file
----
FORM sub_validate_appl_file USING p_file TYPE string.
DATA : tl_file_tbl TYPE STANDARD TABLE OF salfldir, "Files table
wl_msg TYPE string. "Message
CALL FUNCTION 'RZL_READ_DIR'
EXPORTING
name = p_file
TABLES
file_tbl = tl_file_tbl
EXCEPTIONS
argument_error = 1
not_found = 2
send_error = 3
system_failure = 4
OTHERS = 5.
IF sy-subrc = 0.
DESCRIBE TABLE tl_file_tbl LINES sy-tfill.
IF sy-tfill > 0.
*This is & directory and not a file
MESSAGE e016(zcaxx) WITH p_file.
ENDIF.
ENDIF.
CATCH SYSTEM-EXCEPTIONS convt_codepage_init = 2
convt_codepage = 3
open_dataset_no_authority = 4
dataset_too_many_files = 5
OTHERS = 6.
OPEN DATASET p_file FOR INPUT IN BINARY MODE MESSAGE wl_msg.
ENDCATCH.
IF sy-subrc <> 0.
*System message
MESSAGE e000(zcaxx) WITH wl_msg p_file.
ENDIF.
CLOSE DATASET p_file.
REFRESH : tl_file_tbl.
FREE : tl_file_tbl.
ENDFORM.
For Fetching data:
FORM sub_get_data_from_unix USING pw_file TYPE string.
*--Work areas
DATA : wal_data TYPE type_all_data, "For preparing structured data
wl_seperator TYPE char1, "For specifying the file seperator
wal_data_fix TYPE type_data, "For processing fixed length file
wl_string TYPE string. "For processing appl. server file
*--Field symbols
FIELD-SYMBOLS : <l_pt_table> TYPE LINE OF tt_data_tab.
"For processing fixed length file
*--Initializing variables and work areas.
CLEAR : wal_data,
wal_data_fix,
wl_string,
wl_seperator,
w_mesg.
*--Reading file from application server
*--Open the server file
CATCH SYSTEM-EXCEPTIONS convt_codepage_init = 1
convt_codepage = 2
open_dataset_no_authority = 3
open_pipe_no_authority = 4
dataset_too_many_files = 5
OTHERS = 6.
OPEN DATASET pw_file FOR INPUT IN TEXT MODE ENCODING DEFAULT
MESSAGE w_mesg.
*--If error on opening file give error message
IF sy-subrc NE 0.
*-- Error message
MESSAGE i019 WITH w_mesg.
LEAVE LIST-PROCESSING.
ENDIF.
ENDCATCH.
*--Read the data from file
DO.
READ DATASET pw_file INTO wl_string.
IF sy-subrc NE 0.
EXIT. "end of file. exit loop
ELSE.
APPEND wl_string TO t_data_table.
CLEAR wl_string.
ENDIF.
ENDDO.
*--Close the server file
CLOSE DATASET pw_file.
i hope this will help u.
<b>please reward if usefull..</b>
‎2007 Oct 30 10:50 AM
hi ,
sorry i told u need to use presentation server for uploading from background..
it is mandatory to use application server if u r going to upload from background
‎2007 Oct 30 11:19 AM
hi gokul,
thanks for ur answer, so gui_upload cannot be used in background.
i have rewarded u, gokul can u tell me one more thing a session created by batch input program can be scheduled to a particular date and time manually by program rsbdcsub. now programitically i have used fm job_open , submit statement and job_close, can u tell me in which parameter i should mention time.
regards
pankaj