‎2007 Jun 28 8:40 AM
Hi,
I have an internal table with 12 fields.
I have loaded the data in the internal table from a database table but only in 10 fileds.
Now, I have to update the remaining 2 fields for all records with only one value .
How can I do it ?
Is there any direct modify statement to update all the records of the internal table ?
or only loop is the only method ?
Bye,
Satya.
‎2007 Jun 28 8:45 AM
Hi,
WA_mara-field6 = 'X'.
WA_mara-field7 = 'X'.
Modify it_mara from wa_mara
Transporting field6 field7 where field6 ne 'X' or field7 ne 'X'.
Using this you can modify all the lines of the internal table with one line statement.
Message was edited by:
Vigneswaran S
‎2007 Jun 28 8:44 AM
Hi
Use...
FIELD-SYMBOLS : <fs_tab> like line of itab.
LOOP AT itab ASSIGNING <fs_tab>.
<fs_tab>-field11 = value.
<fs_tab>-field12 = value.
ENDLOOP.
Regards
Raj
‎2007 Jun 28 8:45 AM
Hi,
WA_mara-field6 = 'X'.
WA_mara-field7 = 'X'.
Modify it_mara from wa_mara
Transporting field6 field7 where field6 ne 'X' or field7 ne 'X'.
Using this you can modify all the lines of the internal table with one line statement.
Message was edited by:
Vigneswaran S
‎2007 Jun 28 8:45 AM
Hi
LOOP AT ITAB.
l_tabix = sy-tabix.
select single f1 f2 into (v1, v2) from DBTABLE where f1 = itab-f1.
if sy-subrc = 0.
itab-f11 = v1.
itab-f12 = v2.
modify itab index l_tabix.
endif.
endloop.
This will update the the 2 left out fields
<b>
Reward points for useful Answers</b>Regards
Anji
‎2007 Jun 28 8:46 AM
Hi,
you can update the data within the LOOP.. ENDLOOP using MODIFY statement.
Use MODIFY <INTERNAL TABLE>.. TRANSPORTING FIELD1 FIELD2.
If its not within the LOOP, use INDEX with MODIFY.
Regards
Lata
‎2007 Jun 28 8:47 AM
Hi,
i know only this way:
loop at itab. itab-11 = '#'. itab-12 = '#'. mdify itab. endloop.
regards, dieter
‎2007 Jun 28 8:47 AM
Hi,
Check the below code.
PARAMETERS: p_carrid TYPE sflight-carrid,
p_connid TYPE sflight-connid,
p_plane1 TYPE sflight-planetype,
p_plane2 TYPE sflight-planetype.
DATA sflight_tab TYPE SORTED TABLE OF sflight
WITH UNIQUE KEY carrid connid fldate.
DATA sflight_wa TYPE sflight.
SELECT *
FROM sflight
INTO TABLE sflight_tab
WHERE carrid = p_carrid AND
connid = p_connid.
sflight_wa-planetype = p_plane2.
MODIFY sflight_tab FROM sflight_wa
TRANSPORTING planetype WHERE planetype = p_plane1.
‎2007 Jun 28 8:48 AM
as per my knowledge u can only modify all the lines of the internal table by using loop.
Regs,
Saurabh
‎2007 Jun 28 8:55 AM
You cannot directly modify a coloumn in one go, u have to write modify code in LOOP...ENDLOOP.