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

insert the data into tables

Former Member
1,298

Hi Friends,

i am uploading the data from falt file into 2 database tables.

tables are : t604t , t604.

but only t604t one dbase table is updating not second.(t604)

NOTE :

in configuartion side the database tables are updating fine.

from program side .. only one database table was updated.

here is the code pls :

TABLES : t604t , t604.

*data it_t604t like t604t occurs 0 with header line.

DATA : BEGIN OF it_t604t OCCURS 0,

spras LIKE t604t-spras,

land1 LIKE t604t-land1,

stawn LIKE t604t-stawn,

text1 LIKE t604t-text1,

text2 LIKE t604t-text2,

text3 LIKE t604t-text3,

text4 LIKE t604t-text4,

text5 LIKE t604t-text5,

text6 LIKE t604t-text6,

text7 LIKE t604t-text7,

END OF it_t604t.

DATA : t_t604t TYPE STANDARD TABLE OF t604T.

DATA : wa_t604t TYPE t604T.

DATA dir2 TYPE string.

  • SELECTION-SCREEN

----


SELECTION-SCREEN BEGIN OF BLOCK a WITH FRAME TITLE text-001.

PARAMETERS : dir1 LIKE rlgrap-filename.

SELECTION-SCREEN END OF BLOCK a.

**----


*

  • AT SELECTION-SCREEN

----


*-- Validate file Paths

AT SELECTION-SCREEN.

PERFORM validate_file_path.

----


  • Value Request Functionality on Selection Screen

----


*--F4 Functionality

*--for file on the PC

AT SELECTION-SCREEN ON VALUE-REQUEST FOR dir1.

CALL FUNCTION 'KD_GET_FILENAME_ON_F4'

EXPORTING

mask = '*.txt'

CHANGING

file_name = dir1

EXCEPTIONS

mask_too_long = 1

OTHERS = 2.

&----


*& Form validate_file_path

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM validate_file_path.

*--Presentation Server File Path

IF dir1 IS INITIAL.

MESSAGE e006 WITH text-002.

ENDIF.

ENDFORM. " validate_file_path

START-OF-SELECTION.

*select * from t604t into table it_t604t.

dir2 = dir1.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = dir2

filetype = 'ASC'

has_field_separator = 'X'

    • HEADER_LENGTH = 0

    • READ_BY_LINE = 'X'

    • DAT_MODE = ' '

    • IMPORTING

    • FILELENGTH =

    • HEADER =

TABLES

data_tab = it_t604t

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.

IF sy-subrc = 0.

LOOP AT it_t604t .

CLEAR wa_t604t.

wa_t604t-mandt = sy-mandt.

WA_t604t-spras = IT_T604T-SPRAS.

wa_t604t-land1 = it_t604t-land1.

wa_t604t-stawn = it_t604t-stawn.

wa_t604t-text1 = it_t604t-text1.

wa_t604t-text2 = it_t604t-text2.

wa_t604t-text3 = it_t604t-text3.

wa_t604t-text4 = it_t604t-text4.

wa_t604t-text5 = it_t604t-text5.

  • wa_t604t-text6 = it_t604t-text6.

  • wa_t604t-text7 = it_t604t-text7.

APPEND wa_t604t TO t_t604t.

CLEAR it_t604t.

ENDLOOP.

INSERT t604T CLIENT SPECIFIED FROM TABLE t_t604t.

ELSE.

MESSAGE e006 WITH text-003.

endif.

i want update the data into t604 aslo

pls give me the logic ..

regards,

4 REPLIES 4
Read only

Former Member
0 Likes
1,030

Hello Venu,

I couldn't find the insert statement on t604 anywhere in ur program. Please check once.

Regards,

Subbu

Read only

0 Likes
1,030

Hi Subba reddy,

thnx for your reply..

when i am uploading multiple records and insert into table

the program is giving short dump.

using this insert stmt :

INSERT t604t CLIENT SPECIFIED FROM TABLE t_t604t.

so how toi avoid the DUMP PLS when uploading multiple records.

help me.

regards,

Read only

0 Likes
1,030

Hi,

In the INSERT statement you are using CLIENT SPECIFIED bur no where you are giving the client No.

Thats why you are getting short dump.

Change the code like this-

INSERT t604t CLIENT SPECIFIED FROM TABLE t_t604t where MANDT = 'client No'.

try this , in client no mention the client for which you are inserting data or Rather Do not mention CLIENT SPECIFIED.

Like this

INSERT t604t FROM TABLE t_t604t.

You can try either way.

Regards,

Sujit

Read only

bolat_kozbayev
Explorer
0 Likes
1,030

did you find a solution?