Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

unable to capture sy-ucomm in BDC

Mayursatardekar
Explorer
0 Kudos

     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.

1 ACCEPTED SOLUTION

Mayursatardekar
Explorer
0 Kudos

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.

5 REPLIES 5

gouravkumar64
Active Contributor
0 Kudos

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.

Former Member
0 Kudos

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

0 Kudos

issue resolved didnt use BDC but with help of Function module.

0 Kudos

Hi,

So close this thread,by mark the correct answer & also share ,how you solved the problem.

Thanks

Gourav.

Mayursatardekar
Explorer
0 Kudos

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.