on 11-22-2014 11:34 PM
Hi Experts,
I have an requirement and stucked on it. I have an internal tables containing fields as below:
table : IT_tab
WAERS T_BAL L_BAL
--------------- ------------ -------------
TYPES ( WAERS ) ( DMBTR ) ( STRING )
DATA: USD -1234.67 (USD then 2 decimal place)
IDR 123467 - ( No decimal Place )
1. Each line has data as currency( WAERS), total balance (DMBTR), and converted balance(STRING). Adobe Form has a form field named f1 (as decimal
type), If waers is USD then I have to display T_bal at Form field f1, if it is IDR then have to display L_bal. Please suggest me how to do this.
2. The problem is with minus ( - ) sign. if try to display value from L_bal, It display minus sign at right hand side, while it should be display at left side. Please tell how to do that?
Thanks
Piyush
Hello Florian,
I would like to thanks you for your valuable help. Your suggestions helped me and I have completed my requirement successfully.
Thanks again.
Thanks
Piyush
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
First thanks for your response. Have a look at snapshot of requirement.
Internal Table IT_Totaldue have 3 fields WAERS, TBAL and L_TBAL. On form there is one cell (field) named L_TBAL for output. I have to display data either of TBAL or of L_TBAL in output field like below condition:
if waers = USD then
display output_field = TBAL
else
display output_field = L_TBAL
endif.
Can you tell me complete way or script to do this?
Thanks & Regards
Piyush
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Piyush,
if you want it to do in the form itself, you need just an if/else construct.
Here is a link to the official guide of formcalc
LiveCycle ES2 * Adobe LiveCycle Designer ES2
if ( <however you designed your content-tbal> == "USD" ) then
$ = <however you designed your content-tbal>
else
$ = <however you designed your content-l_tbal>
endif
In my opinion the easiest thing is to do it in the interface of much better in the driver-program and pass just one field to the form and set these two as inactive.
~Florian
PS: There are a lot of examples out there. Maybe you work through some tutorials. Here is a link to a similar problem which is solved with javascript
Hi Florian,
Have a look at below snapshot. There is Data hierarchy and script. Is script written by me is correct or anything is wrong in that?
Please correct me if I am doing mistakes.
script is:
data.#subform[0].Table2.Row1[1].L_TBAL::initialize - (JavaScript, client)
if ( $record.S_KUNNR.WAERS.RAWVALUE = "IDR" )
{
$ = $record.S_KUNNR.IT_TOTALDUE.DATA[*].L_TBAL.RAWVALUE;
}
else
{
$ = $record.S_KUNNR.IT_TOTALDUE.DATA[*].TBAL.RAWVALUE;
}
Thanks
Piyush
Hi Piyush,
you need to make yourself familiar with the scripting language itself.
What you got here is a mix between formcalc and javascript.
First mistake:
javascript always starts with "this" when a variable is called
formcalc starts with "$"
a mixing is not possible.
By the way, there is a sytax-check included (marked yellow)
Second mistake:
you have data in a table, you cannot call it from the root, that doesn't make any sense, because you want to sum your fields, do you?
You would just grab one value. (not that your code is working in that way, but if, you would)
Third mistake:
You cannot sum values with different currencies, of course you know that, but what would happen if different currency is in? There is no failure handling...
Out of these, I'm not able to help you in a proper way (points contains unanswered questions).
Anyway, are you familiar with ABAP? So why don't you do that in ABAP?
Again, I really recommend you to work through tutorials and make yourself familiar with IfbA and the script-language.
~Florian
Hi Florian,
Thanks for help. I request you to help me once again at this point.
This.rawValue = $record.S_KUNNR.IT_TOTALDUE.DATA[*].L_TBAL.RAWVALUE;
Above script is correct both side?
Right side of equal sign is initializing value of field "L_TBAL" . Script written right side is correct or not? If it is incorrect please correct it.
Thanks
Piyush
Message was edited by: Florian Henninger
Moderation Note: I deleted your personal information. Read the Rules of Engagement!
6. Avoid solicitations. Avoid marketing your company’s products and services. If you want people to know your affiliation with your company, put those details in your profile to make the information available to the community. Do not embed links to ads in your posts. The same applies to email solicitations and advertising. If you want someone to trust you enough to buy what you offer, share your expertise and they will seek you out. If you want people to contact you, you can choose to make your email visible in your profile, but we ask you not to post it elsewhere on the site.
Hi Piyush,
your right side is not correct. To access data from the root-note using javascript it begins always with
xfa.record.(path)
That doesn't bring us further. Here is the link to the official guide Adobe offers to learn Javascript with a lot of good examples. Also your problem is described in there, so I hope you get it fixed, but right at the moment you need to make yourself familiar with the basic things of programming forms.
And again, why don't you use ABAP to solve your problem?
~Florian
Why not have a "display only" field (it could be just a STRING field) that will have either T_BAL or L_BAL value in it depending on your logic (set the value using script in your form) Then hide the actual T_BAL and L_BAL fields. The user will see the correct one ("display only")?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Christopher,
First I would like to thanks for your quick response. What you are saying I have to do same. there was only two fields in my internal table Waers and T_bal (DMBTR type). When waers is USD then it is ok to display t_bal in "display only" and it display value with 2 decimal place. It is ok. The problem is raise when it is IDR currency then I have to display the value ( converted by BAPI_currency_conv_to_external, it display value with 4 decimal places ) without any decimal place. Based on waers I have to display t_bal data in "display only" field. But the problem is:
1. If keep T_bal as DMBTR it will display value with two decimal places it is either USD or IDR.
2. if keep T_bal as BAPICURR_D type it will display value with four decimal places in both condition. to handle this I move the value in of T_bal in a string if it is USD currency and if it IDR Currency I first move the value (converted by BAPI ) in a DECV15 type variable and then move it to string variable.
this string variable is L_Bal in my internal table.
while It is currency so I use display pattern (pattern : "num:decimal").
I used second step. but with this the problem is when L_bal is negative value, then minus sign displayed at right side of value, I have to display minus sign at left of the value.
I hope that it will help you to understand this. How to handle these both decimal value condition ( for USD and IDR) or if I go with second step then how to handle problem with minus sign?
Thanks
Piyush
I guess I did not explain well....what I mean is to use another extra field that you will use to actually display the value you want shown (that is what I called the "display" field). You can hide the actual fields that hold the actual values (your currency fields). Since this "extra" field is a STRING type, whatever you move to it will be displayed "as is". So use scripting, ABAP code, whatever on the "backend" to prepare you "value" fields to be "moved" over into your "extra" field for display.
Hi,
Can you tell me one thing regarding Adobe Forms. There is an Internal table IT1 having field f1, f2, f3. F1 is flag. On form I have a form field that would display data from IT1 based on flag "F1". If F1 is initial form field display data from F2, if F1 is not initial it will display data from F3.
Can you tell me how to do this?
Thanks
Piyush
User | Count |
---|---|
85 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.