Hi.
I am trying to create an order from a previous selection. The order is getting created with the item, but the quantity is coming through as 0.
This is the code that I am using. Can anyone tell me what it is that I need to change to make this work?
lr_col_wrapper2 = lr_comp1->typed_context->productacc->collection_wrapper->get_marked( ).
ENDIF.
CHECK lr_adminh IS BOUND.
lr_btitemext ?= lr_adminh->get_related_entity( iv_relation_name = 'BTHeaderItemsExt').
IF lr_btitemext IS NOT BOUND.
lr_btitemext ?= lr_adminh->create_related_entity( iv_relation_name = 'BTHeaderItemsExt' ).
ENDIF.
lr_btitemall ?= lr_btitemext->get_related_entity( iv_relation_name = 'BTOrderItemAll').
IF lr_btitemall IS NOT BOUND.
lr_btitemall ?= lr_btitemext->create_related_entity( iv_relation_name = 'BTOrderItemAll' ).
ENDIF.
IF lr_col_wrapper2 IS BOUND.
lr_entity2 ?= lr_col_wrapper2->get_first( ).
WHILE lr_entity2 IS BOUND.
lv_item = lr_entity2->get_property_as_string( iv_attr_name = 'PRODUCT_ID' ).
lv_item_dis = lr_entity2->get_property_as_string( iv_attr_name = 'DESCRIPTION' ).
* lv_item_qty = lr_entity2->get_property_as_string( iv_attr_name = 'MINQUAN' ).
lv_item_qty = lr_entity2->get_property_as_string( iv_attr_name = 'BASE_QTY' ).
IF lv_item IS NOT INITIAL.
lr_btitemall ?= lr_btitemext->create_related_entity( iv_relation_name = 'BTOrderItemAll' ).
lr_btitemall->set_property_as_string( iv_attr_name = 'ORDERED_PROD' iv_value = lv_item ).
typed_context->btadmini->collection_wrapper->add( lr_btitemall ).
***************************
lr_itemschd ?= lr_btitemall->get_related_entity( iv_relation_name = 'BTItemSchedlinExt' ).
IF lr_itemschd IS NOT BOUND.
lr_itemschd ?= lr_btitemall->create_related_entity( iv_relation_name = 'BTItemSchedlinExt' ).
ENDIF.
* lr_schdall ?= lr_itemschd->get_related_entity( iv_relation_name = 'BTSchedlinAll' ).
lr_schdall ?= lr_itemschd->get_related_entity( iv_relation_name = 'BTSchedlinFirst' ).
IF lr_schdall IS NOT BOUND.
* lr_schdall ?= lr_itemschd->create_related_entity( iv_relation_name = 'BTSchedlinAll' ).
lr_schdall ?= lr_itemschd->create_related_entity( iv_relation_name = 'BTSchedlinFirst' ).
ENDIF.
lr_schdall->set_property_as_string( iv_attr_name = 'QUANTITY' iv_value = lv_item_qty ).
typed_context->btadmini->collection_wrapper->add( lr_schdall ).
ENDIF.
lr_entity2 ?= lr_col_wrapper2->get_next( ).
ENDWHILE.
Endif.
lr_core = cl_crm_bol_core=>get_instance( ).
lr_core->modify( ).
lr_root ?= lr_adminh->get_root( ).
lr_tx = lr_root->get_transaction( ).
CHECK lr_tx IS BOUND.
IF ( lr_tx->check_save_needed( ) EQ abap_true ).
IF lr_tx->check_save_possible( ) EQ abap_true.
TRY.
lv_success = lr_tx->save( ).
CATCH cx_crm_bol_duplicate_save.
ENDTRY.
IF NOT lv_success IS INITIAL.
lr_tx->commit( ).
ENDIF.
ENDIF.
lr_adminh->reread( ).
Thank you SO much!
Wendy