on 10-28-2013 8:43 PM
Hi Experts,
My task is to add a new line item to item assignment block in sales order. My logic should be in event handler method since its based on button click.
I am able to add line item with product id and I am facing issue while adding the quantity to line item. Below is the code snippet I am using.
Component/View: BT115IT_SLSO/Items
The quantity field is not filled in web-ui from above code. Please suggest me how to add the quantity to line item.
Thanks,
Vignesh
Hi,
Just get the instance of the core and try bol core modify, so that the entered changes will be updated in the genil as well.
data: Lr_core type ref to cl_crm_bol_core.
lr_core = cl_crm_bol_core=>.get_instance.
lr_core->modify( ).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vignesh,
I am also having similar requirement, where I need to add line items to my Sales Order document.
I could see the items getting added to my context node collection wrapper in debugging, but could see the lines displayed in my Sales order.
Can you please put your entire code snippet, how you have solved your issue. This will be a great help.
Thank You.
Suprita.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
below is the code that is used to add item and it's quantity,
lr_core = cl_crm_bol_core=>get_instance( ).
lr_cw_parent = get_collection_wrapper( gc_context_node_parent ).
check lr_cw_parent is bound.
lr_parent ?= lr_cw_parent->get_current( ).
check lr_parent is bound.
lr_cw = get_collection_wrapper( gc_context_node_admini ).
loop at lt_item into ls_item.
clear: lr_ent.
lr_ent = lr_parent->create_related_entity( gv_item_relation ).
lr_ent->set_property_as_string( exporting iv_attr_name = 'ORDERED_PROD' iv_value = ls_item-item ).
try.
lr_collection = lr_ent->get_related_entities(
iv_relation_name = 'BTItemSchedlinExt' ).
lr_current = lr_collection->get_current( ).
if lr_current is not bound and lr_ent->is_changeable( ) = abap_true.
lr_current = lr_ent->create_related_entity( iv_relation_name = 'BTItemSchedlinExt' ).
endif.
lr_ent ?= lr_current.
lr_collection = lr_ent->get_related_entities(
iv_relation_name = 'BTSchedlinFirst' ).
lr_current = lr_collection->get_current( ).
if lr_current is not bound and lr_ent->is_changeable( ) = abap_true.
lr_current = lr_ent->create_related_entity( iv_relation_name = 'BTSchedlinFirst' ).
endif.
lr_ent ?= lr_current.
clear: lv_qty.
try.
move ls_item-qty to lv_qty.
catch cx_sy_conversion_error.
endtry.
lr_ent->set_property( iv_attr_name = 'QUANTITY' iv_value = lv_qty ).
lr_collection->add( lr_ent ).
lr_collection->publish_current( ).
* lr_core->modify( ).
catch cx_crm_genil_model_error cx_sy_ref_is_initial cx_sy_move_cast_error.
endtry.
Thanks ,
Vignesh
Hi Vigneshwaran G,
I have seen the thread which is some what similar like my requirement.
Please can you share your code or the way you have solved your issue, i am facing similar issue as i have to create a new line item in the same document.
Req: I have to validate a item field on which the value is not initial then i have to create a new line item with all the value same as the parent item.
if possible can you share it.
Email: vamshi_naik@outlook.com
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
7 | |
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.