03-09-2009 9:52 PM
In my upload program I have a selection screen which has the option to to store the failed entries or the updated entries on a error file for log so that in case there is any error it can be viewed later and rectified. I have hard coded that field in selection screen witha file name where its going to store the eroor log directly. everyday on a daily basis . As the eror file will be run with the upload csv file on daily basis and the eroors will be appended to the eroor file on a daily basis , I would liek to have adate on the error file showing or separting the daily error log , Like if it was run today it showuld show the error log with todays date and when it will be run tomm , it shoule start with tommorrows date and followed by the error log.
Thanks
Error log - date:--03/09/2009
jklhdladk
agsdjkahdj
asdgjka
Error log- date- 03/10/2009
hksgdhkfk
dbkhsbfjkds
ect
Thanks
03-09-2009 10:03 PM
Hi,
do you mean it should be appended in the file or it should create a new file everytime with the date....
if you mean that it should be continued in the file by appending then its pretty simple.... first upload the file in an internal table...
keep the structure of the table as a string something like below.
data :
begin of wa,
line type string,
end of wa.
data itab type table of wa.
later on once you have uploaded in itab , append records in itab with new date and with the error logs,
and then use download with itab...
this should work....
**************************************************************************************
if you mean that it should create a new file everytime,
then you need to just concatenate the filepath with todays_date and '.txt.
once you cancatenate then in the download function modle pass the filename with the concatenated variable name
Regards,
Siddarth
03-09-2009 10:03 PM
Hi,
do you mean it should be appended in the file or it should create a new file everytime with the date....
if you mean that it should be continued in the file by appending then its pretty simple.... first upload the file in an internal table...
keep the structure of the table as a string something like below.
data :
begin of wa,
line type string,
end of wa.
data itab type table of wa.
later on once you have uploaded in itab , append records in itab with new date and with the error logs,
and then use download with itab...
this should work....
**************************************************************************************
if you mean that it should create a new file everytime,
then you need to just concatenate the filepath with todays_date and '.txt.
once you cancatenate then in the download function modle pass the filename with the concatenated variable name
Regards,
Siddarth
03-09-2009 10:13 PM
Like I have the Parameters set ias:
p_err like rlgrap-filename modif id g1
DEFAULT 'P:\SAP\ERP\ZWELL\wmigdc\uwi_error.txt', " error file as SAP table format
so how do i put in the todays date here so that a new file is created everyday after teh program is run?
Thanks
03-09-2009 10:20 PM
Hi,
use the following code to achieve the same....
p_err like rlgrap-filename modif id g1
DEFAULT 'P:\SAP\ERP\ZWELL\wmigdc\uwi_error.txt', " error file as SAP table format
data : filename type rlgrap-filename,
file_len type i.
file_len = strlen( p_err ) - 4. " -4 is to extract the last 4 letters that is .txt
concatenate p_err+0(file_len) sy-datump_err+file_len into filename.
" And then use the variable filename in the gui_download or any other FM which you are using to download the itab to file
Regards,
Siddarth
03-09-2009 10:32 PM
Is theer no way we can just add teh todays date onto the file name that we are putting in as default.
Parameter: p_err like rlgrap-filename modif id g1
DEFAULT 'P:\SAP\ERP\ZWELL\wmigdc\uwi_error.txt', " error file as SAP table format
p_err2 LIKE rlgrap-filename modif id g2
DEFAULT '/oracle/DEV/sapreorg/zwell/uwi_error.txt', " error file as input format
Right here so that it just takes that against it and prints the date along with the error generated?
Thanks
03-09-2009 10:36 PM
Hi,
No its not possible, because in default you are hardcoding values due to which we cannot give the dynamic values out there, but we have to write a small piece of code to concatenate date into the filename,
and also if you dont want to take a new variable for it,
you can just use this line for not to create a new variable
concatenate p_err+0(file_len) sy-datump_err+file_len into p_err
Regards,
Siddarth
03-10-2009 1:32 AM
So how do I enter that herer in my parameter selection, it gives me an error when I put thta.
parameters: p_bukrs type t001-bukrs default '1000', " company code
p_zss type zsds_uwi-zss, " Survey system
p_pathps like rlgrap-filename modif id g1 , " Presentation server path
p_pathas like rlgrap-filename modif id g2 , " Application server path
p_pbkas LIKE rlgrap-filename MODIF ID g2 , " Backup path
p_err like rlgrap-filename modif id g1
DEFAULT 'P:\SAP\ERP\ZWELL\wmigdc\uwi_error.txt', " error file as SAP table format
p_err2 LIKE rlgrap-filename modif id g2
DEFAULT '/oracle/DEV/sapreorg/zwell/uwi_error.txt', " error file as input format
p_ps like ssfparms-binccerts radiobutton group ssff " Presentation server
default 'X' user-command shift,
03-10-2009 2:07 AM
Dont change the selection screen....
declare couple of variable of type string...
At selection-screen.
split p_err into lv_path lv_ext.
concatenate sy-datum+4(2) sy-datum+6(2) sy-datum+2(2) seperated by '_' into lv_date.
concatenate lv_path lv_date into p_err.
concatenate p_err lv_ext into p_err.
03-10-2009 2:41 AM
Hi,
You should not put that in the parameters declaration.
you can do that in initialization so as soon as you press F8 you will see the filename on the screen...
After the declaration is completed paste the code given below...
data w_len type i.
INITIALIZATION.
w_len = strlen( p_err ) - 4.
concatenate p_err+0(w_len) sy-datum p_err+w_len into p_err.
concatenate p_err2+0(w_len) sy-datum p_err2+w_len into p_err2.
This will work and the correct values will be displayed when you execute you will get the values in the parameters.
Regards,
Siddarth
03-10-2009 3:26 PM
Thanks for the help it really solved the problem. Theer is still a small aquetsion pertaining to this which if can be explained would be highly appreciated. I am running this program in the background with 4 different variants , so when it runs and after the run it will generate this error log, out of thgis 4 variants three are for one type and the fourth is of a different type , so when the error file will be written with this will it overwrite the file name , if I would like have the file name chnage as per the variant , like add DLS1 for the first file and DLS2 for teh second file and DLS3 for the thirst and NTS 1 for the fourth automatically in teh selection screen , is that possible or I will have to manually put in while setting up the variants for the job?
Thanks
03-10-2009 4:44 PM
Hi,
As far as I have understood, if you want the constant name like DLS1, DLS2, DLS3 and NTS1 in the selection screen depending on the variant selected, then probably you can hardcode them in the variant itself which will save the time....
but if you want to change them dynamically,
then too you hardcode the file name but in the AT Selection-screen/ AT Selection-screen output event... you can change the name with the appropriate date you want...
hope I understood the problem clearly...
Regards,
Siddarth
03-10-2009 6:51 PM
Thanks , it will be better as per your first suggestion to hardcode in varriant . I have done that and it seem to work fine.
Thanks