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

Loop statement logic required!!!

Former Member
0 Likes
414

Dear Gurus,

The following is used now. Need to change into Loop statement.

Read the internal table t_ABC INTO w_ABC WITH KEY .... "ABC is to collect all Successful Insertion

IF sy-subrc NE 0.

CLEAR w_ABC.

Read the internal table t_XYZ INTO w_ABC WITH KEY ....

IF sy-subrc EQ 0.

PERFORM locktable.

INSERT ABC FROM w_ABC.

IF sy-subrc NE 0.

w_failure = c_x.

ENDIF.

PERFORM unlocktable.

APPEND w_ABC TO t_ABC. "Here t_ABC will hv only all Successful Insertion records

CLEAR w_ABC.

ENDIF.

ENDIF.

Since there will be more than one record, I can't use READ Statement.

How to use Loop? But it should not affect performance.

My worry is that, if i use "Locking the table" and "Insert" inside Loop, then it will affect performance.

Can any one please help me out?

It's pretty urgent.

Points will be rewarded immediately.

Thanks & Regards,

Neeraj

2 REPLIES 2
Read only

Former Member
0 Likes
390

hi replace read by this statement..

loop at itab into wa where field1 = v_field .

append and then clear

endloop.

regards,

venkat

Read only

Former Member
0 Likes
390

Hi,

Loop at t_abc INTO w_ABC .

Read table t_XYZ INTO w_ABC WITH KEY ....

IF sy-subrc EQ 0.

PERFORM locktable.

INSERT ABC FROM w_ABC.

IF sy-subrc NE 0.

w_failure = c_x.

ENDIF.

PERFORM unlocktable.

APPEND w_ABC TO t_ABC. "Here t_ABC will hv only all Successful Insertion records

CLEAR w_ABC.

ENDIF.

ENDIF.