cancel
Showing results for 
Search instead for 
Did you mean: 

Currency field causes problem in Smart Form -- newbie needs help!

former_member210148
Participant
0 Kudos

Good day, everyone.

First of all, I have searched both here and the Internet trying to find the solution to this problem. I believe it has to do with a reference field needing declared, but I'm not doing it right because it's still not working.

I have a simple Smart Form that accepts a table as input from the calling ABAP program. I am using a LOOP statement to process my records, line by line. So far so good -- I can see my report using Print Preview and it looks good. I am adding fields one at a time to the output line, going slow as I'm still new to Smart Forms.

Okay, all's good until I try to add a field WA_REPORT-ANSAL to the text line. Field ANSAL is of type ANSAL_15 (currency length 15 decimal 2). In the structure I created that contains this field, I defined a reference table of PA0008 and a reference field of ANCUR. But when I add &WA_REPORT-ANSAL& to the report, run it, and get my print pop-up box, nothing happens when I click the "Print Preview" button. I've been told this means something is blowing up with the Smart Form, which I've confirmed is the addition of this new field.

In the Smart Forms "Global Definitions" selection, "Currency/Quant. Fields" tab, I tried specifying this field (WA_REPORT-ANSAL) with a Reference Field of PA0008-ANCUR, but it said PA0008-ANCUR was unknown. So I went to the "Global Data" tab and declared a variable of that type, then put that variable in as the Reference Field, but it still doesn't work.

I've spent two days trying various combinations of things, but I can't get it to work. I've read things in my searches for help, but I don't understand what they are saying. All I want to do is output that field just like any other field coming in on my table. Can someone tell me exactly what/where/how I need to handle this kind of a field so it will output?

Thanks so much!

Dave

Accepted Solutions (0)

Answers (3)

Answers (3)

former_member210148
Participant
0 Kudos

Thanks Sandra! It doesn't happen very often -- believe me!

I should have posted how I solved it on my own. Here's what I did:

1. In the Smart Form, "Global Definitions" -> "Global Data" tab, I created the following:

Variable Name WA_PA0008, Type Assignment TYPE, Associated Type PA0008

2. In the Smart Form, "Global Definitions" -> "Currency/Quant. Fields", I created the following:

Field Name WA_REPORT-ANSAL, Reference Field WA_PA0008-ANCUR, Data Type CURR

Field Name WA_REPORT-BETRG, Reference Field WA_PA0008-WAERS, Data Type CURR

This solved the problem. Before, I'd been trying to specify a variable of type ANSAL or BETRG in the Global Data tab. I decided to try just declaring a work area for the table only to see if that would make a difference. Thankfully, it did.

Sandra_Rossi
Active Contributor
0 Kudos

In case someone wants to know how currency code field determination works, I created this wiki: http://wiki.sdn.sap.com/wiki/display/ABAP/HowcurrencycodeisdeterminedinSmartFormsforagivenamountfield

(not sure if the wiki is clear, so don't hesitate to modify it yourself (you need to be a wiki editor) or let wiki comments so that I can enhance it)

Sandra_Rossi
Active Contributor
0 Kudos

Hi Dave,

it's a nice demonstration that writing down a problem helps to solve it all by one's own

Sandra

former_member210148
Participant
0 Kudos

Finally solved on own.