SAP Scripts : Conditions on amount values
Dear All,
I have to compare a Netvalue and Print a somthing if value is less than 20,000.
So I wrote ..
/: if &VAR(CT)& LT '20000.00'.
Z2 xxxxxxx
/: ELSE.
Z2 yyyyyy
/: ENDIF.
But this is not working properly.
I wonder how can I compare a amount value.
I am using &VAR(CT)&, just to remove commas, and blank.
Regards
Venkat.
Hi,
Always prefer to take net value in currency format and companre with amount.
I feel you might have store currency in character format.
in &VAR&.
store it in a variable type wrbtr.
and compane ....
if &v_wrbtr& LE 20000
leave comma or decimals.
Check this wasy. Hope this will resolve your query.
*Please mark all helpful answers.
Similar Messages
-
Sap Script - putting dynamic height value in box command
Hello All,
In SAP scirpt I have to display a table which might have variable number of line items. So in box command I cannot mention the height statically.
Is it possible to specify that dynamically like by using a variable and incrementing it every time the element is called from the loop?
Thanks
Indrajitno in SAP-SCRIPT this aint possible. But you could do this in an external perform, and have your incremented value back, tho since a external perform is beeing called from the form, the box statement might already have been interpreted.
this again would mean that this way wouldnt work as well then. -
Program with sap scripts doent show any values
While executing the program with scripts the output doesnt show values from the database. It simply shows the print preview with '&&' values. Pls help me
Edited by: Gayathri Nair on Mar 12, 2009 8:11 AMHi,
Check your driver program
1.you should have used OPEN_FORM with correct sap script form name
2.have read the data into internal table and with in the loop-end loop you are calling WRITE_FORM
with the element and the window type shpuld be MAIN to display the data.
(use the same eleemnt in the MAIN WINDOW defined on the form) then only output will be printed.
3.Have used the close form outside the loop-endloop.
Please revert back in case of problem.
PS:main reason can be the use of elements and the window type as I have also faced the same kind of problem.
Pooja -
Problem in SAP-Script Conditional Block
Hi All,
I am creating one report form using SAP Script, which uses standard driver program. There is a control statement like,
{ Consider W=1, X=0 , Y=0 & Z=0 }
/: IF ((X==0 AND Y==0) OR (Z==0 OR W==0) OR ...) { lot of OR & AND stament used in this conditional statment }
/: ELSE
/: ENDIF
Here is a mistery, it executes both if and else statement. Please give me some idea on this, and why such a weird output is displaying?
<<removed by moderator>>
Edited by: kishan P on Sep 13, 2010 4:17 PMHi..
The syntax of the command could be incorrect. Check for full stops, variables etc.
http://help.sap.com/saphelp_40b/helpdata/en/d1/80325f454211d189710000e8322d00/content.htm
Please check the above link's last paragraph which says :
"If a syntax error occurs in the interpretation of this command, then the command is not executed. This may have an unexpected effect on the subsequent text output. For example, if the IF statement is incorrect, then all following ELSEIF and ELSE commands will be ignored, since the opening IF command is u2018missingu2019. This will cause all the text lines attached to the ELSEIF and ELSE commands to be printed."
Regards,
Karthik -
Error while displaying SAP script
Hi,
I was trying to display a SAP script by passing the values.
When i click the preview button from the Dialog window It's displaying error called "CALL CONTAINED error (ADS(2)) "
Can anyone explain why this problem is coming and what we want to do for making it work.Hi,
Check for the data types of the variables you are passing values.
There can be any data miss match.
Regards,
Rajesh Kumar -
SAP script printout alignment issue
Hi Experts,
I have facing one Script Printout Alignment issue.
SAP Script Form printing some Values in Table format.
While debugging( in debug mode ), I am getting the correct Alignment ( Proper table format with values ).
But in printout the Alignment( The vertical and horizontal lines are not printed properly ) is not correct.
Thanks in Advance.HI Glen Anthony,
I am not using any printer details.
from the Spol (SP01) I am checking the print priview.
Success in debug mode but not in Print.
Please suggest.
Thanks -
Question concerning sap script
Hi all experts! I have a question concerning sap script
First some background information:
Ive created a sap script that is called from a function module and from an executable program, when I run the executable program the sap script work fine, but when I run the function module, all the variables in the sap script dont have value
In the function module the variables are defined in the top include
I dont know why these variables dont take his value from the function module
Any ideas?
Thanks in advance.
Message was edited by: Gerardo hernandezI think that sapscript expects its variables to be in the program which calls the fm <b>by default</b>. When you test via SE37 the framework itself is the calling program and it's unlikely that it will have a variable named kunnr-name1.
To over-ride this default, inside your fm pass the 'options' parameter(type itcpo) to 'open_form' and set the 'tdprogram' value to sy-repid in the function module.
I have tested this in my own environemnt and initially got the same error as you. When I set the tdprogram variable it started working! -
Comma not seen in the amount value in SAp Script
Hi,
I am printing the folllowing values which contain amounts in SAP Script.
<Z>Sum total,,,,,,®UD-SWRBT(13)&,,®UD-SWABZ(9)&,, ®ud-swnet(13)&</>
Both the values are printed as the following
REGUD-SWRBT = 20000,000.00
regud-swnet = 20000,000.00
I want the same to be printed as below.
(ie the comma seperator to be printed in the second set of 3 zeroes as well)
REGUD-SWRBT = 20,000,000.00
regud-swnet = 20,000,000.00
Can any one suggest me please.
Thanks !!
RegardsHi Adarsh,
Actually the problem here is that the field length of the field SWRBT is only 13 and the extra comma you want, can not be accommodated there.
You will have to declare a variable of about 14-15 field length and then
pass this value in it. Definitely the comma will appear.
Hope this is Useful.
Thanks,
Daya. -
IF-condition not working in sap script??????
hi,
i am trying to chk one condition in sap script using if statement....but it is not working at all.
statement i am writing is :-
/: IF &IST_ITEM-SAD_PRINT& <> 0
p7 ,,,,,,,,,,,,,,,,SAD,, 4.00 &IST_ITEM-SAD_PRINT&
/: ENDIF
value for IST_ITEM-SAD_PRINT is coming as it is shown while debuging .
eventhen control is going inside if statement independent from the value of IST_ITEM-SAD_PRINT
how to use if statement properly....
regards
DeepakHi,
Declare a dummy variable of type IST_ITEM-SAD_PRINT and then use that variable in sapscript..
Ex..
<b>Print program</b>
DATA: V_DUMMY LIKE IST_ITEM-SAD_PRINT.
<b>Sap script</b>
/: IF &IST_ITEM-SAD_PRINT& <> <b>&V_DUMMY&</b>
p7 ,,,,,,,,,,,,,,,,SAD,, 4.00 &IST_ITEM-SAD_PRINT&
/: ENDIF
Thanks,
Naren -
Calculation of values in a dunning form (SAP Script)
Hi Experts!
I want to add values to a sum (dunning-amount + dunning-fee + interest) in a dunning form (SAP Script; Z150_DUNN_02).Therefore I'm using a subroutine (Z_FI_KX_DUNN_02_INTEREST) to summarize. Problem is the format of the output-field &Z_FAEBT&. It's not similar to field &MHNK-FAEBT& which was formerly printed (without calculation of interest and dunning-fees.
/: DEFINE &Z_FAEHW& := &MHNK-FAEHW&
/: DEFINE &Z_ZINHW& := &MHNK-ZINHW&
/: DEFINE &Z_MHNGH& := &MHNK-MHNGH&
/: DEFINE &Z_FAEBT& := &MHNK-FAEBT&
/: PERFORM ZFAEBT IN PROGRAM Z_FI_KX_DUNN_02_INTEREST
/: USING &Z_FAEHW&
/: USING &Z_ZINHW&
/: USING &Z_MHNGH&
/: CHANGING &Z_FAEBT&
/: ENDPERFORM
/: ENDIF
A3 &MHNK-WAERS& &Z_FAEBT(C)&
It would be fine to get a hint how to format the field &Z_FAEBT& correctly. Must be done in the subroutine Z_FI_KX_DUNN_02_INTEREST by a special WRITE-command? Is it possible to add these values only in the form?
Thanks for support!
Regards, Berndhi!
I defined the field like you said! After moving this field to a numeric field to add the different amounts the
following error occurred:
Runtime errors CONVT_NO_NUMBER
Exception CX_SY_CONVERSION_NO_NUMBER
Occurred on 16.06.2009 at 15:15:25
Unable to interpret " 1.316,59" as a number.
Definition:
FORM zfaebt TABLES in_par STRUCTURE itcsy
out_par STRUCTURE itcsy.
TABLES: mhnk.
DATA: z_faehw_num LIKE mhnk-faehw,
z_zinhw_num LIKE mhnk-zinhw,
z_mhngh_num LIKE mhnk-mhngh,
z_faebt_num LIKE mhnk-faebt.
DATA: z_faehw TYPE string,
z_zinhw TYPE string,
z_mhngh TYPE string,
z_faebt TYPE string.
statement:
READ TABLE in_par WITH KEY 'Z_FAEHW'.
CHECK sy-subrc = 0.
z_faehw = in_par-value.
z_faehw_num = z_faehw.
I suppose a type-conflict.
Regard, Bernd -
How To Display Minus value in SAP SCript
Hello Guys.
I am working on a Script. My Problem is that For a fields BSAD-DMBTR.
I have to show this fields value as minus or plus as per condition with fields
<b>bsad-shkzg</b>. In my Internal table it's update as minus but when I am calling Write form with loop. the value is not display with minus sign.
How can I display value with minus sign in SAP script.
Regards
Swati,,Hello Guys..
Thanks for Reply. But I am doing that thing already. My Internal table is updated with minus value. My Problem is not That.
let's suppose.
itab-name = 'xyz'.
itab-value = 100.
append itab.
itab-name = 'xyz1'.
itab-value = -1 * 100.
append itab.
loop at itab.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'LINE'
function = 'SET'
type = 'BODY'
window = 'MAIN'
EXCEPTIONS
element = 1
function = 2
type = 3
unopened = 4
unstarted = 5
window = 6
bad_pageformat_for_print = 7
spool_error = 8
codepage = 9
OTHERS = 10.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
endloop.
Now when value is printed in SAP Script both value is display as plus .I want to display secound value as minus.
Please reply it's urgent.
Thanks
Swati.... -
How to calculate a value in sap script?
Hi friends i have to do addition and then display the added value in grandtotal like
total amount + late fee = grand total
i have to do this in sap script can anyone tell me the procedure where to declare wheather in abap aditor if yes how?Hi ...
Its easy to add up two values...
u can do it in a subpool program...
Refer the following code:
Code the following in the Script...
/: PERFORM TOTAL_SUM IN PROGRAM 'ZTEST_ADDITION'
/: USING &VAL1&
/: USING &VAL2&
/: CHANGING &TOTAL&
In the EDitor..create a program ' ZTEST_ADDITION'..
FORM TOTAL_SUM TABLES in_tab STRUCTURE itcsy
out_tab STRUCTURE itcsy.
Read in_tab index 1.
Here u will get the val1...
Read in_tab index 2.
here u will get val2.
l_v_total = val1 + val2.
read out_tab index 1.
out_tab-value = l_v_total.
modify out_tab index 1.
Write the changing paramets in the form
to Output the values...
Thanx,
navin..! -
Error "AND, OR or end of condition expected" in sap script IF statement
Hi all,
/: IF &WA_BSEG_IN-BUKRS& EQ '1000' OR &WA_BSEG_IN-BUKRS& EQ'2000'
= OR &WA_BSEG_IN-BUKRS& EQ '4000' OR &WA_BSEG_IN-BUKRS& EQ '5000'
/: CASE &WA_BSEG_IN-BLART&
/: WHEN 'DZ'
/: IF &SAVE_EVENT& EQ u2018ZPR01u2019 OR &SAVE_EVENT& EQ u2018ZPR06u2019
D1 <C4>Cheque Number/Bank Reference,,Payment Method,,Amount,,Cur,,</>
/: ENDIF
/: WHEN OTHERS
D1 <C4>Payment Method,,Cheque Number/Bank Reference,,Amount,,Cur,,</>
/: ENDCASE
/: ENDIF
I am getting below error in the the if statement (5th line) in sap script.
Error is "AND, OR or end of condition expected".
What is error in the 5th line?
Thanks in advanceHi,
In sap script, always give conditon in a sinlge line. Dont break the condition into many lines.
/: IF &WA_BSEG_IN-BUKRS& EQ '1000' OR &WA_BSEG_IN-BUKRS& EQ'2000' OR &WA_BSEG_IN-BUKRS& EQ '4000'
Thanks. -
Calling different pages in a single sap script based on conditions?
Hi All,
Can anyone please give me an example of how to call different pages in a single sap script based on condition. Eg., i need to call 5 differnet pages from a single sap script based on 5 company codes.
Please help
Regards
PriyaThis approach to make call from SAPscript. Its concept is similar to make call to a subroutine in another program. I would presume you understand how to use USING and CHANGING parameter. =)
SAPscript -
/: Perform get_date in program z_at_date
/: using &p_year&
/: changing &new_date&
/: endperform.
program z_at_date -
form get_date TABLES rec_in STRUCTURE itcsy
rec_out STRUCTURE itcsy..
DATA:
v_year type char10.
sap script and subroutine uses itcsy structure to transmit parameters
first parameter is incoming while second parameter is out going
their function is like an internal table with header line
all data types between SAPscript and subroutine are string.
so, you might need additional conversion.
read incoming parameter with exact name from SAPscript
READ TABLE rec_in WITH KEY name = 'P_YEAR'.
IF sy-subrc EQ 0.
v_year = rec_in-value.
ENDIF.
to return value, use the exact name on the second structure
CONCATENATE v_year v_year INTO v_year.
READ TABLE rec_out WITH KEY name = 'NEW_DATE'.
IF sy-subrc EQ 0.
rec_out-value = v_year.
MODIFY rec_out TRANSPORTING value WHERE name = 'NEW_DATE'.
ENDIF.
endform.
Hope this helps =) -
Output Format for Amount in SAP Script PO
Hi,
In my Standard SAP Script PO Form 'MEDRUCK', all amount values are getting printed in the form 1.234.567,89 but I want them to be in the Form 1,234,567.89 .
For doing this I have gone in T-Code SU3 and set the default decimal notation as
X 1,234,567.89 .
I have also tried by giving the command
/: SET COUNTRY 'IN'
But still the amounts in the ouput format is coming in the same way 1.234.567,89 .
If anyone has faced similar situation, plz tell how to change the output format of amount in SAP Script.
Thanks and Regards,
Nitin GuptaI have tried using SU3 but it's not worknig. Is their any other method also of which maybe I am not aware of?
Maybe you are looking for
-
Acrobat 9.5.2 Failed to send a DDE command
I have a user who is sporadically getting this error message using Acorbat 9.5.2 Standard. Some fixes that I've seen on here mention editing the DDEServername in the registry located at HKEY_CLASSES_ROOT\acrobat\shell\open\ddeexec\application. Unfort
-
Is it possible to rsync the official databases?
It seems unnecessary that every time the database is updated, all of the database files get overwritten with new ones from the tarball. Aside from unnecessary IO, doesn't it increase the overall bandwidth cost for the servers? Even uncompressed, I wo
-
HT1212 I keep getting error 9006 and my ipod wont restore. Now waht?
My ipod is locked out and it wasn't backed up to computer. When I try to restore I'm getting error message 9006. How can i get it to restore?
-
Export Link Annotation in XFDF
Hello I am developing a plugin for Adobe Professional which needs to export all annotations in an xfdf format. All annotations are getting exported correctly, except the link annotation. When i create a link annotation and other annotations in a pdf
-
No mail arrived to 10.6.6 Mail Server after enabling "zen.spamhaus.org" spam filter. I can send to any, but receive only from local domain. And after disabling the filter, I can receive smoothly from all domain. My server is not blacklisted and it's