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

select statement

Former Member
0 Likes
1,055

Hi,

I have some records in itab.

select field3 from knkk for all entries in itab

where kunnr = itab-kunnr.

Here I have to modify table itab with field3 to particular record?

How can i do this in as efficient way?

Regards,

Subbu

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,031

>

> Hi,

>

> I have some records in itab.

DATA : idx LIKE sy-tabix.

LOOP AT itab.

idx = sy-tabix.

select <fieldname> into itab-fld3 from knkk where kunnr = itab-kunnr.

if sy-subrc eq 0.

MODIFY itab INDEX idx.

endif.

ENDLOOP.

> Here I have to modify table itab with field3 to particular record?

>

> How can i do this in as efficient way?

>

> Regards,

> Subbu

10 REPLIES 10
Read only

Former Member
0 Likes
1,031

loop at itab.

if itab-field = specific value

itab-field3 = field3 value.

modify itab.

endif.

endloop.

Awrd POints if useful

Bhupal

Read only

Former Member
0 Likes
1,031

Hi,

check dis

ACEPS_OPEN_PERIOD_DETERMINE

Read only

Former Member
0 Likes
1,031

Hi subba reddy,

Try the below logic.It will helpful to u ok..

itab-number = 3.

itab-name = 'REDDy'. "previous name is reddi

modify itab.

Award points if helpful.

Kiran Kumar.G

Have a Nice Day..

Read only

Former Member
0 Likes
1,031

hi,

sort internal table and then use read in bineary search mode. do the code given by bhupal. that will more effective as per my knowledge.

WISH YOU HAPPY NEW YEAR

pavan

Read only

0 Likes
1,031

Hi Pavan,

Thanks and wish you the same

Please find my query once again.

Itab:fields f1 f2 f3 f4

values 1 ab zz

2 ac zc

etc....,

Now I have to select f3 from knkk where f1 = itab-f1

and f2 = itab-f2 .

Then I have to update itab-f3 with that value.

What will be the efficient way to do that?

Thanks for the response.

Subbu

Read only

0 Likes
1,031

hi

select f3 from xxx for all entries of table itab

where f1 = itab-f1 and f2= itab-f2.

modify table itab-f3 transporting f3.

regards,

pavan

Read only

Former Member
0 Likes
1,031

Hi,

Will you please more clear about question.

Thanks,

Sakthi C

Read only

0 Likes
1,031

Hai,

Try the following code:

Read Table itab index i.

itab-field3 = newValue.

append itab.

where i is the index of the record which you want to modify.

Regards

Read only

Former Member
0 Likes
1,032

>

> Hi,

>

> I have some records in itab.

DATA : idx LIKE sy-tabix.

LOOP AT itab.

idx = sy-tabix.

select <fieldname> into itab-fld3 from knkk where kunnr = itab-kunnr.

if sy-subrc eq 0.

MODIFY itab INDEX idx.

endif.

ENDLOOP.

> Here I have to modify table itab with field3 to particular record?

>

> How can i do this in as efficient way?

>

> Regards,

> Subbu

Read only

0 Likes
1,031

Hi.,

Try this following code for your solution.

loop at itab.

select single field3 from KNKK into KNKK-field3 where kunnr = itab-kunnr.

if sy-subrc = 0.

itab-field3 = KNKK-field3

modify itab transporting field3

else.

delete itab index sy-tabix.

endif.

endloop.

Regards,

Raj.