2022 Jun 28 7:14 PM
Hi everyone
in this code i want to generate file when my program is runing in background, i don't have any error but the file is not generated when i double-click in path from TVARVC.
plz help to understand it and if u want more details about problem i remain available.
Thnx a lot.
IF p_sfl = 'X'.<br> DATA lv_low TYPE rvari_val_255.<br><br> SELECT SINGLE low<br> FROM tvarvc<br> INTO lv_low<br> WHERE name = 'ZTAI'.<br><br> OPEN DATASET lv_low FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.<br> CHECK sy-subrc EQ 0.<br> LOOP AT gt_flight INTO gs_flight.<br> TRANSFER gs_flight TO lv_low.<br> ENDLOOP.<br> CLOSE DATASET lv_low.<br><br> ELSEIF p_spfli = 'X'.<br> OPEN DATASET lv_low FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.<br> CHECK sy-subrc EQ 0.<br> LOOP AT it_spfli INTO wa_spfli.<br> TRANSFER wa_spfli TO lv_low.<br> ENDLOOP.<br> CLOSE DATASET lv_low.<br> ENDIF.<br>
Hi everyone
in this code i want to generate file when my program is runing in background, i don't have any error but the file is not generated when i double-click in path from TVARVC.
plz help to understand it and if u want more details about problem i remain available.
Thnx a lot.
IF p_sfl = 'X'.<br> DATA lv_low TYPE rvari_val_255.<br><br> SELECT SINGLE low<br> FROM tvarvc<br> INTO lv_low<br> WHERE name = 'ZTAI'.<br><br> OPEN DATASET lv_low FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.<br> CHECK sy-subrc EQ 0.<br> LOOP AT gt_flight INTO gs_flight.<br> TRANSFER gs_flight TO lv_low.<br> ENDLOOP.<br> CLOSE DATASET lv_low.<br><br> ELSEIF p_spfli = 'X'.<br> OPEN DATASET lv_low FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.<br> CHECK sy-subrc EQ 0.<br> LOOP AT it_spfli INTO wa_spfli.<br> TRANSFER wa_spfli TO lv_low.<br> ENDLOOP.<br> CLOSE DATASET lv_low.<br> ENDIF.<br>
2022 Jun 28 7:25 PM
Debug it and handle better the exceptions so that you get a log.
2022 Jun 28 10:28 PM
Hi,
You need to check the file in Application server. Run Tcode AL11 and check if the files present in the file path or not.
Provide some error message if open dataset fails. There could be authorization issue to access the file.
Thanks,
Aditya.
2022 Jun 29 2:02 PM
2022 Jun 29 5:49 PM
Put a error message after sy-subrc check. if open dataset fails, then you may have authrisation issue. in that case you need to check with your basis or security team.
2022 Jun 29 6:01 PM
hi
the problem is the authorization, so i change path and the file is created, now the problem is that my file is empty ^^ if u can give me some help plz !
thanks for all your answers.
2022 Jun 29 6:10 PM
chkoupi
By debugging your program, even if it runs in background, you will solve the issue on your own.2022 Jul 01 10:52 AM
Did you try to add a call of AUTHORITY_CHECK_DATASET before OPEN or handling return code / exception from the OPEN DATASET and TRANSFER statements (and other part of your code)
OPEN DATASET lv_low FOR OUTPUT IN TEXT MODE ENCODING DEFAULT MESSAGE mess.
IF sy-subrc = 8.
MESSAGE mess TYPE 'E'.
ELSE.
LOOP AT gt_flight INTO gs_flight.
TRY.
TRANSFER gs_flight TO lv_low.
CATCH cx_dynamic_check INTO lo_cx_ref.
mess = lo_cx_ref->if_message~get_text( ).
MESSAGE mess TYPE 'E'.
ENDTRY
ENDLOOP.
IF sy-subrc NE 0.
MESSAGE 'No data read, D''oh!, did I forget to check?' TYPE 'E'.
ENDIF.
CLOSE DATASET lv_low.
ENDIF.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |