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

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:

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

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.

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

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

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

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

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

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

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

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

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

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.

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

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

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

Later they are copied to pricing workarea field by field:

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

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

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

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

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

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的填充原理

上一篇:SAP WebClient UI One Hit Navigation的实现方法


下一篇:移植lvgl图形库