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

alternate code

Former Member
0 Likes
482

can any one provide me alternate code for following statement using 1.READ from internal table, 2. by using "for all entries".

<u>following is the code</u>

*TABLE J_5HPDBEAR

  • LOOP AT gt_cr INTO gs_cr.

  • SELECT * FROM j_5hpdbear WHERE annuser = gs_cr-ausfuehrer.

  • gs_cr-vorname = j_5hpdbear-vorname. "First name

  • gs_cr-nachname = j_5hpdbear-nachname. "last name

  • gs_cr-mail = j_5hpdbear-mail. "mail id

*

  • MODIFY gt_cr FROM gs_cr.

*

  • ENDSELECT.

  • ENDLOOP.

here gs-cr is the header for gt_cr

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
441

if not gt_cr is initial.

select *

from j_5hpdbear

into table gt_j_5hpdbear

for all entries in gt_cr

where annuser = gt_cr-ausfuehrer.

loop at gt_cr into gs_cr.

read table gt_j_5hpdbear into wa_j_5hpdbear where annuser = gs_cr-ausfuehrer.

if sy-subrc = 0.

move :

wa_j_5hpdbear-vorname to gs_cr-vorname ,

wa_j_5hpdbear-nachname to gs_cr-nachname,

wa_j_5hpdbear-mail to gs_cr-mail.

modify gt_cr from gs_cr index sy-tabix transporting vorname nachname mail .

endif.

endloop.

endif.

3 REPLIES 3
Read only

Former Member
0 Likes
441

Hi

if gt_cr is not initial.

select * form J_5HPDBEAR into table itab

for all entries in gt_cr

where annuser = gt_cr-annuser.

endif.

next do what ever you want.

Reward if it is helpful.

Thanks

Siva Kuamr.

Read only

Former Member
0 Likes
441

Hi,

do like this.......

TABLE J_5HPDBEAR.

 If gt_cr is not intial.
  SELECT * FROM j_5hpdbear into table git_j_5hpdbear  for all entries in gt_cr WHERE annuser = gt_cr-ausfuehrer.
endif.
 sort git_j_5hpdbear by annuser.
 LOOP AT gt_cr INTO gs_cr.
  Read table git_j_5hpdbear into wa_j_5hpdbear with key annuser = gs_cr-annuser binary search.
  if sy-subrc = 0.
   gs_cr-vorname = wa_j_5hpdbear-vorname. "First name
   gs_cr-nachname = wa_j_5hpdbear-nachname. "last name
   gs_cr-mail = wa_j_5hpdbear-mail. "mail id
   MODIFY gt_cr FROM gs_cr.
   clear gs_cr.
  endif.
 ENDLOOP.

Regards,

Satish

Read only

Former Member
0 Likes
442

if not gt_cr is initial.

select *

from j_5hpdbear

into table gt_j_5hpdbear

for all entries in gt_cr

where annuser = gt_cr-ausfuehrer.

loop at gt_cr into gs_cr.

read table gt_j_5hpdbear into wa_j_5hpdbear where annuser = gs_cr-ausfuehrer.

if sy-subrc = 0.

move :

wa_j_5hpdbear-vorname to gs_cr-vorname ,

wa_j_5hpdbear-nachname to gs_cr-nachname,

wa_j_5hpdbear-mail to gs_cr-mail.

modify gt_cr from gs_cr index sy-tabix transporting vorname nachname mail .

endif.

endloop.

endif.