Hi,
I have written a below code in order to create line item/Products for a TPM.
IF lr_core IS BOUND.
TRY.
CALL METHOD lr_core->get_root_entity
EXPORTING
iv_object_name = 'Trade'
iv_object_guid = lv_cgpl_guid
RECEIVING
rv_result = ent.
IF ent IS BOUND.
LOOP AT lt_itab INTO ls_itab.
SELECT SINGLE product_guid FROM comm_product INTO lv_prod_guid WHERE product_id = ls_itab-lv_prod.
IF lv_prod_guid IS NOT INITIAL.
ent_prod = ent->create_related_entity( iv_relation_name = 'TPMProductRel').
CALL METHOD ent_prod->if_bol_bo_property_access~set_property
EXPORTING
iv_attr_name = 'PRODUCT_GUID'
iv_value = lv_prod_guid.
CALL METHOD ent_prod->if_bol_bo_property_access~set_property
EXPORTING
iv_attr_name = 'PRODUCT_ID'
iv_value = ls_itab-lv_prod.
CALL METHOD ent_prod->if_bol_bo_property_access~set_property
EXPORTING
iv_attr_name = 'QUANTITY'
iv_value = ls_itab-lv_quant.
lr_core->modify( ).
lr_transaction = lr_core->get_transaction( ).
lv_success = lr_transaction->save( ).
IF lv_success EQ abap_true.
lr_transaction->commit( ).
ENDIF.
ENDIF.
ENDLOOP.
ENDIF.
The code gets executed successfully but no line item gets added up.
Could anyone please suggest what I am missing or any other way to execute it.
Thanks and Regards,
Ashish Singh.