Skip to Content
0
Former Member
Dec 12, 2008 at 04:01 AM

access data in structure

42 Views

Hi,

I am trying to access some data in my structure CRMA_PARTNER.

On doing this i am getting an error:

Field CRMA_PARTNER-PARTNER_NO is unknown.

Following is my code:

method INIT_CHANGEHISTORY.
DATA: lr_ent TYPE REF TO if_bol_bo_property_access,
ls_adminh TYPE crmst_adminh_btil,
lt_ch TYPE crmt_cdorder_alv_tab,
lr_ch TYPE REF TO crmt_cdorder_alv,
ls_ch TYPE crmt_cdorder_alv,
lv_value_node1 TYPE REF TO cl_bsp_wd_value_node,
lv_value_node TYPE REF TO cl_bsp_wd_value_node.

lr_ent = me->typed_context->btadminh->collection_wrapper->get_current( ).
CHECK lr_ent IS BOUND.

lr_ent->get_properties( IMPORTING es_attributes = ls_adminh ).

CALL FUNCTION 'CRM_CDORDER_DISPLAY'
EXPORTING
iv_header_guid = ls_adminh-guid
iv_object = ls_adminh-object_id
iv_bus = ls_adminh-object_type
i_no_dialogue = abap_true
IMPORTING
ausg = lt_ch.

CALL FUNCTION 'CRM_LOG_READ_EXTENDED'
EXPORTING
iv_header_guid = ls_adminh-guid
CHANGING
et_cdorder = lt_ch.

    * removing all item related change logs

DELETE lt_ch WHERE number_int IS NOT INITIAL.

    * show newest entry first

SORT lt_ch BY udate DESCENDING utime DESCENDING.

    * clear old collection

me->typed_context->changehistoryvn->collection_wrapper->clear( ).
DATA :
LV_TABNAME TYPE STRING.

    * create new entities and add them to the collection


CREATE DATA lr_ch.
LOOP AT lt_ch INTO ls_ch.
CREATE OBJECT lv_value_node
EXPORTING
iv_data_ref = lr_ch.
lv_value_node->if_bol_bo_property_access~set_properties( ls_ch ).
LV_TABNAME = LV_VALUE_NODE->GET_PROPERTY_AS_STRING( IV_ATTR_NAME = 'TABNAME' ).
IF LV_TABNAME = 'CRMA_PARTNER'.
LV_PARTNER = CRMA_PARTNER-PARTNER_NO.
ENDIF.
me->typed_context->changehistoryvn->collection_wrapper->add( lv_value_node ).
ENDLOOP.

me->typed_context->changehistoryvn->sort( ). " keep the sorting

endmethod.

Please help!

Any pointers would be highly appreciated.

Thanks and Regards

Shilpi

Edited by: Matt on Dec 12, 2008 10:05 AM - please use tags around your abap