2006 Aug 29 12:15 PM
Hi everyone
Has anybody else experienced this problem and if so what was your solution?
I have a select statement that gets data from table VBKD, the problem relates specifically to the field bstdk_e. The data is initially stored in a temporary table but is then split into two seperate internal tables depedning on the value of POSNR. All of the itabs and work areas use the same type declaration which contains a field 'bstdk_e' with type 'vbkd-bstdk_e'. Later in the program I check to see if this field is not initial i.e.
IF NOT itab-bstdk_e IS INITIAL.
* do some stuff
ENDIF.
However, the program is returning true at the IF statement when the contents of bstdk_e are INITIAL i.e. '00000000'. I have tried with other date fields on VBKD and they work fine. All of the date fields I tried use the same domain (datum) and are type declared in the same way.
I imagine I could get it to work by using the following:
IF itab-bstdk_e <> '00000000'.
* do some stuff
ENDIF.But I'm not sure if this is safe and am concerned the problem is a symptom of something more serious.
Thanks in advance
Andy
2006 Aug 29 3:12 PM
In case of date better check for initial using the operator CO/CN...
if itab_bstdk_e CN '0 '.
do some stuff.
endif.
2006 Aug 29 12:20 PM
Hi,
BSTKD_E is character field of length 35, Hence the initial value of that field is '0000000' but blank.
I dont know why you have '0000000' as one of the entries in VBKD, but it is not correct. you can check out the assosiated Order and get it corrected.
2006 Aug 29 12:25 PM
Hi,
The field in question is bstdk_e not bstkd_e - which I agree is a little confusing!!! bstdk_e is a field of domain datum.
Kind regards
Andy
2006 Aug 29 12:44 PM
Hi,
The field which you mentioned here is BSTDK_E, its an date field so it can't allow as initial, you have to mention like
if BSTDK_E <> '00000000'.
**do some stuff
endif.
This is right statement which you have to use.
I used these types in so many programs.
Thanks
Satheesh
2006 Aug 29 12:26 PM
Hello,
I hope the internal table field itab-bstdk_e must have been declared like this.
bstdk_e(10) type c or it may refer a data element,
if you declare like this the condition always fails, because for all <b>the character fields the initial value will be a blank space and for the date fields with type d it will be '0000000'.</b>
<b> when you move the date field to a character field your condition fails.</b>
Reward if helps.
Thanks,
Krishnakumar
2006 Aug 29 12:31 PM
Hi Krishnakumar
The field is declared in the following way:
TYPES: BEGIN OF ty_itab,
bstdk_e TYPE vbkd-bstdk_e,
END OF ty_itab.Therefore, I think it should contain '00000000' as its initial value and there is no type conversion occuring as all fields containing data from bstdk_e are of type bstdk_e.
Kind regards
Andy
2006 Aug 29 12:38 PM
Hello
I have been testing the code, and it works
if i put :(with value 00000000)
It doesn´t enter:
if not vbkd-bstdk_e is initial.
write 'a'.
endif.
It enters:
if vbkd-bstdk_e is initial.
write 'a'.
endif.
regards
2006 Aug 29 12:46 PM
i just tried this simple code and it works as expected.
TABLES: vbkd .
DATA: itab LIKE vbkd OCCURS 0 WITH HEADER LINE .
SELECT * UP TO 10 ROWS FROM vbkd INTO TABLE itab .
LOOP AT itab .
IF NOT itab-bstdk_e IS INITIAL .
write:/ 'Success' .
ENDIF.
ENDLOOP .
Regards
Raja
2006 Aug 29 2:51 PM
Hi Raja
I've tried running this on our system and it doesn't work! We're on Release 4.6C on Windows OS using an Oracle 9.2 DB - if that helps.
Kind regards
Andy
2006 Aug 29 3:07 PM
Hi,
Since it is a Date Field , you have to do the check in this way..
if itab-BSTDK_E+0(4) <> '0000'.
"field is with data..
endif.Regards
vijay
2006 Aug 29 3:12 PM
In case of date better check for initial using the operator CO/CN...
if itab_bstdk_e CN '0 '.
do some stuff.
endif.