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

Data fetching problem in select query

Former Member
0 Likes
1,329

HI Expert,

Pls check the below code as data is not fetching due to BGMKOBJ-OBJNR(22) not equal to EQKT-EQUNR(18).

select EQUNR

EQKTX

  • from EQKT into corresponding fields of table IT_EQKT

  • from EQKT into table IT_EQKT

into table IT_EQKT

from EQKT

  • for all entries in IT_BGMKOBJ

  • for all entries in IT_ITOB

where EQUNR = IT_ITOB-OBJNR

and spras eq 'EN'.

Pls help me with code.

Thanks & Regards,

Singha

6 REPLIES 6
Read only

Former Member
0 Likes
959

Hi,

The problem in your select query is your are matching OBJNR field to EQUNR

Where EQUNR is equipment number

OBJNR is object number

if you have only objnr in hand then go to EQUI table and fetch the EQUNR field and use for all entries by the the EQUNR fetched

Regards,

siva chalasani.

Read only

Former Member
0 Likes
959

select EQUNR

EQKTX

.

.

.

.

.

*change the where condition as

where EQUNR = IT_ITOB-OBJNR+0(18).

Read only

Former Member
0 Likes
959

Hi,

You can do inother way ,but not suggestable.

DATA : v_char(18).

LOOP AT IT_ITOB.

v_char = IT_ITOB-OBJNR.

select EQUNR

EQKTX

into APPENDING table IT_EQKT

from EQKT

where EQUNR = v_char

and spras eq 'EN'.

clear v_char.

ENDLOOP.

Read only

0 Likes
959

hi,

appending is giving error.Pls suggest.

thanks

Read only

Former Member
0 Likes
959

Hi,

Remove the FIRST TWO characters of OBJNR field and then pass that to the SELECT query.

In the table BGMKOBJ , for EQUNR present in EQKT, each EQUNR is appended with value 'IE' in the beginning.

So truncate the first two characters.

Your select query will work just fine.

Reward if helpful.

Regards.

Read only

former_member210123
Active Participant
0 Likes
959

Create a new internal table with the field EQUNR with BGMKOBJ-OBJNR values and do for all entries on this table.There is no alternative on this.

e.g,

types: begin of t_equnr,

equnr type EQKT-EQUNR,

end of t_equnr.

data : it_equnr type table of t_equnr,

wa_equnr type t_equnr.

loop at IT_BGMKOBJ into wa_BGMKOBJ .

wa_equnr-equnr = wa_BGMKOBJ-OBJNR.

append wa_equnr to it_equnr.

endloop.

select EQUNR

EQKTX

  • from EQKT into corresponding fields of table IT_EQKT

  • from EQKT into table IT_EQKT

into table IT_EQKT

from EQKT

  • for all entries in IT_BGMKOBJ

  • for all entries in it_equnr

where EQUNR = it_equnr-EQUNR