on 06-09-2014 7:58 AM
Hi Experts,
When i am reading 'BTAdminI' context node data, I am getting empty lines along with data. I can able to delete only one empty lines when its executing second empty line its failing in loop. Can you suggest me how can i delete multiple empty lines. I am using below code.
DATA: lr_entity1 TYPE REF TO cl_crm_bol_entity,
lr_current TYPE REF TO if_bol_bo_property_access,
lr_iterator TYPE REF TO if_bol_bo_col_iterator,
lv_strukname TYPE strukname,
dref TYPE REF TO data,
lv_thtmlb_tableview TYPE REF TO cl_thtmlb_table_view,
lr_cn TYPE REF TO cl_bsp_wd_context_node_tv,
cr_mixed_node_tv TYPE REF TO cl_bsp_wd_mixed_node.
FIELD-SYMBOLS: <fs_line_structure> TYPE data.
lr_iterator = me->typed_context->btadmini->collection_wrapper->get_iterator( ).
TRY.
lr_current = lr_iterator->get_first( ).
CATCH cx_root.
ENDTRY.
WHILE lr_current IS BOUND.
lr_entity1 ?= lr_current.
CHECK lr_entity1 IS BOUND.
lr_entity1->get_attr_struct_name( RECEIVING rv_result = lv_strukname ).
IF lv_strukname IS NOT INITIAL.
CREATE DATA dref TYPE (lv_strukname).
ASSIGN dref->* TO <fs_line_structure>.
IF <fs_line_structure> IS ASSIGNED.
lr_current->get_properties( IMPORTING es_attributes = <fs_line_structure> ).
IF <fs_line_structure> IS INITIAL.
me->typed_context->btadmini->collection_wrapper->remove( lr_current ).
EXIT.
ENDIF.
ENDIF.
ENDIF.
TRY.
lr_current = lr_iterator->get_next( ).
CATCH cx_root.
ENDTRY.
ENDWHILE.
Hi Nitish,
I just curious to know why would you use EXIT statement after deleting first empty line?
System will not continue the loop after deleting the first empty line.
Regards,
Dharmakasi.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nitish,
Try below code instead of your code,
Data:
lt_empty_lines TYPE TABLE OF REF TO cl_crm_bol_entity,
lr_entity TYPE REF TO cl_crm_bol_entity.
After getting collection from BTadmini use the below code.
lr_iterator ?= lr_coll->get_iterator( ).
lr_entity ?= lr_iterator->get_first( ).
WHILE lr_entity IS BOUND.
IF lr_entity->is_send_active( ) EQ abap_false.
APPEND lr_entity TO lt_empty_lines.
ENDIF.
lr_entity ?= lr_iterator->get_next( ).
ENDWHILE.
LOOP AT lt_empty_lines INTO lr_entity.
typed_context->btadmini->collection_wrapper->remove( lr_entity ).
lr_entity->delete( ).
ENDLOOP.
Best Regards,
Dharmakasi.
Hi ,
Use below statement before endwhile:
UNASSIGN <fs_line_structure>.
ENDWHILE.
Thanks
Kumar Gaurav
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
8 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.