cancel
Showing results for 
Search instead for 
Did you mean: 

How to bring a non-flat structure as table type into Webdynpro

Former Member
0 Kudos

Hi Guys,

i have a FunctionModule collecting necessary Data of ALL BusinessPartners (means: bapibus1006_central, central_organ, address, etc).

It stores the data for each BP in a Structure, lets call it "BP_data", containing all these abovementioned structures. The FM collects all BPs in a tabletype "BP_data_tab" and returns it.

Resulting a structure like:

- BP_data_tab
   - BP_data  //first BP
      - centraldata
          - some attributes
          - some attributes
          - ...
      - organisation
          - ... 
      - address
          - ...
   - BP_data  //second BP
   - BP_data  //third BP
   - ... //many BPs

So far so good.

Now i like to display the attributes in a webdynpro table. One line of the table corresponds to one line in "BP_data_tab", and therefore is a "BP_data" struct.

BUT: After creating the service-call in my componentcontroller, the created context node does contain the elements of "BP_data" as single attributes. As comparation to the example above:

- BP_data_tab
   - BP_data  //first BP
      - centraldata //as atomar type, not node :/
      - organisation
      - address
   - BP_data  //second BP
   - BP_data  //third BP
   - ... //many BPs

For example an attribute centraldata of type bapibus1006_central as attribute and not as node as is want it to.

Therefore i cant access the atom attributes of those contained structures. But that's exactly what i need.

Can you please tell me what i messed up?

Thanks!

Philipp

Edited by: Philipp.Heinemann on Jun 6, 2010 9:56 PM

Accepted Solutions (0)

Answers (2)

Answers (2)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

>After creating the service-call in my componentcontroller

What is wrong is that you used the service call wizard. This is a very basic wizard and really only good for simple services when you are first learning Web Dynpro ABAP. You shouldn't come to rely upon it as part of your development tools. It can't for instance handle nested structures as in your example.

You will need to delete the attributes that it created for the substructures and recreate them as nested nodes in the context. You can then either replace the code the wizard generated or try and adjust it. You will need to popuplate the sub-nodes of the context.

You can loop through the parent elements and create child node elements that are dependent upon the parent elements like such:

****Loop Through all the Items
  DATA element_set TYPE wdr_context_element_set.
  DATA ls_product TYPE sdemo_pd_with_price.
  DATA lt_product_name TYPE sdemo_pd_na_tt.
  FIELD-SYMBOLS <wa_set> LIKE LINE OF element_set.
  FIELD-SYMBOLS <wa_item> TYPE sdemo_so_item_all.
  DATA l_tabix TYPE sytabix.
  element_set = lo_nd_sales_items->get_elements( ). "Parent Node - Already Popuplated
  LOOP AT element_set ASSIGNING <wa_set>.  "Loop through each element of parent node
    l_tabix = sy-tabix.
    READ TABLE <wa_so>-t_item ASSIGNING <wa_item> INDEX l_tabix.  "Read corresponding data form itab

*****Load WDCTX_SCHEDULE_LINES
    DATA lo_nd_schedule_lines TYPE REF TO if_wd_context_node.
    DATA lt_schedule_lines TYPE wd_this->elements_schedule_lines.
    lo_nd_schedule_lines = <wa_set>->get_child_node( name = if_componentcontroller=>wdctx_schedule_lines ).
    lt_schedule_lines = <wa_item>-t_sl.
    lo_nd_schedule_lines->bind_table( new_items = lt_schedule_lines set_initial_elements = abap_true ).

  ENDLOOP.

Former Member
0 Kudos

Hi,

thanks to vishal kapoor and thomas jung.

Your tips sound very good! I'm going to try this in the next days and post my experiences here.

Until that point, thanks and best regards

Philipp

Former Member
0 Kudos

Thanks for the tip...

i created a nested structure in my context of a view as well as a GUI-Table in the Layout.

Afterwards i tried to map the table to elements of the context.

If i chose the parent BP_data (see example above) in the wizard (used to map a table to a structure) it doesnt show the nested nodes and their elements.

Former Member
0 Kudos

Finally we decided to build a flat structure.

Former Member
0 Kudos

Hi,

post this question in webdynpro abap forum to get good response. In your question, as per my understanding all the table lines will be different from each other as u have different business partner information. in case of web dynpro the table line type must be same for every row. showing this data in one table seems tricky or not possible.

If you want to create the node hiereachy as you mentioned, create them manually in component controller and do the mapping with importing exporting parameters of your BAPi call.

Regards

Vishal Kapoor

matt
Active Contributor
0 Kudos

Thread moved.