cancel
Showing results for 
Search instead for 
Did you mean: 

Pricing : ABAP to Java conversion help needed

0 Kudos

Hi all.

I am basically an ABAP developer. My recent assignment needs some java coding.

It will be very helpful if we anybody helps me in finding the corresponding pricing fields in java.

The abap code is as follows

check : xkomv - kgrpe = ' '.

check: xkomv - xkbetr ne 0.

check : komp - kpein ne 0.

if komp - netwr < 0.

komp - netpr = 0 - komp - netpr.

endif.

xkwert = ( ( ( komp - netpr * ( 100000 + xkomv - xkbetr)) / 100000)

  • komp-mglme / komp-kumza * komp - kumne / 1000 / komp - kpein )

- komp-netwr.

Please help in converting this abap code to its corresponding java code.

Thanks and Regards

Deepika

Accepted Solutions (1)

Accepted Solutions (1)

ravindra_bollapalli2
Active Contributor
0 Kudos

hi deepika,

in abap check is simillar to the if-edif or nested if in java

look this thread for abap

http://help.sap.com/saphelp_nw04/helpdata/EN/9f/db9afe35c111d1829f0000e829fbfe/content.htm

mean whle i wll send the java code for this

ravindra

0 Kudos

Hello Ravindra,

Thanks for the reply....

I have developed one skeleton java code for the corresponding abap code. But its not working, So your help in coding will help me in correcting my code.

Thanks

Deepika

ravindra_bollapalli2
Active Contributor
0 Kudos

hi deepika will u send the java code (copy the code to sdn ) what u written so that we will solve the problem

ravindra

0 Kudos

Here is the code I have developed: Please check and let me know if there are any changes


import java.math.BigDecimal;

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

import com.sap.spe.pricing.transactiondata.PricingTransactiondataConstants;

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

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

import com.sap.spe.pricing.transactiondata.userexit.ValueFormulaAdapter;


public class ZS2S_IPC_ZDCP extends ValueFormulaAdapter {

      public BigDecimal overwriteConditionValue(

            IPricingItemUserExit item,

            IPricingConditionUserExit condition) {
                 

            BigDecimal kompKumza = new BigDecimal(String.valueOf(condition.getFraction().getNumerator()));

            BigDecimal kompKumne = new BigDecimal(String.valueOf(condition.getFraction().getDenominator()));

            boolean xkomvKgrpe = condition.isGroupCondition();

            BigDecimal kompKpein = condition.getPricingUnit().getValue();     

            BigDecimal kompNetwr  = item.getNetValue().getValue();

            BigDecimal kompNetpr  = item.getNetPrice().getValue();

            BigDecimal xkomvKbetr = condition.getConditionRate().getValue();

            BigDecimal kompMglme = item.getBaseQuantity().getValue();

            
              if ( xkomvKgrpe = true )

                  return PricingTransactiondataConstants.ZERO;

             
              if ( kompKumza != PricingTransactiondataConstants.ZERO )

                return PricingTransactiondataConstants.ZERO;


            if ( kompKumne != PricingTransactiondataConstants.ZERO )

                  return PricingTransactiondataConstants.ZERO;    


            if ( kompKpein != PricingTransactiondataConstants.ZERO )

                    return PricingTransactiondataConstants.ZERO;


            if (kompNetwr.compareTo(PricingTransactiondataConstants.ZERO) < 0 )

                  kompNetpr = (PricingTransactiondataConstants.ZERO).subtract(kompNetwr);
            

             BigDecimal y = new BigDecimal("100000");

            BigDecimal a = y.add(xkomvKbetr);

            BigDecimal temp = kompNetpr.multiply(a);

            BigDecimal result1 = temp.divide(y, 2, BigDecimal.ROUND_HALF_UP);

            

            BigDecimal result2 = result1.multiply(kompMglme) 
                                     .divide(kompKumza, 2 BigDecimal.ROUND_HALF_UP).multiply(kompKumne).divide(kompKpein, 2,  BigDecimal.ROUND_HALF_UP);

           
            BigDecimal Result = result2.subtract(kompNetwr);

          return Result;

      } 

}

Edited by: Deepika Mallya on Aug 6, 2009 9:08 AM

ravindra_bollapalli2
Active Contributor
0 Kudos

hi deepika,

refer this document or read this

http://www.fdc.co.il/tips/88_20090116151515.pdf

mean while i wll send the details answer for u r query

ravindra

Edited by: VENKATA R BOLLAPALL on Aug 6, 2009 12:45 PM

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi deepika,

Java code

int xkomv - kgrpe =' ';

int xkomv - xkbetr =0;

int koma - kpein = 0;

if(komp - netwr < 0)

{

komp - netpr = 0 - komp - netpr;

}

int xkwert = (((komp - netpr * (100000 + xkomv - xkbetr)) / 100000) * komp - mglme / komp - kumza * komp - kumne / 1000 / komp - kpein) - komp - netwr.

System.out.println(xlwert) // printing purpose just like write statement in abap.

Regards,

Sunaina Reddy T