Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Data not uploading in internal table

Former Member
0 Kudos

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??

1 ACCEPTED SOLUTION

shaik_sajid
Active Contributor
0 Kudos

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

6 REPLIES 6

alex_m
Active Contributor
0 Kudos

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

shaik_sajid
Active Contributor
0 Kudos

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

0 Kudos

I tried the Same code..But it's not working on my system..

0 Kudos

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

Former Member
0 Kudos

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.

former_member187457
Active Contributor
0 Kudos

Change your File type to ASC..

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