2014 Apr 11 1:06 AM
hello folks i'm having a dump because i can't open the dataset, but
when i use this code
open dataset p_file for output in text mode encoding default message mes.
if sy ne 0.
message mess type E.
endif.
the error is triggered but if i use:
TRY.
OPEN DATASET p_file FOR OUTPUT
IN TEXT MODE ENCODING DEFAULT.
CATCH cx_dynamic_check INTO gr_err.
gs_msg = gr_err->get_text( ).
ENDTRY.
in debug i can see sy-subrc = 8 but the catch is not trigger, i have also try with cx_sy_file_authority but nothing, i'm in ECC6 unicode.
Regards
2014 Apr 11 11:28 AM
Hi Marco,
i guess, you are not trying to upload the other format file instead of '.txt' file.
The below link may help you. in case you are uploading .txt, then the program should work.
Best of luck.
Regards,
Krishnaes
2014 Apr 11 2:47 AM
Hi
Check for sy-subrc after OPEN DATASET statement and include exception code if SY-SUBRC # 0.
Thanks,
Sreeram
2014 Apr 11 2:57 AM
If you check out the SAP Help, the SY-SUBRC = 8 means the app server was unable to open the file.
In your dump does it mention the name of the class based exception that was raised?
http://help.sap.com/abapdocu_702/en/abapopen_dataset.htm
For test purposes, you can set it to CX_ROOT and see what comes up. Then change it to something more appropriate. CX_DYNAMIC_CHECK will only be raised for catchable exceptions caused during runtime.
Hope that helps...
2014 Apr 11 5:18 AM
Hi,
May I sugest you that you also use this addition:
DATA: mess TYPE string .
OPEN DATASET p_file FOR OUTPUT IN BINARY MODE MESSAGE mess .
Regards.
2014 Apr 11 5:23 AM
Hi Marco,
Before processing the program, make sure the upload file is closed. And check whether you have an authorizations for accessing the file from an application server.
Regards,
Krishnaes.
2014 Apr 11 6:58 AM
Hi Marco,
as Katan said, you try to catch the wrong exception class CX_DYNAMIC_CHECK.
Either you try to catch one or some of the classes in his link or you try to catch CX_ROOT for all available catchable exceptions.
Regards,
Klaus
2014 Apr 11 9:50 AM
hy all thanx for you reply, i've also try to catch all the possible exception like this:
data gr_err TYPE REF TO cx_root,
TRY.
OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING NON-UNICODE.
CATCH cx_sy_file_open INTO gr_err.
gs_msg = gr_err->get_text( ).
CATCH cx_sy_file_authority INTO gr_err.
gs_msg = gr_err->get_text( ).
CATCH cx_dynamic_check INTO gr_err.
gs_msg = gr_err->get_text( ).
ENDTRY.
still nothing catch and sy-subrc still 8.
2014 Apr 11 10:47 AM
Hi Marco,
check whether you can open the file from "AL11" t-code else, take an authorizations for accessing the file and try. Hope it may helps you.
Regards,
Krishnaes.
2014 Apr 11 11:03 AM
2014 Apr 11 11:28 AM
Hi Marco,
i guess, you are not trying to upload the other format file instead of '.txt' file.
The below link may help you. in case you are uploading .txt, then the program should work.
Best of luck.
Regards,
Krishnaes