cancel
Showing results for 
Search instead for 
Did you mean: 

Pricing condition formula on IPC

Former Member
0 Kudos

Hi,

Here's the issue -

The freight for items is calculated using scale based rates for gross weight of the items.

For example, if the gross wt. for an item is 38 pounds, the rate is determined as $18 from the scale. However, if the quantity is increased to 2, a rate of say, $30 is taken from the scale corresponding to the gross wt. which is now 76 pounds.

However, the requirement is that the rate of $18 should be chosen and multiplied by the quantity for all quantities greater than 1. So the freight should have been $36 (18 x 2) instead.

The freight is calculated using a pricing formula in R/3 where the gross wt. is first divided by the quantity to get the base condition. Scale based rates are taken to calculate the freight condition value and multiplied by the quantity again.

AltCTy

modify xkomv.

read table xkomv with key kschl = 'ZABC'.

xkomv-kwert = xkomv-kbetr * komp-mgame.

modify xkomv.

xkwert = xkomv-kwert / 1000.

AltCBV

if komp-mgame ne space.

komp-brgew = komp-ntgew.

xkwert = ( komp-brgew / komp-mgame ) * 1000.

komp-brgew = ( komp-brgew / komp-mgame ) * 1000.

else.

komp-brgew = komp-ntgew.

xkwert = ( komp-brgew / komp-mglme ) * 1000.

komp-brgew = ( komp-brgew / komp-mglme ) * 1000.

endif.

The problem arises while implementing this formula in IPC. Unlike on the R/3 side, it is not possible to change the gross wt. of an item in IPC. Also, I couldn't find a way to explicitly specify the gross wt. to calculate the condition.

The other option was to implement a BADI to change the gross wt. of the items before calculating the conditions. I tried using the CRM_PRODUCT_I_BADI where it is possible to change the gross wt. when an item is entered, however, the quantity for the line item is not available in this BADI so as to divide it to get the appropriate gross wt. for an item.

Any help would be greatly appreciated.

Accepted Solutions (0)

Answers (1)

Answers (1)

MauricioMiao
Contributor
0 Kudos

Hello,

If this badi is executed inside order creation you can try call function CRM_ORDER_READ to get the item quantity.

It might work if the item data is updated before this badi is called.

Instead of pass the header like in the example below, pass the item guid to the function.

INSERT gc_object_name-orderadm_i INTO TABLE lt_requested_objects.

INSERT gc_object_name-schedlin INTO TABLE lt_requested_objects.

CALL FUNCTION 'CRM_ORDER_READ'

EXPORTING

it_header_guid = lt_header_guid

iv_mode = gc_mode-display

it_requested_objects = lt_requested_objects

IMPORTING

et_orderadm_i = lt_orderadm_i

et_schedlin = lt_schedlin

EXCEPTIONS

document_not_found = 1

error_occurred = 2

document_locked = 3

no_change_authority = 4

no_display_authority = 5

no_change_allowed = 6

OTHERS = 7.

IF sy-subrc <> 0.

MOVE sy-msgty TO ev_type.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 INTO ev_message.

EXIT.

ENDIF.

LOOP AT lt_orderadm_i INTO ls_orderadm_i.

MOVE ls_orderadm_i-number_int TO itens_vlr-numitem.

MOVE ls_orderadm_i-ordered_prod TO itens_vlr-produto.

MOVE ls_orderadm_i-description TO itens_vlr-descricao.

READ TABLE lt_schedlin INTO ls_schedlin

WITH KEY item_guid = ls_orderadm_i-guid.

IF sy-subrc = 0.

MOVE ls_schedlin-quantity TO itens_vlr-qtdprod.

ENDIF.

APPEND itens_vlr.

ENDLOOP.

Regards,

Mauricio

Former Member
0 Kudos

Thanks Mauricio for your response.

The BADI is executed within order creation when a line item has been entered.

I did use CRM_ORDER_READ to try to get the values using the item GUID. However, et_schedlin is returned as initial and et_schedlin_i shows the order quantity as zero. However, the product, ordered product etc. is returned correctly within the structure et_orderadm_i.

I was wondering if there is any other way to get the quantity for the line item or if I was doing something wrong.

Thanks & Regards,

Rohini.

MauricioMiao
Contributor
0 Kudos

Hi Rohini,

There is only one more way I know to get this information.

You can try use function CRM_INTLAY_GET_DATA.

To find out what are the parameters, do the following create an item in order transaction, navigate to another tab, start debug, navigate back to item tab and insert a break-point into this function.

Then you will find what is the structure and so on, the IV_GUID is the item guid and IV_KIND is B for item data.

Regards,

Mauricio