Hello,

Sign up to join our community!

Welcome Back,

Please sign in to your account!

Forgot Password,

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

You must login to ask a question.

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

SAP EWM Help Latest Questions

  • 0
  • 0
DPM125
Beginner

How does the FILTER operator work in modern ABAP to get specific entries from a table?

It returns a filtered internal table based on a condition—no need for loops or APPEND.

*&---------------------------------------------------------------------*
*& Report  ZREP_LCLCLASS
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT zrep_lclclass.
TYPESBEGIN OF ty_user,
         name   TYPE string,
         status TYPE string,
       END OF ty_user.

DATAlt_users TYPE STANDARD TABLE OF ty_user WITH EMPTY KEY,
      lt_active_users TYPE STANDARD TABLE OF ty_user WITH EMPTY KEY.

lt_users VALUE #(
  name 'Alice'   status 'ACTIVE' )
  name 'Bob'     status 'INACTIVE' )
  name 'Charlie' status 'ACTIVE' )
).

lt_active_users FILTER #lt_users WHERE status 'ACTIVE' ).

LOOP AT lt_active_users INTO DATA(user).
  WRITE/ user-nameuser-status.
ENDLOOP.
 
Output : 


Alice ACTIVE
Charlie ACTIVE


Related Questions

Leave an answer

Leave an answer