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: 

upload flat file into data base table using interface

Former Member
0 Kudos

hi all,

i want to upload a flat file into database table by using interface.

flat file has 1 .header data

2. information data

3. fotter data

but information data contains some extra fields compare to data base table .

can i upload this into database table or not?

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

You can copy the values based on the fields exist in ztable.

1. Upload data to internal table

2. Loop the internal table.

3. move the data to work area (structure similar as ztable)

4. Insert work area data into ztable.

5. Endloop.

8 REPLIES 8

Former Member
0 Kudos

You will be able to upload only those many fields which exist in database table. Rest of the fields are to be removed from flatfile if they are not required.

Regards,

Bhavin P Shah

0 Kudos

hi bhavin ,

i didn't understand one thing here.

what is the need of header data and footer data here.

with out header and footer data cant we upload into data base table.

0 Kudos

Hi,

for a particular transaction we will have header data,item data,

and also some cases schedule line data and also some other data..

it seems in ur flat file u r getting header data,item data and some other data.....so u have upload all the data to the transaction .........

Regards,

nagaraj

0 Kudos

hi nagraj ,

can u explain me about header data and footer data in flat file clearly?

0 Kudos

Hi,

as already i have expalined that for a particular transaction we willl have header and item data...

if u see VA01,tcode u can see the header and item details....

so while uploading the data u should have both header and ite details....

so in a flat file u will always get header and item data.....if some other data like schedule line data are there for that also u will get the data in flat file...

so finally u will upload the corresponding data from flat file to header,item etc....

generally we can get these data's by some indicator,

if it is a header data then it will be indicated as 'H' ,item data will be 'I' or 'L' like this in ur flatfile.....

Regards,

Nagaraj

Former Member
0 Kudos

Hi,

You can copy the values based on the fields exist in ztable.

1. Upload data to internal table

2. Loop the internal table.

3. move the data to work area (structure similar as ztable)

4. Insert work area data into ztable.

5. Endloop.

Former Member
0 Kudos

Hi Kumari,

try this code.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = 'd:\myfile.txt'

TABLES

DATA_TAB = rawdata

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

CALL FUNCTION 'TEXT_CONVERT_CSV_TO_SAP'

EXPORTING

I_FIELD_SEPERATOR = ';'

I_LINE_HEADER =

I_TAB_RAW_DATA = rawdata

I_FILENAME = 'd:\myfile1.txt'

TABLES

I_TAB_CONVERTED_DATA = itab

EXCEPTIONS

CONVERSION_FAILED = 1

OTHERS = 2

kindly reward if found helpful.

cheers,

Hema.

Former Member
0 Kudos

You will have to filter out the fields from Information section which do not exist in the database table.

Your structure to be passed to the database structure should not be in conflict with the SAP databse table stucture. all additonal fields should be removed.