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

ALV Currency Problems

Former Member
0 Likes
2,644

Hi guys..

I am using an alv grid and it has of the fields called 'AMOUNT' which is editable. The 'Amount' Field in the internal table refers to FMBL-TVAL01(CURR 17,2).

In the ALV, when i try to edit the amount and click on refresh button the value is divided by hundred everytime.

For example alv has 40,000.00 . I change it to 48,000.00 and when i click on refresh now the value becomes 480.00.

Why is this happening.

Now i change the value to 489.11 it gives me an message "Too many deicmal Places( Maximum 0)".

How do i handle this situation. Why is the value getting divided everytime?

Madhu

Message was edited by: Madhu A

1 ACCEPTED SOLUTION
Read only

venkat_o
Active Contributor
0 Likes
2,005

Hi Madhu,

Paste ur code .

We will check it out where the problem is.

<b>Thanks,

Venkat.O</b>

Hi guys..

I am using an alv grid and it has of the fields called 'AMOUNT' which is editable. The 'Amount' Field in the internal table refers to FMBL-TVAL01(CURR 17,2).

In the ALV, when i try to edit the amount and click on refresh button the value is divided by hundred everytime.

For example alv has 40,000.00 . I change it to 48,000.00 and when i click on refresh now the value becomes 480.00.

Why is this happening.

Now i change the value to 489.11 it gives me an message "Too many deicmal Places( Maximum 0)".

How do i handle this situation. Why is the value getting divided everytime?

Madhu

Message was edited by: Madhu A

13 REPLIES 13
Read only

former_member181966
Active Contributor
0 Likes
2,005

Welcome to SDN...

Well , check what is your user setting in TR.<b>SU3</b>

Thanks

Saquib

Read only

0 Likes
2,005

hi saquib,

In transaction SU3 'Defaults' Tab.

Decimal Notation is : 1,234,567.89

Madhu

Read only

0 Likes
2,005

Did you check the program ...

.I change it to 48,000.00 and when i click on refresh now the value becomes 480.00.Why is this happening.

- is there any condistion , you put in prohram . try to "Debug it" <b>/h</b> after editing .. You`ll find something .....

Thanks

Saquib

Read only

venkat_o
Active Contributor
0 Likes
2,006

Hi Madhu,

Paste ur code .

We will check it out where the problem is.

<b>Thanks,

Venkat.O</b>

Read only

Former Member
0 Likes
2,005

With a currency field, you should also have to specify the currency key field. If you don't have the currency key in your internal table, then give something like BSEG-WAERS as the currency key field in the field catalog. Read the documentation.

Read only

Former Member
0 Likes
2,005

My internal table is as follows

TYPES: BEGIN OF T_RESULT,

FLAG(1) TYPE C, "Records Flagged by the user

ACT_TYPE TYPE ZACT_TYPE, "Action

FM_AREA TYPE FMBL-FM_AREA, "Financial Management Area

DOCYEAR TYPE FMBL-DOCYEAR, "Document Year

DOCNR TYPE FMBL-DOCNR, "Budget Entry Document Number

DOCLN TYPE FMBL-DOCLN, "Budget entry document line

FUND TYPE FMBL-FUND, "Fund

FUNDSCTR TYPE FMBL-FUNDSCTR, "Funds Center

CMMTITEM TYPE FMBL-CMMTITEM, "Commitment item

FUNCAREA TYPE FMBL-FUNCAREA, "Functional Area

MEASURE TYPE FMBL-MEASURE, "Program in Funds Management

TCURR TYPE FMBL-TCURR,

DOCTYPE TYPE FMBH-DOCTYPE, "Budget Document type

APRJ_AMT TYPE FMBL-TVAL01, "APRJ Amount

OPRJ_AMT TYPE FMBL-TVAL01, "OPRJ Amount

ADVC_AMT TYPE FMBL-TVAL01, "Advance Const Amount

FED_FUND TYPE FMBL-TVAL01, "Federal Funds Amount

STATE_FUND TYPE FMBL-TVAL01, "State Funds Amount

LOCAL_FUND TYPE FMBL-TVAL01, "Local Funds Amount

ESTRT TYPE PRTE-ESTRT, "Forecasted start date of the WBS

ENV_DATE TYPE PRPS-ZZDT_CLR, "Date of Clearance

  • PROG_CODE "TBD*** Record B Program code

  • 463_STAT TYPE C, "TBD*** 463 Status

WBS_INT TYPE PROJ-PSPNR,

END OF T_RESULT.

The field catalogue is built this this.

FIELDCATALOG-FIELDNAME = 'APRJ_AMT'.

FIELDCATALOG-REPTEXT = 'APRJ Amount'.

FIELDCATALOG-CFIELDNAME = 'TCURR'.

      • FIELDCATALOG-CURRENCY = 'USD'.

FIELDCATALOG-COL_POS = 11.

FIELDCATALOG-OUTPUTLEN = 23.

FIELDCATALOG-EDIT = C_X.

APPEND FIELDCATALOG TO P_PT_FIELDCAT.

CLEAR FIELDCATALOG.

Read only

Former Member
0 Likes
2,005

Hi Madhu,

why dont u check in user profile.

go to se38 path system->user profile->own data.

i think there u need to do some setting under DEFAULTS.

Thanks

Vikranth Khimavath

Read only

Former Member
0 Likes
2,005

Hi Madhu,

Do this change in the fieldcatalog you have mentioned for the amount field.

FIELDCATALOG-FIELDNAME = 'APRJ_AMT'.

FIELDCATALOG-REPTEXT = 'APRJ Amount'.

<b>FIELDCATALOG-CFIELDNAME = ' '.</b>

      • FIELDCATALOG-CURRENCY = 'USD'.

FIELDCATALOG-COL_POS = 11.

FIELDCATALOG-OUTPUTLEN = 23.

FIELDCATALOG-EDIT = C_X.

APPEND FIELDCATALOG TO P_PT_FIELDCAT.

CLEAR FIELDCATALOG.

Hope this helps.

Regards,

Vicky

PS: Award points if helpful

Read only

Former Member
0 Likes
2,005

Try this....

FIELDCATALOG-FIELDNAME = 'APRJ_AMT'.

FIELDCATALOG-REPTEXT = 'APRJ Amount'.

<b>FIELDCATALOG-CFIELDNAME = 'WAERK'.</b>

      • FIELDCATALOG-CURRENCY = 'USD'.

FIELDCATALOG-COL_POS = 11.

FIELDCATALOG-OUTPUTLEN = 23.

FIELDCATALOG-EDIT = C_X.

APPEND FIELDCATALOG TO P_PT_FIELDCAT.

CLEAR FIELDCATALOG.

Regards

vijay

Read only

Former Member
0 Likes
2,005

also provide this...

<b>FIELDCATALOG-DATATYPE = 'CURR'.</b>

Read only

Former Member
0 Likes
2,005

done these two changes ..

FIELDCATALOG-CFIELDNAME = ' '.

FIELDCATALOG-DATATYPE = 'CURR'.

It works great now..Thanks guys

Read only

Former Member
0 Likes
2,005

Hi Madhu,

Could you do following change to your code and see if it works.

FIELDCATALOG-FIELDNAME = 'APRJ_AMT'.

FIELDCATALOG-REPTEXT = 'APRJ Amount'.

FIELDCATALOG-EDIT = C_X.

*Below line added to the code so that field is in same *format as the internal table assuming I_RESULT is the *final internal table to be displayed. You can add same *ine to all the catalog fields.

*Start of addition

FIELDCATALOG-TABNAME = 'I_RESULT' .

*End of addition

APPEND FIELDCATALOG TO P_PT_FIELDCAT.

CLEAR FIELDCATALOG.

Cheers,

Vikram

Pls reward for helpful replies!!

Read only

0 Likes
2,005

Hi,

there is more to the ALV:

As said, in the fieldcatalog you have to specify the currency field. Best is to have the currency in the list as well.

We have some ALVs for accounting where the postings using different transaction currencies are shown.

The result is, if you want any totals or subtotals, ALV will automatically create one total for each currency involved.

Ans that's how we do it: We have a column called BALSCOA_T . This will show the balance of a SCOA account in transaction currency which is stored in field RTCUR.

After creating the (standard) field catalog, we call a routine to make some corrections in the field catalog

<pre>

FORM alv_fieldcat_enhance

CHANGING pt_alv_fieldcat TYPE slis_t_fieldcat_alv.

FIELD-SYMBOLS:

<alv_fieldcat> TYPE slis_fieldcat_alv.

LOOP AT pt_alv_fieldcat ASSIGNING <alv_fieldcat>.

CASE <alv_fieldcat>-fieldname.

*...

WHEN 'BALSCOA_T'.

<alv_fieldcat>-cfieldname = 'RTCUR'.

*...

ENDCASE." <alv_fieldcat>-fieldname.

ENDLOOP." at pt_alv_fieldcat assigning <fieldcat_alv>.

ENDFORM. "alv_fieldcat_enhance

</pre>

And I think you will not have any errors as the one described. Just follow the rule: Use standard data elements for the fields. For all currency amount fiels (type CURR), have a field in the list for the currency key (CUKY). Relate them in field catalog as shown above.

This is audit-approved!

Regards,

Clemens