Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

how do I find if an string is contained in an internal table field

how do I find if an string is contained in an internal table field. Please could you give me just an small example

Thx

Tags:
replied

Keyword is CS.

DATA : Begin of gt_itab occurs 0,

roll(2) type n,

string(20) type c,

end of gt_itab.

gt_itab-roll = '01'.

gt_itab-string = 'KARTHIK INDIA'.

append gt_itab.

gt_itab-roll = '02'.

gt_itab-string = 'KARTHIK USA'.

append gt_itab.

gt_itab-roll = '03'.

gt_itab-string = 'ARUN INDIA'.

append gt_itab.

gt_itab-roll = '04'.

gt_itab-string = ' KALAM IND'.

append gt_itab.

gt_itab-roll = '01'.

gt_itab-string = 'BUSH USA'.

append gt_itab.

write 'Roll no '.

Loop at gt_itab.

  • Here we are checking whether the itab string contains

  • INDIA are not.

IF gt_itab-string CS 'INDIA' .

write : / gt_itab-roll.

endif.

endloop.

Done.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question