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

Quantity field to string with units ?

Former Member
0 Likes
2,290

Hello All,

i'm moving quantity field to a string .

But I want to move with reference unit also.


      DATA: lv_del_qty TYPE string.
      CLEAR lv_del_qty.
      lv_del_qty = itab->del_quantity.

I want the unit referece also.

How to do this ?

Regards,

Deepu.K

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,513

Hi Deepu,

If you want to add the quantity fiels to a string then go for the concatenation of othe reference Unit and the quantity.

<b>Syntax is</b> .

      DATA: lv_del_qty TYPE string.
      CLEAR lv_del_qty.
Concatenate  itab-quantity itab-refence_unit into lv_del_qty.
 Write:/ lv_del_qty.

<b>Output</b> will be 1222USD.

loop at itab into wa_itab.

concatenate itab-quantity itab-currency into v_string separated by space.

modify itab from wa_itab.

endloop.

Hi Deepu,

If you want to add the quantity fiels to a string then go for the concatenation of othe reference Unit and the quantity.

<b>Syntax is</b> .

      DATA: lv_del_qty TYPE string.
      CLEAR lv_del_qty.
Concatenate  itab-quantity itab-refence_unit into lv_del_qty.
 Write:/ lv_del_qty.

<b>Output</b> will be 1222USD.

loop at itab into wa_itab.

concatenate itab-quantity itab-currency into v_string separated by space.

modify itab from wa_itab.

endloop.

5 REPLIES 5
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,513

So you want to have something like "1,234.56" USD in the string? If so then you can simply concatenate the currency key field with the value into string.

Regards,

Rich Heilman

Read only

0 Likes
1,513

Hello Heilman,

I didn't understand u. Can u explain ?

Regards,

Deepu.K

Read only

Former Member
0 Likes
1,513
loop at itab into wa_itab.
   concatenate itab-quantity itab-currency into v_string separated by space.
   modify itab from wa_itab.
endloop.
Read only

Former Member
0 Likes
1,514

Hi Deepu,

If you want to add the quantity fiels to a string then go for the concatenation of othe reference Unit and the quantity.

<b>Syntax is</b> .

      DATA: lv_del_qty TYPE string.
      CLEAR lv_del_qty.
Concatenate  itab-quantity itab-refence_unit into lv_del_qty.
 Write:/ lv_del_qty.

<b>Output</b> will be 1222USD.

loop at itab into wa_itab.

concatenate itab-quantity itab-currency into v_string separated by space.

modify itab from wa_itab.

endloop.

Read only

0 Likes
1,513

Hello Friends,

I solved it.

I moved the qty to char and then to string.



    DATA:lv_qty TYPE char20.
             lv_del_qty TYPE string.

      CLEAR :lv_qty,lv_del_qty.
      WRITE itab->del_quantity TO lv_qty UNIT itab->units.
      lv_del_qty = lv_qty.

Regards,

Deepu.K