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

Strange Problem with select statement

martin_svik2
Participant
0 Likes
6,574

Hello,

i have a VERY strange problem:

in a Z-Report i select a Y-Field (customer field) from SAP Standard table EQUI. The Y-field is part of an append-structure of the table with format DATS (date field).

     SELECT SINGLE yyp57a INTO wa_itab-yyp57a FROM equi WHERE                                
                                equnr = lo_data-equnr.

The field equnr is the unique key of table EQUI.

So far so good: in most of the cases the value of the field yyp57a is catched correctly. In some cases the select brings EMPTY value of the field yyp57a. BUT in EQUI (when selecting it over SE16, etc....) the field has a correct value !

When i start the report again with the same selection the field yyp57a for the same key equnr is found, but then other records have no value. Sometimes ALL records are correct, so that looks like a "random" choice.

I have NO idea what can cause this problem 😞

br Martin

17 REPLIES 17
Read only

Jeansy
Active Contributor
0 Likes
6,120

Hi Martin,

can you please also double check with old-fashioned T-Code SE17 how the data is (really) stored in the database without any output conversion and so on? I assume that the process that is putting the data into the table could sometimes insert values into this field that do not fit to the DATS format, e.g. invalid dates. In this case the transfer into the field of the corresponding type could not work.

Kind regards
Jens

Read only

0 Likes
6,120

Hello Jens,

thank you for your hint. I am very confused now 🙂

See SE17, the date is initial with 00.00.0000

See SE16, the date is filled with its real value of 09.04.2022 for the SAME EQUINR.

When i go back to selection screen in SE17 and select the equipment the value is displayed also correctly ! I cant do a third screenshot here 😞

How can this be ?

br Martin

Read only

Jeansy
Active Contributor
0 Likes
6,120

Are you really sure that you have a look on the same EQUI-entry (also including the leading zeros)?

On the screenshot I cannot see this detail.

Which data elemet has been used for this field?

KR Jens

Read only

Sandra_Rossi
Active Contributor
0 Likes
6,120

I think only you can find out what's going on...

Read only

Sandra_Rossi
Active Contributor
6,120

Could you check the SQL trace what table/view is actually used in the database?

Could you extract all EQUNR / YYP57A values using both ABAP SQL and Native SQL, and compare the values?

Could you check DB patches?

Could you check SAP notes?

Read only

FredericGirod
Active Contributor
6,120

if it is an oracle database, you could destroy & recreate the index

Read only

former_member9115
Participant
0 Likes
6,120

Hi,

I think the work area (or internal table) for that field is not refreshing properly .

(As you said sometimes fetch and sometimes not fetch so.)

Read only

0 Likes
6,120

Yes, it seems so. But what can i do against it ? 🙂

Read only

martin_svik2
Participant
0 Likes
6,120

frdric.girod It is an Windows Database.

Read only

martin_svik2
Participant
0 Likes
6,120

sandra.rossi I am not sure what you mean with "check the SQL trace what table/view is actually used in the database" ??? I is about table EQUI as described, what else should i find in SQL trace ?

Read only

martin_svik2
Participant
0 Likes
6,120

Thank you all for your help..........i am very desperate. In my 30 years working with SAP i have never seen such mystery 🙂

One more thing to mention: the table has about 270 fields, only 75 of it are standard fields, the rest are Z-fields in 4 include structures. Could this cause any problems ? Is there a limit of (z)-fields in a table ?

br Martin

Read only

Jeansy
Active Contributor
0 Likes
6,120

No I don't think that there is a limitation of Z-fields in a Z-table...

Really strange.

Read only

FredericGirod
Active Contributor
0 Likes
6,120

martin.svik2 , I think Sandra would like to check in ST05, the explanation to check how SAP made the SELECT statement

Read only

FredericGirod
Active Contributor
6,120

Does your table is buffered ?

Read only

Sandra_Rossi
Active Contributor
0 Likes
6,120

What I mean -> see ABAP documentation concerning Replacement Objects: "A CDS view can be assigned (using the name of its CDS entity) as a replacement object to a transparent database table and to a classic database view in ABAP Dictionary".

Just do an SQL trace. It takes less time than replying "why".

Read only

Sandra_Rossi
Active Contributor
0 Likes
6,120

And also here: "Open SQL accesses the CDS view instead of the table itself"

Read only

Sandra_Rossi
Active Contributor
0 Likes
6,120

here: "Using Extras -> Proxy Object in SE11 you can find out whether a CDS view is replacing a database table"