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

Move space to Date & Numc type fields

Former Member
0 Likes
2,310

Hi Experts,

I have data declaration like this.

data :

char1(10) type c,

dat1 type dats,

num1 type numc.

Now i want to move spaces to all of them based on certain conditions. So i use

move : space to char1,

space to dat1,

space to num1.

for char1 it displays empty but for dat1 it shows - - or / /

and for num1 it shows 000 (depending on length of field).

Now how do i fully clear the char1 and num1 field as well?

thanks

Dany

Hi Experts,

I have data declaration like this.

data :

char1(10) type c,

dat1 type dats,

num1 type numc.

Now i want to move spaces to all of them based on certain conditions. So i use

move : space to char1,

space to dat1,

space to num1.

for char1 it displays empty but for dat1 it shows - - or / /

and for num1 it shows 000 (depending on length of field).

Now how do i fully clear the char1 and num1 field as well?

thanks

Dany

11 REPLIES 11
Read only

Former Member
0 Likes
1,701

"check values while displaying

IF dat1 IS INITIAL.
  WRITE space.
ENDIF.

IF num1 IS INITIAL.
  WRITE space.
ENDIF.

Read only

0 Likes
1,701

Hi Perez C,

Its not even touching the IF cond as i see that dat1 & num1 have space(nit intial) in debug mode.

well, actually i need to pass these values to display them in ALV.

Any more suggestions?

Read only

0 Likes
1,701

report  zars no standard page heading
        line-size 170
        line-count 65(4).

data : zdate like sy-datum.
data : zdatechar(10) type c.

move space to zdate.

write zdate using edit mask '__ __ ____' to zdatechar.

write zdatechar.

Read only

0 Likes
1,701

Hi a®s ,

Now can you give an idea as how can i pass these fields (say zdatechar) into an itab meant for ALV display?

thanks

Dany

Read only

0 Likes
1,701

Dan,

For ALV , why we need to go for roundway solution. Please check the following parameters in the field catalog

ie

NO_SIGN = 'X'

NO_ZERO = 'X'

system will take care the rest.

In your first post you have not mentioned anything about displaying the values in ALV

Read only

0 Likes
1,701

Hi a®s ,

Oh! you are right.

But i am getting / / for the dates field here still. I tried to set my own data in user profile..but no use.

Any suggestions?

Read only

0 Likes
1,701

Hi,

Try with

fieldcat-edit_mask = '__ __ ____'.

Read only

0 Likes
1,701

otherwise declare the date field as char(10)

Read only

0 Likes
1,701

Hi a®s,

I am able to see (in ebug mode) that the date fields are holding spaces but after geting displayed in ALV they are shown as / / ..etc like wise.

I cannot set edit mask in field catalog as this becoems generic.

I am converting the values of fields to spaces only based on certain conditions (liekif there are duplicate invoiceno rows..etc)

Please suggest.

Read only

0 Likes
1,701

Define the date column as char 12. WRITE the date value to that field when you want the value to display. Don't use the WRITE statement when you want to keep the field blank.

Only issue will be when a user sorts by the date column, the sorting will be goofy.

Read only

Former Member
0 Likes
1,701

Yes it is displaying the Default values in the respective format.

To Consider them as space u can do as follows;

Take variables for each dats and numc of their size and of character type.

WHen u r checking the conditions and moving space to Dats and Numc variables move space to these character variables also.

SO that u can use them if required again.

awrd points if useful

Bhupal