01-29-2015 9:45 AM
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
01-29-2015 11:20 AM
01-29-2015 11:53 AM
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.
01-29-2015 3:02 PM
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
01-29-2015 4:10 PM
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.
01-29-2015 4:16 PM