Skip to Content

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

Filtering records from one internal table based on ranges in another itab

Hi guys,

I have 1 internal table with set of GL accounts. I have 2nd internal table where lower interval and upper interval of GL accounts

How to filter out records from 1 internal table by comparing with the GL account ranges present in 2nd internal table.

Please reply.

Tags:
Former Member
replied

Hi

Create a RANGE for GL Accounts.

LOOP the second Internal Table.

And assign HIGH & LOW to ranges from second ITAB.

And Delete the accounts which are not there in the range.

Use the below code as reference.

DATA: itab TYPE TABLE OF mara WITH HEADER LINE.

DATA: r_matnr TYPE RANGE OF matnr WITH HEADER LINE.

  SELECT * FROM mara INTO TABLE itab UP TO 10 ROWS.
  
  r_matnr-sign = 'I'.
  r_matnr-option = 'BT'.
  r_matnr-low  = '000000000016900036'.
  r_matnr-high = '000000000016900040'.
  APPEND r_matnr.
  
  DELETE itab WHERE matnr NOT IN r_matnr.

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