Skip to Content
author's profile photo Former Member
Former Member

Conveting type

Hi Friend,

I have one field having data type CHAR. But the field contains values like 10000, 10000.56.

I wanted to use do_sum in my ALV for this field. For that I need to change the data type. While data type I need to consider?

I had taken type packed decimals but got an status message the field cannot be totalled because of field overflow.

Any suggestion??

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jan 10, 2008 at 04:18 AM

    Hi Neha ,

    You can use the Qauntity data type , QUAN ,e.g. of such data types is LABST.

    Regards

    Arun

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 10, 2008 at 04:21 AM

    Hi Neha,

    try this.

    DATA: char TYPE char10 VALUE '254.879,004'.

    DATA: pac(10) TYPE p DECIMALS 2.

    REPLACE ALL OCCURRENCES OF '.' IN char WITH space.

    CONDENSE char NO-GAPS.

    PAC = CHAR.

    (or) do like this.

    Use pack statement.

    Example

    DATA C_FIELD(4) TYPE C VALUE '0103',

    P_FIELD(2) TYPE P.

    PACK C_FIELD TO P_FIELD.

    C_FIELD: C'0103' --> P_FIELD: P'103C'

    kindly reward if found helpful.

    cheers,

    Hema.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 10, 2008 at 04:28 AM

    Hi,

    Use FM 'CHECK_AND_CONVERT_NUMERICS' to convert numeric value (with decimals) to packed variable.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 10, 2008 at 04:30 AM

    Hi Neha,

    U better to take that field type as 'CURR' TYPE OR

    we have to decalre that field type as below format.

    value like vbap-netpr.

    SAMPLE CODE

    DATA: BEGIN OF ITAB OCCURS 0,

    VALUE LIKE VBAP-NETPR,

    END OF ITAB.

    And we have to perform DO_SUM on that filed.That works fine.

    Award points if helpful.

    Kiran Kumar.G.A

    Have a Nice Day..Neha

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 10, 2008 at 05:03 AM

    Hi Neha,

    Just increase length of field you have defined..Packed type should work fine.

    Regards,

    Mohaiyuddin

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.