F String search in Internal Table in SAP ABAP | CodeTheta

String search in Internal Table in SAP ABAP


Code :
REPORT ZVP_INTERNAL_TBL_STRING_SEARCH.

TYPESBEGIN OF STR,
         ID   TYPE CHAR10,
         NAME TYPE CHAR10,
       END OF STR.

DATAIT_STR TYPE STANDARD TABLE OF STR,
      WA_STR TYPE STR.

WA_STR-ID '1'.
WA_STR-NAME 'SUJOY'.
APPEND WA_STR TO IT_STR.
CLEAR WA_STR.

WA_STR-ID '2'.
WA_STR-NAME 'KAMAL'.
APPEND WA_STR TO IT_STR.
CLEAR WA_STR.

WA_STR-ID '3'.
WA_STR-NAME 'BIJOY'.
APPEND WA_STR TO IT_STR.
CLEAR WA_STR.

WA_STR-ID '4'.
WA_STR-NAME 'NANDAN'.
APPEND WA_STR TO IT_STR.
CLEAR WA_STR.

LOOP AT IT_STR INTO WA_STR.
  SEARCH WA_STR-NAME FOR '*OY'.
  IF SY-SUBRC EQ 0.
    WRITE:/ WA_STR-ID,
    WA_STR-NAME.
  ENDIF.
ENDLOOP.


Output :

IDE Used To Test This Code : SAP Login 730.

Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us.We will reply you as soon as possible.

Post a Comment