Skip to Content
avatar image
Former Member

Data not uploading in internal table

Hi all..

I am trying to create a bdc for vk12.

for that i am uploading data into internal table via code

DATA : BEGIN OF T_ITAB OCCURS 0,

ZKSCHL TYPE KSCHL,

ZVKORG TYPE VKORG,

ZVTWEG TYPE VTWEG,

ZKUNNR TYPE KUNNR,

ZMATNR TYPE MATNR,

ZKBETR TYPE KBETR,

ZDATAB TYPE DATAB,

ZDATBI TYPE DATBI,

END OF T_ITAB.

*DATA : SDATE TYPE SY-DATUM.

  • DATA: T_ITAB TYPE T_ITAB,

  • T_ITAB INITIAL SIZE 1.

DATA : BDCDATA TYPE BDCDATA OCCURS 0 WITH HEADER LINE.

REFRESH T_ITAB.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = 'C:\VK12_NEW.TXT'

FILETYPE = 'DAT'

HAS_FIELD_SEPARATOR = 'X"

TABLES

DATA_TAB = T_ITAB

IF SY-SUBRC <> 0.

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

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

ENDIF.

My flat file is

PR00 'SKHM' 'SC' 100000 BY2000101 9.01 08072009 31122020

But only PR00 is comung in T_ITAB. why rest of the field are not coming??

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    Jul 15, 2009 at 10:57 AM

    Hi

    I tried out your program and tested and its working fine now.

    1. I changed little in your program (see source code below).

    2. In your flat file you have to press tab key after each value (see flat file below).

    DATA : BEGIN OF T_ITAB OCCURS 0,
    ZKSCHL TYPE KSCHL,
    ZVKORG TYPE VKORG,
    ZVTWEG TYPE VTWEG,
    ZKUNNR TYPE KUNNR,
    ZMATNR TYPE MATNR,
    ZKBETR TYPE KBETR,
    ZDATAB TYPE DATAB,
    ZDATBI TYPE DATBI,
    
    END OF T_ITAB.
    *DATA : SDATE TYPE SY-DATUM.
    
    * DATA: T_ITAB TYPE T_ITAB,
    * T_ITAB INITIAL SIZE 1.
    DATA : BDCDATA TYPE BDCDATA OCCURS 0 WITH HEADER LINE.
    REFRESH T_ITAB.
    
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
    FILENAME = 'C:\VK12_NEW.TXT'
    *FILETYPE = 'DAT'
    HAS_FIELD_SEPARATOR = 'X'
    TABLES
    DATA_TAB = T_ITAB.
    
    IF SY-SUBRC eq 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.

    Flat File

    PR00 'SKHM' 'SC' 100000 BY2000101 9.01 08072009 31122020

    Regards

    Sajid

    Add comment
    10|10000 characters needed characters exceeded

    • Hi,

      As i mention in your earlier post.

      It is a problem with your file.

      It is not a tab delimited file.

      I copied the data into a notepad and checked.

      For me also it was taking just kschl value.

      Do the following.

      1. Right click on your notepad file and say open with excel.

      2. If it is table delimited file you will find that each value will be in individual cell.

      3. If it is not then it will be in a single cell.

      This means that the file is not a tab delimited file and hence the data is not getting copied.

      Store your file as a tab delimited file and then upload.

      Regards,

      Ankur Parab

  • avatar image
    Former Member
    Jul 15, 2009 at 10:47 AM

    Give TAB space for each field and try to upload also file type as 'ASC'.

    Edited by: Alexander on Jul 15, 2009 12:48 PM

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 15, 2009 at 12:47 PM

    Hi ,

    Please check in the function module you are maintiang field seperator 'X' which is not there in between fields.. please comment and try to execute it now you will get the data accordingly into your internal table ..

    Thanks.

    Add comment
    10|10000 characters needed characters exceeded

  • Jul 16, 2009 at 06:10 AM

    Change your File type to ASC..

    Edited by: Rahul Keshav on Jul 16, 2009 11:40 AM

    Add comment
    10|10000 characters needed characters exceeded