Code snippet : Fill value is a table view with value node
The code has to be added to DO_PREPARE_OUTPUT method of the impel class of the view .
DATA: lv_collection TYPE REF TO if_bol_bo_col,
entity TYPE REF TO cl_crm_bol_entity.
DATA: lv_mode TYPE char1.
DATA: lr_wrapper TYPE REF TO cl_bsp_wd_collection_wrapper, " BP collection wrapper
lr_entity TYPE REF TO if_bol_bo_property_access, " wrapper entity
lv_bp_nr TYPE string, " BP (business partner) number as string
lv_partner TYPE bu_partner, " BP number in correct format (for RFC call)
ls_smof_erpsh TYPE smof_erpsh, " structure of the RFC destination
lr_col TYPE REF TO if_bol_bo_col, " collection to fill node ZBP_FAVS
lr_valuenode TYPE REF TO cl_bsp_wd_value_node, " value nodes to fill a collection
lr_tabline TYPE REF TO adrc, " table line reference to fill value node
lt_adrc TYPE TABLE OF adrc, " local table with data from ERP-table ZBP_FAVS
ls_adrc TYPE adrc. " local structure of table above
* create collection object to transfer data
CREATE OBJECT lr_col
TYPE
cl_crm_bol_bo_col.
SELECT * FROM adrc INTO TABLE lt_adrc WHERE addrnumber EQ '0000010509'.
* loop through all found data...
LOOP AT lt_adrc INTO ls_adrc.
"...create line object
CREATE DATA lr_tabline.
"...create value object with current line for colleciton
CREATE OBJECT lr_valuenode
EXPORTING
iv_data_ref = lr_tabline.
"...set current line data
lr_valuenode->set_properties( ls_adrc ).
"...add current line to collection
lr_col->add( lr_valuenode ).
ENDLOOP.
* set collection
me->typed_context->bpaddress->set_collection( lr_col ).
DATA: lv_collection TYPE REF TO if_bol_bo_col,
entity TYPE REF TO cl_crm_bol_entity.
DATA: lv_mode TYPE char1.
DATA: lr_wrapper TYPE REF TO cl_bsp_wd_collection_wrapper, " BP collection wrapper
lr_entity TYPE REF TO if_bol_bo_property_access, " wrapper entity
lv_bp_nr TYPE string, " BP (business partner) number as string
lv_partner TYPE bu_partner, " BP number in correct format (for RFC call)
ls_smof_erpsh TYPE smof_erpsh, " structure of the RFC destination
lr_col TYPE REF TO if_bol_bo_col, " collection to fill node ZBP_FAVS
lr_valuenode TYPE REF TO cl_bsp_wd_value_node, " value nodes to fill a collection
lr_tabline TYPE REF TO adrc, " table line reference to fill value node
lt_adrc TYPE TABLE OF adrc, " local table with data from ERP-table ZBP_FAVS
ls_adrc TYPE adrc. " local structure of table above
* create collection object to transfer data
CREATE OBJECT lr_col
TYPE
cl_crm_bol_bo_col.
SELECT * FROM adrc INTO TABLE lt_adrc WHERE addrnumber EQ '0000010509'.
* loop through all found data...
LOOP AT lt_adrc INTO ls_adrc.
"...create line object
CREATE DATA lr_tabline.
"...create value object with current line for colleciton
CREATE OBJECT lr_valuenode
EXPORTING
iv_data_ref = lr_tabline.
"...set current line data
lr_valuenode->set_properties( ls_adrc ).
"...add current line to collection
lr_col->add( lr_valuenode ).
ENDLOOP.
* set collection
me->typed_context->bpaddress->set_collection( lr_col ).
Post a Comment