Skip to Content
author's profile photo Former Member
Former Member

Regarding Upload of data into SAP from Application server using DATA SETS

Hi all,

I have a problem when uploading data that is application server [.txt file] into SAP using OPEN DATA SET,READ DATA SET & CLOSE DATA SET it is now going to dump. The file is actually splits the fields by using Tab Delimiter.

During uploading some junk values are coming with '#' so it going to dump and giving follow type of error.

Runtime Errors CONVT_NO_NUMBER

Exception CX_SY_CONVERSION_NO_NUMBER

Unable to interpret "#0#0#0#0#0#0#0#" as a number.

Can any one solve the above issue as i need it urgently.

Thanks in advance.

Thanks & Regards,

Rayeezuddin.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

6 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jul 29, 2005 at 09:29 PM

    Dear Rayeezuddin,

    Dont try take it for grant that tabs and spaces are same and it is constant. Tabs may vary from PC to PC.

    You have to use a special Tab Character to delimit your file.

    If you are using 4.6 version you can do

    data : tab_char type x value '09'.

    .....

    read the line in a character string.

    split <var> at tab_char into var1 var2 var3 var4.

    If you are using 4.7 version, you can do

    CLASS cl_abap_char_utilities DEFINITION LOAD.

    ....

    read the line in a character string.

    split <var> at cl_abap_char_utilities=>horizontal_tab into var1 var2 var3 var4.

    I hope this will help .

    Please let me know in case of any problem

    Regards

    Mitesh

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Mitesh,

      The resolution you have given has worked for me.

      We have used following resolution.

      If you are using 4.7 version, you can do

      CLASS cl_abap_char_utilities DEFINITION LOAD.

      ....

      read the line in a character string.

      split <var> at cl_abap_char_utilities=>horizontal_tab into var1 var2 var3 var4.

      once again Thanks for that reply.

      Thanks,

      Rayeezuddin.

  • Posted on Jul 29, 2005 at 06:51 PM

    How are you reading it in, in binary mode? Post your code and a sample file.

    Regards,

    Rich Heilman

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Rich Heilman

      Hi Hielman,

      Thnaks for that reply and for effort you are putting to solve my issue.

      I had done the same thing what u have posted prior to your reply but still i am getting dump.

      FORM f_get_legacy_data .

      DATA: l_tab type xstring,

      l_tab1(1) type c,

      s type x.

      move '23' to l_tab.

      move l_tab to l_tab1.

      • OPEN DATASET v_pfile FOR INPUT IN TEXT MODE ENCODING DEFAULT.

      OPEN DATASET v_pfile FOR INPUT IN TEXT MODE ENCODING DEFAULT.

      • IF sy-subrc <> 0.

      • MESSAGE text-207 TYPE c_e.

      • ELSE.

      DO.

      CLEAR wa_input1.

      • READ DATASET v_pfile INTO wa_input1.

      READ DATASET v_pfile INTO wa_read.

      IF sy-subrc EQ 0.

      move wa_read to i_txt-txt.

      append i_txt.

      ELSE.

      EXIT.

      ENDIF.

      ENDDO.

      s = '09'.

      loop at i_txt.

      • move i_txt-txt+10(1) to l_tab1.

      • move '#' to l_tab1.

      • split i_txt-txt at s into wa_input1-vbeln wa_input1-posnr

      split i_txt-txt at '#' into wa_input1-vbeln wa_input1-posnr

      wa_input1-per0bal wa_input1-per1val

      wa_input1-per2val wa_input1-per3val

      wa_input1-per4val wa_input1-per5val

      wa_input1-per6val wa_input1-per7val

      wa_input1-per8val wa_input1-per9val

      wa_input1-per10val wa_input1-per11val

      wa_input1-per12val.

      APPEND wa_input1 TO i_input1.

      CLEAR wa_input1.

      endloop.

      • ENDIF.

      CLOSE DATASET v_pfile.

      IF i_input1[] IS INITIAL.

      • If there is no data in the legacy file or if the structure of the

      • legacy data does not match with that of internal table error message

      • need to be displayed.

      MESSAGE text-211 TYPE c_e.

      *&--


      begin of change--


      ELSE.

      CLEAR: wa_input, wa_input1.

      LOOP AT i_input1 INTO wa_input1.

      • MOVE wa_input1 TO wa_input.

      MOVE: wa_input1-vbeln TO wa_input-vbeln,

      wa_input1-posnr TO wa_input-posnr,

      wa_input1-per0bal TO wa_input-per0bal,

      wa_input1-per1val TO wa_input-per1val,

      wa_input1-per2val TO wa_input-per2val,

      wa_input1-per3val TO wa_input-per3val,

      wa_input1-per4val TO wa_input-per4val,

      wa_input1-per5val TO wa_input-per5val,

      wa_input1-per6val TO wa_input-per6val,

      wa_input1-per7val TO wa_input-per7val,

      wa_input1-per8val TO wa_input-per8val,

      wa_input1-per9val TO wa_input-per9val,

      wa_input1-per10val TO wa_input-per10val,

      wa_input1-per11val TO wa_input-per11val,

      wa_input1-per12val TO wa_input-per12val.

      APPEND wa_input TO i_input.

      CLEAR: wa_input, wa_input1.

      ENDLOOP.

      ENDIF.

      ENDFORM. " GET_LEGACY_DATA

      When i am giving input as

      Directory /pw/data/erp/D5S/fi/up

      Name: Backlog1616_D1S.txt

      -


      BKCOPO1 BKSOI1 1000.00 100.00 -200.00 0 0 0 0 0 0 0

      BKSOPO2 BKSOI2 2222.22 0 300 0 0 0 0 0 0 0

      BKSOPO3 BKSOI3 -3000 400 0 0 0 0 0 0 0 0

      BKSOPO4 4000.55 500 600 0 0 0 0 0 0 0

      0040000000 000010 -100 -110 -110 0 0 -600 0 0 0 0

      0040000001 000010 -110 -110 0 0 0 -610 0 0 0 0

      I am getting i_input internal table populated as follows at the end of that subroutine.

      After appending [APPEND wa_input TO i_input].

      BKCOPO1#BK|000000| 0.00 | 0.00 | 0.00 |

      BKSOPO2#BK|000000| 0.00 | 0.00 | 0.00 |

      BKCOPO3#BK|000000| 0.00 | 0.00 | 0.00 |

      BKCOPO4##4|000000| 0.00 | 0.00 | 0.00 |

      0040000000|000000| 0.00 | 0.00 | 0.00 |

      0040000001|000000| 0.00 | 0.00 | 0.00 |

      And output is showing erronious records: 6

      No entries inserted.

      Can you solve this issue.

  • author's profile photo Former Member
    Former Member
    Posted on Jul 29, 2005 at 07:00 PM

    Are you using the addition IN TEXT MODE with OPEN DATASET?

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 29, 2005 at 08:43 PM

    Hi,

    The tab is read in SAP system as hex char '09'. I have written this code to read tab delimited file from presentation server.

    It should work for Datasets also.

    REPORT test.

    DATA : s type x.

    DATA : BEGIN OF itab OCCURS 0,

    line(255) TYPE c,

    END OF itab.

    DATA : BEGIN OF itab1 OCCURS 0,

    l1(30),

    l2(30),

    l3(30),

    l4(15),

    l5(15),

    END OF itab1.

    CALL FUNCTION 'GUI_UPLOAD'

    EXPORTING

    filename = 'H://testtab.txt'

    • FILETYPE = 'ASC'

    • HAS_FIELD_SEPARATOR = ' '

    • HEADER_LENGTH = 0

    • READ_BY_LINE = 'X'

    • DAT_MODE = ' '

    • IMPORTING

    • FILELENGTH =

    • HEADER =

    TABLES

    data_tab = itab

    EXCEPTIONS

    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 = 16

    OTHERS = 17

    .

    IF sy-subrc <> 0.

    • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

    ENDIF.

    s = '09'.

    LOOP AT itab.

    SPLIT itab-line AT s INTO itab1-l1 itab1-l2

    itab1-l3 itab1-l4 itab1-l5.

    APPEND itab1.

    WRITE: /1 itab1-l1, itab1-l2, itab1-l3, itab1-l4, itab1-l5.

    ENDLOOP.

    My input file looked like this :

    asdas asd asd 123 22

    asdas dfs cdsgre 12 44

    ewrg qwe nbyh 34 12

    asdfa 12 123 453 123

    Reagrds,

    Gagan

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 29, 2005 at 09:34 PM

    Hi,

    You need to get the hex code for '#' coming from the file as it is not # char but a control char. When reading file , put a breakpoint at read statement, then check the contents of the line and note the position of #. Then change the display to hex,( there is buttom on the right on filed content fields in debugging mode ). get the hex code for #. Remember that there are 2 char in hex per one char in character format. Get the code and use the code I have written above. just replace 09 in s = '09' with the code you got for '#'. I hope it works for you.

    In my system code '09' is working perfectly.

    Regards,

    Gagan

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 01, 2005 at 12:54 PM

    Hi all,

    Thanks all the guys who had worked for this isuue resolution.

    Thanks again for all your efforts.

    Thanks,

    Rayeezuddin.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.