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

Data type is giving error

Former Member
0 Likes
2,960

BUt Hi guys,

I am  trying to create a progrem in SE38 and while assigning the data type to a column its giving me error.

My  Column is Quantity which has a currency key. So in ABAP Program while declaring Data I wrote

COPASLTYQ (17) TYPE  P((n+1)/2),

COPASLQTU (3) TYPE  C(5),

G_QVVQ01 (17) TYPE  P((n+1)/2),

G_UVVQ01 (3) TYPE  C(n),

I researched and found this link on Help.SAP.Com

Data Types in the ABAP Dictionary - ABAP Programming (BC-ABA) - SAP Library

But it did not  help me.

Any ideas what am I doing wrong?

Regards

Prashant

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,777

Hi,

No need of writing n , define as below ,

Data :

COPASLTYQ(17) TYPE  P decimals 3,

COPASLQTU(3) TYPE  C,

G_QVVQ01(17) TYPE P decimals 3,

G_UVVQ01 (3) TYPE  C.

Regards,

Salil

13 REPLIES 13
Read only

paul_bakker2
Active Contributor
0 Likes
2,777

Hi,

If it has a currency key then these fields store currency amounts.

I suggest you look at some existing SAP tables that store currency amounts.

You want the DEC data type.

cheers

Paul

Read only

0 Likes
2,777

Thats how I have declared. See the screen shot below:-

Read only

0 Likes
2,777

Hi Prashant,

Declare variables like below.

COPASLTYQ TYPE MSEG-MENGE,

COPASLQTU TYPE MSEG-MEINS,

G_QVVQ01 TYPE MSEG-MENGE,

G_UVVQ01 TYPE MSEG-MEINS.

Arivazhagan S

Read only

0 Likes
2,777

I am doing this in BW. Still I should refer to ECC Table names?

Read only

0 Likes
2,777

Hi,

Declare like below.

COPASLTYQ(17) TYPE  P decimals 3,

COPASLQTU(3) TYPE  C,

G_QVVQ01(17) TYPE P decimals 3,

G_UVVQ01 (3) TYPE  C,

Arivazhagan S

Read only

former_member198834
Participant
0 Likes
2,777

Dear Prashant,

Use Data Elements Directly like

COPASLQTU TYPE MEINS,


Suresh

Read only

0 Likes
2,777

This worked for UoM but not for Key Figures.

Read only

0 Likes
2,777

share me u r code

Read only

0 Likes
2,777

DATA: BEGIN OF WA1,

COMPANY(6) TYPE C,

ZSOLD_TO(25) TYPE C,

FISCPER3(3) TYPE N,

/BIC/ZSHIP_TO(25) TYPE C,

/BIC/ZMATERIAL(50) TYPE C,

*G_QVVQ01(17) TYPE  did not work here ,

G_UVVQ01 TYPE MEINS,

*COPASLTYQ(17) TYPE did not work here,

Read only

0 Likes
2,777

DATA: BEGIN OF WA1,

COMPANY(6) TYPE C,

ZSOLD_TO(25) TYPE C,

FISCPER3(3) TYPE N,

/BIC/ZSHIP_TO(25) TYPE C,

/BIC/ZMATERIAL(50) TYPE C,

G_QVVQ01 TYPE  /BI0/OIQUANITITY ,

G_UVVQ01 TYPE MEINS,

COPASLTYQ TYPE /BI0/OIQUANITITY

Declare like above.

Read only

Former Member
0 Likes
2,778

Hi,

No need of writing n , define as below ,

Data :

COPASLTYQ(17) TYPE  P decimals 3,

COPASLQTU(3) TYPE  C,

G_QVVQ01(17) TYPE P decimals 3,

G_UVVQ01 (3) TYPE  C.

Regards,

Salil

Read only

0 Likes
2,776

Now it gives me following error:-

"For type "P" , a length specification from 1 to 6 is allowed"

Though the length specified for these quantity fields is(17).

Regards

Prashant

Read only

0 Likes
2,776

Hi,


Maximum Length is 16 allowed.


Data :
COPASLTYQ(16) TYPE  P decimals 3,
COPASLQTU(3) TYPE  C,
G_QVVQ01(16) TYPE P decimals 3,
G_UVVQ01(3) TYPE  C.

 

OR use Data Element DEC17_3


Data :

COPASLTYQ type DEC17_3,
COPASLQTU(3) TYPE  C,
G_QVVQ01 type DEC17_3,
G_UVVQ01(3) TYPE  C.


Regards,

Salil