Application Development 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 TABLE <FS_TABLE> ASSIGNING <FS_WA>.

Former Member
0 Kudos

Hi,

This my problem:

FIELD-SYMBOLS: <wa_wf_steps> TYPE swwwihead,

<table_wf_steps> TYPE table.

*reference swwwihead

DATA dref1 TYPE REF TO data.

CREATE DATA dref1 TYPE TABLE OF swwwihead.

ASSIGN dref1->* TO <table_wf_steps>.

.....

I need browse this table <table_wf_steps> by read or loop and use (or something else) <b>condition (WHERE)</b> c.

loop at <table_wf_steps> assigning <wa_wf_steps> <b>WHERE col1 = 'X'.</b>

endloop.

or this

READ TABLE <table_wf_steps> ASSIGNING <wa_wf_steps> with <b>key col1 = 'X'.</b>

How Can I find record with some condition when I use field symbols for working area and table?

Thanks

5 REPLIES 5

Former Member
0 Kudos

Just do this,

DATA:

dref1 TYPE REF TO data.

waref1 TYPE REF TO data.

CREATE DATA dref1 TYPE TABLE OF swwwihead.

ASSIGN dref1->* TO <table_wf_steps>.

CREATE DATA waref1 TYPE swwwihead.

ASSIGN waref1->* TO <wa_wf_steps>.

READ TABLE <table_wf_steps> INTO <wa_wf_steps> with key col1 = 'X'.

0 Kudos

But It doesnt work.

ERROR

<b>"The specified type has no structure and therefore no component called ELEMENT".</b>

FIELD-SYMBOLS: <wa_wf_container> TYPE swcont,

<table_wf_container> TYPE table.

DATA: dref2 TYPE REF TO data,

waref2 TYPE REF TO data.

CREATE DATA: dref2 TYPE TABLE OF swcont,

waref2 TYPE swcont.

ASSIGN: dref2->* TO <table_wf_container>,

waref2->* TO <wa_wf_container>.

... If "fill" table <table_wf_container>..

<b>READ TABLE <table_wf_container> INTO <wa_wf_container> WITH KEY ELEMENT = '_RESULT'.</b>

Thanks

0 Kudos

Hi

I just skipped one point here:

FIELD-SYMBOLS: <wa_wf_container> TYPE swcont,

<table_wf_container> TYPE table.

DATA: dref2 TYPE REF TO data,

waref2 TYPE REF TO data.

CREATE DATA: dref2 TYPE TABLE OF swcont,

waref2 TYPE swcont.

ASSIGN: dref2->* TO <table_wf_container>,

waref2->* TO <wa_wf_container>.

... If "fill" table <table_wf_container>..

LOOP AT <table_wf_container> INTO <wa_wf_container>.

IF <wa_wf_container>-element EQ '_RESULT'

EXIT.

ENDIF.

ENDLOOP.

Now <wa_wf_container> will contain the actual record.

Regards,

Srikanth

0 Kudos

Thanks, I know these possibilities. I supposed that exist somethink like:

read table <fs_table> assigning <fs_wa> with key col1 = 'X'.

Or looping at relevant records - without if - endif inside loop.

Thanks

Former Member
0 Kudos

Zdenek,

Can you try this?

data: fieldname(5) type c value 'COL1'.

field-symbols : <fs_any> type any.

loop at <table_wf_steps> assigning <wa_wf_steps> .

assign component fieldname of structure <wa_wf_steps> to <fs_any>.

if <fs_any> = 'X'.

Do the Processing.

endif.

endloop.

regards,

Ravi

Note : Please reward if this helps you.