Quantcast
Channel: SCN : All Content - SAP CRM: Marketing
Viewing all articles
Browse latest Browse all 1578

Purchasing from Marketing project

$
0
0

Hi.

 

We are implementing BADI CRM_MKTPL_PURCHASE to change distribution type of Purchase Requisition before it is created.

 

Method: IF_BADI_CRM_MKTPL_PURCHASE~CHANGE_DATA (add, delete or change item parameter).

 

In BADI implementation we change:

Item Data:

Internal table ct_item_data
      <fs_item_data>-twrkz = '2'. "Partial Invoice Indicator (Value 2 = Apportion IR quantities to GR quantities proportionately)
      <fs_item_data>-vrtkz = '2'. "Distribution Indicator for Multiple Account Assignment (Value 2 = Distribution by percentage)
      <fs_item_data>-repos = 'X'. "Invoice Receipt Indicator.

 

Internal table: ct_itemx_data

      <fs_itemx_data>-vrtkz = abap_true.
      <fs_itemx_data>-twrkz = abap_true.
      <fs_itemx_data>-repos = abap_true.

 

Account Asigment come in with 1 record per item, we are create new position to set a distribution of 40% and 60% per Cost Ctr but it always return messages: Sum of percentages >60.0< smaller than 100 % to CRM.

 

Ithink he justtakes thelast position, because if i change % to 10% and 90%, return error Sum of percentages >90.0< smaller than 100 % to CRM.

 

Any ideahow to solve it? I think itis anapplicationerror in FM CRS_PURCHASE_PROXY_PROCESS, but i'm not sure.

 

Code in method is:

[CODE]

    FIELD-SYMBOLS: <fs_item_data>  TYPE crms_mktpl_mereq_item,
                   <fs_itemx_data> TYPE mereq_itemx,
                   <fs_acct_data>  TYPE crms_mktpl_exkn,
                   <fs_acctx_data> TYPE crms_mktpl_exknx.

    DATA: lw_acct_data  TYPE crms_mktpl_exkn,
          lw_acctx_data TYPE crms_mktpl_exknx,
          lv_index      TYPE sy-tabix,
          lv_porc       TYPE char3.

    lv_porc = 40.

    LOOP AT ct_item_data ASSIGNING <fs_item_data>.
      <fs_item_data>-twrkz = '2'.
      <fs_item_data>-vrtkz = '2'.
      <fs_item_data>-repos = 'X'.

      READ TABLE ct_acct_data ASSIGNING <fs_acct_data>
       WITH KEY phead_assig_guid = <fs_item_data>-phead_assig_guid
                pitem_assig_guid = <fs_item_data>-pitem_assig_guid.

      IF <fs_acct_data> IS ASSIGNED.

        lv_index = sy-index.

        <fs_acct_data>-vproz = lv_porc.

**        ADD NEW POSITION.
        lw_acct_data = <fs_acct_data>.
        lw_acct_data-vproz = 100 - lw_acct_data-vproz.
        APPEND lw_acct_data TO ct_acct_data.

        READ TABLE ct_acctx_data ASSIGNING <fs_acctx_data> INDEX lv_index.
        IF <fs_acctx_data> IS ASSIGNED.

          <fs_acctx_data>-vproz = abap_true.

          lw_acctx_data = <fs_acctx_data>.
          APPEND lw_acctx_data TO ct_acctx_data.

        ENDIF.

      ENDIF.

    ENDLOOP.

    LOOP AT ct_itemx_data ASSIGNING <fs_itemx_data>.
      <fs_itemx_data>-vrtkz = abap_true.
      <fs_itemx_data>-twrkz = abap_true.
      <fs_itemx_data>-repos = abap_true.
    ENDLOOP.

[/CODE]


Viewing all articles
Browse latest Browse all 1578

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>