cancel
Showing results for 
Search instead for 
Did you mean: 

Converting issues of QUAN clomn

Former Member
0 Kudos

Dear All

I tried to take a clue from a thread posted before but not working for me

I want. 1,000 is printed as 1. But even after coding below in smartforms it gives me 1,000.

GS_FKIMG is of type BDMNG

GS_ITEM-FKIMG is of type FKIMG of type QUAN (13,3)

In %CODE program lines for Element I am using

GS_FKIMG = GS_ITEM-FKIMG.

I am printing &GS_FKIMG(.0)& but not working

I also tried using &GS_FKIMG(C.0)& but in vain.

could you guide if I am writing program lines wrong or at wrong place.

Accepted Solutions (0)

Answers (6)

Answers (6)

Former Member
0 Kudos

Hi,

Delcare a field of type i and move qty field to type i field.

or

give proper qunatity reference field to quantity field

and try your syntax qty(.0).

Thanks,

Challa Sridhar Reddy.

Former Member
0 Kudos

Hi,

Smartforms will link your quantity with unit then print out. It also take the configuration of decimal of each unit.

If you want to archive your goal, I think you have to convert your quantity to string then delete right zero if needed. Please try this:


Write [QUANTITY] TO TEXT UNIT [UNIT].
"and use form routine below to delete the right zero

FORM delete_right_zero  USING    p_text.

  IF p_text CP '*,*'.
    SHIFT p_text RIGHT DELETING TRAILING space.
    SHIFT p_text RIGHT DELETING TRAILING '0'.
    IF p_text+69(1) EQ ','.
      SHIFT p_text RIGHT BY 1 PLACES.
    ENDIF.
  ENDIF.
ENDFORM.    

Best regards,

Thien

Former Member
0 Kudos

Hi Amol,

The syntax you have used seems to be right.

I similarly faced problems using &Var(.0)&. It often fails to work, but not always. The work-around for this is to move this field into a field of desired type, and then display that field.

Regards,

Karthik

Former Member
0 Kudos

What did you accomplish by putting 13,3 into another variable (type BDMNG 13,3)? If you used &var_name(.0)& and you got 1,000, then the original value is 1,000.000, isn't it?

Former Member
0 Kudos

can't you just move your variable to a variable of the type i ?

and print that integer-variable?

I also checked the wiki-page on this issue and as you can read there, you are doing it correctly.

http://wiki.sdn.sap.com/wiki/display/ABAP/SAPscript#SAPscript-Whatarethevarioustextformattingoptions...

Strange that it doesn't work...

Tom

Former Member
0 Kudos

Hi

I've tried your code and works fine: &GS_FKIMG(.0)&

Max