2007 Oct 26 7:54 AM
I want to update the Ztable from internal table datas.
what is the syntax to update.
Its urgent send with coding example is better
2007 Oct 26 7:57 AM
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
2007 Oct 26 7:59 AM
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
2007 Oct 26 7:59 AM
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
2007 Oct 26 8:00 AM
2007 Oct 26 8:01 AM
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^
2007 Oct 26 8:09 AM
Hi,
update ztable
set <field in ztable> = <value> where <condition>.
reward points if useful.
regards,
Vinod Samuel.