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

Display empty fields in query

stefan_bo
Participant
0 Likes
2,116

Hello,

I have a Query using Logical Database QMI.

There are some date and time fields, which show "00.00.0000" or "00:00:00" if there is no entry.

Is it possible to show a empty Field " " instead of "00.00.0000" or "00:00:00"?

Thanks

5 REPLIES 5
Read only

Former Member
0 Likes
1,199

This message was moderated.

Read only

archanapawar
Contributor
0 Likes
1,199

Hi,

You can use character type variable instead of sy-datum. Move date to variable and if it is zero clear the contents and display it.

date: v_date   type char10.

move wa_data-date to v_date.

If v_date eq 0.

     clear v_date.

endif.

Read only

jogeswararao_kavala
Active Contributor
0 Likes
1,199

Hello S B,

This might not be that simple. This would call for 4 character variables. For example your date field is AUSBS then


Data: v_day type char2,

          v_mon type char2,

          v_year type char4,

          v_date type char10.

"You need to extract these parts from the date field AUSBS using syntax like:


" Code to be given in the coding area of Addl field v_day

v_day = DIQMEL-AUSBS+6(2). 

" Code to be given in the coding area of Addl field v_mon

v_mon = DIQMEL-AUSBS+4(2).

" Code to be given in the coding area of Addl field v_year

v_year = DIQMEL-AUSBS+0(4). 

"The following code is to be given in the coding area of Addl field v_date.

If v_day = '00' and v_mon = '00' and v_year = '0000'.

v_date = ''.

else.

concatenate v_day '/' v_mon '/' v_year into v_date.

endif.

This you need to do in the Extras of your SQ02.  This is the basic approach you need to proceed. Correct syntax errors if any. I need not mention that the finished product of this work is the Additional field v_date, which you would use in the place of field AUSBS.

Best of luck

KJogeswaraRao

Read only

0 Likes
1,199

Hello,

thanks you all for your replies.

I solved it like this.

Added a additional field, for example v_date type char10, to the query.

Added coding for this field like this.

     IF DIQMEL-QMDAT ne 0.

          CALL FUNCTION 'CONVERSION_DATE_TO_EXTERNAL'

               EXPORTING

                    DATE_INTERNAL      =     DIQMEL-QMDAT

               IMPORTING

                    DATE_EXTERNAL     =     v_date

               EXCEPTIONS

                    DATE_INTERNAL_IS_INVALID     =     1

                    OTHERS                                         =     2.

     ELSE.

          CLEAR v_date.

     ENDIF.

Read only

0 Likes
1,199

Yes,

FM makes it much simpler. This is also the way.

Thank you