Skip to Content
avatar image
Former Member

SAP Script : using Perform to do Arthematic Operation

Dear All,

I am having a problem in SAP Script. I have 2 fields total and Tax, I have to perform a arthematic operation and get sub-total, Total - Tax. I am using below code but I am getting error as CONVT_NO_NUMBER. UNABLE TO INTERPRET ' 01500.00'as a number.

Please help me in this regard. please seee the code ..as I am a new-bie, I might making some silly mistake. Please look at this problem and suggest me.

I have been suggested by my friend to use ..Move but I am not sure ..how to do that. Please kindly spare some time.

/: PERFORM GET_SUBTOTAL IN PROGRAM ZGET_SUBTOTAL

/: USING &BSEG-WRBTR&

/: USING &BSEG-WMWST&

/: CHANGING &S_SUBTOTAL&

/: ENDPERFORM.

Sub-routine Program.

PROGRAM ZGET_SUBTOTAL.

FORM GET_SUBTOTAL TABLES INT_COND STRUCTURE ITCSY

OUT_COND STRUCTURE ITCSY.

DATA : W_WRBTR TYPE BSEG-WRBTR, " Total

W_WMWST TYPE BSEG-WMWST. " Tax

READ TABLE INT_COND INDEX 1.

W_WRBTR = INT_COND-VALUE.

READ TABLE INT_COND INDEX 2.

W_WMWST = INT_COND-VALUE.

OUT_COND-NAME = 'S_SUBTOTAL'.

OUT_COND-VALUE = W_WRBTR - W_WMWST.

MODIFY OUT_COND INDEX 1.

ENDFORM.

Thanking you.

With kind Regards

Venkat

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • Best Answer
    May 10, 2006 at 04:47 PM

    Please try this instead.

    
    DATA : W_WRBTR TYPE BSEG-WRBTR, " Total
           W_WMWST TYPE BSEG-WMWST. " Tax
    
    READ TABLE INT_COND INDEX 1.
    <b>
    clear w_wrbtr.
    W_WRBTR =  W_WRBTR + INT_COND-VALUE.</b>
    
    READ TABLE INT_COND INDEX 2.
    <b>
    clear w_wmwst.
    W_WMWST =  W_WMWST + INT_COND-VALUE.</b>
    
    
    

    Regards,

    Rich Heilman

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      /: PERFORM GET_SUBTOTAL IN PROGRAM ZGET_SUBTOTAL

      /: USING &BSEG-WRBTR&

      /: USING &BSEG-WMWST&

      /: CHANGING &S_SUBTOTAL&

      /: ENDPERFORM.

      As you are already passing the S_SUBTOTAL with the changing paramter and in the Form you have that value in table OUT_COND.

      So no need to for this statment OUT_COND-NAME = 'S_SUBTOTAL'.

      As you have only 1 value in the CHANGING . If there are multipal values in the CHANGING then you need to READ THE TABLE OUT_COND WITH INDEX.

  • avatar image
    Former Member
    May 10, 2006 at 05:13 PM

    Delete the <b>BOLD</b> part and enter <u><i>Underline and Italic</i></u> part.

    /: PERFORM GET_SUBTOTAL IN PROGRAM ZGET_SUBTOTAL

    /: USING &BSEG-WRBTR&

    /: USING &BSEG-WMWST&

    /: CHANGING &S_SUBTOTAL&

    /: ENDPERFORM.

    Sub-routine Program.

    PROGRAM ZGET_SUBTOTAL.

    FORM GET_SUBTOTAL TABLES INT_COND STRUCTURE ITCSY

    OUT_COND STRUCTURE ITCSY.

    DATA : W_WRBTR TYPE BSEG-WRBTR, " Total

    W_WMWST TYPE BSEG-WMWST. " Tax

    READ TABLE INT_COND INDEX 1.

    W_WRBTR = INT_COND-VALUE.

    READ TABLE INT_COND INDEX 2.

    W_WMWST = INT_COND-VALUE.

    <b>OUT_COND-NAME = 'S_SUBTOTAL'.</b>

    <i><u>READ TABEL OUT_COND INDEX 1.</u></i>

    OUT_COND-VALUE = W_WRBTR - W_WMWST.

    MODIFY OUT_COND INDEX 1.

    ENDFORM.

    Add comment
    10|10000 characters needed characters exceeded

  • May 10, 2006 at 05:15 PM

    If the problem is that the comma is coming in the variable, then we can strip it out.

    
    READ TABLE INT_COND INDEX 1.
    
    <b>translate INT_COND-VALUE using ', '.
    condense INT_COND-VALUE no-gaps.</b>
    
    W_WRBTR = INT_COND-VALUE.
    
    
    

    Regards,

    Rich Heilman

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 10, 2006 at 07:23 PM

    Hi Venkat,

    Pls make the following changes in form routine.

    PROGRAM ZGET_SUBTOTAL.

    FORM GET_SUBTOTAL TABLES INT_COND STRUCTURE ITCSY

    OUT_COND STRUCTURE ITCSY.

    DATA: STR_AMT(255) TYPE C.

    W_WRBTR TYPE BSEG-WRBTR, " Total

    W_WMWST TYPE BSEG-WMWST. " Tax

    READ TABLE INT_COND INDEX 1.

    STR_AMT = INT_COND-VALUE.

    SY-SUBRC = 0.

    WHILE SY-SUBRC = 0.

    REPLACE ',' WITH ' ' INTO STR_AMT.

    ENDWHILE.

    CONDENSE STR_AMT NO-GAPS.

    MOVE STR_AMT TO W_WRBTR.

    READ TABLE INT_COND INDEX 2.

    STR_AMT = INT_COND-VALUE.

    SY-SUBRC = 0.

    WHILE SY-SUBRC = 0.

    REPLACE ',' WITH ' ' INTO STR_AMT.

    ENDWHILE.

    CONDENSE STR_AMT NO-GAPS.

    MOVE STR_AMT TO W_WMWST.

    READ TABLE OUT_COND INDEX 1.

    IF SY-SUBRC EQ 0.

    OUT_COND-VALUE = W_WRBTR - W_WMWST.

    MODIFY OUT_COND INDEX 1.

    ENDIF.

    ENDFORM.

    Hope this give you some idea!!!

    Cheers,

    Vikram

    Pls reward points for helpful replies!!

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      I think you need to remove the formatting before your PERFORM statement. You do not want the thousands separator or any other formatting. You can do this with the "(KT)" option in SAPscript.

      Example..

      /: PERFORM GET_SUBTOTAL IN PROGRAM ZGET_SUBTOTAL

      /: USING &BSEG-WRBTR(KT)&

      /: USING &BSEG-WMWST(KT)&

      /: CHANGING &S_SUBTOTAL&

      /: ENDPERFORM

      When passing currency fields with a PERFORM, I have seen some decimal places set as ','. If this occurs, you should translate.

      TRANSLATE INT_COND-VALUE using ',.'.

  • avatar image
    Former Member
    May 10, 2006 at 08:53 PM

    I just found some code where I am also doing a PERFORM in SAPscript with the field BSEG-WRBTR.

    As I listed in the previous thread, I pass the USING variable like &BSEG-WRBTR(KT)& and do a TRANSLATE in the ABAP program (TRANSLATE INT_COND-VALUE USING ',.'). It seems to work fine.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Dear All,

      Atlast .. I got !!!!!!!!!!

      Thank you .Special thanks to Khan / Rich / Vijay.

      I am closing this thread. awarding points.

      Regards

      Venkat