Skip to Content
0

Could any one help me in providing alternative for field symbols in For all entries ?

Jun 05, 2017 at 07:28 AM

62

avatar image

Hello Everyone,

I'm having a dynamic table <fs_a> in which there are key fields A and B. There is another table <fs_b>. and select statement goes as shown below.

Select A B C from (Any_Standard_table) into table <fs_b>

for all entries in <fs_a>

where A = <fs_a>-A

AND B = <fs_b>-b.

where <fs_a> and <fs_b> are declared as 'TYPE ANY TABLE'.

10 |10000 characters needed characters left characters exceeded

And the question is?
The scenario to have all dynamic is?

0
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Salah ZINET Jun 05, 2017 at 10:20 AM
2

Hi Sravan,

Check the Idea in the code bellow :

*******************************************************************

FIELD-SYMBOLS: <fs_a> TYPE ANY TABLE,
<fs_b> TYPE ANY TABLE.

DATA: ClauseWhere TYPE TABLE OF string.

* ASSIGN ... <fs_a>
*....
* ASSIGN ... <fs_B>
*...

APPEND 'Field1 = <fs_a>-A and' TO ClauseWhere. " Field1 of Any_Standard_table
APPEND 'Field2 = <fs_a>-B ' TO ClauseWhere. " Field1 of Any_Standard_table
*....

select A B C
from (Any_Standard_table) into table <fs_b>
FOR ALL ENTRIES IN <fs_a>
where
(ClauseWhere)

*************************************************************

Regards,

Salah.

Share
10 |10000 characters needed characters left characters exceeded
Mike Pokraka Jun 05, 2017 at 09:44 AM
0

The example above will never work, you can't use your result as a selection criteria.

...AND B = <fs_A>-b. 

should work.

Please use the code format when posting code, it makes it much easier to read.

Show 3 Share
10 |10000 characters needed characters left characters exceeded

FIELD-SYMBOLS: <fs_tekko> TYPE ANY TABLE,
<fs_tekpo> TYPE ANY TABLE.

ASSIGN: d_ref_ekpo->* TO <fs_tekpo>,
d_ref_ekko->* TO <fs_tekko>.

SELECT ebeln ebelp loekz werks menge afnam
FROM ekpo INTO TABLE <fs_tekpo>
FOR ALL ENTRIES IN <fs_tekko>
WHERE ebeln = <fs_tekko>-ebeln.

The above code is giving the following error (

The specified type has no structure and therefore no component called
"EBELN". component called "EBELN".

)

Could you please help in dealing with such scenarious ?

0

As before, please use code formatting! It makes it much easier to read.

The error is to be expected. ANY TABLE means what it says, there are no fields specified, therefore you cannot reference it directly.

Why can't you declare <fs_ekko> as type TABLE OF EKKO ?

0

In this case, I think that 'using LOOP' like explained in the link bellow can Help you.

https://archive.sap.com/discussions/thread/1151142

Regards.

0