Application Development and Automation 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: 
Read only

upload data into the table

Former Member
0 Likes
1,172

hi all,

i have data in the internal table which i need to put one Ztable which i created, can any one help me out in giving an example for how to upload the data into the table in background job everyday Using BDC.

I will be very thankful if any one you can help me out with some examples thanks in advance.

8 REPLIES 8
Read only

Former Member
0 Likes
1,085

Hi,

If you have created any custom screen to Insert data into the custom table, then you can do BDC for it. If there is no Custom Screen, you can 1st validate the data that is uploaded and directly user INSERT statement to create data in table. I dont see any advantage in doing BDC for SM30 and uploading data into table.

regards,

Mahesh

Read only

Former Member
0 Likes
1,085

Hi,

Sample code to update the Z db table :

REPORT yupload.

TABLES ybtab.

DATA itab LIKE ybtab OCCURS 0 WITH HEADER LINE.

CALL FUNCTION 'WS_UPLOAD'

EXPORTING

  • CODEPAGE = ' '

filename = 'C:\data.txt'

filetype = 'DAT'

  • HEADLEN = ' '

  • LINE_EXIT = ' '

  • TRUNCLEN = ' '

  • USER_FORM = ' '

  • USER_PROG = ' '

  • DAT_D_FORMAT = ' '

  • IMPORTING

  • FILELENGTH =

TABLES

data_tab = itab

EXCEPTIONS

CONVERSION_ERROR = 1

FILE_OPEN_ERROR = 2

FILE_READ_ERROR = 3

INVALID_TYPE = 4

NO_BATCH = 5

UNKNOWN_ERROR = 6

INVALID_TABLE_WIDTH = 7

GUI_REFUSE_FILETRANSFER = 8

CUSTOMER_ERROR = 9

NO_AUTHORITY = 10

OTHERS = 11

.

IF sy-subrc <> 0.

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

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

ELSE.

INSERT ybtab FROM TABLE itab.

ENDIF.

Schedule this program as a Background Job with required time paramters .

Regards,

Anji

Read only

0 Likes
1,085

Anji,

You said 'Schedule this program as a Background Job with required time paramters'.

Do you not know that you cannot schedule this FM in the background.

Read only

Former Member
0 Likes
1,085

Hello Madan,

For ur requirement there is no need to use BDC. Instead declare ut itab similar to the ZTABLE anf use the MODIFY statement.

<b>MODIFY ZTABLE FROM ITAB.</b>

Vasanth

Read only

sreeramkumar_madisetty
Active Contributor
0 Likes
1,085

Hi

As you will upload the data to the standard tables through the standard transactions we can do the same to upload the data to the ztables.

Regards,

kumar

Read only

Former Member
0 Likes
1,085

use insert statement to upload data, but validate ur data before inserting.

Read only

Former Member
0 Likes
1,085

Hi,

If you wnat to upload the data from the internal table into the ztable then you have to first create the dialogue program with some screens which updates the table from the data given in the screen.

After that you can record your dialogue program and code a BDC.

However, I suggest you to use the statement.

Insert <Ztablename> from table <internal_table_name>.

with the help of this , you will be able to directly post the value of the internal table to the Ztable.

The internal table should be of the same structure like the Ztable.

Remember to validate the data before inserting.

I hope this might be helpfull

Read only

0 Likes
1,085

Thanks for your valuable inputs,

so i have the fields in the table the Company Code, Plant, Year, Material No ... , As per the reply you have given i have to create a screen with the Company code Plant and Year and the remaining i will update after validating can you suggest me some example.

Here is my Requirement i have the data in the internal table, my internal table has the fields like Company code, Plant, Year, Inventory Qty, Material num, Inventory Value, ........

So i want to upload the data to the table which have the similar structure of my internal table.