Skip to Content
-1
Sep 09, 2023 at 12:03 PM

Send data into object cl_bsp_wd_collection_wrapper when its initial.

154 Views Last edit Sep 11, 2023 at 01:28 AM 2 rev

Hi Experts,

I have my code as below:

lr_current is turning out to be intial and is throwing an exception which i want to avoid.

I need to pass some data into this lr_current when it is initial to avoid this?

data: lr_current        TYPE REF TO if_bol_bo_property_access,
	lr_coll_wrapper   TYPE REF TO cl_bsp_wd_collection_wrapper.


            TRY.
                  lr_current ?= lr_coll_wrapper->get_current( ).
                 CHECK lr_current IS BOUND.
                  DATA : lv_country TYPE string.
                  lv_country =  lr_current->get_property_as_string( iv_attr_name = 'COUNTRY' ).
                  IF lv_country is INITIAL.
                     lr_current->set_property( iv_attr_name = 'COUNTRY' iv_value = 'US' ).
                  ENDIF.

             CATCH cx_sy_move_cast_error.
endtry.

Can any one pls suggest?