Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

reference fields in a zstructure

kiran_k8
Active Contributor
0 Likes
2,243

Hi Folks,

I had created a structure and was able to populate the data in the smartform.But I have a problem with Currency and Quantity fields.

1.I have a field called PRICE for which I had given RV13A-KONWA as reference field.In the Structure I had given the component type as KBETR_KOND.

2.I have a field called Quantity for which I had given MARA-MEINS as reference field.I had given the component type as MEGEN_D.

While activating the structure it is fine when I run the smartform it is giving an erro saying reference field is unknown in the form.

How to correct this?

Thanks,

K.Kiran.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,667

Smartforms will automatically look for the currency or quantity unit in a table in order to format the value correctly as both can have different number of decimal places for different units.

You need to include a currency and quantity field in your structure, reference it and populate it with the appropriate values.

Regards,

Nick

8 REPLIES 8
Read only

Former Member
0 Likes
1,668

Smartforms will automatically look for the currency or quantity unit in a table in order to format the value correctly as both can have different number of decimal places for different units.

You need to include a currency and quantity field in your structure, reference it and populate it with the appropriate values.

Regards,

Nick

Read only

0 Likes
1,667

Nick,

<i>"You need to include a currency and quantity field in your structure, reference it and populate it with the appropriate values."</i>

What you have mentioned as above that already did while creating a structure,but still it showing the error.What could be the reason.Kinldy check the way I declared the reference fields in my post and let me know where I went wrong.

Thanks,

K.Kiran.

Read only

0 Likes
1,667

Hi,

Your reference field needs to be defined in your structure. For example if your structure is called Z_VALUES it currently has two fields, PRICE and QUAN which reference units in other tables.

What you need are four fields, PRICE, CURR, QUAN, UNIT. PRICE should reference CURR and QUAN should reference UNIT.

Before the form is called you need also to fill CURR with the currency that PRICE is held in and UNIT with the unit of measure that QUAN is held in. Smartforms will then format that values to match their unit.

For example, 234.45 GBP or 54000 JPY (ie no decimals on the JPY).

Regards,

Nick

Read only

Former Member
0 Likes
1,667

Hi Kiran,

You have to give a reference field which is present there in the same structure. When you select the amount/quantity, it will have a referencing currency/unit also in the DB table. Select this too and create fields for your currency/unit also in your smartform structure. Then give this as reference to your amount/quantity.

Then it will not give any error and this is the right way of doing also as if it references a wrong currency it can give you wrong output .

Hope it's clear. Pls reward if this helps you,

Regards,

Ratheesh V

Read only

Former Member
0 Likes
1,667

Hi,

in Table declaration declare your table like that of structure(ITAB) , and in global definition declare Work area(WA) like that of structure.

then in refrence field give WA-FIELDNAME LIKE ITAB-FIELDNAME and currency / quantity field.

Hope this solves your problem.

Regards,

Bharat.

      • Reward Points if helpful

Read only

Former Member
0 Likes
1,667

in global definitions there would be tab for currency and quatity fields ........standard sap will search for curr/quant fields first in global definitions .....so u have to refer u r curr/quant variables in that tab

Read only

kiran_k8
Active Contributor
0 Likes
1,667

Hi Folks,

I had declared the price and quantity fields in the structure that I am using for the smartform as char.Becuase in the first internal table it is declared as konp-kbetr and mseg-menge which are later concatenated to some other variable to display some text like "Includes Tax" and 'Nos" respectively.Now it is working fine.

Thanks a lot,

K.Kiran.

Message was edited by:

Kiran K

Read only

kiran_k8
Active Contributor
0 Likes
1,667

Problem Solved.

Thanks,

K.Kiran.