cancel
Showing results for 
Search instead for 
Did you mean: 

populating table displayed in view

former_member203480
Participant
0 Kudos

trying to populate values into a table that is being displayed in the view

iam using the value node

iam writing this logic in do_prepare_output

TYPES: BEGIN OF ltype_attr_struct,

          reason TYPE char80,

          answered TYPE char80,        

          END OF ltype_attr_struct.

DATA: DATA: lwa_struct TYPE  ltype_attr_struct,

          lwa_table TYPE TABLE OF ltype_attr_struct,

    lwa_struct-answered = 'YES'.

    lwa_struct-reason = 'going overseas'.

    APPEND lwa_struct TO lwa_table.

     lwa_struct-answered = 'YES'.

    lwa_struct-reason = 'returning back'.

    APPEND lwa_struct TO lwa_table.

lwa_struct-answered = 'NO'.

    lwa_struct-reason = 'frequent travel'.

    APPEND lwa_struct TO lwa_table.

I WANT TO POPULATE THIS TABLE LWA_TABLE INTO THE TABLE DISPLAYED IN THE VIEW

IF I WANT TO POPULATE SINGLE RECORD IAM USING THIS

lr_entity = typed_context->declineconditions->collection_wrapper->get_current( ).

lr_entity->set_properties( EXPORTING is_attributes = lwa_struct ).

BUT I WANT TO POPULATE MULTIPLE RECORDS

REGARDS

LUXMI

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

You can try below piece of logic.

  1. TYPES: BEGIN OF str, 
  2.               status TYPE char20, 
  3.             END OF str. 
  4. * Structure of status context node. 
  5. DATA  lr_struct_ref    TYPE REF TO str. 
  6. * Structure of your context node 
  7. data  ls_struct    type  str,
  8.         lt_struct type standard table of str.
  9. DATA lr_value_node    TYPE REF TO cl_bsp_wd_value_node. 
  10. CREATE DATA lr_struct_ref. 
  11. Loop at lt_struct into ls_struct.
  12. CREATE OBJECT lr_value_node 
  13.    EXPORTING 
  14.      iv_data_ref = lr_struct_ref. 
  15. ls_struct-status = 'Your Value'. 
  16. lr_value_node->if_bol_bo_property_access~set_properties( ls_struct ). 
  17. endloop.
  18. *Add Value Node to a collection 
  19. typed_context->testnode->collection_wrapper->add( lr_value_node ). 

Regards,

Amrit

former_member203480
Participant
0 Kudos

Hi amrit,

i have added the below code  as mentioned

LOOP AT lwa_table INTO lwa_struct.

       GET REFERENCE OF lwa_struct INTO lt_table.

       CREATE OBJECT lv_entity

         EXPORTING

           iv_data_ref = lt_table.

*    set the data into value node

       lv_entity->if_bol_bo_property_access~set_properties( EXPORTING is_attributes = lwa_struct ).

       "add node to the collection

       if lv_entity is bound.

       me->typed_context->declineconditions->collection_wrapper->add( lv_entity ).

       endif.

       CLEAR lwa_struct.

     ENDLOOP.


it is populating the table displayed with records. but the first  record in teh displayed  is blank.

how to get rid of this blank record.pls let me know

thanks&regards

luxmi

deepika_chandrasekar
Active Contributor
0 Kudos

Hi Luxmi,

Check IF_BSP_MODEL~INIT method in context node .

There one empty entity will be added in context node.comment that code and check

Regards,

Deepika.

former_member203480
Participant
0 Kudos

thanks deepika i have commented the code and its working

regards

luxmi

Answers (1)

Answers (1)

dharmakasi
Active Contributor
0 Kudos

Hi Luxmi,

This is a very basic issue and you can find many threads related to this requirement. Please search forum before posting question.You may not get direct answer but there will be helpful answers.

Best Regards,

Dharmakasi.