cancel
Showing results for 
Search instead for 
Did you mean: 

[Flash Islands] How to realize dynamic SAP Tables inside a Flex Application

Former Member
0 Kudos

Hi,

i have the following problem:

I´ve realized a WebDynpro Application with FlashIslands. Everything works fine but, how do i have to manage the

variable declaration/ the mapping / etc. for different inputtables.

More detailed:

Data i want to pass to Flex is a table. The table could have on the first call 5 columns, on second 10 and on third just 2. I dont know the maximum or the minimum.

How could i realize the mapping and the definition of variables inside the Flex application dynamic as explained above?

I would be pleased for every hint or solution.

regards

Daniel

Accepted Solutions (1)

Accepted Solutions (1)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

We have some islands inside SAP that use dynamic tables. You create the context dynmically just like you would for any normal usage within WD. If you need help with that part, let me know.

For the Island interface however, you still have to define al lthe properties of the DataSource via the interface. We have used the WDDOMODIFYVIEW method to add the properties dynamically. Something like the following code:

loop at  lt_rich_catalog assigning <wa_rich_cat>.
      concatenate `SALES_DATA.` <wa_rich_cat>-colid into t_bind_value.
      condense t_bind_value no-gaps.
      concatenate `GACPROP` <wa_rich_cat>-colid into t_id.
      condense t_id no-gaps.
      lr_ds  ?= view->get_element( 'GACDATASOURCE' ).
      lr_ds_prop = cl_wd_gac_property=>new_gac_property(
           bind_value     = t_bind_value
           id             = t_id
           name           = <wa_rich_cat>-colid
           read_only      = ''
           view           = view ).
      lr_ds->add_property(
        exporting
          the_property = lr_ds_prop ).
    endloop.

The only problem is that on the flex side you don't know what "columns" you might have in your ArrayCollection. We work around this problem by also passing a field catalot dataSource - basically just another context node binding - but each element describes one of the columsn in the dynamic dataSource. This is very similiar to what you do when using ALV.

Former Member
0 Kudos

Hi Thomas,

thx for the reply. I saw your code in another thread but i gave him no attention

Ok, stop kidding.

Just for my understanding:

I would pass with your solution two dataSources to Flex, one with the column-names and the second with values?

And after importing the values to Flex i have to match the two arrayCollections?

Sry, but i´m new to Web Dynpro and Islands.

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

>And after importing the values to Flex i have to match the two arrayCollections?

Yes. That is what I was suggesting. Not required to send the dataSource with the column names/descriptions - but we found it makes the processing on the Flex side when dealing with dynamic tables much simplier.

Answers (2)

Answers (2)

Former Member
0 Kudos

It works !

->problem solved

Former Member
0 Kudos

Hello Daniel,

We do have same kind of requirement to define dynamic table in flex application and use it in web dynpro ABAP. Can you tell me the steps what you did?

Thanks

Mohan

Former Member
0 Kudos

Hi Mohan,

sry for my late response.

->

The problem of dynamic tables inside of flex is easy to solve.

Dynamic columns have to be transformed into dynamic rows.

Example:

Original table:

clumn-names: a, b, c, d, e, f, ....

a gets the id 1, b is 2, c is 3, and so on. so after transformation (creating a new table) you would get somiething like this:

new table:

column names: x, y, text, value

x is the row of the original table,

y is the column.

text is the column-name.

value is the specific value of the row at the column-point:

1 1 a value1

1 2 b value2

1 3 c value3

.

.

.

Now you have variable and dynamic rows, but static columns inside your flex-application.

I hope i could help you

Former Member
0 Kudos

Thank you Thomas !

I will try it.