码迷,mamicode.com
首页 > 数据库 > 详细

SAP CRM订单数据库表CRMD_SHIPPING的填充原理

时间:2020-08-27 13:16:04      阅读:63      评论:0      收藏:0      [点我收藏+]

标签:ltm   custom   prot   done   main   single   ret   not   link   

In my recent project I need to figure out the logic how fields in table CRMD_PRICING are populated.

Take several of them highlighted below for example:

技术图片

Here is the test data I used to demonstrate the scenario.

I have created a corporate account which is assigned to Sales Organization O 50000732, Distribution Channel 01, Division 02.

技术图片

And in Pricing->Pricing in the Business Transaction->Determine Pricing Procedures, I maintain a corresponding determination procedure:

技术图片
技术图片

The document pricing procedure for my own transaction type ZSRV is maintained as S:

技术图片

For customer pricing procedure flag, it is maintained in the sales data in my corporate account:

技术图片

So far all customizing are done.
Now create a new Service order, enter that corporate account as Sold-to Party:

技术图片

function module CRM_PRICING_PARTNER_CHANGE_EC will be called.

Inside it CRM_PRICING_MERGE_FROM_BUPA_OW will be called to get the pricing data from that corporate account.

技术图片

Those data are read from account and stored in variable ls_data:

技术图片
技术图片

Later they are copied to pricing workarea field by field:

技术图片

This is how pricing set is created.
Once you saved the service order successfully,

技术图片

Execute the report below to directly print out the data in CRMD_SHIPPING which belongs to this service order:

技术图片

REPORT tool_display_order_price_head.

PARAMETERS: objid TYPE crmd_orderadm_h-object_id OBLIGATORY DEFAULT ‘5700000507‘,
             obtype TYPE crmd_orderadm_h-process_type OBLIGATORY DEFAULT ‘SRVO‘.

SELECT SINGLE guid INTO @DATA(lv_guid) FROM crmd_orderadm_h
    WHERE object_id = @objid AND process_type = @obtype.

IF sy-subrc <> 0.
  WRITE:/ ‘ Service Order does not exist‘.
  RETURN.
ENDIF.

SELECT SINGLE * INTO @DATA(ls_link) FROM crmd_link
   WHERE guid_hi = @lv_guid AND objtype_hi = ‘05‘ AND objtype_set = ‘09‘.

IF sy-subrc <> 0.
  WRITE:/ ‘no price data exists for this order‘.
  RETURN.
ENDIF.

SELECT SINGLE * INTO @DATA(ls_price) FROM crmd_pricing
   WHERE guid = @ls_link-guid_set.

IF sy-subrc <> 0.
  WRITE:/ ‘no price data exists for this order‘.
  RETURN.
ENDIF.

cl_crm_1order_set_print_tool=>print_structure( ls_price ).

Source code of CL_CRM_1ORDER_SET_PRINT_TOOL:

CLASS cl_crm_1order_set_print_tool DEFINITION
  PUBLIC
  FINAL
  CREATE PUBLIC .
  PUBLIC SECTION.
    CLASS-METHODS print_structure
      IMPORTING
        !is_data TYPE any .
  PROTECTED SECTION.
  PRIVATE SECTION.
ENDCLASS.

CLASS CL_CRM_1ORDER_SET_PRINT_TOOL IMPLEMENTATION.
  METHOD print_structure.
    DATA(lo_struct_descr) = CAST cl_abap_structdescr( cl_abap_datadescr=>describe_by_data( is_data ) ).
    DATA(lt_comp) = lo_struct_descr->components.
    DO.
      ASSIGN COMPONENT sy-index OF STRUCTURE is_data TO FIELD-SYMBOL(<data>).
      IF sy-subrc <> 0.
        RETURN.
      ENDIF.
      READ TABLE lt_comp ASSIGNING FIELD-SYMBOL(<comp>) INDEX sy-index.
      IF <data> IS NOT INITIAL.
         DATA(lv_color) = sy-index MOD 4.
         DATA(lv_print) = |Field: { <comp>-name }, value: { <data> } |.
         CASE lv_color.
            WHEN 0.
              WRITE: / lv_print  COLOR COL_NEGATIVE.
            WHEN 1.
              WRITE: / lv_print  COLOR COL_POSITIVE.
            WHEN 2.
              WRITE: / lv_print  COLOR COL_GROUP.
            WHEN 3.
              WRITE: / lv_print  COLOR COL_KEY.
         ENDCASE.
      ENDIF.
    ENDDO.
  ENDMETHOD.
ENDCLASS.

要获取更多Jerry的原创文章,请关注公众号"汪子熙":
技术图片

SAP CRM订单数据库表CRMD_SHIPPING的填充原理

标签:ltm   custom   prot   done   main   single   ret   not   link   

原文地址:https://www.cnblogs.com/sap-jerry/p/13544861.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!