Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Dynamic clause WHERE

Former Member
0 Likes
473

Hi all, i'm trying to Read from an internal dynamique table <it_tab> into <ls_tab> i need to add a WHERE at the end

I tried

READ TABLE <it_tab> INTO <ls_tab> WITH KEY (clause_where).

And

LOOP AT <it_tab>ASSIGNING <ls_tab> WHERE (clause_where).

But it's not working :s :s s

PS: clause _where is a String TYPE

Regards.

Mehdi

1 ACCEPTED SOLUTION
Read only

andreas_mann3
Active Contributor
0 Likes
427

you must wait for

http://www.sdn.sap.com/irj/sdn/nw-70ehp2?rid=/webcontent/uuid/1009fbb7-fd08-2d10-0182-852b6fa05f08">sap [original link is broken] [original link is broken]

altenatives:

1) read table

DATA key1(72) .

DATA key2(72) .

key1 =...

read table itab into wa with key (key1) = x.

(key2) = z.

2) GENERATE SUBROUTINE POOL prog NAME genprog MESSAGE message

LINE line WORD word.

A.

2 REPLIES 2
Read only

andreas_mann3
Active Contributor
0 Likes
428

you must wait for

http://www.sdn.sap.com/irj/sdn/nw-70ehp2?rid=/webcontent/uuid/1009fbb7-fd08-2d10-0182-852b6fa05f08">sap [original link is broken] [original link is broken]

altenatives:

1) read table

DATA key1(72) .

DATA key2(72) .

key1 =...

read table itab into wa with key (key1) = x.

(key2) = z.

2) GENERATE SUBROUTINE POOL prog NAME genprog MESSAGE message

LINE line WORD word.

A.

Read only

Former Member
0 Likes
427

I found the solution somewhere and it wokrs that's what i found :

LOOP AT <table> ASSIGNING <ligne_table> .

MOVE-CORRESPONDING <ligne_table2> TO <ligne_output>.

ASSIGN COMPONENT ds_tabx-forkey OF STRUCTURE <ligne_table> TO <ls>.

READ TABLE <table1> INTO <ligne_table1> WITH KEY (clause_where3) = <ls>.

IF sy-subrc = 0.

MOVE-CORRESPONDING <ligne_table1> TO <ligne_output>.

ENDIF.

APPEND <lligne_output> TO <table_output>.

ENDLOOP.

Regards iMedix.