Application Development 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: 

How to clear currency variable and to print as blank in ALV output?

Former Member
0 Kudos

Hi Experts,

I have a field in a internal table of type currency .

While printing for some records the value is 0.00.

My requirement is i want to print as blank instead of "0.00' in ALV o/p

While populating i tried to assign with variable of space of same type as below

 data: w_cspace type wert8 value space.

How to print the currency value as blank.

Please advice

Regards

Balaji R

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Balaji,

Just check the Field catalog structure 'SLIS_FIELDCAT_ALV' . In this structure check ' 'SLIS_FIELDCAT_MAIN0 ' structure , you will find 'NO_ZERO' field in that.

When you are filling field catalog just put NO_ZERO = 'X'.

Ex:

WA_FCAT-NO_ZERO      = 'X'.


  
DATA: 
  WA_FCAT TYPE  SLIS_FIELDCAT_ALV . 


 CLEAR WA_FCAT.

  WA_FCAT-FIELDNAME    = 'PRICE'.
  WA_FCAT-TABNAME      = 'SFLIGHT'.
   WA_FCAT-REPTEXT_DDIC = 'Ticket Price'.

  WA_FCAT-NO_ZERO      = 'X'.

  APPEND WA_FCAT TO T_FCAT.

Now you will not get '0.00'.

You will get Space in place of '0.00'.

when you are printing result using ALV then by filling the particular currency field with SPACE will not work. Because it takes the declaration type of that particular field and prints the values. So try with 'NO_ZERO' option. Now It works fine .

Regards,

Rajitha.

6 REPLIES 6

Former Member
0 Kudos

Hi,

Better you convert your currency field to char field and replace it with blank...

0 Kudos

Hello,

Thanks for your reply.

It is an internal table.

I have currency values for some records in whch i need to print the actual values.

i need to print balank when the value is 0.00.

Thanks

Former Member
0 Kudos

Ok...I got your point so just before your text field enter a code line in which you will asign the currency field into the charecter field...and replace the 0.00 with space.....

I have done like this it helps your particular requirement.

Try it.

Former Member
0 Kudos

Hi Balaji,

Just check the Field catalog structure 'SLIS_FIELDCAT_ALV' . In this structure check ' 'SLIS_FIELDCAT_MAIN0 ' structure , you will find 'NO_ZERO' field in that.

When you are filling field catalog just put NO_ZERO = 'X'.

Ex:

WA_FCAT-NO_ZERO      = 'X'.


  
DATA: 
  WA_FCAT TYPE  SLIS_FIELDCAT_ALV . 


 CLEAR WA_FCAT.

  WA_FCAT-FIELDNAME    = 'PRICE'.
  WA_FCAT-TABNAME      = 'SFLIGHT'.
   WA_FCAT-REPTEXT_DDIC = 'Ticket Price'.

  WA_FCAT-NO_ZERO      = 'X'.

  APPEND WA_FCAT TO T_FCAT.

Now you will not get '0.00'.

You will get Space in place of '0.00'.

when you are printing result using ALV then by filling the particular currency field with SPACE will not work. Because it takes the declaration type of that particular field and prints the values. So try with 'NO_ZERO' option. Now It works fine .

Regards,

Rajitha.

Former Member
0 Kudos

fieldcat-tabname = 'NAV_T'.

fieldcat-fieldname = 'VERTN'.

fieldcat-col_pos = '8'.

fieldcat-seltext_m = 'No sr Iss'.

fieldcat-just = 'C'.

fieldcat-outputlen = 13.

fieldcat-do_sum = 'X'.

fieldcat-datatype = 'CURR'.

*******************************

fieldcat-no_zero = 'X'.

********************************

APPEND fieldcat TO fieldtab2.

CLEAR fieldcat.

This will suatable for you

Former Member
0 Kudos

Thank you for all of who contributed.

Problem Solved.

Thanks.

Regards

Balaji