Quantcast
Channel: SCN : Discussion List - Customer Relationship Management (SAP CRM)
Viewing all articles
Browse latest Browse all 4296

How to Add/Create a Pricing Condition for a specific Item in an Order

$
0
0

I'm relatively new to CRM ABAP and am looking for a way to add a line to the pricing conditions table for a specific item.
In the CRM_UI for a service order quotation, in a line item, under the pricing details tab you see a list like this:

 

CRM_UI pricing details.png

 

And to add a new “Detail” you can select the “add” button and pick one from this list:

 

CRM_UI add pricing detail.png

 

I want to add both these items to my list of pricing details for this line item, but I want to do it through ABAP.


I’ve done a lot of work with CRM_ORDER_MAINTAIN, but when I put a break point in there to see what fields were populated I found that the et_pridoc table was empty – so where were these details added? Using what FM call?


I’ve tried to do the update using crm_order_maintain anyway (as this seems logial to me!) using this code (ev_item_guid is the guid of the line item that I want this pricing for):

 

  data: lt_pridoc type  crmt_pridoc_comt        ,ls_pridoc type  crmt_pridoc_com        ,lt_pric_cond type prct_cond_du_tab        ,ls_pric_cond type prct_cond_du.

*      ls_pric_cond-knumv = ? I don’t know the document number...    ls_pric_cond-kposn = ev_item_guid.    ls_pric_cond-kschl = 'ZMDP'.    ls_pric_cond-kbetr = ‘59’.    ls_pric_cond-kmein = 'PC'.    append ls_pric_cond to lt_pric_cond.    ls_pridoc-ref_handle = ref_handle.    ls_pridoc-PRIC_COND = lt_pric_cond.     append ls_pridoc to lt_pridoc.

*    ls_nametab = 'KBETR'.
*    append ls_nametab to lt_nametab.
*    ls_nametab = 'KMEIN'.
*    append ls_nametab to lt_nametab.
*    ls_nametab = 'KSCHL'.
*    append ls_nametab to lt_nametab.    ls_input_fields-ref_handle = ref_handle. "But there's no ref handle in the pri-doc table..    ls_input_fields-ref_kind = 'A'. "Is this correct??    ls_input_fields-objectname = 'PRIDOC'.
*    ls_input_fields-field_names = lt_nametab.    append ls_input_fields to lt_input_fields.

 

 

Then I’d call the crm_order_maintain.

But is it possible to do it this way?
What would I populate the field_names table with? (If anything?)

The Results should look like this (from crm_order_read - in et_pridoc-pric_cond):

 

pri_cond 1.png

pri_cond 2.png

 


If not, what FM/BAPI should I be using?

 

Any advice anyone can give me on populating values in this pricing table will be rewarded with points!

 

Please help - many answers I've found online don't help!


Viewing all articles
Browse latest Browse all 4296

Trending Articles



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