Skip to Content
avatar image
Former Member

how to change currency fields to character fields.

Hi Experts,

I have requirement where I need to change all my currency fields to character fields. Other wise it is giving me a dump saying that

UC_OBJECTS_NOT_CHARLIKE

Here is my types ,IT and workarea declarations:

TYPES: BEGIN OF gty_sapgl_to_cim,

gjahr TYPE cosp-gjahr, "Fiscal Year

perbl TYPE cosp-perbl, "Fiscal Month

versn TYPE cosp-versn, "Plan Version

kstar TYPE cosp-kstar, "Cost Element

wrttp TYPE cosp-wrttp, "Value Type

beknz TYPE cosp-beknz, "Debit/credit indicator

wkg001 TYPE cosp-wkg001, "Amount - Period 1

wkg002 TYPE cosp-wkg002, "Amount - Period 2

wkg003 TYPE cosp-wkg003, "Amount - Period 3

wkg004 TYPE cosp-wkg004, "Amount - Period 4

wkg005 TYPE cosp-wkg005, "Amount - Period 5

wkg006 TYPE cosp-wkg006, "Amount - Period 6

wkg007 TYPE cosp-wkg007, "Amount - Period 7

wkg008 TYPE cosp-wkg008, "Amount - Period 8

wkg009 TYPE cosp-wkg009, "Amount - Period 9

wkg010 TYPE cosp-wkg010, "Amount - Period 10

wkg011 TYPE cosp-wkg011, "Amount - Period 11

wkg012 TYPE cosp-wkg012, "Amount - Period 12

wkg013 TYPE cosp-wkg013, "Amount - Period 13

wkg014 TYPE cosp-wkg014, "Amount - Period 14

wkg015 TYPE cosp-wkg015, "Amount - Period 15

wkg016 TYPE cosp-wkg016, "Amount - Period 16

kokrs TYPE cskb-kokrs, "Controlling area

kostl TYPE cskb-kostl, "Cost Center

ktext TYPE cskt-ktext, "Cost Center Name

ltext TYPE csku-ltext, "Cost Element Name

END OF gty_sapgl_to_cim.

DATA : gt_sapgl_to_cim TYPE STANDARD TABLE OF gty_sapgl_to_cim.

DATA : gs_sapgl_to_cim TYPE gty_sapgl_to_cim.

Now I have to change all the amount fields to char fields.

My question is how to convert currency fields to char fields.

Can anybody suggest me how to do it.

Thanks.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • avatar image
    Former Member
    Sep 08, 2008 at 11:40 PM

    Hi, try this:

    DATA: g_char TYPE string.

    g_char = itab-wkg001.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Deepthi,

      That is what I am getting confused. So to assign amount field to a char field , do I need to create separate IT? because it is giving me dump when I execute the code. Can you tell me the steps if you don't mind please.

      Thanks.

  • avatar image
    Former Member
    Sep 09, 2008 at 04:16 AM

    Here is the solution

    data: lw_menge type menge_d, 
                     lw_quant   type char20. 
    
    ** Conversion happens when you write the output 
    write lw_menge to lw_quant. 
    
    ** this will convert the Quantity to char field, but then yoou cant do any calculation on this
    

    Hope That Helps

    Anirban M.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 09, 2008 at 04:20 AM

    Where ever u declared amount you declare them as char fields... No need for extra internal table.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi deepthi,

      I have declared all amounts in my types to char type as follows.

      TYPES: BEGIN OF gty_sapgl_to_cim,

      gjahr TYPE cosp-gjahr, "Fiscal Year

      perbl TYPE cosp-perbl, "Fiscal Month

      versn TYPE cosp-versn, "Plan Version

      kstar TYPE cosp-kstar, "Cost Element

      wrttp TYPE cosp-wrttp, "Value Type

      beknz TYPE cosp-beknz, "Debit/credit indicator

      wkg001(15) TYPE c, "Amount - Period 1

      wkg002(15) TYPE c, "Amount - Period 2

      wkg003(15) TYPE c, "Amount - Period 3

      wkg004(15) TYPE c, "Amount - Period 4

      wkg005(15) TYPE c, "Amount - Period 5

      wkg006(15) TYPE c, "Amount - Period 6

      wkg007(15) TYPE c, "Amount - Period 7

      wkg008(15) TYPE c, "Amount - Period 8

      wkg009(15) TYPE c, "Amount - Period 9

      wkg010(15) TYPE c, "Amount - Period 10

      wkg011(15) TYPE c, "Amount - Period 11

      wkg012(15) TYPE c, "Amount - Period 12

      wkg013(15) TYPE c, "Amount - Period 13

      wkg014(15) TYPE c, "Amount - Period 14

      wkg015(15) TYPE c, "Amount - Period 15

      wkg016(15) TYPE c, "Amount - Period 16

      kokrs TYPE cskb-kokrs, "Controlling area

      kostl TYPE cskb-kostl, "Cost Center

      ktext TYPE cskt-ktext, "Cost Center Name

      ltext TYPE csku-ltext, "Cost Element Name

      str TYPE string,

      END OF gty_sapgl_to_cim.

      And I Have commented the global declarations part for all wkg001 to wkg016.

      When I activate it is foing to dump near the select statement that is for the subroutine fill_data.

  • avatar image
    Former Member
    Sep 09, 2008 at 04:51 AM

    In your internal table u declared ktext and ltext but in ur select u r not using them. so its giving a dump

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      I am so sorry. If you don't like, leave it.

      If I write ktext and ltext in my select statement then do i need to join those tables also?Since I have already assigned the text descriptions using field symbols.

      How does it work.