03-25-2014 5:43 AM
Hello Everyone,
I have created a BDC for CG3Y everything is working fine after creating a log when sy-subrc eq 0. when user hits SAVE I have given a message stating 'LOG HAS BEEN GENERATED' but when the pop for overwrite appears and I hit NO, it should give a different message for that i am not able to capture SY-UCOMM.
please help.
03-27-2014 2:00 PM
Actually the issue was just had to get the file(Error log) from Application Server to Presentation, Here is the code for it.
data: i_fl_openerror type boolean,
i_os_message(100) type C,
i_flg_continue type boolean.
CALL FUNCTION 'C13Z_FILE_DOWNLOAD_ASCII'
EXPORTING
i_file_front_end = 'C:\ERROR_LOG.XLS'
i_file_appl = '/USR/SAP/TMP/FILE3.XLS'
* I_FILE_OVERWRITE = ESP1_FALSE
IMPORTING
E_FLG_OPEN_ERROR = i_fl_openerror
E_OS_MESSAGE = i_os_message
EXCEPTIONS
FE_FILE_OPEN_ERROR = 1
FE_FILE_EXISTS = 2
FE_FILE_WRITE_ERROR = 3
AP_NO_AUTHORITY = 4
AP_FILE_OPEN_ERROR = 5
AP_FILE_EMPTY = 6
OTHERS = 7
.
IF sy-subrc <> 0.
case sy-subrc.
when 2.
CALL FUNCTION 'C14A_POPUP_ASK_FILE_OVERWRITE'
IMPORTING
E_FLG_CONTINUE = i_flg_continue
.
if i_flg_continue eq true.
CALL FUNCTION 'C13Z_FILE_DOWNLOAD_ASCII'
EXPORTING
i_file_front_end = 'C:\ERROR_LOG.XLS'
i_file_appl = '/USR/SAP/TMP/FILE3.XLS'
I_FILE_OVERWRITE = ESP1_TRUE
IMPORTING
E_FLG_OPEN_ERROR = i_fl_openerror
E_OS_MESSAGE = i_os_message
EXCEPTIONS
FE_FILE_OPEN_ERROR = 1
FE_FILE_EXISTS = 2
FE_FILE_WRITE_ERROR = 3
AP_NO_AUTHORITY = 4
AP_FILE_OPEN_ERROR = 5
AP_FILE_EMPTY = 6
OTHERS = 7
.
IF sy-subrc <> 0.
write : / 'CANNOT DOWNLOAD' , '/USR/SAP/TMP/FILE3.XLS' .
else.
write : / 'LOG HAS BEEN GENERATED C:\ERROR_LOG.XLS'.
endif.
else.
write : / 'LOG NOT GENERATED'.
endif.
when others .
write : / 'CANNOT DOWNLOAD FILE1', '/USR/SAP/TMP/FILE3.XLS'.
endcase.
03-25-2014 6:10 AM
Hi,
you can try like this,
declare,
CONSTANTS : gc_save TYPE syucomm VALUE '&DATA_SAVE'.
then,
CASE sy-ucomm.
WHEN gc_save.
message '....'
ENDCASE.
Thanks.
03-25-2014 6:14 AM
hi Mayur
Shall we call 'POPUP_TO_COMFIRM' function before call transaction 'CG3Y', then if the user click the NO, give a message you wanted. Once the abap process inter in BDC, take user clicked the OK always.
Regards,
Archer
03-26-2014 10:27 AM
03-26-2014 11:28 AM
Hi,
So close this thread,by mark the correct answer & also share ,how you solved the problem.
Thanks
Gourav.
03-27-2014 2:00 PM
Actually the issue was just had to get the file(Error log) from Application Server to Presentation, Here is the code for it.
data: i_fl_openerror type boolean,
i_os_message(100) type C,
i_flg_continue type boolean.
CALL FUNCTION 'C13Z_FILE_DOWNLOAD_ASCII'
EXPORTING
i_file_front_end = 'C:\ERROR_LOG.XLS'
i_file_appl = '/USR/SAP/TMP/FILE3.XLS'
* I_FILE_OVERWRITE = ESP1_FALSE
IMPORTING
E_FLG_OPEN_ERROR = i_fl_openerror
E_OS_MESSAGE = i_os_message
EXCEPTIONS
FE_FILE_OPEN_ERROR = 1
FE_FILE_EXISTS = 2
FE_FILE_WRITE_ERROR = 3
AP_NO_AUTHORITY = 4
AP_FILE_OPEN_ERROR = 5
AP_FILE_EMPTY = 6
OTHERS = 7
.
IF sy-subrc <> 0.
case sy-subrc.
when 2.
CALL FUNCTION 'C14A_POPUP_ASK_FILE_OVERWRITE'
IMPORTING
E_FLG_CONTINUE = i_flg_continue
.
if i_flg_continue eq true.
CALL FUNCTION 'C13Z_FILE_DOWNLOAD_ASCII'
EXPORTING
i_file_front_end = 'C:\ERROR_LOG.XLS'
i_file_appl = '/USR/SAP/TMP/FILE3.XLS'
I_FILE_OVERWRITE = ESP1_TRUE
IMPORTING
E_FLG_OPEN_ERROR = i_fl_openerror
E_OS_MESSAGE = i_os_message
EXCEPTIONS
FE_FILE_OPEN_ERROR = 1
FE_FILE_EXISTS = 2
FE_FILE_WRITE_ERROR = 3
AP_NO_AUTHORITY = 4
AP_FILE_OPEN_ERROR = 5
AP_FILE_EMPTY = 6
OTHERS = 7
.
IF sy-subrc <> 0.
write : / 'CANNOT DOWNLOAD' , '/USR/SAP/TMP/FILE3.XLS' .
else.
write : / 'LOG HAS BEEN GENERATED C:\ERROR_LOG.XLS'.
endif.
else.
write : / 'LOG NOT GENERATED'.
endif.
when others .
write : / 'CANNOT DOWNLOAD FILE1', '/USR/SAP/TMP/FILE3.XLS'.
endcase.