2007 Apr 25 12:53 PM
Hi all,
I have problem to maintain the error log files in my program.
Actually my requirement is to craete sales orders getting required data from the application server.
1st actually i have to check that coming data(customer no,material number) is exixting in the master data base tables.
if it is there means one message i have to keep in one file.and even that data is not existing in the master data base tables means error messages i have to store in one file.
i dont have idea how can i maintain the error log files in my program?
and how can i sent that file to my user directly when i am executing program.
every message has to sent to user mail id.
if any one knows solution pls help me.
Regards,
lokesh
Hi all,
I have problem to maintain the error log files in my program.
Actually my requirement is to craete sales orders getting required data from the application server.
1st actually i have to check that coming data(customer no,material number) is exixting in the master data base tables.
if it is there means one message i have to keep in one file.and even that data is not existing in the master data base tables means error messages i have to store in one file.
i dont have idea how can i maintain the error log files in my program?
and how can i sent that file to my user directly when i am executing program.
every message has to sent to user mail id.
if any one knows solution pls help me.
Regards,
lokesh
2007 Apr 25 12:57 PM
Hi,
Coz u are using Application server..
write a select to check if the record is existing in the database..
If sy-subrc <> 0.
Open dataset for 'FILE1' Appending in text mode encoding default.
Transfer wa to 'FILE1'.
Close dataset 'FILE1'.
Else.
Open dataset for 'FILE2' Appending in text mode encoding default.
Transfer wa to 'FILE2'.
Close dataset 'FILE2'.
EndIf.
hope that helps.
santhosh
2007 Apr 25 1:03 PM
Thanks for reply Santhosh.
Actually i dont have idea how to check the my incoming text file data with database table data.
if u have example code.pls can u send it to me.
Regards,
lokesh.
2007 Apr 25 1:10 PM
Hi,
check material existance by using the bapi
BAPI_MATERIAL_EXISTENCECHECK,]
to check if customer exists use FM CUSTOMER_EXISTS
santhosh
2007 Apr 25 1:11 PM
2007 Apr 26 6:50 AM
THANKS FOR REPLY.
YES I AM GETTING total data from the text file.
now i have to check it with the data base table data.
is it possible with out using fm also?
pls guide me.
Regards,
lokesh.
2007 Apr 26 7:23 AM
you can download the file to an internal table with either one of the following ways:
1).
w_filename TYPE string.
w_filename = p_file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = w_filename
TABLES
data_tab = wt_file
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.
or
2).
w_name(60) type c.
CALL FUNCTION 'FILE_GET_NAME'
EXPORTING
logical_filename = w_name
parameter_1 = w_numlot1
IMPORTING
file_name = w_filenme2
EXCEPTIONS
file_not_found = 1
OTHERS = 2.
OPEN DATASET w_filenme2 FOR input IN TEXT MODE ENCODING DEFAULT.
IF SY-SUBRC NE 0.
append error message<----
ELSE.
do.
READ DATASET w_filenme2 INTO ws_file.
IF sy-SUBRC = 0.
APPEND ws_file TO wt_file.
else.
exit.
ENDIF.
enddo.
ENDIF.
CLOSE DATASET .
then you loop at that table
read from master table with key kunnr and matnr
if su-subrc ne 0 --> append error table
else do processing
Hope this helps you!
Regards ,
Sooness
2007 Apr 25 1:15 PM
put the extracted data in an internal table.
loop at that table
read master data with key eequal to customer no and matnr
if record exists
-->append to file
else
-->append to internal table for errors
after processing put tha data you got in a text file and send to client
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |