‎2019 Jun 18 12:04 PM
Hi,
Can you please help with the following code. I am getting a dump when I execute.
Thanks,
Ven
REPORT Testreport.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE TEXT-001.PARAMETERS: p_infile LIKE rlgrap-filenameDEFAULT 'C:\Users\nveni\Desktop\name.txt' OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b1.
DATA: gd_file TYPE string.
TYPES: BEGIN OF t_record,
name1 LIKE pa0002-vorna,
name2 LIKE pa0002-name2,
age TYPE i,
END OF t_record.
DATA: it_record TYPE STANDARD TABLE OF t_record INITIAL SIZE 0,
wa_record TYPE t_record.
CALL FUNCTION 'GUI_UPLOAD'EXPORTING
filename = p_infile
filetype = 'ASC'
has_field_separator = ' '
TABLES
data_tab = it_recordEXCEPTIONS
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 = 16OTHERS = 17.IF sy-subrc NE 0.WRITE: 'Error ', sy-subrc, 'returned from GUI_UPLOAD FM'.SKIP.ENDIF.
END-OF-SELECTION.
LOOP AT it_record INTO wa_record.WRITE:/ sy-vline,(10) wa_record-name1, sy-vline,(10) wa_record-name2, sy-vline,(10) wa_record-age, sy-vline.ENDLOOP.i
‎2019 Jun 18 12:18 PM
Please use the code button to format your code. Also it looks like it's not your complete code. I see an 'i' after the last loop.
It might also be useful to mention what dump you're actually getting.
Having said this it is most likely a type mismatch.
Instead of p_infile for the Filename parameter, try moving it to a string variable and use that variable.
‎2019 Jun 18 12:32 PM
Please use the CODE button to format your code so that it's more user-friendly.
Please provide the full short dump.
‎2019 Jun 18 12:47 PM
change p_infile with gd_file below.
*** begin
gd_file = p_infile.
CALL FUNCTION 'GUI_UPLOAD'EXPORTING
filename = gd_file
*** end
‎2019 Jun 18 8:39 PM
Hi,
I modify your code kindly look at the attachment.
Regards,
Nawa.