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

update ztable from internal table

Former Member
0 Likes
5,970

I want to update the Ztable from internal table datas.

what is the syntax to update.

Its urgent send with coding example is better

6 REPLIES 6
Read only

Former Member
0 Likes
1,924

Hi

To update a Z table

u can refer following code:

DATA scarr_wa TYPE zscarr.

scarr_wa-carrid = 'FF'.

scarr_wa-carrname = 'Funny Flyers'.

scarr_wa-currcode = 'EUR'.

scarr_wa-url = 'http://www.funnyfly.com'.

INSERT INTO zscarr VALUES scarr_wa.

Message was edited by:

Vasudha L

Read only

Former Member
0 Likes
1,924

Hi

PARAMETERS: p_carrid TYPE sflight-carrid,

percent(1) TYPE p DECIMALS 0.

DATA sflight_tab TYPE TABLE OF sflight.

FIELD-SYMBOLS <sflight> TYPE sflight.

SELECT *

FROM sflight

INTO TABLE sflight_tab

WHERE carrid = p_carrid AND

fldate = sy-datum.

IF sy-subrc = 0.

LOOP AT sflight_tab ASSIGNING <sflight>.

<sflight>-price =

<sflight>-price * ( 1 - percent / 100 ).

ENDLOOP.

ENDIF.

<b>UPDATE sflight FROM TABLE sflight_tab.</b>

Thanks

Vijay

PLZ reward points if helpful

Read only

Former Member
0 Likes
1,924

Hi Ramesh,

If you have the internal table hich has same structure of Z table and the internal table has 20 records

Do as follows

Update database_table_name from table itab.

Never update the Z table within a loop ,endloop until its required.

Reward points if helpful

Read only

Former Member
0 Likes
1,924

hi.

use

<b>modify zitab from itab</b>

regards.

prajwal.k

Read only

Former Member
0 Likes
1,924

hi

good

try this

DATA: BEGIN OF itab OCCURS 1.

INCLUDE STRUCTURE ztable.

DATA: END OF itab.

DATA: wtab LIKE itab.

LOOP AT itab INTO wtab.

SELECT SINGLE * FROM ztable WHERE matnr = wtab-matnr.

IF sy-subrc = 0.

MODIFY ztable FROM wtab.

Elseif sy-subrc <> 0.

insert into ztable value wtab.

ENDIF.

ENDLOOP.

reward point if helpful.

thanks

mrutyun^

Read only

Former Member
0 Likes
1,923

Hi,

update ztable

set <field in ztable> = <value> where <condition>.

reward points if useful.

regards,

Vinod Samuel.