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: 

modify internal table

Former Member
0 Kudos

Hi,

i want create serial no according to delivery challan no.and save that no in database table.

but record not insert.

my code.

TABLES: zann.

DATA : vbeln TYPE zann-vbeln.

DATA : srno type zann-srno.

DATA: Z_ANN LIKE ZANN OCCURS 0 WITH HEADER LINE.

data: itab type standard table of zann with header line.

PARAMETERS: p_vbeln TYPE zann-vbeln.

START-OF-SELECTION.

SELECT single *

FROM zann into z_ann

WHERE vbeln EQ p_vbeln.

IF sy-subrc = 0.

MESSAGE e001(38) WITH 'Already Exist in the Data Base'.

endif.

CONCATENATE 'D'

p_vbeln

INTO srno.

itab-vbeln = p_vbeln.

itab-srno = srno.

MODIFY TABLE z_ann FROM itab.

thanks in advance.

Regard.

Sam

1 ACCEPTED SOLUTION

Former Member
0 Kudos

do like dis...

DATA : vbeln TYPE zann-vbeln.

DATA : srno type zann-srno.

data: itab type standard table of zann,

wa type zann.

PARAMETERS: p_vbeln TYPE zann-vbeln.

START-OF-SELECTION.

SELECT single *

FROM zann into wa

WHERE vbeln EQ p_vbeln.

IF sy-subrc = 0.

MESSAGE e001(38) WITH 'Already Exist in the Data Base'.

endif.

CONCATENATE 'D'

p_vbeln

INTO srno.

wa-vbeln = p_vbeln.

wa-srno = srno.

INSERT zann FROM wa.

6 REPLIES 6

Former Member
0 Kudos

Hi,

If u want to insert record , then use insert statement.

for ex:

insert zct_plnt_prcntg from g_chgtab_field_wa .

thanks.

Former Member
0 Kudos

do like dis...

DATA : vbeln TYPE zann-vbeln.

DATA : srno type zann-srno.

data: itab type standard table of zann,

wa type zann.

PARAMETERS: p_vbeln TYPE zann-vbeln.

START-OF-SELECTION.

SELECT single *

FROM zann into wa

WHERE vbeln EQ p_vbeln.

IF sy-subrc = 0.

MESSAGE e001(38) WITH 'Already Exist in the Data Base'.

endif.

CONCATENATE 'D'

p_vbeln

INTO srno.

wa-vbeln = p_vbeln.

wa-srno = srno.

INSERT zann FROM wa.

0 Kudos

Hi TT ,

but it's give me syntax error.

"ZANN" is not an internal table "OCCURS n" specification is missing.

Regards.

Sam.

Mohamed_Mukhtar
Active Contributor
0 Kudos

Hi,

Just try like this

loop at itab.
CONCATENATE 'D'
               p_vbeln
          INTO srno.
 
   itab-vbeln = p_vbeln.
   itab-srno  = srno.

  MODIFY TABLE z_ann FROM INDEX sy-tabix  itab TRANSPORTING srno.
endloop.

Thanks and Regards

Former Member
0 Kudos

problem not solved.

Edited by: sam on Jan 17, 2009 11:30 AM

0 Kudos

ya...change the insert statement to

INSERT INTO ZANN VALUES WA.