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

search value in internal table

Former Member
0 Likes
2,148

Hi experts,

i have a lifnr in a variable gv_lifnr and i have a internal table git_lifnr consiting of set of 10 lifnrs ,how can i search that gv_lifnr is in git_lifnr or not please advice

1 ACCEPTED SOLUTION
Read only

former_member386202
Active Contributor
0 Likes
729

Hi,

Loop at itab

if itab-lifnr =gv_lifnr

endif.

endloop.

Reagrds,

Prashant

Hi experts,

i have a lifnr in a variable gv_lifnr and i have a internal table git_lifnr consiting of set of 10 lifnrs ,how can i search that gv_lifnr is in git_lifnr or not please advice

5 REPLIES 5
Read only

Former Member
0 Likes
729

hi,

u can use

read statment and than check that if sy-subrc is 0 than its there in table...

DATA : BEGIN OF itab OCCURS 0,

matnr LIKE mara-matnr,

END OF itab.

DATA : f TYPE i.

itab-matnr = '101'.

APPEND itab.

itab-matnr = '102'.

APPEND itab.

itab-matnr = '103'.

APPEND itab.

itab-matnr = '104'.

APPEND itab.

itab-matnr = '105'.

APPEND itab.

LOOP AT itab.

READ TABLE itab WITH KEY matnr = '106'.

IF sy-subrc = 0.

f = 1.

EXIT.

ENDIF.

ENDLOOP.

IF f = 1.

WRITE:/ 'Available'.

ENDIF.

Read only

Former Member
0 Likes
729
Sort table git_lifnr.
Read table git_lifnr into gwa_lifnr with key lifnr = gv_lifnr binary search.
If sy-subrc = 0.
 * You got entry
endif.

Regards,

Satish

Read only

Former Member
0 Likes
729

Hi,

You can loop your internal table.

Loop at itab.

Read table itab with key lifnr = gt_lifnr.

if sy-subrc eq 0.

  • Do your further processing.

endif.

endloop.

Thanks,

lalit

Read only

former_member386202
Active Contributor
0 Likes
730

Hi,

Loop at itab

if itab-lifnr =gv_lifnr

endif.

endloop.

Reagrds,

Prashant

Read only

Former Member
0 Likes
729

hi ,

u can use:

LOOP AT itab.

READ TABLE itab WITH KEY lifnr eq gv_lifnr.

IF sy-subrc = 0.

means it is thier in the internal table....

reward if helpful

regards,

sohi