cancel
Showing results for 
Search instead for 
Did you mean: 

CRM_COND_COM_BADI

Former Member
0 Kudos

Hi all

can somebody please send me a sample implementation code of CRM_COND_COM_BADI so that i can transfer the attributes that are nt readily available in IPC ....

Also any user exit code in java where there is extensive use of attributes that are nt passed to IPC but which are passed thru badi.

Thanks in advance

Kris

P.S Needless to say points will be awarded !!!!!

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

forgot to mention the email address

maverick550_in@yahoo.com

Former Member
0 Kudos

Hi Kris,

here you have:

method IF_EX_CRM_COND_COM_BADI~ITEM_COMMUNICATION_STRUCTURE .

data: zzcopro type zcopro_der.

data: zzderk type zderk.

data:entero(6),

entero1(3),

entero2(3).

  • modificacion APEX07 14/12/2005

data:decimal(6).

  • fin modificacion

data: longitud type n.

data: delimiter(1) value '.'.

******************************************************

  • MMG - Parametro para el MatchCode de Nº de paquete *

  • 1-12-04

DATA w_product_id TYPE COMM_PRODUCT-PRODUCT_ID.

CLEAR w_product_id.

SELECT SINGLE PRODUCT_ID FROM COMM_PRODUCT

INTO w_product_id

WHERE PRODUCT_GUID = CS_ACS_I_COM-PRODUCT.

set parameter id 'ZPROD' FIELD w_product_id.

******************************************************

***************************************************

  • MMG - Inicio modificacion 31-11-04

  • Motivo: Cambio de campo de paquete SGDR

  • Antiguo campo: po_number_sold

  • Nuevo campo: your_ref_sold

  • Obtencion del campo YOUR_REF_SOLD

****Tablas Y Estructuras para CRM_ORDER_READ.

DATA: zet_orderadm_h TYPE crmt_orderadm_h_wrkt,

zit_header_guid TYPE crmt_object_guid_tab,

zit_item_guid TYPE CRMT_OBJECT_GUID_TAB,

zet_sales TYPE crmt_sales_wrkt,

zet_sales_line TYPE LINE OF crmt_sales_wrkt,

zet_orderadm_i TYPE crmt_orderadm_i_wrkt,

wet_orderadm_i TYPE crmt_orderadm_i_wrkt.

DATA ET_PRIDOC TYPE CRMT_PRIC_COND_T.

DATA et_customer_i TYPE CRMT_CUSTOMER_I_WRKT.

DATA wet_customer_i TYPE LINE OF CRMT_CUSTOMER_I_WRKT.

DATA w_paqueteSGDR TYPE CRMT_YOUR_REFERENCE_SOLD.

  • Posicion tratada: CS_ACS_I_COM-CRM_ITEM_GUID.

clear w_paqueteSGDR.

append CS_ACS_I_COM-CRM_ITEM_GUID to zit_item_guid.

CALL FUNCTION 'CRM_ORDER_READ'

EXPORTING

it_item_guid = zit_item_guid

IMPORTING

et_orderadm_h = zet_orderadm_h

et_orderadm_i = zet_orderadm_i

et_customer_i = et_customer_i

et_sales = zet_sales

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.

READ TABLE ZET_SALES INTO ZET_SALES_LINE INDEX 1.

  • Nuevo valor del paquete, campo YOUR_REF_SOLD

w_paqueteSGDR = ZET_SALES_LINE-YOUR_REF_SOLD.

  • MMG - Fin modificación 31-11-04

***************************************************

select * from zcopro_der into zzcopro where paquete =

***************************************************

  • MMG - Inicio modificacion 31-11-04

  • Motivo: Cambio de campo de paquete SGDR

  • Antiguo campo: po_number_sold

  • cs_ACS_I_COM-pO_NUMBER_SOLD.

  • Nuevo campo: your_ref_sold

w_paqueteSGDR.

  • MMG - Fin modificación 31-11-04

***************************************************

entero = zzcopro-PORC_PRO.

  • Modificacion APEX07 14/12/2005

decimal = zzcopro-PORC_PRO.

  • Fin modificacion

split entero at delimiter into entero1 entero2.

  • condense entero1 no-gaps.

condense decimal no-gaps.

  • longitud = STRLEN( entero1 ).

  • if longitud = 3.

  • else.

  • if longitud = 2.

  • concatenate '0' entero1 into entero1.

  • else. "Longitud = 1

  • concatenate '00' entero1 into entero1.

  • endif.

  • endif.

case sy-dbcnt.

  • Modificacion APEX07 14/12/2005

when '1'.

  • CS_ACS_I_COM-zzporco = entero1.

CS_ACS_I_COM-zzporco = decimal.

when '2'.

  • CS_ACS_I_COM-zzporco2 = entero1.

CS_ACS_I_COM-zzporco2 = decimal.

when '3'.

  • CS_ACS_I_COM-zzporco3 = entero1.

CS_ACS_I_COM-zzporco3 = decimal.

when '4'.

  • CS_ACS_I_COM-zzporco4 = entero1.

CS_ACS_I_COM-zzporco4 = decimal.

when '5'.

  • CS_ACS_I_COM-zzporco5 = entero1.

CS_ACS_I_COM-zzporco5 = decimal.

when '6'.

  • CS_ACS_I_COM-zzporco6 = entero1.

CS_ACS_I_COM-zzporco6 = decimal.

when '7'.

  • CS_ACS_I_COM-zzporco7 = entero1.

CS_ACS_I_COM-zzporco7 = decimal.

when '8'.

  • CS_ACS_I_COM-zzporco8 = entero1.

CS_ACS_I_COM-zzporco8 = decimal.

when '9'.

  • CS_ACS_I_COM-zzporco9 = entero1.

CS_ACS_I_COM-zzporco9 = decimal.

  • Fin modificacion APEX07 14/12/2005

endcase.

clear: entero, entero1, longitud, decimal.

endselect.

CS_ACS_I_COM-zzerp = CS_ACS_I_COM-zzporco + CS_ACS_I_COM-zzporco2 +

CS_ACS_I_COM-zzporco3 + CS_ACS_I_COM-zzporco4 + CS_ACS_I_COM-zzporco5 +

CS_ACS_I_COM-zzporco6 + CS_ACS_I_COM-zzporco7 + CS_ACS_I_COM-zzporco8 +

CS_ACS_I_COM-zzporco9.

CS_ACS_I_COM-zzerp = '100' - CS_ACS_I_COM-zzerp.

longitud = STRLEN( CS_ACS_I_COM-zzerp ).

if longitud = 3.

else.

condense CS_ACS_I_COM-zzerp no-gaps.

concatenate '0' CS_ACS_I_COM-zzerp into CS_ACS_I_COM-zzerp.

condense CS_ACS_I_COM-zzerp no-gaps.

endif.

  • Cogemos porcentaje de comercialización

***************************************************

  • MMG - Inicio modificacion 31-11-04

  • Motivo: Cambio de campo de paquete SGDR

  • Antiguo campo: po_number_sold

  • IF NOT cs_ACS_I_COM-pO_NUMBER_SOLD IS INITIAL.

  • Nuevo campo: your_ref_sold

IF NOT w_paqueteSGDR IS INITIAL.

  • MMG - Fin modificación 31-11-04

***************************************************

select single * from zderk into zzderk where paquete =

***************************************************

  • MMG - Inicio modificacion 31-11-04

  • Motivo: Cambio de campo de paquete SGDR

  • Antiguo campo: po_number_sold

  • cs_ACS_I_COM-pO_NUMBER_SOLD.

  • Nuevo campo: your_ref_sold

w_paqueteSGDR.

  • MMG - Fin modificación 31-11-04

***************************************************

if sy-subrc = 0.

  • Modificacion APEX07 21/12/2005

  • entero = zzderk-PORC_COM.

decimal = zzderk-PORC_COM.

  • split entero at delimiter into entero1 entero2.

  • longitud = STRLEN( entero1 ).

  • if longitud = 3.

  • else.

  • concatenate '0' entero1 into entero1.

  • endif.

  • CS_ACS_I_COM-zzcom = entero1.

condense decimal no-gaps.

CS_ACS_I_COM-zzcom = decimal.

condense CS_ACS_I_COM-zzcom no-gaps.

  • Fin Modificacion APEX07 21/12/2005

clear zzderk.

endif.

ENDIF.

*******************************************************

  • MMG - 04/01/05 *

  • Mapeo del IGIC introducido en la pestaña de cliente *

  • a nivel de cabecera y el de material a nivel de *

  • posición.

*******************************************************

DATA et_customer_h TYPE CRMT_CUSTOMER_H_WRKT.

DATA wet_customer_h TYPE LINE OF CRMT_CUSTOMER_H_WRKT.

*BREAK SAPCRM2.

refresh zit_header_guid.

append CS_ACS_I_COM-HEADER_GUID to zit_header_guid.

CALL FUNCTION 'CRM_ORDER_READ'

EXPORTING

it_header_guid = zit_header_guid

IMPORTING

et_customer_h = et_customer_h

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.

READ TABLE et_customer_h INTO wet_customer_h INDEX 1.

  • IGIC de cliente 02

*CS_ACS_I_COM-TAX_TYPE_BP_02 = 'IGIC'.

CS_ACS_I_COM-TAX_GROUP_BP_02 = wet_customer_h-ZZTAX_GRP_BP_02.

READ TABLE et_customer_i INTO wet_customer_i INDEX 1.

  • IGIC de material 02

*CS_ACS_I_COM-TAX_DEPT_TYPE_02 = 'IGIC'.

CS_ACS_I_COM-TAX_DEPT_GRP_02 = wet_customer_i-ZZTAXDEPT_GRP02.

*CS_ACS_I_COM-TAX_TYPE_02 = 'IGIC'.

CS_ACS_I_COM-TAX_GRP_02 = wet_customer_i-ZZTAXDEPT_GRP02.

  • IVA de cliente 01

*CS_ACS_I_COM-TAX_TYPE_BP_01 = 'MWST'.

CS_ACS_I_COM-TAX_GROUP_BP_01 = wet_customer_h-ZZIVA.

  • MMG - 17/02/05 - El IVA del material no se puede cambiar en CRM,

  • porque el sistema lo recupera automaticamente del material.

**READ TABLE et_customer_i INTO wet_customer_i INDEX 1.

  • IVA de material 01

*CS_ACS_I_COM-TAX_DEPT_TYPE_01 = 'MWST'.

CS_ACS_I_COM-TAX_DEPT_GRP_01 = wet_customer_i-ZZIVA.

*CS_ACS_I_COM-TAX_TYPE_01 = 'MWST'.

CS_ACS_I_COM-TAX_GRP_01 = wet_customer_i-ZZIVA.

  • MMG - 04/01/05

*******************************************************

endmethod. "IF_EX_CRM_COND_COM_BADI~ITEM_COMMUNICATION_STRUCTURE

Regards

Andrea

Former Member
0 Kudos

Hi Kris,

as example of Java code of an existing exit in IPC read by comunication structure of price procedure I send this:

Distribution of this software is restricted. SAP does not make any warranty

about the software, its performance or its conformity to any specification.

*******************************************************************************/

package userexits;

import java.math.BigDecimal;

import com.sap.spe.condmgnt.customizing.application.IStep;

import com.sap.spe.condmgnt.finding.application.IConditionFindingManagerUserExit;

import com.sap.spe.condmgnt.finding.exc.FormulaNotImplementedException;

import com.sap.spe.conversion.application.IQuantityValue;

import com.sap.spe.pricing.customizing.application.ICopyType;

import com.sap.spe.pricing.customizing.application.IPricingType;

import com.sap.spe.pricing.transactiondata.application.IGroupConditionUserExit;

import com.sap.spe.pricing.transactiondata.application.ILastPrice;

import com.sap.spe.pricing.transactiondata.application.IPricingConditionUserExit;

import com.sap.spe.pricing.transactiondata.application.IPricingCondition;

import com.sap.spe.pricing.transactiondata.application.IPricingItem;

import com.sap.spe.pricing.transactiondata.application.IPricingDocumentUserExit;

import com.sap.spe.pricing.transactiondata.application.IPricingItemUserExit;

import com.sap.spe.pricing.transactiondata.application.IPricingUserExits;

import com.sap.spe.pricing.customizing.application.IPricingType;

import com.sap.spe.pricing.customizing.application.ICopyType;

import com.sap.spe.pricing.customizing.application.PricingCustomizingConstants;

import com.sap.spe.pricing.transactiondata.application.imp.PricingConstants;

import com.sap.sxe.db.util.engine.IEngineUserExit;

import com.sap.sxe.log.log_api; //Para escribir lineas de log

import java.util.Hashtable; //Para manejar tablas Hash

// *************************************************************************************************************************

// *************************************************************************************************************************

// *************************************************************************************************************************

/**

  • Exemplary implementation of the pricing engine's userexits. These methods correspond

  • to the VOFM-Routines for pricing in R/3 and to the userexits in the program RV61AFZB.

*/

public class PricingUserExits implements IPricingUserExits {

private IEngineUserExit pricingEngine;

/**

  • @return true if the requirement is fulfilled.

*/

public boolean checkRequirement(IConditionFindingManagerUserExit item,

IStep step,

int reqNo) {

switch (reqNo) {

//case 601: implement your formulas

default:

throw new FormulaNotImplementedException(item, "requirement", reqNo);

}

}

// *************************************************************************************************************************

// *************************************************************************************************************************

// *************************************************************************************************************************

/**

  • This method is called after the calculation of the condition base value of each

  • pricing condition. If the baseFormulaNumber is smaller than 600 or greater than 999

  • coding in a standard class is processed else the code of the class provided

  • by the customer is processed (600 <= baseFormulaNumber <= 999).

  • The baseFormulaNumber should be used to specify which logic will be processed.

  • This number is provided by the customizing of the pricing step.

*/

public BigDecimal overwriteConditionBase(IPricingItemUserExit prItem,

ILastPrice lastPrice,

IPricingConditionUserExit prCondition,

int baseFormNo) {

switch (baseFormNo) {

default:

throw new FormulaNotImplementedException(prItem, "base formula", baseFormNo);

}

}

// *************************************************************************************************************************

// *************************************************************************************************************************

// *************************************************************************************************************************

/**

  • This method is called after the calculation of the condition value of each

  • pricing condition. If the valueFormulaNumber is smaller than 600 or greater than 999

  • coding in a standard class is processed else the code of the class provided

  • by the customer is processed (600 <= valueFormulaNumber <= 999).

  • The valueFormulaNumber should be used to specify which logic will be processed.

  • This number is provided by the customizing of the pricing step.

*/

public BigDecimal overwriteConditionValue( IPricingItemUserExit prItem,

ILastPrice lastPrice,

IPricingConditionUserExit prCondition,

int valueFormNo)

{

switch (valueFormNo)

{

case 601:

BigDecimal xworkf = prItem.getSubtotal(PricingCustomizingConstants.ConditionSubtotal.SUBTOTAL_F);

BigDecimal xworkg = prItem.getSubtotal(PricingCustomizingConstants.ConditionSubtotal.SUBTOTAL_G);

BigDecimal xworke = prItem.getSubtotal(PricingCustomizingConstants.ConditionSubtotal.SUBTOTAL_E);

//Realizamos la suma de los valores máximo (xworke) y mínimo (xworkf) y dividimos por 2.

BigDecimal tempResult= (xworkf.add(xworke)).divide(BigDecimal.valueOf(2),10,BigDecimal.ROUND_UNNECESSARY);

if ((xworkf.add(xworke)).compareTo(PricingConstants.ZERO) != 0)

{

prCondition.setConditionRateValue((xworkg.subtract(tempResult)).divide(tempResult,10,BigDecimal.ROUND_HALF_UP).multiply(BigDecimal.valueOf(100)));

return (xworkg.subtract(tempResult));

}

else

{

return PricingConstants.ZERO;

}

// GROSS_VALUE - XWORKE

// Se cambia para coger SUBTOTAL_2 - XWORKE

case 602:

// xworkh es la comercialización

BigDecimal xworkh = prItem.getSubtotal(PricingCustomizingConstants.ConditionSubtotal.SUBTOTAL_H);

//if (xworkh.compareTo(PricingConstants.ZERO) != 0) //hay comercializacion

//{

// grossVAlue es el neto

BigDecimal grossValue = prItem.getSubtotal(PricingCustomizingConstants.ConditionSubtotal.SUBTOTAL_2);

//BigDecimal grossValue = prItem.getSubtotal(PricingCustomizingConstants.ConditionSubtotal.GROSS_VALUE);

BigDecimal comisionAgente = prItem.getSubtotal(PricingCustomizingConstants.ConditionSubtotal.SUBTOTAL_J);

if ((xworkh.compareTo(comisionAgente) > 0)) //comercializ > comisionAgente

{

grossValue = grossValue.subtract(xworkh);

}

else //comercialización cero ó < comisionAgente

{

grossValue = grossValue.subtract(comisionAgente);

}

return grossValue; //new BigDecimal(67)

// XWORKI + XWORKH - XWORKJ

case 603:

//Pedro 23 marzo 2004

// si comercializ > comisionAgente -> (particip + comercializ -comisionAgente)

// si comercializ es 0 ó < comisiónAgente -> particip

xworkh= prItem.getSubtotal(PricingCustomizingConstants.ConditionSubtotal.SUBTOTAL_H);

BigDecimal xworki= prItem.getSubtotal(PricingCustomizingConstants.ConditionSubtotal.SUBTOTAL_I);

//BigDecimal xwork2= prItem.getSubtotal(PricingCustomizingConstants.ConditionSubtotal.SUBTOTAL_2);

BigDecimal xworkj= prItem.getSubtotal(PricingCustomizingConstants.ConditionSubtotal.SUBTOTAL_J);

if ((xworkh.compareTo(xworkj) > 0)) //comercializ > comisionAgente

{

return xworki.add(xworkh).subtract(xworkj);

}

else //comercialización cero ó < comisionAgente

{

return xworki;

}

//return xworki.add(prItem.getSubtotal(PricingCustomizingConstants.ConditionSubtotal.SUBTOTAL_H)).subtract (xworkj);

//return xwork2.subtract(xworkj);

case 650: // Calculo de los porcentajes de los copropietarios

// JavierMerino 20 diciembre 2005

// Cogemos el valor neto del documento

BigDecimal ValorNeto = prItem.getSubtotal(PricingCustomizingConstants.ConditionSubtotal.SUBTOTAL_M);

// Cogemos el valor por si ha habido entrada manual

BigDecimal inputManualValue = prCondition.getConditionRate().getValue();

// Localizamos en que clase de condicion nos encontramos

String cond = prCondition.getConditionTypeName();

if((cond.equals("ZSC1")))

{

String zzporco = null;

BigDecimal zzporcodec = PricingConstants.ZERO;

try

{

zzporco = prItem.getItemAttributeValue("ZZPORCO").getValue();

zzporcodec = new BigDecimal( zzporco );

}

catch(Exception a)

{

zzporcodec = PricingConstants.ZERO;

}

if (inputManualValue.compareTo(zzporcodec) != 0 && inputManualValue.compareTo(PricingConstants.ZERO)>0)

{

zzporcodec = inputManualValue;

}

prCondition.setConditionRateValue(zzporcodec);

BigDecimal resultadoSocio1 = ValorNeto.multiply(zzporcodec).divide( BigDecimal.valueOf(100), 100, BigDecimal.ROUND_HALF_UP);

// Modificacion Javier Merino 11 de Enero de 2006

//contenedor.put("Socio1", resultadoSocio1);

//prItem.setDynamicReturnValue("elprimero",resultadoSocio1.toString());

// Fin de la segunda modificacion

return resultadoSocio1;

}

if(cond.equals("ZSC2"))

{

String zzporco2 = null;

BigDecimal zzporco2dec = PricingConstants.ZERO;

try

{

zzporco2 = prItem.getItemAttributeValue("ZZPORCO2").getValue();

zzporco2dec = new BigDecimal( zzporco2 );

}

catch(Exception a)

{

zzporco2dec = PricingConstants.ZERO;

}

if (inputManualValue.compareTo(zzporco2dec) != 0 && inputManualValue.compareTo(PricingConstants.ZERO)>0)

{

zzporco2dec = inputManualValue;

}

prCondition.setConditionRateValue(zzporco2dec);

return ValorNeto.multiply(zzporco2dec).divide( BigDecimal.valueOf(100), 100, BigDecimal.ROUND_HALF_UP);

}

if(cond.equals("ZSC3"))

{

String zzporco3 = null;

BigDecimal zzporco3dec = PricingConstants.ZERO;

try

{

zzporco3 = prItem.getItemAttributeValue("ZZPORCO3").getValue();

zzporco3dec = new BigDecimal( zzporco3 );

}

catch(Exception a)

{

zzporco3dec = PricingConstants.ZERO;

}

if (inputManualValue.compareTo(zzporco3dec) != 0 && inputManualValue.compareTo(PricingConstants.ZERO)>0)

{

zzporco3dec = inputManualValue;

}

prCondition.setConditionRateValue(zzporco3dec);

return ValorNeto.multiply(zzporco3dec).divide( BigDecimal.valueOf(100), 100, BigDecimal.ROUND_HALF_UP);

}

if(cond.equals("ZSC4"))

{

String zzporco4 = null;

BigDecimal zzporco4dec = PricingConstants.ZERO;

try

{

zzporco4 = prItem.getItemAttributeValue("ZZPORCO4").getValue();

zzporco4dec = new BigDecimal( zzporco4 );

}

catch(Exception a)

{

zzporco4dec = PricingConstants.ZERO;

}

if (inputManualValue.compareTo(zzporco4dec) != 0 && inputManualValue.compareTo(PricingConstants.ZERO)>0)

{

zzporco4dec = inputManualValue;

}

prCondition.setConditionRateValue(zzporco4dec);

return ValorNeto.multiply(zzporco4dec).divide( BigDecimal.valueOf(100), 100, BigDecimal.ROUND_HALF_UP);

}

if(cond.equals("ZSC5"))

{

String zzporco5 = null;

BigDecimal zzporco5dec = PricingConstants.ZERO;

try

{

zzporco5 = prItem.getItemAttributeValue("ZZPORCO5").getValue();

zzporco5dec = new BigDecimal( zzporco5 );

}

catch(Exception a)

{

zzporco5dec = PricingConstants.ZERO;

}

if (inputManualValue.compareTo(zzporco5dec) != 0 && inputManualValue.compareTo(PricingConstants.ZERO)>0)

{

zzporco5dec = inputManualValue;

}

prCondition.setConditionRateValue(zzporco5dec);

return ValorNeto.multiply(zzporco5dec).divide( BigDecimal.valueOf(100), 100, BigDecimal.ROUND_HALF_UP);

}

if(cond.equals("ZSC6"))

{

String zzporco6 = null;

BigDecimal zzporco6dec = PricingConstants.ZERO;

try

{

zzporco6 = prItem.getItemAttributeValue("ZZPORCO6").getValue();

zzporco6dec = new BigDecimal( zzporco6 );

}

catch(Exception a)

{

zzporco6dec = PricingConstants.ZERO;

}

if (inputManualValue.compareTo(zzporco6dec) != 0 && inputManualValue.compareTo(PricingConstants.ZERO)>0)

{

zzporco6dec = inputManualValue;

}

prCondition.setConditionRateValue(zzporco6dec);

return ValorNeto.multiply(zzporco6dec).divide( BigDecimal.valueOf(100), 100, BigDecimal.ROUND_HALF_UP);

}

if(cond.equals("ZSC7"))

{

String zzporco7 = null;

BigDecimal zzporco7dec = PricingConstants.ZERO;

try

{

zzporco7 = prItem.getItemAttributeValue("ZZPORCO7").getValue();

zzporco7dec = new BigDecimal( zzporco7 );

}

catch(Exception a)

{

zzporco7dec = PricingConstants.ZERO;

}

if (inputManualValue.compareTo(zzporco7dec) != 0 && inputManualValue.compareTo(PricingConstants.ZERO)>0)

{

zzporco7dec = inputManualValue;

}

prCondition.setConditionRateValue(zzporco7dec);

return ValorNeto.multiply(zzporco7dec).divide( BigDecimal.valueOf(100), 100, BigDecimal.ROUND_HALF_UP);

}

if(cond.equals("ZSC8"))

{

String zzporco8 = null;

BigDecimal zzporco8dec = PricingConstants.ZERO;

try

{

zzporco8 = prItem.getItemAttributeValue("ZZPORCO8").getValue();

zzporco8dec = new BigDecimal( zzporco8 );

}

catch(Exception a)

{

zzporco8dec = PricingConstants.ZERO;

}

if (inputManualValue.compareTo(zzporco8dec) != 0 && inputManualValue.compareTo(PricingConstants.ZERO)>0)

{

zzporco8dec = inputManualValue;

}

prCondition.setConditionRateValue(zzporco8dec);

return ValorNeto.multiply(zzporco8dec).divide( BigDecimal.valueOf(100), 100, BigDecimal.ROUND_HALF_UP);

}

if(cond.equals("ZSC9"))

{

String zzporco9 = null;

BigDecimal zzporco9dec = PricingConstants.ZERO;

try

{

zzporco9 = prItem.getItemAttributeValue("ZZPORCO9").getValue();

zzporco9dec = new BigDecimal( zzporco9 );

}

catch(Exception a)

{

zzporco9dec = PricingConstants.ZERO;

}

if (inputManualValue.compareTo(zzporco9dec) != 0 && inputManualValue.compareTo(PricingConstants.ZERO)>0)

{

zzporco9dec = inputManualValue;

}

prCondition.setConditionRateValue(zzporco9dec);

return ValorNeto.multiply(zzporco9dec).divide( BigDecimal.valueOf(100), 100, BigDecimal.ROUND_HALF_UP);

}

case 660: // Porcentaje de comercializacion

// JavierMerino 09 Enero 2006

String luis10 = null;

try{

luis10 = prItem.getItemAttributeValue("ZZCOM").getValue();

BigDecimal fran10 = new BigDecimal( luis10 );

prCondition.setConditionRateValue(fran10);

BigDecimal perico10 = prItem.getSubtotal(PricingCustomizingConstants.ConditionSubtotal.SUBTOTAL_2);

return perico10.multiply(fran10).divide( BigDecimal.valueOf(100), 100, BigDecimal.ROUND_HALF_UP);

}

catch(Exception j)

{

BigDecimal Resultado10 = PricingConstants.ZERO;

return Resultado10;

}

case 661: // Porcentaje de participacion

// Javier Merino 11 de Enero de 2006

BigDecimal ValorNetoPAR = prItem.getSubtotal(PricingCustomizingConstants.ConditionSubtotal.SUBTOTAL_M);

BigDecimal PorcenPart = new BigDecimal("0.00");

int step;

for(step=240;step<=320;step+=10)

{

IPricingCondition condicionPAR = prItem.findPricingCondition(step,1);

if(condicionPAR!=null)

{

BigDecimal Res = condicionPAR.getConditionRate().getValue();

if (Res!=null)

{

PorcenPart = PorcenPart.add(Res);

}

}

}

BigDecimal Total = new BigDecimal("100.00");

BigDecimal valuePAR = Total.subtract(PorcenPart);

prCondition.setConditionRateValue(valuePAR);

return ValorNetoPAR.multiply(valuePAR).divide( BigDecimal.valueOf(100), 100, BigDecimal.ROUND_HALF_UP);

default:

throw new FormulaNotImplementedException(prItem, "value formula", valueFormNo);

}

}

// *************************************************************************************************************************

// *************************************************************************************************************************

// *************************************************************************************************************************

/**

  • This method is called after the calculation of the condition base value of each

  • pricing condition. If the scaleBaseFormulaNumber is smaller than 600 or greater than 999

  • coding in a standard class is processed else the code of the class provided

  • by the customer is processed (600 <= scaleBaseFormulaNumber <= 999).

  • The scaleBaseFormulaNumber should be used to specify which logic will be processed.

  • This number is provided by the customizing of the pricing condition type.

*/

public BigDecimal overwriteScaleBase(IPricingItemUserExit prItem,

ILastPrice lastPrice,

IPricingConditionUserExit prCondition,

IGroupConditionUserExit grCondition,

int scaleFormNo) {

switch (scaleFormNo) {

default:

throw new FormulaNotImplementedException(prItem, "scale base formula", scaleFormNo);

}

}

// *************************************************************************************************************************

// *************************************************************************************************************************

// *************************************************************************************************************************

/**

  • This method is called after the calculation of the condition base value of each

  • group condition on the pricing document level. If the scaleBaseFormulaNumber

  • is smaller than 600 or greater than 999 coding in a standard class is processed

  • else the code of the class provided by the customer is processed (600 <= scaleBaseFormulaNumber <= 999).

  • The scaleBaseFormulaNumber should be used to specify which logic will be processed.

  • This number is provided by the customizing of the pricing condition type.

*/

public BigDecimal overwriteGroupConditionScaleBase(IPricingDocumentUserExit prDocument,

IGroupConditionUserExit grCondition,

int scaleFormNo) {

switch (scaleFormNo) {

default:

IConditionFindingManagerUserExit item = (IConditionFindingManagerUserExit) prDocument.getUserExitItems().elementAt(0);

throw new FormulaNotImplementedException(item, "group scale base formula", scaleFormNo);

}

}

// *************************************************************************************************************************

// *************************************************************************************************************************

// *************************************************************************************************************************

/**

  • This method is called after the calculation of the condition value of each

  • group condition on the pricing document level.

  • If the valueFormulaNumber is smaller than 600 or greater than 999

  • coding in a standard class is processed else the code of the class provided

  • by the customer is processed (600 <= valueFormulaNumber <= 999).

  • The valueFormulaNumber should be used to specify which logic will be processed.

  • This number is provided by the customizing of the pricing step.

*/

public BigDecimal overwriteGroupConditionValue(IPricingDocumentUserExit prDocument,

IGroupConditionUserExit grCondition,

int valueFormNo) {

switch (valueFormNo) {

default:

IConditionFindingManagerUserExit item = (IConditionFindingManagerUserExit) prDocument.getUserExitItems().elementAt(0);

throw new FormulaNotImplementedException(item, "group value formula", valueFormNo);

}

}

// *************************************************************************************************************************

// *************************************************************************************************************************

// *************************************************************************************************************************

/**

  • This method is called after the key of a group condition is determined

  • on the pricing document level.

  • If the keyFormulaNumber is smaller than 60 or greater than 99

  • coding in a standard class is processed else the code of the class provided

  • by the customer is processed (60 <= keyFormulaNumber <= 99).

  • The keyFormulaNumber should be used to specify which logic will be processed.

  • This number is provided by the customizing of the pricing condition type.

*/

public String setGroupConditionKey(IPricingDocumentUserExit prDoc,

IPricingItemUserExit prItem,

IPricingConditionUserExit prCondition,

IGroupConditionUserExit grCondition,

int keyFormNo) {

switch (keyFormNo) {

default:

throw new FormulaNotImplementedException(prItem, "group key formula", keyFormNo);

}

}

// *************************************************************************************************************************

// *************************************************************************************************************************

// *************************************************************************************************************************

/**

  • This method is called when pricing conditions are copied.

  • If the formulaNumber is smaller than 600 or greater than 999

  • coding in a standard class is processed else the code of the class provided

  • by the customer is processed (600 <= formulaNumber <= 999).

  • The formulaNumber should be used to specify which logic will be processed.

  • This number is provided by the customizing of the copy type.

  • NB: copyType also contains the formulaNumber

*/

public void pricingCopy(IPricingDocumentUserExit prDocument,

IPricingItemUserExit prItem,

IPricingConditionUserExit prCondition,

IPricingType pricingType,

ICopyType copyType,

IQuantityValue sourceSalesQuantity,

int copyFormulaNo) {

switch (copyFormulaNo) {

default:

throw new FormulaNotImplementedException(prItem, "copy formula", copyFormulaNo);

}

}

// *************************************************************************************************************************

// *************************************************************************************************************************

// *************************************************************************************************************************

/**

  • @return the string array of attribute names which is necessary to process the

  • code for the requirment with the number requirementNumber.

*/

public String[] determineRelevantAttributesForRequirement(boolean headerAttributes,

int reqNo) {

return new String[] { };

}

// *************************************************************************************************************************

// *************************************************************************************************************************

// *************************************************************************************************************************

/**

  • @return a string array which corresponds to the header/item attributes which

  • are required in the condition base formula (e.g. the item attribute "PRICE_PRODUCT" or

  • the header attribute "SOLD_TO_PARTY").

*/

public String[] determineRelevantAttributesForBaseFormula(boolean headerAttributes,

int baseFormulaNo)

{

return new String[] { };

}

// *************************************************************************************************************************

// *************************************************************************************************************************

// *************************************************************************************************************************

/**

  • @return a string array which corresponds to the header/item attributes which

  • are required in the condition value formula (e.g. the item attribute "PRICE_PRODUCT" or

  • the header attribute "SOLD_TO_PARTY").

*/

public String[] determineRelevantAttributesForValueFormula( boolean headerAttributes,

int valueFormulaNo)

{

String[] relevantAttributes = new String[0];

if (headerAttributes)

{

//KOMK

switch(valueFormulaNo)

{

case 601:

break;

case 602:

break;

case 603:

break;

case 650:

break;

}

}

else

{

//KOMP

switch(valueFormulaNo)

{

case 601:

break;

case 602:

break;

case 603:

break;

case 650:

relevantAttributes = new String[] { "ZZPORCO", "ZZPORCO2", "ZZPORCO3", "ZZPORCO4", "ZZPORCO5", "ZZPORCO6", "ZZPORCO7", "ZZPORCO8", "ZZPORCO9" };

break;

case 660:

relevantAttributes = new String[] { "ZZCOM" };

break;

case 661:

break;

}

}

return relevantAttributes;

}

// *************************************************************************************************************************

// *************************************************************************************************************************

// *************************************************************************************************************************

/**

  • @return a string array which corresponds to the header/item attributes which

  • are required in the condition scale base formula (e.g. the item attribute "PRICE_PRODUCT" or

  • the header attribute "SOLD_TO_PARTY").

*/

public String[] determineRelevantAttributesForScaleBaseFormula(boolean headerAttributes,

int scaleBaseFormulaNo) {

return new String[] { };

}

// *************************************************************************************************************************

// *************************************************************************************************************************

// *************************************************************************************************************************

/**

  • @return a string array which corresponds to the header/item attributes which

  • are required in the condition value formula (e.g. the item attribute "PRICE_PRODUCT" or

  • the header attribute "SOLD_TO_PARTY").

*/

public String[] determineRelevantAttributesForGroupConditionKey(boolean headerAttributes,

int groupConditionKeyFormulaNo) {

return new String[] { };

}

// *************************************************************************************************************************

// *************************************************************************************************************************

// *************************************************************************************************************************

/**

  • @return a string array which corresponds to the header/item attributes which

  • are required in the pricing copy formula (e.g. the item attribute "PRICE_PRODUCT" or

  • the header attribute "SOLD_TO_PARTY").

*/

public String[] determineRelevantAttributesForPricingCopyFormula(boolean headerAttributes,

int formulaNo) {

return new String[] { };

}

// *************************************************************************************************************************

// *************************************************************************************************************************

// *************************************************************************************************************************

/**

  • @return a string array which corresponds to the header/item attributes which

  • are required in the user exit methods pricingDocumentInit, pricingItemInit,

  • pricingConditionInit, pricingItemCalculateBegin and pricingItemCalculateEnd

  • @see #pricingDocumentInit

  • @see #pricingItemInit

  • @see #pricingConditionInit

  • @see #pricingItemCalculateBegin

  • @see #pricingItemCalculateEnd

*/

public String[] determineRelevantAttributesForFormulaIndependentUserExits(boolean headerAttributes) {

return new String[] { };

}

// *************************************************************************************************************************

// *************************************************************************************************************************

// *************************************************************************************************************************

/**

  • @return the array of requirement numbers which are used in the method checkRequirement.

  • @see #checkRequirement

*/

public int[] getRequirementNumbers() {

return new int[] { };

}

// *************************************************************************************************************************

// *************************************************************************************************************************

// *************************************************************************************************************************

/**

  • @return the array of condition base formula numbers which are used in the method overwriteConditionBase.

  • @see #overwriteConditionBase

*/

public int[] getConditionBaseFormulaNumbers() {

return new int[] { };

}

// *************************************************************************************************************************

// *************************************************************************************************************************

// *************************************************************************************************************************

/**

  • @return the array of condition value formula numbers which are used in the method overwriteConditionValue

  • and overwriteGroupConditionValue.

  • @see #overwriteConditionValue

  • @see #overwriteGroupConditionValue

*/

public int[] getConditionValueFormulaNumbers() {

return new int[] { 601, 602, 603, 650, 660, 661 };

}

// *************************************************************************************************************************

// *************************************************************************************************************************

// *************************************************************************************************************************

/**

  • @return the array of scale base formula numbers which are used in the method overwriteScaleBase

  • and overwriteGroupConditionScaleBase.

  • @see #overwriteScaleBase

  • @see #overwriteGroupConditionScaleBase

*/

public int[] getConditionScaleBaseFormulaNumbers() {

return new int[] { };

}

// *************************************************************************************************************************

// *************************************************************************************************************************

// *************************************************************************************************************************

/**

  • @return the array of group condition key formula numbers which are used in the method setGroupConditionKey.

  • @see #setGroupConditionKey

*/

public int[] getGroupConditionKeyFormulaNumbers() {

return new int[] { };

}

// *************************************************************************************************************************

// *************************************************************************************************************************

// *************************************************************************************************************************

/**

  • @return the array of copy formula numbers which are used in the method pricingCopy.

  • @see #pricingCopy

*/

public int[] getPricingCopyFormulaNumbers() {

return new int[] { };

}

// *************************************************************************************************************************

// *************************************************************************************************************************

// *************************************************************************************************************************

/**

  • @param pricingEngine provides information about the database connection and the client.

  • This information should be used to select customer specific data.

*/

public void init(IEngineUserExit pricingEngine) {

this.pricingEngine = pricingEngine;

}

// *************************************************************************************************************************

// *************************************************************************************************************************

// *************************************************************************************************************************

// real R/3-userexits

/**

  • This method is processed when a pricing document is created.

*/

public void pricingDocumentInit(IPricingDocumentUserExit prDocument) {

}

// *************************************************************************************************************************

// *************************************************************************************************************************

// *************************************************************************************************************************

/**

  • This method is processed when a pricing item is created.

*/

public void pricingItemInit(IPricingDocumentUserExit prDocument,

IPricingItemUserExit prItem) {

}

// *************************************************************************************************************************

// *************************************************************************************************************************

// *************************************************************************************************************************

/**

  • This method is processed when a pricing condition is created.

*/

public void pricingConditionInit(IPricingDocumentUserExit prDocument,

IPricingItemUserExit prItem,

IPricingConditionUserExit prCondition) {

}

// *************************************************************************************************************************

// *************************************************************************************************************************

// *************************************************************************************************************************

/**

  • This method is processed at the beginning of the method 'calculate' of the

  • pricing item. This method is processed e.g. when the method 'pricing' is used.

*/

public void pricingItemCalculateBegin(IPricingDocumentUserExit prDocument,

IPricingItemUserExit prItem) {

}

// *************************************************************************************************************************

// *************************************************************************************************************************

// *************************************************************************************************************************

/**

  • This method is processed at the end of the method 'calculate' of the

  • pricing item.

*/

public void pricingItemCalculateEnd(IPricingDocumentUserExit prDocument,

IPricingItemUserExit prItem) {

}

}

If you consider the case 660 and 661 you should be able to find the link between Item-communication structure and Java routine.

Regards,

Andrea

Former Member
0 Kudos

Hi Andrea

That was so cool thanks a lot

Points awarded !!!!!

Thanks and Regards

Kris

Former Member
0 Kudos

Hi Drakes,

Is there some standard way to transport this PricingUserExits.java File from Test to QA and productive systems?

Or should they be manually overwritten in the directory

<IPC>\ipc\lib\userexits

We are currently using IPC 4.0

Regards

MK.

Former Member
0 Kudos

Just want to reformat code by Andrea Canella. Credit goes to her . Part 1


IF_EX_CRM_COND_COM_BADI~ITEM_COMMUNICATION_STRUCTURE . 
data: zzcopro type zcopro_der. data: zzderk type zderk. 
data:entero(6), entero1(3), entero2(3).
* modificacion APEX07 14/12/2005 
data:decimal(6). 
* fin modificacion 
data: longitud type n. data: delimiter(1) value '.'. 
****************************************************** 
* MMG - Parametro para el MatchCode de Nº de paquete 
* * 1-12-04 
DATA w_product_id TYPE COMM_PRODUCT-PRODUCT_ID. 
CLEAR w_product_id. 
SELECT SINGLE PRODUCT_ID FROM COMM_PRODUCT INTO w_product_id 
WHERE PRODUCT_GUID = CS_ACS_I_COM-PRODUCT. 

set parameter id 'ZPROD' FIELD w_product_id. 
****************************************************** 
*************************************************** 
* MMG - Inicio modificacion 31-11-04 
* Motivo: Cambio de campo de paquete SGDR 
* Antiguo campo: po_number_sold 
* Nuevo campo: your_ref_sold 
* Obtencion del campo YOUR_REF_SOLD 
****Tablas Y Estructuras para CRM_ORDER_READ. 
DATA: zet_orderadm_h TYPE crmt_orderadm_h_wrkt, 
zit_header_guid TYPE crmt_object_guid_tab, 
zit_item_guid TYPE CRMT_OBJECT_GUID_TAB, 
zet_sales TYPE crmt_sales_wrkt, 
zet_sales_line TYPE LINE OF crmt_sales_wrkt, 
zet_orderadm_i TYPE crmt_orderadm_i_wrkt, 
wet_orderadm_i TYPE crmt_orderadm_i_wrkt. 
DATA ET_PRIDOC TYPE CRMT_PRIC_COND_T. 
DATA et_customer_i TYPE CRMT_CUSTOMER_I_WRKT. 
DATA wet_customer_i TYPE LINE OF CRMT_CUSTOMER_I_WRKT. 
DATA w_paqueteSGDR TYPE CRMT_YOUR_REFERENCE_SOLD. 
* Posicion tratada: CS_ACS_I_COM-CRM_ITEM_GUID. 
clear w_paqueteSGDR. 
append CS_ACS_I_COM-CRM_ITEM_GUID to zit_item_guid.
CALL FUNCTION 'CRM_ORDER_READ' 
EXPORTING it_item_guid = zit_item_guid 
IMPORTING et_orderadm_h = zet_orderadm_h 
 et_orderadm_i = zet_orderadm_i 
et_customer_i = et_customer_i 
 et_sales = zet_sales 
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. 
READ TABLE ZET_SALES INTO ZET_SALES_LINE INDEX 1. 
* Nuevo valor del paquete, campo YOUR_REF_SOLD 
w_paqueteSGDR = ZET_SALES_LINE-YOUR_REF_SOLD. 
* MMG - Fin modificación 31-11-04 
*************************************************** 
select * from zcopro_der into zzcopro 
where paquete = xx
 *************************************************** 
* MMG - Inicio modificacion 31-11-04 
* Motivo: Cambio de campo de paquete SGDR
 * Antiguo campo: po_number_sold 
* cs_ACS_I_COM-pO_NUMBER_SOLD. 
* Nuevo campo: your_ref_sold w_paqueteSGDR. 
* MMG - Fin modificación 31-11-04 
*************************************************** 
entero = zzcopro-PORC_PRO. 
* Modificacion APEX07 14/12/2005 
decimal = zzcopro-PORC_PRO. 
* Fin modificacion split entero at delimiter into entero1 entero2. 
* condense entero1 no-gaps. 
 condense decimal no-gaps. 
* longitud = STRLEN( entero1 ). 
* if longitud = 3. 
* else. 
* if longitud = 2. 
* concatenate '0' entero1 into entero1. 
* else. "Longitud = 1 
* concatenate '00' entero1 into entero1. 
* endif. 
* endif. 

Former Member
0 Kudos

Part 2


case sy-dbcnt. 
* Modificacion APEX07 14/12/2005 
when '1'. 
* CS_ACS_I_COM-zzporco = entero1. 
CS_ACS_I_COM-zzporco = decimal. 
when '2'. 
* CS_ACS_I_COM-zzporco2 = entero1. 
CS_ACS_I_COM-zzporco2 = decimal. 
when '3'. 
* CS_ACS_I_COM-zzporco3 = entero1. 
CS_ACS_I_COM-zzporco3 = decimal. 
when '4'. 
* CS_ACS_I_COM-zzporco4 = entero1. 
CS_ACS_I_COM-zzporco4 = decimal. 
when '5'. 
* CS_ACS_I_COM-zzporco5 = entero1. 
CS_ACS_I_COM-zzporco5 = decimal. 
when '6'. 
* CS_ACS_I_COM-zzporco6 = entero1. 
CS_ACS_I_COM-zzporco6 = decimal. 
when '7'. 
* CS_ACS_I_COM-zzporco7 = entero1. 
CS_ACS_I_COM-zzporco7 = decimal. 
when '8'. 
* CS_ACS_I_COM-zzporco8 = entero1. 
CS_ACS_I_COM-zzporco8 = decimal. 
when '9'. 
* CS_ACS_I_COM-zzporco9 = entero1. 
CS_ACS_I_COM-zzporco9 = decimal. 
* Fin modificacion APEX07 14/12/2005 
endcase. 
clear: entero, entero1, longitud, decimal. 
endselect. 

CS_ACS_I_COM-zzerp = CS_ACS_I_COM-zzporco + CS_ACS_I_COM-zzporco2 + CS_ACS_I_COM-zzporco3 + CS_ACS_I_COM-zzporco4 + CS_ACS_I_COM-zzporco5 + CS_ACS_I_COM-zzporco6 + CS_ACS_I_COM-zzporco7 + CS_ACS_I_COM-zzporco8 + CS_ACS_I_COM-zzporco9. 

CS_ACS_I_COM-zzerp = '100' - CS_ACS_I_COM-zzerp. 
longitud = STRLEN( CS_ACS_I_COM-zzerp ).
 if longitud = 3. 
else. 
condense CS_ACS_I_COM-zzerp no-gaps. 
concatenate '0' CS_ACS_I_COM-zzerp into CS_ACS_I_COM-zzerp. 
condense CS_ACS_I_COM-zzerp no-gaps. 
endif. 
* Cogemos porcentaje de comercialización 
*************************************************** 
* MMG - Inicio modificacion 31-11-04 
* Motivo: Cambio de campo de paquete SGDR 
* Antiguo campo: po_number_sold 
* IF NOT cs_ACS_I_COM-pO_NUMBER_SOLD IS INITIAL. 
* Nuevo campo: your_ref_sold 
IF NOT w_paqueteSGDR IS INITIAL. 
* MMG - Fin modificación 31-11-04 
*************************************************** 
select single * from zderk into zzderk 
where paquete = xx
*************************************************** 
* MMG - Inicio modificacion 31-11-04 
* Motivo: Cambio de campo de paquete SGDR 
* Antiguo campo: po_number_sold 
* cs_ACS_I_COM-pO_NUMBER_SOLD. 
* Nuevo campo: your_ref_sold w_paqueteSGDR. 
* MMG - Fin modificación 31-11-04 
*************************************************** 
if sy-subrc = 0. 
* Modificacion APEX07 21/12/2005 
* entero = zzderk-PORC_COM. 
decimal = zzderk-PORC_COM. 
* split entero at delimiter into entero1 entero2. 
* longitud = STRLEN( entero1 ). 
* if longitud = 3. 
* else. 
* concatenate '0' entero1 into entero1. 
* endif. 
* CS_ACS_I_COM-zzcom = entero1. 
condense decimal no-gaps. 
CS_ACS_I_COM-zzcom = decimal. 
condense CS_ACS_I_COM-zzcom no-gaps. 
* Fin Modificacion APEX07 21/12/2005 
clear zzderk. 
endif. 
ENDIF. 
******************************************************* 
* MMG - 04/01/05 * 
* Mapeo del IGIC introducido en la pestaña de cliente * 
* a nivel de cabecera y el de material a nivel de * 
* posición. 
******************************************************* 
DATA et_customer_h TYPE CRMT_CUSTOMER_H_WRKT. 
DATA wet_customer_h TYPE LINE OF CRMT_CUSTOMER_H_WRKT. 
*BREAK SAPCRM2. 
refresh zit_header_guid. 
append CS_ACS_I_COM-HEADER_GUID to zit_header_guid. 
CALL FUNCTION 'CRM_ORDER_READ' 
EXPORTING it_header_guid = zit_header_guid 
IMPORTING et_customer_h = et_customer_h 
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. 
READ TABLE et_customer_h INTO wet_customer_h INDEX 1. 
* IGIC de cliente 02 
*CS_ACS_I_COM-TAX_TYPE_BP_02 = 'IGIC'. 
CS_ACS_I_COM-TAX_GROUP_BP_02 = wet_customer_h-ZZTAX_GRP_BP_02. 
READ TABLE et_customer_i INTO wet_customer_i INDEX 1. 
* IGIC de material 02 
*CS_ACS_I_COM-TAX_DEPT_TYPE_02 = 'IGIC'. 
CS_ACS_I_COM-TAX_DEPT_GRP_02 = wet_customer_i-ZZTAXDEPT_GRP02. 
*CS_ACS_I_COM-TAX_TYPE_02 = 'IGIC'. 
CS_ACS_I_COM-TAX_GRP_02 = wet_customer_i-ZZTAXDEPT_GRP02. 
* IVA de cliente 01 
*CS_ACS_I_COM-TAX_TYPE_BP_01 = 'MWST'. 
CS_ACS_I_COM-TAX_GROUP_BP_01 = wet_customer_h-ZZIVA. 
* MMG - 17/02/05 - El IVA del material no se puede cambiar en CRM, 
* porque el sistema lo recupera automaticamente del material. 
**READ TABLE et_customer_i INTO wet_customer_i INDEX 1. 
* IVA de material 01 
*CS_ACS_I_COM-TAX_DEPT_TYPE_01 = 'MWST'. 
CS_ACS_I_COM-TAX_DEPT_GRP_01 = wet_customer_i-ZZIVA. 
*CS_ACS_I_COM-TAX_TYPE_01 = 'MWST'. 
CS_ACS_I_COM-TAX_GRP_01 = wet_customer_i-ZZIVA. 
* MMG - 04/01/05 *******************************************************
 endmethod. 

Former Member
0 Kudos

Just want to reformat IPC code from Andrea Carnella. Credit goes to her. Part 1


//*******************************************************************************/ 
package userexits; 
import java.math.BigDecimal; 
import com.sap.spe.condmgnt.customizing.application.IStep; 
import com.sap.spe.condmgnt.finding.application.IConditionFindingManagerUserExit; 
import com.sap.spe.condmgnt.finding.exc.FormulaNotImplementedException; 
import com.sap.spe.conversion.application.IQuantityValue; 
import com.sap.spe.pricing.customizing.application.ICopyType; 
import com.sap.spe.pricing.customizing.application.IPricingType; 
import com.sap.spe.pricing.transactiondata.application.IGroupConditionUserExit; 
import com.sap.spe.pricing.transactiondata.application.ILastPrice; 
import com.sap.spe.pricing.transactiondata.application.IPricingConditionUserExit; 
import com.sap.spe.pricing.transactiondata.application.IPricingCondition; 
import com.sap.spe.pricing.transactiondata.application.IPricingItem; 
import com.sap.spe.pricing.transactiondata.application.IPricingDocumentUserExit; 
import com.sap.spe.pricing.transactiondata.application.IPricingItemUserExit; 
import com.sap.spe.pricing.transactiondata.application.IPricingUserExits; 
import com.sap.spe.pricing.customizing.application.IPricingType; 
import com.sap.spe.pricing.customizing.application.ICopyType; 
import com.sap.spe.pricing.customizing.application.PricingCustomizingConstants; 
import com.sap.spe.pricing.transactiondata.application.imp.PricingConstants; 
import com.sap.sxe.db.util.engine.IEngineUserExit; 
import com.sap.sxe.log.log_api; 
//Para escribir lineas de log import java.util.Hashtable; 
//Para manejar tablas Hash 
// ************************************************************************************************************************* 
// ************************************************************************************************************************* 
// ************************************************************************************************************************* 
/** * Exemplary implementation of the pricing engine's userexits. These methods correspond * to the VOFM-Routines for pricing in R/3 and to the userexits in the program RV61AFZB. */ 
public class PricingUserExits implements IPricingUserExits { 
  private IEngineUserExit pricingEngine; 
/** * @return true if the requirement is fulfilled. */ 
    public boolean checkRequirement(IConditionFindingManagerUserExit item, IStep step, int reqNo) 
     { switch (reqNo) { 
              //case 601: implement your formulas default: throw new FormulaNotImplementedException(item, "requirement", reqNo); 
        } 
     } 
// ************************************************************************************************************************* 
// ************************************************************************************************************************* 
// ************************************************************************************************************************* 
/** * This method is called after the calculation of the condition base value of each * pricing condition. If the baseFormulaNumber is smaller than 600 or greater than 999 * coding in a standard class is processed else the code of the class provided * by the customer is processed (600 <= baseFormulaNumber <= 999). * The baseFormulaNumber should be used to specify which logic will be processed. * This number is provided by the customizing of the pricing step. */ 
public BigDecimal overwriteConditionBase(IPricingItemUserExit prItem, ILastPrice lastPrice, IPricingConditionUserExit prCondition, int baseFormNo)
 { 
    switch (baseFormNo) { 
          default: throw new FormulaNotImplementedException(prItem, "base formula", baseFormNo); 
   } 
 } 

}

Edited by: The Agus Santoso on Nov 25, 2011 9:09 AM

Former Member
0 Kudos

Part 2


public class PricingUserExits implements IPricingUserExits { 
// ************************************************************************************************************************* 
// ************************************************************************************************************************* 
// ************************************************************************************************************************* 
/** * This method is called after the calculation of the condition value of each * pricing condition. If the valueFormulaNumber is smaller than 600 or greater than 999 * coding in a standard class is processed else the code of the class provided * by the customer is processed (600 <= valueFormulaNumber <= 999). * The valueFormulaNumber should be used to specify which logic will be processed. * This number is provided by the customizing of the pricing step. */ 
public BigDecimal overwriteConditionValue( IPricingItemUserExit prItem, ILastPrice lastPrice, IPricingConditionUserExit prCondition, int valueFormNo) 
{ 
    switch (valueFormNo) { 
             case 601: 
                 BigDecimal xworkf = prItem.getSubtotal(PricingCustomizingConstants.ConditionSubtotal.SUBTOTAL_F); 
                 BigDecimal xworkg = prItem.getSubtotal(PricingCustomizingConstants.ConditionSubtotal.SUBTOTAL_G); 
                 BigDecimal xworke = prItem.getSubtotal(PricingCustomizingConstants.ConditionSubtotal.SUBTOTAL_E); 
         //Realizamos la suma de los valores máximo (xworke) y mínimo (xworkf) y dividimos por 2. 
                 BigDecimal tempResult= (xworkf.add(xworke)).divide(BigDecimal.valueOf(2),10,BigDecimal.ROUND_UNNECESSARY); 
                if ((xworkf.add(xworke)).compareTo(PricingConstants.ZERO) != 0) 
                  {                             
                        prCondition.setConditionRateValue((xworkg.subtract(tempResult)).divide(tempResult,10,BigDecimal.ROUND_HALF_UP)
                                  .multiply(BigDecimal.valueOf(100))); 
                          return (xworkg.subtract(tempResult)); 
                  } else { 
                       return PricingConstants.ZERO; 
                  } 
               // GROSS_VALUE - XWORKE 
              // Se cambia para coger SUBTOTAL_2 - XWORKE 
            case 602: 
             // xworkh es la comercialización 
                BigDecimal xworkh = prItem.getSubtotal(PricingCustomizingConstants.ConditionSubtotal.SUBTOTAL_H); 
              //if (xworkh.compareTo(PricingConstants.ZERO) != 0) 
              //hay comercializacion 
              //{ 
                     // grossVAlue es el neto 
                     BigDecimal grossValue = prItem.getSubtotal(PricingCustomizingConstants.ConditionSubtotal.SUBTOTAL_2); 
                     //BigDecimal grossValue = prItem.getSubtotal(PricingCustomizingConstants.ConditionSubtotal.GROSS_VALUE); 
                      BigDecimal comisionAgente = prItem.getSubtotal(PricingCustomizingConstants.ConditionSubtotal.SUBTOTAL_J); 
                     if ((xworkh.compareTo(comisionAgente) > 0)) 
                           //comercializ > comisionAgente 
                      { 
                            grossValue = grossValue.subtract(xworkh); 
                       } else 
                          //comercialización cero ó < comisionAgente 
                       { 
                              grossValue = grossValue.subtract(comisionAgente); 
                       } 
                        return grossValue; 
                       //new BigDecimal(67) 
                       // XWORKI + XWORKH - XWORKJ 
                case 603: 
                      //Pedro 23 marzo 2004 
                     // si comercializ > comisionAgente -> (particip + comercializ -comisionAgente) 
                   // si comercializ es 0 ó < comisiónAgente -> particip 
                 xworkh= prItem.getSubtotal(PricingCustomizingConstants.ConditionSubtotal.SUBTOTAL_H); 
                 BigDecimal xworki= prItem.getSubtotal(PricingCustomizingConstants.ConditionSubtotal.SUBTOTAL_I); 
                //BigDecimal xwork2= prItem.getSubtotal(PricingCustomizingConstants.ConditionSubtotal.SUBTOTAL_2); 
               BigDecimal xworkj= prItem.getSubtotal(PricingCustomizingConstants.ConditionSubtotal.SUBTOTAL_J); 
                 if ((xworkh.compareTo(xworkj) > 0))   //comercializ > comisionAgente 
                { 
                   return xworki.add(xworkh).subtract(xworkj); 
               }  else   //comercialización cero ó < comisionAgente 
               { 
                   return xworki; 
               } 
//return xworki.add(prItem.getSubtotal(PricingCustomizingConstants.ConditionSubtotal.SUBTOTAL_H)).subtract (xworkj); //return xwork2.subtract(xworkj); 
           
     } //end switch
}

}

Former Member
0 Kudos

Part 3


public class PricingUserExits implements IPricingUserExits { 
// ************************************************************************************************************************* 
// ************************************************************************************************************************* 
// ************************************************************************************************************************* 
/** * This method is called after the calculation of the condition value of each * pricing condition. If the valueFormulaNumber is smaller than 600 or greater than 999 * coding in a standard class is processed else the code of the class provided * by the customer is processed (600 <= valueFormulaNumber <= 999). * The valueFormulaNumber should be used to specify which logic will be processed. * This number is provided by the customizing of the pricing step. */ 
public BigDecimal overwriteConditionValue( IPricingItemUserExit prItem, ILastPrice lastPrice, IPricingConditionUserExit prCondition, int valueFormNo) 
{ 
    switch (valueFormNo) { 
      case 650: 
// Calculo de los porcentajes de los copropietarios 
// JavierMerino 20 diciembre 2005 
// Cogemos el valor neto del documento 
BigDecimal ValorNeto = prItem.getSubtotal(PricingCustomizingConstants.ConditionSubtotal.SUBTOTAL_M); 
// Cogemos el valor por si ha habido entrada manual 
BigDecimal inputManualValue = prCondition.getConditionRate().getValue(); 
// Localizamos en que clase de condicion nos encontramos 
String cond = prCondition.getConditionTypeName(); 
if((cond.equals("ZSC1"))) { 
   String zzporco = null; 
   BigDecimal zzporcodec = PricingConstants.ZERO; 
   try { 
       zzporco = prItem.getItemAttributeValue("ZZPORCO").getValue(); 
       zzporcodec = new BigDecimal( zzporco ); 
   } catch(Exception a) { 
        zzporcodec = PricingConstants.ZERO; 
   } 
   if (inputManualValue.compareTo(zzporcodec) != 0 
     && inputManualValue.compareTo(PricingConstants.ZERO)>0) { 
     zzporcodec = inputManualValue; 
   } 
   prCondition.setConditionRateValue(zzporcodec); 
   BigDecimal resultadoSocio1 = ValorNeto.multiply(zzporcodec).divide( BigDecimal.valueOf(100), 100, BigDecimal.ROUND_HALF_UP); 
   // Modificacion Javier Merino 11 de Enero de 2006 
   //contenedor.put("Socio1", resultadoSocio1); 
   //prItem.setDynamicReturnValue("elprimero",resultadoSocio1.toString()); 
  // Fin de la segunda modificacion 
    return resultadoSocio1; 
   } 
   if(cond.equals("ZSC2")) { 
      String zzporco2 = null; 
      BigDecimal zzporco2dec = PricingConstants.ZERO; 
      try { 
        zzporco2 = prItem.getItemAttributeValue("ZZPORCO2").getValue(); 
        zzporco2dec = new BigDecimal( zzporco2 ); 
      } catch(Exception a) { 
         zzporco2dec = PricingConstants.ZERO; 
      } 
      if (inputManualValue.compareTo(zzporco2dec) != 0 
        && inputManualValue.compareTo(PricingConstants.ZERO)>0) { 
        zzporco2dec = inputManualValue; 
      } 
      prCondition.setConditionRateValue(zzporco2dec); 
      return ValorNeto.multiply(zzporco2dec).divide( BigDecimal.valueOf(100), 100, BigDecimal.ROUND_HALF_UP); 
   } 
   if(cond.equals("ZSC3")) { 
       String zzporco3 = null; 
       BigDecimal zzporco3dec = PricingConstants.ZERO; 
       try { 
          zzporco3 = prItem.getItemAttributeValue("ZZPORCO3").getValue();    
          zzporco3dec = new BigDecimal( zzporco3 ); 
      } catch(Exception a) { 
           zzporco3dec = PricingConstants.ZERO; 
       } 
        if (inputManualValue.compareTo(zzporco3dec) != 0 
      && inputManualValue.compareTo(PricingConstants.ZERO)>0) { 
       zzporco3dec = inputManualValue; 
      } prCondition.setConditionRateValue(zzporco3dec); 
     return ValorNeto.multiply(zzporco3dec).divide( BigDecimal.valueOf(100), 100, BigDecimal.ROUND_HALF_UP); 
    } 
    if(cond.equals("ZSC4")) { 
       String zzporco4 = null; BigDecimal zzporco4dec = PricingConstants.ZERO; 
       try { 
         zzporco4 = prItem.getItemAttributeValue("ZZPORCO4").getValue(); 
          zzporco4dec = new BigDecimal( zzporco4 ); 
      } catch(Exception a) { 
       zzporco4dec = PricingConstants.ZERO; 
      } 
     if (inputManualValue.compareTo(zzporco4dec) != 0 
        && inputManualValue.compareTo(PricingConstants.ZERO)>0) { 
      zzporco4dec = inputManualValue; 
      } 
      prCondition.setConditionRateValue(zzporco4dec); 
      return ValorNeto.multiply(zzporco4dec).divide( BigDecimal.valueOf(100), 100, BigDecimal.ROUND_HALF_UP); 
   } 
    // to be continued ...
    } //end switch
} 
}

Former Member
0 Kudos

Part 4


public class PricingUserExits implements IPricingUserExits {
  public BigDecimal overwriteConditionValue( IPricingItemUserExit prItem, ILastPrice lastPrice, IPricingConditionUserExit prCondition, int valueFormNo) 
{ 
    switch (valueFormNo) { 
      case 650: 
          //continued from previous post
         if(cond.equals("ZSC5")) { 
	  String zzporco5 = null; 
          BigDecimal zzporco5dec = PricingConstants.ZERO; 
           try { 
             zzporco5 = prItem.getItemAttributeValue("ZZPORCO5").getValue();              zzporco5dec = new BigDecimal( zzporco5 ); 
           } catch(Exception a) { 
             zzporco5dec = PricingConstants.ZERO; 
          } 
        if (inputManualValue.compareTo(zzporco5dec) != 0 
            && inputManualValue.compareTo(PricingConstants.ZERO)>0) { 
          zzporco5dec = inputManualValue; 
        } 
       prCondition.setConditionRateValue(zzporco5dec); 
       return ValorNeto.multiply(zzporco5dec).divide( BigDecimal.valueOf(100), 100, BigDecimal.ROUND_HALF_UP); 
     }   
       if(cond.equals("ZSC6")) { 
          String zzporco6 = null; 
          BigDecimal zzporco6dec = PricingConstants.ZERO; 
          try { 
             zzporco6 = prItem.getItemAttributeValue("ZZPORCO6").getValue();              zzporco6dec = new BigDecimal( zzporco6 ); 
           } catch(Exception a) { 
              zzporco6dec = PricingConstants.ZERO; 
          } 
          if (inputManualValue.compareTo(zzporco6dec) != 0 
          && inputManualValue.compareTo(PricingConstants.ZERO)>0) { 
             zzporco6dec = inputManualValue; 
           } 
          prCondition.setConditionRateValue(zzporco6dec); 
          return ValorNeto.multiply(zzporco6dec).divide( BigDecimal.valueOf(100), 100, BigDecimal.ROUND_HALF_UP); 
       } 
       if(cond.equals("ZSC7")) { 
          String zzporco7 = null; 
          BigDecimal zzporco7dec = PricingConstants.ZERO; 
          try { 
              zzporco7 = prItem.getItemAttributeValue("ZZPORCO7").getValue();               zzporco7dec = new BigDecimal( zzporco7 ); 
          } catch(Exception a) { 
             zzporco7dec = PricingConstants.ZERO; 
          } 
         if (inputManualValue.compareTo(zzporco7dec) != 0 
            && inputManualValue.compareTo(PricingConstants.ZERO)>0) { 
            zzporco7dec = inputManualValue; 
          } 
          prCondition.setConditionRateValue(zzporco7dec); 
         return ValorNeto.multiply(zzporco7dec).divide( BigDecimal.valueOf(100), 100, BigDecimal.ROUND_HALF_UP); 
       } 
        if(cond.equals("ZSC8")) { 
             String zzporco8 = null; 
             BigDecimal zzporco8dec = PricingConstants.ZERO; 
             try { 
              zzporco8 = prItem.getItemAttributeValue("ZZPORCO8").getValue();               zzporco8dec = new BigDecimal( zzporco8 ); 
             } catch(Exception a) { zzporco8dec = PricingConstants.ZERO; } 
            if (inputManualValue.compareTo(zzporco8dec) != 0 
              && inputManualValue.compareTo(PricingConstants.ZERO)>0) { 
                   zzporco8dec = inputManualValue; 
            } 
            prCondition.setConditionRateValue(zzporco8dec); 
            return ValorNeto.multiply(zzporco8dec).divide( BigDecimal.valueOf(100), 100, BigDecimal.ROUND_HALF_UP); 
      }
     if(cond.equals("ZSC9")) { 
            String zzporco9 = null; 
            BigDecimal zzporco9dec = PricingConstants.ZERO; 
            try { 
             zzporco9 = prItem.getItemAttributeValue("ZZPORCO9").getValue();              zzporco9dec = new BigDecimal( zzporco9 ); 
            } catch(Exception a) { zzporco9dec = PricingConstants.ZERO; } 
           if (inputManualValue.compareTo(zzporco9dec) != 0 
               && inputManualValue.compareTo(PricingConstants.ZERO)>0) { 
              zzporco9dec = inputManualValue; 
           }
           prCondition.setConditionRateValue(zzporco9dec); 
          return ValorNeto.multiply(zzporco9dec).divide( BigDecimal.valueOf(100), 100, BigDecimal.ROUND_HALF_UP); 
       }
      //to be continued to next post
    }//end switch
}
}

Former Member
0 Kudos

Part 5


public class PricingUserExits implements IPricingUserExits {
  public BigDecimal overwriteConditionValue( IPricingItemUserExit prItem, ILastPrice lastPrice, IPricingConditionUserExit prCondition, int valueFormNo) 
{ 
    switch (valueFormNo) {
      //continued from previous post
       case 660: 
// Porcentaje de comercializacion 
// JavierMerino 09 Enero 2006 
   String luis10 = null; 
   try{ 
      luis10 = prItem.getItemAttributeValue("ZZCOM").getValue(); 
       BigDecimal fran10 = new BigDecimal( luis10 );         prCondition.setConditionRateValue(fran10); 
        BigDecimal perico10 = prItem.getSubtotal(PricingCustomizingConstants.ConditionSubtotal.SUBTOTAL_2); 
        return perico10.multiply(fran10).divide( BigDecimal.valueOf(100), 100, BigDecimal.ROUND_HALF_UP); 
     } catch(Exception j) { 
         BigDecimal Resultado10 = PricingConstants.ZERO; 
        return Resultado10; 
     } 
case 661: 
// Porcentaje de participacion 
// Javier Merino 11 de Enero de 2006 
    BigDecimal ValorNetoPAR = prItem.getSubtotal(PricingCustomizingConstants.ConditionSubtotal.SUBTOTAL_M); 
    BigDecimal PorcenPart = new BigDecimal("0.00"); 
    int step; 
    for(step=240;step<=320;step+=10) { 
       IPricingCondition condicionPAR = prItem.findPricingCondition(step,1); 
       if(condicionPAR!=null) { 
          BigDecimal Res = condicionPAR.getConditionRate().getValue(); 
          if (Res!=null) { 
             PorcenPart = PorcenPart.add(Res); 
          } 
       } 
    } //end for 
    BigDecimal Total = new BigDecimal("100.00"); 
    BigDecimal valuePAR = Total.subtract(PorcenPart);     prCondition.setConditionRateValue(valuePAR); 
    return ValorNetoPAR.multiply(valuePAR).divide( BigDecimal.valueOf(100), 100, BigDecimal.ROUND_HALF_UP); 
    default: throw new FormulaNotImplementedException(prItem, "value formula", valueFormNo);
    } //end switch
 }
//************************************************************************************************************************* 
//************************************************************************************************************************* 
/** * This method is called after the calculation of the condition base value of each 
* pricing condition. If the scaleBaseFormulaNumber is smaller than 600 or greater than 999
 * coding in a standard class is processed else the code of the class provided 
* by the customer is processed (600 <= scaleBaseFormulaNumber <= 999). 
* The scaleBaseFormulaNumber should be used to specify which logic will be processed. 
* This number is provided by the customizing of the pricing condition type. */ 
public BigDecimal overwriteScaleBase(IPricingItemUserExit prItem, ILastPrice lastPrice, IPricingConditionUserExit prCondition, IGroupConditionUserExit grCondition, int scaleFormNo) { 
   switch (scaleFormNo) { 
     default: throw new FormulaNotImplementedException(prItem, "scale base formula", scaleFormNo); 
    } 
 }
// ************************************************************************************************************************* 
/** * This method is called after the calculation of the condition base value of each 
* group condition on the pricing document level. If the scaleBaseFormulaNumber 
* is smaller than 600 or greater than 999 coding in a standard class is processed * else the code of the class provided by the customer is processed (600 <= scaleBaseFormulaNumber <= 999). 
* The scaleBaseFormulaNumber should be used to specify which logic will be processed. 
* This number is provided by the customizing of the pricing condition type. */ 
public BigDecimal overwriteGroupConditionScaleBase(IPricingDocumentUserExit prDocument, IGroupConditionUserExit grCondition, int scaleFormNo) { 
    switch (scaleFormNo) { 
     default: IConditionFindingManagerUserExit item = (IConditionFindingManagerUserExit) prDocument.getUserExitItems().elementAt(0); 
    throw new FormulaNotImplementedException(item, "group scale base formula", scaleFormNo); } 
}

}

Former Member
0 Kudos

Part 6


public class PricingUserExits implements IPricingUserExits {
   //continued from previous post
   // ************************************************************************************************************************* 
/** * This method is called after the calculation of the condition value of each 
* group condition on the pricing document level. 
* If the valueFormulaNumber is smaller than 600 or greater than 999 
* coding in a standard class is processed else the code of the class provided 
* by the customer is processed (600 <= valueFormulaNumber <= 999). 
* The valueFormulaNumber should be used to specify which logic will be processed. 
* This number is provided by the customizing of the pricing step. */ 
public BigDecimal overwriteGroupConditionValue(IPricingDocumentUserExit prDocument, IGroupConditionUserExit grCondition, int valueFormNo) { 
    switch (valueFormNo) { 
      default: IConditionFindingManagerUserExit item = (IConditionFindingManagerUserExit) prDocument.getUserExitItems().elementAt(0); 
     throw new FormulaNotImplementedException(item, "group value formula", valueFormNo); 
   } 
}
// ************************************************************************************************************************* 
/** * This method is called after the key of a group condition is determined 
* on the pricing document level. 
* If the keyFormulaNumber is smaller than 60 or greater than 99 
* coding in a standard class is processed else the code of the class provided 
* by the customer is processed (60 <= keyFormulaNumber <= 99). 
* The keyFormulaNumber should be used to specify which logic will be processed. 
* This number is provided by the customizing of the pricing condition type. */ 
public String setGroupConditionKey(IPricingDocumentUserExit prDoc, IPricingItemUserExit prItem, IPricingConditionUserExit prCondition, IGroupConditionUserExit grCondition, int keyFormNo) { 
   switch (keyFormNo) { 
    default: throw new FormulaNotImplementedException(prItem, "group key formula", keyFormNo); 
   } 
}
// ************************************************************************************************************************* 
/** * This method is called when pricing conditions are copied. 
* If the formulaNumber is smaller than 600 or greater than 999 
* coding in a standard class is processed else the code of the class provided 
* by the customer is processed (600 <= formulaNumber <= 999). 
* The formulaNumber should be used to specify which logic will be processed. 
* This number is provided by the customizing of the copy type. 
* NB: copyType also contains the formulaNumber */ 
public void pricingCopy(IPricingDocumentUserExit prDocument, IPricingItemUserExit prItem, IPricingConditionUserExit prCondition, IPricingType pricingType, ICopyType copyType, IQuantityValue sourceSalesQuantity, int copyFormulaNo) { 
  switch (copyFormulaNo) { 
   default: throw new FormulaNotImplementedException(prItem, "copy formula", copyFormulaNo); 
  } 
}
// ************************************************************************************************************************* 
/** * @return the string array of attribute names which is necessary to process the 
* code for the requirment with the number requirementNumber. */ 
public String[] determineRelevantAttributesForRequirement(boolean headerAttributes, int reqNo) { 
     return new String[] { }; 
 }
// ************************************************************************************************************************* 
/** * @return a string array which corresponds to the header/item attributes which 
* are required in the condition base formula (e.g. the item attribute "PRICE_PRODUCT" or 
* the header attribute "SOLD_TO_PARTY"). */ 
public String[] determineRelevantAttributesForBaseFormula(boolean headerAttributes, int baseFormulaNo) { 
   return new String[] { }; 
}
//to be continued to next post
}


Former Member
0 Kudos

Part 7


public class PricingUserExits implements IPricingUserExits {
   //continued from previous post
  // ************************************************************************************************************************* 
/** * @return a string array which corresponds to the header/item attributes which 
* are required in the condition value formula (e.g. the item attribute "PRICE_PRODUCT" or 
* the header attribute "SOLD_TO_PARTY"). */ 
public String[] determineRelevantAttributesForValueFormula( boolean headerAttributes, int valueFormulaNo) { 
   String[] relevantAttributes = new String[0]; 
   if (headerAttributes) { 
    //KOMK 
    switch(valueFormulaNo) { 
      case 601: break; 
      case 602: break; 
      case 603: break; 
      case 650: break; 
    } 
   } else { 
     //KOMP 
    switch(valueFormulaNo) { 
     case 601: break; 
     case 602: break; 
     case 603: break; 
     case 650: relevantAttributes = new String[] { "ZZPORCO", "ZZPORCO2", "ZZPORCO3", "ZZPORCO4", "ZZPORCO5", "ZZPORCO6", "ZZPORCO7", "ZZPORCO8", "ZZPORCO9" }; break; 
    case 660: relevantAttributes = new String[] { "ZZCOM" }; break; 
   case 661: break;  
   } 
  } 
  return relevantAttributes; 
}
// ************************************************************************************************************************* 
/** * @return a string array which corresponds to the header/item attributes which 
* are required in the condition scale base formula (e.g. the item attribute "PRICE_PRODUCT" or 
* the header attribute "SOLD_TO_PARTY"). */ 
public String[] determineRelevantAttributesForScaleBaseFormula(boolean headerAttributes, int scaleBaseFormulaNo) { 
   return new String[] { }; 
}
// ************************************************************************************************************************* 
/** * @return a string array which corresponds to the header/item attributes which 
* are required in the condition value formula (e.g. the item attribute "PRICE_PRODUCT" or 
* the header attribute "SOLD_TO_PARTY"). */ 
public String[] determineRelevantAttributesForGroupConditionKey(boolean headerAttributes, int groupConditionKeyFormulaNo) { 
  return new String[] { }; 
}
// ************************************************************************************************************************* 
/** * @return a string array which corresponds to the header/item attributes which 
* are required in the pricing copy formula (e.g. the item attribute "PRICE_PRODUCT" or 
* the header attribute "SOLD_TO_PARTY"). */ 
public String[] determineRelevantAttributesForPricingCopyFormula(boolean headerAttributes, int formulaNo) { 
  return new String[] { }; 
}
// ************************************************************************************************************************* 
/** * @return a string array which corresponds to the header/item attributes which 
* are required in the user exit methods pricingDocumentInit, pricingItemInit, 
* pricingConditionInit, pricingItemCalculateBegin and pricingItemCalculateEnd 
* @see #pricingDocumentInit 
* @see #pricingItemInit 
* @see #pricingConditionInit 
* @see #pricingItemCalculateBegin 
* @see #pricingItemCalculateEnd */ 
public String[] determineRelevantAttributesForFormulaIndependentUserExits(boolean headerAttributes) { 
  return new String[] { }; 
}
// ************************************************************************************************************************* 
/** * @return the array of requirement numbers which are used in the method checkRequirement. 
* @see #checkRequirement */ 
public int[] getRequirementNumbers() { return new int[] { }; }
// ************************************************************************************************************************* 
/** * @return the array of condition base formula numbers which are used in the method overwriteConditionBase. 
* @see #overwriteConditionBase */ 
public int[] getConditionBaseFormulaNumbers() { return new int[] { }; } 
// ************************************************************************************************************************* 
/** * @return the array of condition value formula numbers which are used in the method overwriteConditionValue 
* and overwriteGroupConditionValue. 
* @see #overwriteConditionValue 
* @see #overwriteGroupConditionValue */ 
public int[] getConditionValueFormulaNumbers() { return new int[] { 601, 602, 603, 650, 660, 661 }; }

//to be continued to next post...
}

Former Member
0 Kudos

Part 8


public class PricingUserExits implements IPricingUserExits {
   //continued from previous post

// ************************************************************************************************************************* 
/** * @return the array of scale base formula numbers which are used in the method overwriteScaleBase 
* and overwriteGroupConditionScaleBase. 
* @see #overwriteScaleBase 
* @see #overwriteGroupConditionScaleBase */ 
public int[] getConditionScaleBaseFormulaNumbers() { return new int[] { }; }
// ************************************************************************************************************************* 
/** * @return the array of group condition key formula numbers which are used in the method setGroupConditionKey. 
* @see #setGroupConditionKey */ 
public int[] getGroupConditionKeyFormulaNumbers() { return new int[] { }; } 
// ************************************************************************************************************************* 
/** * @return the array of copy formula numbers which are used in the method pricingCopy. 
* @see #pricingCopy */ 
public int[] getPricingCopyFormulaNumbers() { return new int[] { }; }
/** * @param pricingEngine provides information about the database connection and the client. 
* This information should be used to select customer specific data. */ 
public void init(IEngineUserExit pricingEngine) { 
  this.pricingEngine = pricingEngine; 
}
// ************************************************************************************************************************* 
// real R/3-userexits 
/** * This method is processed when a pricing document is created. */ 
public void pricingDocumentInit(IPricingDocumentUserExit prDocument) { }
// ************************************************************************************************************************* 
/** * This method is processed when a pricing item is created. */ 
public void pricingItemInit(IPricingDocumentUserExit prDocument, IPricingItemUserExit prItem) { } 
// ************************************************************************************************************************* 
/** * This method is processed when a pricing condition is created. */ 
public void pricingConditionInit(IPricingDocumentUserExit prDocument, IPricingItemUserExit prItem, IPricingConditionUserExit prCondition) { }
// ************************************************************************************************************************* 
/** * This method is processed at the beginning of the method 'calculate' of the * pricing item. This method is processed e.g. when the method 'pricing' is used. */ 
public void pricingItemCalculateBegin(IPricingDocumentUserExit prDocument, IPricingItemUserExit prItem) { }
}
// ************************************************************************************************************************* 
/** * This method is processed at the end of the method 'calculate' of the * pricing item. */ 
public void pricingItemCalculateEnd(IPricingDocumentUserExit prDocument, IPricingItemUserExit prItem) { }