I have requirement where I have multiple KSCHL (condition types) in bset table.
I have written the select query with the required condition types as below.
You can see in the above image that multiple kschl we have used in select query.
You can see in the below we are using multiple read tables as below.
Now i have to READ it with each KSCHL which is taken alot of space. I want to get all the
values of ktosl in single read table.
I am expecting something like this.
READ TABLE lt_bset INTO ls_bset WITH KEY bukrs = ls_bseg-bukrs
belnr = ls_bseg-belnr
gjahr = ls_bseg-gjahr
kschl = 'JICR' and kschl = 'JISR 'and kschl = 'JICN'
txgrp = ls_bseg-txgrp.
is it possible ?
or let me know if there is any way so that I can use only one read table.
The following is the select query of bset table.
Add all the condition types in a range table and use it in SELECT WHERE clause(KSCHL in lr_kschl).
Note: The range itab can not be used in READ but you can LOOP the itab and use it in WHERE clause.
LOOP it_bset into ls_bset WHERE ..."othet conditions
KSCHL in lr_kschl.
You can create a nested table.
First take all key fields and add an additional column as table of KSCHL.
t_kschl type table of ....
into table @data(lt_data)
loop at lt_data into wa_data.
read table lth_nested assigning field-symbol(<wa_nested>)
from corresponding #(wa_data).
if sy-subrc is not initial.
insert corresponding #(wa_data) into table lth_nested assigning <wa_nested>.
insert wa_data-kschl into table <wa_nested>-t_kschl.
read table lth_nested assigning <wa_nested> with table key ...
check sy-subrc is initial.
loop at <wa_nested>-t_kschl into ....