cancel
Showing results for 
Search instead for 
Did you mean: 

Quantity field display in Smartforms

Former Member
0 Kudos

Hi,

I have 4 quantity fields - example MCHB-CLABSthe value comes in the form of 1234.000 to smartforms.

Now my requirement is:

Display of quantity should be use UoM as a reference field .

E.g. 1000 PC => should be dispalyed like 1,000 PC

1000 KG => should be dispalyed like 1,000.000 KG

Please advice!

regards

Mohan

Accepted Solutions (1)

Accepted Solutions (1)

Former Member

Hi,

Create the reference field for the quantity you want to display in the tab currency/Quantity fields in the GLOBAL DATA. Before you display that value use a program line node and transfer the value to the reference field and then format it as you like using the options like

&symbol(Z)& Omit Leading Zeros

&symbol(S)& Omit Leading Sign

&symbol(<)& Display Leading Sign to the Left

&symbol(>)& Display Leading Sign to the Right

&symbol(C)& Compress Spaces

&symbol(.N)& Display upto N decimal places

&symbol(T)& Omit thousands separator

&symbol(R)& Right justified

&symbol(I)& Suppress output of the initial value

and display them.

Refer this link for more details about the currency and quantity fields

[Quantity/Currency fields|https://help.sap.com/saphelp_nw04/helpdata/en/0b/5da4e42cf511d5b692006094192fe3/frameset.htm]

Thanks&Regards

Sarves

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

Still

&symbol(C)& Compress Spaces doesnt work.

My output is 1234.000 but i want 1,234.

Thanks

Mohan

Former Member
0 Kudos

Hi

Use packed(P) data type without decimal place.

Hope this helps

Sonal..

Former Member
0 Kudos

Hi Mohan,

I had a same situation for JPY & USD currency problem in smart forms,,

No difference in Curr & Quan fields,,, Both work on same principle,,, so modify accordingly from below code...

 DATA: LV_AMOUNT_TXT TYPE STEXT.

IF GS_HD_GEN-BIL_WAERK EQ 'JPY'.
WRITE: GS_HD_GEN-BIL_NETWR CURRENCY GS_HD_GEN-BIL_WAERK TO LV_AMOUNT_TXT.
ELSE.
WRITE: GS_HD_GEN-BIL_NETWR CURRENCY GS_HD_GEN-BIL_WAERK DECIMALS 2 TO LV_AMOUNT_TXT.
ENDIF.

Sample for Quantity...

 DATA: LV_QUANTITY_TXT TYPE STEXT.

IF GS_HD_GEN-BIL_MEINS EQ 'PC'.
WRITE: GS_HD_GEN-BIL_MENGE QUANTITY GS_HD_GEN-BIL_MEINS TO LV_AMOUNT_TXT.
ELSE.
WRITE: GS_HD_GEN-BIL_MENGE QUANTITY GS_HD_GEN-BIL_MEINS DECIMALS 3 TO LV_AMOUNT_TXT.
ENDIF.

You add this in the program lines, just above to the text where you want to display..!

Thanks & regards,

Dileep .C

Former Member
0 Kudos

Define quantity like this

DATA: LV_QUANTITY LIKE VBAP-KWMENG.

Former Member
0 Kudos

Hi,

Take

data : symbol type p decimals 0.

Former Member
0 Kudos

Solved on my own

Former Member
0 Kudos

Hi Mohankumar,

I see that the check table for the MATNR field in the table MCHB is the MARA table, you can do a join and select the MATNR field from MCHB table and the MEINS field from the MARA table and then pass it to the smartform and dispaly it as follows

&mchb-matnr(c)& &mara-meins&

This would display it along with the UoM (Base Unit of Measure). If you want the decimals to be present, then you can go for any conversion routines or type casting.

Regards,

S.Dakshna nagaratnam.