on 11-15-2010 12:58 PM
Hi,
i m implementing CRM_COND_COM_BADI for pricing. Since in the item structure there is not quantity i m trying to get it from BOL model
I wrote down this code
-
method IF_EX_CRM_COND_COM_BADI~ITEM_COMMUNICATION_STRUCTURE.
BREAK DOMINO.
data:
ZZMVGR1 type MVGR1,
ZZMVGR2 type MVGR2,
ZZMVGR3 type MVGR3,
ZZMVGR4 type MVGR4,
ZZKWMENG type KWMENG.
data:
LO_CORE type ref to CL_CRM_BOL_CORE,
LO_ENTITY type ref to CL_CRM_BOL_ENTITY,
LO_ACTIV type ref to CL_CRM_BOL_ENTITY,
LX_ROOT type ref to CX_ROOT,
LV_UCID type STRING,
LV_TYPE type STRING,
LS_ACTIV type CRMST_ACTIVITYH_BTIL,
LO_TRX type ref to IF_BOL_TRANSACTION_CONTEXT,
LR_COLLECTION type ref to IF_BOL_BO_COL,
CURRENT type ref to IF_BOL_BO_PROPERTY_ACCESS,
DREF type ref to CRMT_SCHEDLIN_QUAN.
BREAK DOMINO.
LO_CORE = CL_CRM_BOL_CORE=>GET_INSTANCE( ).
LO_CORE->START_UP( 'ONEORDER' ).
LO_ENTITY ?= LO_CORE->GET_ROOT_ENTITY( IV_OBJECT_NAME = 'BTAdminI'
IV_OBJECT_GUID = CS_ACS_I_COM-GUID ).
try.
LR_COLLECTION = LO_ENTITY->GET_RELATED_ENTITIES(
IV_RELATION_NAME = 'BTItemSchedlinExt' ).
CURRENT = LR_COLLECTION->GET_CURRENT( ).
if CURRENT is not bound and LO_ENTITY->IS_CHANGEABLE( ) = ABAP_TRUE.
CURRENT = LO_ENTITY->CREATE_RELATED_ENTITY( IV_RELATION_NAME = 'BTItemSchedlinExt' ).
endif.
catch cx_crm_genil_model_error cx_sy_ref_is_initial.
endtry.
-
but
LO_ENTITY ?= LO_CORE->GET_ROOT_ENTITY( IV_OBJECT_NAME = 'BTAdminI'
IV_OBJECT_GUID = CS_ACS_I_COM-GUID ).
is not getting value when I run UI.
The same code is running quite good (quantity is not update when i change values)
Any help???
Hi,
I would suggest to use the CRM_ORDER_READ function module instead or the CRM_SCHEDLIN_I_READ_OW to read the data in the context of the BADI.
Best Regards,
Michael
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
BTW,
i changed the code in this way
LO_CORE = CL_CRM_BOL_CORE=>GET_INSTANCE( ).
LO_CORE->START_UP( 'ONEORDER' ).
LO_ENTITY ?= LO_CORE->GET_ROOT_ENTITY( IV_OBJECT_NAME = 'BTOrder'
IV_OBJECT_GUID = CS_ACS_I_COM-HEADER_GUID ).
LO_ENTITY ?= LO_ENTITY->GET_RELATED_ENTITY( IV_RELATION_NAME = 'BTOrderHeader' ).
LO_ENTITY ?= LO_ENTITY->GET_RELATED_ENTITY( IV_RELATION_NAME = 'BTHeaderItemsExt' ).
LR_COLLECTION ?= LO_ENTITY->GET_RELATED_ENTITIES( IV_RELATION_NAME = 'BTOrderItemAll' ).
create object test.
TEST->set_collection( collection = LR_COLLECTION ).
QUANTITY = TEST->GET_QUANTITY( ATTRIBUTE_PATH = '' ).
-
In debug mode I obtain quanity correctly for twice changes...from the third one the quantity value is valued as 0
Can someone help me to understand why?
User | Count |
---|---|
3 | |
1 | |
1 | |
1 | |
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.