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 statement

Former Member
0 Likes
539

Hi all,

Is correct pgm below plz see it..

Data: BEGIN OF itab OCCURS 0.

INCLUDE STRUCTURE zst1.

data: end of itab.

PAI:

IF SY-UCOMM = 'SUBMIT'.

IF SY-SUBRC = 0.

MOVE-CORRESPONDING ZST1 TO ITAB.

Insert zst1 from itab---->its correct pgm. can display to db table.

Insert zst1 from table itab.----> its cannot displayt to db table? how??

MESSAGE I000(ZS1).

ENDIF.

ENDIF.

Reply me immediately,

S.Suresh.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
518

hi,

using

MOVE-CORRESPONDING ZST1 TO ITAB.

you are moving values to header line not to internal table.

you must use append also with it.

so u cannot use

Insert zst1 from table itab.

but u can use Insert zst1 from itab

as itab is header line and has values

You can code in 2 ways

Data: BEGIN OF itab OCCURS 0.

INCLUDE STRUCTURE zst1.

data: end of itab.

PAI:

IF SY-UCOMM = 'SUBMIT'.

IF SY-SUBRC = 0.

MOVE-CORRESPONDING ZST1 TO ITAB.

append itab.

Insert zst1 from table itab.

MESSAGE I000(ZS1).

ENDIF.

ENDIF.

(or)

Data: BEGIN OF itab OCCURS 0.

INCLUDE STRUCTURE zst1.

data: end of itab.

PAI:

IF SY-UCOMM = 'SUBMIT'.

IF SY-SUBRC = 0.

MOVE-CORRESPONDING ZST1 TO ITAB.

Insert zst1 from itab.

MESSAGE I000(ZS1).

ENDIF.

ENDIF.

reward if helpful

mahesh

3 REPLIES 3
Read only

Former Member
0 Likes
519

hi,

using

MOVE-CORRESPONDING ZST1 TO ITAB.

you are moving values to header line not to internal table.

you must use append also with it.

so u cannot use

Insert zst1 from table itab.

but u can use Insert zst1 from itab

as itab is header line and has values

You can code in 2 ways

Data: BEGIN OF itab OCCURS 0.

INCLUDE STRUCTURE zst1.

data: end of itab.

PAI:

IF SY-UCOMM = 'SUBMIT'.

IF SY-SUBRC = 0.

MOVE-CORRESPONDING ZST1 TO ITAB.

append itab.

Insert zst1 from table itab.

MESSAGE I000(ZS1).

ENDIF.

ENDIF.

(or)

Data: BEGIN OF itab OCCURS 0.

INCLUDE STRUCTURE zst1.

data: end of itab.

PAI:

IF SY-UCOMM = 'SUBMIT'.

IF SY-SUBRC = 0.

MOVE-CORRESPONDING ZST1 TO ITAB.

Insert zst1 from itab.

MESSAGE I000(ZS1).

ENDIF.

ENDIF.

reward if helpful

mahesh

Read only

Former Member
0 Likes
518

Hi,

Data: BEGIN OF itab OCCURS 0.

INCLUDE STRUCTURE zst1.

data: end of itab.

PAI:

IF SY-UCOMM = 'SUBMIT'.

IF SY-SUBRC = 0.

MOVE-CORRESPONDING ZST1 TO ITAB.

you need to append to the itab table because move only moves to the work area itab and does not append . write this line after move

Append itab

Insert zst1 from itab---->its correct pgm. can display to db table. This is work area

Insert zst1 from table itab.----> its cannot displayt to db table? how??

MESSAGE I000(ZS1).

ENDIF.

ENDIF.

regards,

Advait

Read only

Former Member
0 Likes
518

Hi,

caseSY-UCOMM

when 'SUBMIT'.

MOVE-CORRESPONDING ZST1 TO ITAB.

Insert zst1 from itab---->its correct pgm. can display to db table.

endcase.

MESSAGE I000(ZS1).

Regards,

Raghu