\*&---------------------------------------------------------------------\*
\*& Report ZHANA\_PRODUCT\_SEARCH
\*&
\*&---------------------------------------------------------------------\*
\*&
\*&
\*&---------------------------------------------------------------------\*
REPORT zassign\_ip.
PARAMETERS: prod type comm\_product-product\_id OBLIGATORY DEFAULT '5600000010',
order TYPE CRMD\_ORDERADM\_H-object\_id.
DATA: lo\_core TYPE REF TO cl\_crm\_bol\_core,
lo\_collection TYPE REF TO if\_bol\_entity\_col,
lv\_query\_name TYPE crmt\_ext\_obj\_name,
lt\_selection\_parameter TYPE genilt\_selection\_parameter\_tab,
ls\_selection\_parameter TYPE genilt\_selection\_parameter,
ls\_query\_parameters TYPE genilt\_query\_parameters.
ls\_selection\_parameter-attr\_name = 'OBJECTID'.
ls\_selection\_parameter-option = 'EQ'.
ls\_selection\_parameter-sign = 'I'.
ls\_selection\_parameter-low = order.
APPEND ls\_selection\_parameter TO lt\_selection\_parameter.
ls\_query\_parameters-max\_hits = 1.
lv\_query\_name = 'BTAdvQueryAUI'.
lo\_core = cl\_crm\_bol\_core=>get\_instance( ).
lo\_core->load\_component\_set( 'BT' ).
lo\_collection = lo\_core->dquery(
iv\_query\_name = lv\_query\_name
it\_selection\_parameters = lt\_selection\_parameter
is\_query\_parameters = ls\_query\_parameters ).
DATA(lo\_contract) = lo\_collection->get\_current( ).
CHECK lo\_contract IS NOT INITIAL.
DATA(locked) = lo\_contract->lock( ).
CHECK locked = 'X'.
DATA(lr\_item\_handler) = cl\_crm\_ipm\_item\_handler\_provid=>get\_instance( lo\_contract ).
ASSERT lr\_item\_handler IS NOT INITIAL.
lv\_query\_name = 'ProdAdvSearchRgProducts'.
CLEAR: lt\_selection\_parameter.
ls\_selection\_parameter-attr\_name = 'PRODUCT\_ID'.
ls\_selection\_parameter-option = 'EQ'.
ls\_selection\_parameter-sign = 'I'.
ls\_selection\_parameter-low = prod.
APPEND ls\_selection\_parameter TO lt\_selection\_parameter.
lo\_core->load\_component\_set( 'PROD\_ALL' ).
lo\_collection = lo\_core->dquery(
iv\_query\_name = lv\_query\_name
it\_selection\_parameters = lt\_selection\_parameter
is\_query\_parameters = ls\_query\_parameters ).
DATA(lo\_product) = lo\_collection->get\_current( ).
ASSERT lo\_product IS NOT INITIAL.
DATA(result) = lr\_item\_handler->create\_ip( lo\_product ).
ASSERT result IS NOT INITIAL.
DATA(lo\_transaction) = lo\_core->get\_transaction( ).
lo\_core->modify( ).
DATA(lv\_changed) = lo\_transaction->check\_save\_needed( ).
CHECK lv\_changed EQ abap\_true.
DATA(lv\_success) = lo\_transaction->save( ).
IF lv\_success = abap\_true.
lo\_transaction->commit( ).
WRITE:/ 'IP Assigned Successfully'.
ELSE.
lo\_transaction->rollback( ).
WRITE: / 'IP Assigned failed'.
ENDIF.
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。