cancel
Showing results for 
Search instead for 
Did you mean: 

Scientific Notation from APD

Loed
Active Contributor
0 Kudos

Hi,

I extracted a CSV file from the result of a query designer using APD..

However, the keyfigures are in scientific notation..Is there a way to extract values of KF not in scientific notation? Or is there a way to convert the result of the KF to its original value?

Thank you.

Loed

Accepted Solutions (1)

Accepted Solutions (1)

former_member186445
Active Contributor
0 Kudos

think you can use this- EXPONENT

e.g.:

DATA: float          TYPE f,

       formatted_text TYPE c LENGTH 6.

float = SQRT( 2 ).

WRITE  float TO formatted_text EXPONENT 0.

write : / float.

write : / formatted_text.


M.

Loed
Active Contributor
0 Kudos

Hi,

I will try this code on Monday since I'm at home right now..

Thank you..

Loed

Loed
Active Contributor
0 Kudos

Hi,

This solved my problem..Thanks for this command!

WRITE  float TO formatted_text EXPONENT 0.

Modified the code a bit to fit in APD routine..

Thanks a lot!

Loed

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Loed,

Open this documents.Hope it helps.

SAP Community Network - The Social Network for SAP Professionals

Thanks,

Urmil.

RafkeMagic
Active Contributor
0 Kudos

which links to the document I (tried to) link(ed) to last week...

RafkeMagic
Active Contributor
0 Kudos

someone solved that in the past with "code", as you can see here

Loed
Active Contributor
0 Kudos

Hi Raf,

Link is not working?

Loed

RafkeMagic
Active Contributor
0 Kudos

Bizar... I think I was referring to the solution of this post (), but now that I click on the link there, nothing happens.

I guess something is going wrong with the "conversion" of SCN to the new platform...

RafkeMagic
Active Contributor
0 Kudos

the "cached" version is still available in Google 🙂

http://webcache.googleusercontent.com/search?q=cache:i_2qz5iChu8J:www.sdn.sap.com/irj/scn/index%3Fri...

the APD code part:

REPORT RSAN_WB_ROUTINE_TEMP_REPORT .

TYPES: BEGIN OF Y_SOURCE_FIELDS ,

ARTICLE TYPE /BI0/OIARTICLE ,

CALDAY TYPE /BI0/OICALDAY ,

KYF_0004 TYPE FLOAT ,

KYF_0001 TYPE I ,

KYF_0003 TYPE FLOAT ,

KYF_0002 TYPE FLOAT,

END OF Y_SOURCE_FIELDS .

TYPES: YT_SOURCE_FIELDS TYPE STANDARD TABLE OF Y_SOURCE_FIELDS .

TYPES: BEGIN OF Y_TARGET_FIELDS ,

ARTICLE(8) TYPE C ,

CALDAY(10) TYPE C ,

VOLUME(18) TYPE C ,

SALES(18) TYPE C ,

END OF Y_TARGET_FIELDS .

TYPES: YT_TARGET_FIELDS TYPE STANDARD TABLE OF Y_TARGET_FIELDS .

*---------- BEGIN OF TYPE DEFINITIONS -------------------------------

*TYPES: ...

*----------- END OF TYPE DEFINITIONS --------------------------------

FORM COMPUTE_DATA_TRANSFORMATION

USING IT_SOURCE TYPE YT_SOURCE_FIELDS

IR_CONTEXT TYPE REF TO IF_RSAN_RT_ROUTINE_CONTEXT

EXPORTING ET_TARGET TYPE YT_TARGET_FIELDS .

*--------- BEGIN OF TRANSFORMATION CODE -----------------------------

DATA: LS_SOURCE TYPE Y_SOURCE_FIELDS,

LS_TARGET TYPE Y_TARGET_FIELDS,

LV_CALDAY(10) TYPE C,

LV_VOLUME TYPE I,

L_LEN TYPE I,

L_LENGTH TYPE N.

LOOP AT IT_SOURCE INTO LS_SOURCE.

MOVE-CORRESPONDING LS_SOURCE TO LS_TARGET.

CONCATENATE LS_SOURCE-CALDAY+6(2) '.' LS_SOURCE-CALDAY+4(2) '.'

LS_SOURCE-CALDAY(4) INTO LV_CALDAY.

LS_TARGET-CALDAY = LV_CALDAY.

*ARTICLE SHOULD BE LEFT PADDED WITH ZEROES SO THAT IT IS 8 CHARACTERS

*LONG.

IF STRLEN( LS_SOURCE-ARTICLE) GT 8.

SHIFT LS_SOURCE-ARTICLE BY 8 PLACES LEFT.

  1. ENDIF.

L_LEN = STRLEN( LS_SOURCE-ARTICLE ).

IF L_LEN GT 8.

L_LEN = L_LEN - 8.

  1. ELSE.

L_LEN = 0.

  1. ENDIF.

L_LENGTH = L_LEN.

LS_TARGET-ARTICLE = LS_SOURCE-ARTICLE+L_LENGTH(8) .

LV_VOLUME = LS_SOURCE-KYF_0001.

LS_TARGET-VOLUME = VOLUME.

SHIFT LS_TARGET-VOLUME RIGHT DELETING TRAILING SPACE.

CONDENSE LS_TARGET-VOLUME NO-GAPS.

LS_TARGET-SALES = LS_SOURCE-KYF_0002.

SHIFT LS_TARGET-SALES RIGHT DELETING TRAILING SPACE.

CONDENSE LS_TARGET-SALES NO-GAPS.

APPEND LS_TARGET TO ET_TARGET.

  1. ENDLOOP.

*---------- END OF TRANSFORMATION CODE ------------------------------

ENDFORM

ccc_ccc
Active Contributor
0 Kudos

Hi Loed,

Could you please share some sample data how its looks like.

Thank you,

Nanda

Loed
Active Contributor
0 Kudos

Hi Nanda,

SAMPLE output from APD:

1.23456E+03

SHOULD BE output:

1234.56

Thank you..

Loed

ccc_ccc
Active Contributor
0 Kudos

Hi Loed,

Please check this thread, it solved.

if link not open, here is the logic

Dear all,

I was trying to get values in an ALV grid recently and I noticed that the values are displayed as exponential values which didn't satisfy the client very much. So after a little research I found this function module that converted the exponential format to float format.

This form takes the exponential value in V_FLOAT variable converts it to the float value in V_CHAR P10_4 variable

FORM CONVERT CHANGING V_FLOAT V_CHAR P10_4.

   IF V_FLOAT IS NOT INITIAL.

   CALL FUNCTION 'CEVA_CONVERT_FLOAT_TO_CHAR'

   EXPORTING

     FLOAT_IMP  = V_FLOAT

     FORMAT_IMP = P10_4

     ROUND_IMP  = ' '

  IMPORTING

    CHAR_EXP = V_CHAR.

  ENDIF.

ENDFORM.

DATA: V_FLOAT TYPE F , V_CHAR(25), P10_41(10) TYPE P DECIMALS 3.     "CONVERSION OF STRING TO FLOAT STRUCTURE.

V_FLOAT = VALUE_BEFORE_CONVERSION.

PERFORM CONVERT CHANGING V_FLOAT V_CHAR P10_41.

VALUE_AFTER_CONVERSION  = V_CHAR.

Hope this simple routine is useful.

If you have any doubts, please don't hesitate to ask.

Thank you,

Nanda

Loed
Active Contributor
0 Kudos

Hi Nanda,

The FM CEVA_CONVERT_FLOAT_TO_CHAR does not exist in our BW..


Loed