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

ABAP Code Question

Former Member
0 Likes
944

Hi experts,

Need your input/s.

Loop i_tab into wa_tab.

read table i_tab2 into wa_tab2 with key...

if sy-subrc eq 0.

<b> Modify the i_tab2 entry found by marking its QMSM-FOUND with 'X'.</b> endif.

endloop.

How can I code this line:

<b>Modify the i_tab2 entry found by marking its QMSM-FOUND with 'X'.</b>

Thanks.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
911

refer below -

Loop at i_tab into wa_tab.

read table i_tab2 into wa_tab2 with key...

if sy-subrc eq 0.

wa_tab2-found = 'X'.

Modify i_tab2 from wa_tab2.

endif.

endloop.

8 REPLIES 8
Read only

Former Member
0 Likes
911

Hi marc you can hard code the values for the internal table you want to modify after the sy-subrc ... it will definately work...

Regards,

Jayant Sahu

Message was edited by:

JAYANT KUMAR

Read only

Former Member
0 Likes
912

refer below -

Loop at i_tab into wa_tab.

read table i_tab2 into wa_tab2 with key...

if sy-subrc eq 0.

wa_tab2-found = 'X'.

Modify i_tab2 from wa_tab2.

endif.

endloop.

Read only

Former Member
0 Likes
911

Hello,

You could do like this...

Loop i_tab into wa_tab.

read table i_tab2 into wa_tab2 with key...

if sy-subrc eq 0.

<b>wa_tab2-QMSM = 'X'.

modify itab2 from wa_tab2.</b>

endif.

endloop.

Regards,

Vasanth

Read only

Former Member
0 Likes
911

CODE LIKE THIS

Loop at i_tab into wa_tab.

read table i_tab2 into wa_tab2 with key f1 = wa_tab-f1."<common field between *i_tab1 and i_tab2>

if sy-subrc eq 0.

wa_tab2-found = 'X'.

Modify i_tab2 from wa_tab2 index sy-tabix.

clear wa_tab2.

endif.

endloop.

here your i_tab2 must contain found like QMSM-FOUND

regards

shiba dutta

Read only

Former Member
0 Likes
911

Hi Marc ,

You can use the command

modify <table> from <wa>... transporting <field name>

so what it does is it just modifies the values in the fields mentioned after transporting.

Regards

Arun

Read only

Former Member
0 Likes
911

Code can be...

loop at itab2 into wa_itab2.

read table itab1 into wa_itab1 with key .... binary search.

if sy-subrc = 0.

itab2-found = 'X'.

Modify itab2 transporting found.

endif.

endloop.

Still you have to declare 'Found' in the itab2 and please check the data in both the internal tables before writing the statement.... beacude you will be knowing that which table to loop and which internal table to read...

Read only

Former Member
0 Likes
911

Hi experts,

Need another input/s.

Loop i_tab into wa_tab.

Read table i_tab2 into wa_tab2 with key...

if sy-subrc eq 0.

<b> delete the current i_tab entry.</b>

endif.

Endloop.

How can I cide this line.

<b> delete the current i_tab entry.</b>

Thanks.

Read only

0 Likes
911

Hi Marc,

I dont think there is a way you can hide a piece of code , what i suggest is in the internal table add another filed called FLAG and when ever the conditiion is satisfied for a perticular record set the flag as 'X' and modify the table and in further processing use only those records where the value of flag is initial.

Regards

ARUN