cancel
Showing results for 
Search instead for 
Did you mean: 

Remove the automatically inserted empty row in web ui.

Former Member
0 Kudos

Hi Experts,

I am new to Web UI and I would need your help with the following situation.

Once I press the edit button on the main page, a new row gets generated into the assignment block from the screenshot.

I have checked the methods from the view of the assignment block but I couldn't identify any logic for the addition of that line.

Now I want that line to not be generated.


Can you help me with any suggestions where should I look at or what needs to be done?


Thank you and appreciate your help.


Best regards,

Elena

Accepted Solutions (1)

Accepted Solutions (1)

navn_metts
Active Participant
0 Kudos

Hello Elena,

you can impllement your logic in the DO_PREPARE_OUTPUT method of that contract approvals view.

Step1: Initially check the view is in editable mode.

Step2: If the view is in editable mode read the collection.

Step3: Read each entity of the collection and check for the empty line (like Approval loop is initial and Approval status is initial). And delete that entity from the collection.

Br,

Navn

Former Member
0 Kudos

Hi Naveen,

Thank you for your answer, appreciate it.

Do you have perhaps a sample code for the above steps?

Something I can use as reference?

Thank you.

Best regards,

Elena

former_member210661
Active Contributor
0 Kudos

Hi Elena,

I am giving ex code for steps which is mentioned by naveen.

Step1: Initially check the view is in editable mode.


data : lr_cuco type ref to custom controller class ,
         lr_rootnode type ref to cl_crm_bol_entity.

         lr_cuco ?= get_custom_controller( controller_id = 'your CuCo' ).

         lr_rootnode ?= lr_cuco->typed_context->rootnode->collection_wrapper->get_current( ).

         if lr_rootnode->lock( ) = abap_true.

Step2: If the view is in editable mode read the collection.


read your contract approval node.

           lr_coll ?= me->typed_context->contract approl node->collection_wrapper.

lr_entity ?= lr_coll->get_first().

while lr_entity is bound.


Step3: Read each entity of the collection and check for the empty line (like Approval loop is initial and Approval status is initial). And delete that entity from the collection.


lr_entity->get_property_as_string( iv_attr_name = 'yourfieldname' ).


if yourfieldname is not initial.

lr_entity->get_next( ).

else.

lr_col->remove(lr_entity ).

lr_entity->get_next ( ).

endif.

endwhile.


try this logic this will work.


Thanks & Regards,

Srinivas.

Former Member
0 Kudos

Hi Srinivas,

Just now, I have seen your code.

Thank you for your answer.

Have a lovely day ahead!

Best,

Elena

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

I managed to do it using your advice.

Below is the used code:

DATA : lr_iterator    TYPE REF TO if_bol_bo_col_iterator,

           lt_empty_lines TYPE TABLE OF REF TO cl_crm_bol_entity,

           lv_edit        TYPE string.

  lv_edit = me->view_group_context->is_view_in_display_mode( me ).

    IF lv_edit EQ ABAP_FALSE.

       lr_iterator = me->typed_context->zbtx_ctr_appr->collection_wrapper->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.

    me->typed_context->zbtx_ctr_appr->collection_wrapper->remove( lr_entity ).

    lr_entity->delete( ).

ENDLOOP.

  ENDIF.

Thank you.

Have a lovely day ahead!

Best,

Elena