2006 Nov 01 10:22 PM
Hi Dear All,
In SAP Script Debugging, I would like to know whether my condition is true or false. I mean, I have to know whether my Sy-subrc is 4 or 0. where can I see that.
Second question : can I compare a amount value to a charecter. I guess SAP Scripts variables are always charecters, if I have variable which reflects amount value, eg var1 value is 50,000.00 ...can I compare with '50,000.00'
I mean can I use lessthan and greater than and compare.
Please let me know..
Thanks & Regards
Venkat
2006 Nov 01 10:28 PM
Hi
U can check SAPSCRIPT-SUBRC
If the validation IF &AMOUNT& > '50,000.00' doesn't work you can create a routine and do the validation in the routine:
/: DEFINE &RESULT& = ' '
/: PERFORM CHECK_AMOUNT IN PROGRAM Z....
/: USING &AMOUNT&
/: CHANGING &RESULT&
/: ENDPERFORM
/: IF &RESULT& = 'X'
Anyway you can do the validation in the program insetad of the sapscript.
Max
Hi
U can check SAPSCRIPT-SUBRC
If the validation IF &AMOUNT& > '50,000.00' doesn't work you can create a routine and do the validation in the routine:
/: DEFINE &RESULT& = ' '
/: PERFORM CHECK_AMOUNT IN PROGRAM Z....
/: USING &AMOUNT&
/: CHANGING &RESULT&
/: ENDPERFORM
/: IF &RESULT& = 'X'
Anyway you can do the validation in the program insetad of the sapscript.
Max
2006 Nov 01 10:24 PM
2006 Nov 01 10:28 PM
Hi
U can check SAPSCRIPT-SUBRC
If the validation IF &AMOUNT& > '50,000.00' doesn't work you can create a routine and do the validation in the routine:
/: DEFINE &RESULT& = ' '
/: PERFORM CHECK_AMOUNT IN PROGRAM Z....
/: USING &AMOUNT&
/: CHANGING &RESULT&
/: ENDPERFORM
/: IF &RESULT& = 'X'
Anyway you can do the validation in the program insetad of the sapscript.
Max
2006 Nov 01 10:42 PM
Hi Max,
Thanks for your reply.
Can I use formatting options and compare.
I mean to say, Can I use &Amount(CT)&
and compare .
eg : if &amount(CT)& > '50000'.
As C will condense and T will remove thousands separaters.
also want to know. Can I use
&Amount(CT.0)& which gives results without decimals, commas and thousand separators.
Please let me know. Thanks you once again. alloting points for your efforts.
Regards
Venkat
2006 Nov 02 3:28 AM
Hi
I tried to do that validation in the form but it doesn't work because it compares them as they was chaar fields, so 10000 is less than 500 because 10000 begin with 1 and 1 is less than 5.
Try to use a routine like I described in my previous answer:
FORM CHECK_AMOUNT TABLES IN_TAB STRUCTURE ITCSY
OUT_TAB STRUCTURE ITCSY.
DATA AMOUNT TYPE WRBTR.
READ TABLE IN_TAB WITH KEY NAME = 'BSEG-WRBTR'.
IF SY-SUBRC = 0.
DO.
REPLACE '.' WITH SPACE INTO IN_TAB-VALUE.
IF SY-SUBRC <> 0. EXIT. ENDIF.
ENDDO.
DO.
REPLACE ',' WITH SPACE INTO IN_TAB-VALUE.
IF SY-SUBRC <> 0. EXIT. ENDIF.
ENDDO.
CONDENSE IN_TAB-VALUE NO-GAPS.
MOVE IN_TAB-VALUE TO AMOUNT.
AMOUNT = AMOUNT / 100.
IF AMOUNT > 5000.
READ TABLE OUT_TAB WITH KEY NAME = 'RESULT'.
IF SY-SUBRC = 0.
MOVE 'X' TO OUT_TAB-VALUE.
MODIFY OUT_TAB INDEX SY-TABIX.
ENDIF.
ENDIF.
ENDIF.
ENDFORM.Max
2006 Nov 02 4:25 AM
you can compare to contants and as you suspect you have to get the length correct and include a sign at the end so it is not a good idea. The best way is surely to declare a constant in your abap and use that:
data c_max_wrbtr type bsid-wrbtr value '50000'.
Then in sapscript:
/: if &bsid-wrbtr& > &c_max_wrbtr&.
/: endif.
2006 Nov 02 6:38 PM
Hi Max, Naresn, Neil .
Thank you very much for your efforts. I got it .
I did it like this ..
form COMPARE_AMOUNT tables int_cond structure itcsy
out_cond structure itcsy.
data : W_SWNET type REGUD-SWNET,
C_SWNET TYPE REGUD-SWNET VALUE 50000,
compare type regud-swnet,
FLAG TYPE C.
read table int_cond index 1.
translate INT_COND-VALUE using ', '.
condense INT_COND-VALUE no-gaps.
W_SWNET = int_cond-value.
*compare = int_cond-value.
IF w_swnet > C_SWNET.
FLAG = 'X'.
ENDIF.
OUT_COND-NAME = 'FLAG'.
OUT_COND-VALUE = FLAG.
This worked fine ...
Thanking you once again. Closing this thread and alloting points to you all..
Regards
Venkat
| User | Count |
|---|---|
| 5 | |
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |