Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

CRM WebUI - Service Order - Item Quantity

Hi experts!

I'm try to reach the field quantity in one row of service order item table, the goal is fill this field and other with a button.

I can get the others fields with no problems but, the column quantity is not in the attribute structure of the component node itself in runtime mode ( i can see it in the attributes of the context node of the BOL BTAdminI from tx BSP_WD_CMPWB )

I try with the follow code

TYPES: BEGIN OF ltype_attr_struct,
             quantity TYPE crmt_schedlin_quan,z
             END OF ltype_attr_struct.

  DATA:
      lr_admini   TYPE REF TO if_bol_bo_property_access,
      lr_ordpro   TYPE REF TO crmt_ordered_prod,
      lr_cw       TYPE REF TO cl_bsp_wd_collection_wrapper,
      lr_col      TYPE REF TO if_bol_bo_col,
      lr_msg_srv  TYPE REF TO cl_bsp_wd_message_service,
      lr_mixed_wrapper          TYPE REF TO cl_bsp_wd_2collection_wrapper,
      lr_mixed_node             TYPE REF TO cl_bsp_wd_mixed_node,
      lr_model_node             TYPE REF TO cl_crm_bol_entity,
      ls_mixed_node_attr        TYPE        ltype_attr_struct,
      lr_mixed_node_attr_ref    TYPE REF TO ltype_attr_struct,
      lv_quantity               TYPE crmt_schedlin_quan,
      lcn_btschedlin         TYPE REF TO cl_bsp_wd_context_node
        .


 TRY.

     CHECK me->is_entity_changeable( ) = abap_true.

* copy current selected item
      lr_cw       = get_collection_wrapper( gc_context_node_admini ).
      lr_cw_items = get_collection_wrapper( gc_context_node_items ).

      CHECK lr_cw IS BOUND AND lr_cw_items IS BOUND.

      lr_col      = lr_cw->get_marked( ).


      CHECK lr_col IS BOUND.

        lr_admini ?= lr_col->get_first( ).

      WHILE lr_admini IS BOUND.

*** create mixed node to save additional information
      CREATE OBJECT lr_mixed_node
        EXPORTING
          iv_struct     = ls_mixed_node_attr
          iv_model_node = lr_admini.


        lr_mixed_node->IF_BOL_BO_PROPERTY_ACCESS~set_property_as_string( iv_attr_name = 'ORDERED_PROD'
                                           iv_value     =  '320'
                                         ).

        lr_mixed_node->if_bol_bo_property_access~set_property( iv_attr_name = 'QUANTITY'
                                    iv_value     =   lv_quantity
                                                                   ).

*   create collection wrapper
        CREATE OBJECT lr_mixed_wrapper TYPE cl_bsp_wd_2collection_wrapper.

*   set value attribute structure
        CREATE DATA lr_mixed_node_attr_ref.

        lr_mixed_wrapper->set_value_struct( lr_mixed_node_attr_ref ).

* set mixed node to wrapper
        CALL METHOD lr_mixed_wrapper->add
          EXPORTING
            iv_entity = lr_mixed_node.

        lr_admini ?= lr_col->get_next( ).

      ENDWHILE.

but when i debugg it, the property is not reached.... in the col entity i can find the attibute in this path into lr_cw ( context node BTAdminI )

lr_cw = get_collection_wrapper( gc_context_node_admini ).

-ENTITY_LIST

-ENTITY_LIST[1]-BO

-OBJECT_MODEL

-PROPERTIES_TAB

-PROPERTIES_TAB[344]-PROPERTIES

-ATTRIBUTES

QUANTITY CRMT_SCHEDLIN_QUAN 10

Someone can tell me how to set this value ?

Best Regards

Martin Aguirre

Edited by: Martin Aguirre on Mar 16, 2010 4:28 PM

Edited by: Martin Aguirre on Mar 16, 2010 4:37 PM

Tags:
replied

Hi Martin,

You can see the quantity field under the BTAdminI context node because, a model node allows adding attributes that belongs to "Relations". Quantity comes from a BOL relation. This attribute does not belong to the BTAdminI strcture. As to your problem, you should access the quantity entity via relations. Look at the SET_QUANTITY method in the BTAdminI context node class to find out how to set item quantity.

With that away, I'm not sure what these mixed nodes are for. As far as I see, all your needs can be taken care of using bol entity types(cl_crm_bol_entiy).

Regards,

Arun Prakash

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question