当前位置:Gxlcms > 数据库问题 > SAP CRM订单数据库表CRMD_SHIPPING的填充原理

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

时间:2021-07-01 10:21:17 帮助过:44人阅读

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   

人气教程排行