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

Problem while creating with QUAN and CURR data type fields

0 Likes
4,060

I am trying to create a Z table. A couple of fields are of data type QUAN and CURR, which need to have reference table and reference field.

Field DataType Length Decimal

TOT_QTY QUAN 15 3

PRICE CURR 16 2

For reference table and fields, I found a Table HRPAD23 which has a field called N_QUANTITY (15,3) that matches my TOT_QTY field's data type and it also has a field called UN_PRICE that matches my PRICE field's data type. But when I use them as reference, and try to activate the table, I get an error "combination reference table/field does not exist". How do I fix this? Can anybody help me? Thanks in advance.

Chris

Edited by: martin99 on Aug 18, 2011 9:16 PM

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,872

Martin,

To be precise, you should create and populate these ref fields in your table.

And so for Total qty - create an additional field VRKME that has data element VRKME.

Also - for Price - create an additional field WAERK that has data element WAERK

Look at table VBAP - as a reference point (fields KWMENG and NETWR).

I am trying to create a Z table. A couple of fields are of data type QUAN and CURR, which need to have reference table and reference field.

Field DataType Length Decimal

TOT_QTY QUAN 15 3

PRICE CURR 16 2

For reference table and fields, I found a Table HRPAD23 which has a field called N_QUANTITY (15,3) that matches my TOT_QTY field's data type and it also has a field called UN_PRICE that matches my PRICE field's data type. But when I use them as reference, and try to activate the table, I get an error "combination reference table/field does not exist". How do I fix this? Can anybody help me? Thanks in advance.

Chris

Edited by: martin99 on Aug 18, 2011 9:16 PM

10 REPLIES 10
Read only

Former Member
0 Likes
2,873

Martin,

To be precise, you should create and populate these ref fields in your table.

And so for Total qty - create an additional field VRKME that has data element VRKME.

Also - for Price - create an additional field WAERK that has data element WAERK

Look at table VBAP - as a reference point (fields KWMENG and NETWR).

Read only

0 Likes
2,872

Ahh yes - and once you add the 2 new fields, use the new fields as the reference fields versus the SAP ones that you were mentioning.

Read only

0 Likes
2,872

Martin,

I doubt that you need to add 2 extra fields in your table as suggested in the last post by John.

Your error is very CLEAR that you seem to be use wrong combination of reference table and field.

For QTY field,

use ref table - HRPAD23. ref field- UNIT

OR

ref table - VBAP ref field - VRKME

For PRICE field,

use ref table - PAD25 ref field - KWAER

OR

ref table - T77REFDOC ref field - CURRENCY

It should work.

BR,

Diwakar

Read only

0 Likes
2,872

D,

You are correct that the fields do not need to added to make the table activate - but to make the table TRULY CORRECT and INDEPENDENT from other tables/objects, the 2 fields should added.

Hope that helps.

Read only

0 Likes
2,872

Diwa & John, Thanks a lot you both. It solved my problem. I didn't create the two nea fields but added the right combination of reference table and field.

martin

Read only

0 Likes
2,872

Martin,

Just remember that without the 2 fields added, your table is not truly correct in SAP's, databasing, and object-oriented eyes. You should really follow SAP Best Practices and add the two fields - your employer/client would expect Best Practices to be used (I hope).

Read only

0 Likes
2,872

John,

Thanks for your advice. I'd like to follow the best practices. Now, should I add two extra fields to my table and reference my fields to these two new fields? Are these like dummy fields in my table? As I have not done this before, if you could educate me on this I'd appreciate it.

Martin

Read only

0 Likes
2,872

Martin,

Review the fields in table VBAP. You can see how SAP creates their tables with the same reqs.

In your case - you will want to create the two new fields in your custom table - and then point your QUAN and CURR fields (in the same custom table) to the 2 new fields. This makes your table truly independent.

Also - The new fields are not dummy fields - you should populate them with the correct values "USD", for example.

This seems like extra work - and it can be skipped if Best Practices are not desired - but this makes the table its own self-sustaining object. It is the best idea; and it only takes a few extra keystrokes and mouse clicks.

Hope that helps.

Read only

0 Likes
2,872

John, thank you very much for your input. I have one quick question. If I need a field TOT_PRICE of data type CURR of length 13 with 2 decimal places, I can still create a new field called KWAER and reference my PRICE field to KWAER, although KWAER is of length 5 with 0 decimal places? Just curious if the length must match, or it is enoough that the data type is same.

Thanks again pal.

Martin

Read only

0 Likes
2,872

Martin,

Think of this way - CHAR(8) and CHAR(20) are both character fields - but they are very different aside from that. Length and data type are two distinct attributes of variable.

As a Comp Sci Professor, I can recite from my lecture materiasl - variables have 3 attributes:

- a variable name

- a length

- a data type

You should reference fields with the same data type AND the same length.