Skip to Content
-3
Jul 25, 2018 at 03:35 PM

File reading into internal table without defined structure

166 Views

Dear Experts

I am trying to achieve dynamic reading of file from presentation server. The file structure will be know only at run time. i tried to do it but i am getting # between every column. Please find the code below.


SPAN {
font-family: "Courier New";
font-size: 10pt;
color: #000000;
background: #FFFFFF;
}
.L0S31 {
font-style: italic;
color: #808080;
}
.L0S33 {
color: #4DA619;
}
.L0S52 {
color: #0000FF;
}
.L0S55 {
color: #800080;
}
.L0S70 {
color: #808080;
}

PARAMETERS: p_tabnam TYPE tabname,

            p_selfl1 TYPE edpline,

            p_value  TYPE edpline,

            p_where1 TYPE edpline.



PARAMETERS: p_file TYPE ibipparms-path.

DATA: file TYPE string.



DATA: it_tab TYPE TABLE OF zfile,

      wa_tab TYPE zfile.





DATA: lt_where    TYPE TABLE OF edpline,

      lt_sel_list TYPE TABLE OF edpline,

      l_wa_name   TYPE string,

      ls_where    TYPE edpline,

      l_having    TYPE string,

      dref        TYPE REF TO data,

      itab_type   TYPE REF TO cl_abap_tabledescr,

      struct_type TYPE REF TO cl_abap_structdescr,

      elem_type   TYPE REF TO cl_abap_elemdescr,

      comp_tab    TYPE cl_abap_structdescr=>component_table,

      comp_fld    TYPE cl_abap_structdescr=>component.



TYPES: f_count TYPE i.



FIELD-SYMBOLS : <lt_outtab> TYPE ANY TABLE,

                "*                <ls_outtab> TYPE ANY,

                <l_fld>     TYPE any.







AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

  CALL FUNCTION 'F4_FILENAME'

    EXPORTING

      field_name = 'P_FILE'

    IMPORTING

      file_name  = p_file.

  file = p_file.




SPAN {
font-family: "Courier New";
font-size: 10pt;
color: #000000;
background: #FFFFFF;
}
.L0S31 {
font-style: italic;
color: #808080;
}
.L0S33 {
color: #4DA619;
}
.L0S52 {
color: #0000FF;
}
.L0S55 {
color: #800080;
}

 CALL FUNCTION 'GUI_UPLOAD'

    EXPORTING

      filename            = file

      filetype            = 'ASC'

      has_field_separator = ' '

*     HEADER_LENGTH       = 0

*     READ_BY_LINE        = 'X'

*     DAT_MODE            = ' '

*     CODEPAGE            = ' '

*     IGNORE_CERR         = ABAP_TRUE

*     REPLACEMENT         = '#'

*     CHECK_BOM           = ' '

*     VIRUS_SCAN_PROFILE  =

*     NO_AUTH_CHECK       = ' '

*   IMPORTING

*     FILELENGTH          =

*     HEADER              =

    TABLES

      data_tab            = it_tab.

In the IT_TAB i am getting the fields name with #. Even i tried to replace the # with blank for all occurrence but its not working.

How to remove this. Since the structure is declared as char 999. I am getting like this. Please let me know how to achieve this.

Thanks and Regards

Vijay

Attachments

abap-debugging.png (15.1 kB)