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

JOIN error

Former Member
0 Likes
717

Hi all, I have written the following join:

DATA:

IT_WRKGDATES TYPE STANDARD TABLE OF EINDT.

DATA:

WA_WRKGDATES TYPE EINDT.

SELECT EINDT MENGE

INTO CORRESPONDING FIELDS OF TABLE IT_RELEASE

FROM

EKEK AS A

JOIN EKEH AS B

ON

AEBELN = BEBELN AND

AEBELP = BEBELP AND

AABART = BABART AND

AABRUF = BABRUF

WHERE

A~EBELN = WA_PURDOC-EBELN AND

A~EBELP = WA_PURDOC-EBELP AND

A~ABART = '2' AND

B~EINDT IN IT_WRKGDATES.

I needed to run this query for all records in the internal table IT_WRKGDATES...but the system gives the error "The line structure of the table IT_WRKGDATES is incorrect"..

Can anybody suggest what the problem might be?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
689

hi Puri,

do this way

SELECT EINDT MENGE

INTO CORRESPONDING FIELDS OF TABLE IT_RELEASE

FROM

EKEK AS A

JOIN EKEH AS B

ON

AEBELN = BEBELN AND

AEBELP = BEBELP AND

AABART = BABART AND

AABRUF = BABRUF

<b>FOR ALL ENTRIES IN IT_WRKGDATES</b>

WHERE

A~EBELN = WA_PURDOC-EBELN AND

A~EBELP = WA_PURDOC-EBELP AND

A~ABART = '2' AND

<b>B~EINDT = IT_WRKGDATES-EINDT.</b>

7 REPLIES 7
Read only

Former Member
0 Likes
690

hi Puri,

do this way

SELECT EINDT MENGE

INTO CORRESPONDING FIELDS OF TABLE IT_RELEASE

FROM

EKEK AS A

JOIN EKEH AS B

ON

AEBELN = BEBELN AND

AEBELP = BEBELP AND

AABART = BABART AND

AABRUF = BABRUF

<b>FOR ALL ENTRIES IN IT_WRKGDATES</b>

WHERE

A~EBELN = WA_PURDOC-EBELN AND

A~EBELP = WA_PURDOC-EBELP AND

A~ABART = '2' AND

<b>B~EINDT = IT_WRKGDATES-EINDT.</b>

Read only

0 Likes
689

The error it gives is: The type EINDT has no structure and therefore no component called "EINDT"

Read only

0 Likes
689

My requirement is that i need to select all records from this join for all the matching conditions and for each record of the internal table IT_WRKGDATES.

This internal table contains just one field of dates and this date should match the B~EINDT date.

so suppose the internal table has 2 dates(01/01/2001 and 02/02/2002) and there are 4 matching records in the join with dates (01/01/2001,01/01/2001 and 02/02/2002,03/03/2003) then the resultand table IT_RELEASE should have 3 records.

Read only

0 Likes
689

Hi Anmol,

Try this..

<b>DATA: BEGIN OF IT_WRKGDATES OCCURS 0,

EINDT TYPE EINDT.

END OF IT_WRKGDATES.

  • FILL THE IT_WRKGDATES TABLE WITH RECORDS AND ALSO WA_PURDOC WORK AREA.

LOOP AT IT_WRKGDATES.

SELECT BEINDT BMENGE

INTO CORRESPONDING FIELDS OF TABLE IT_RELEASE

FROM

EKEK AS A

JOIN EKEH AS B

ON

AEBELN = BEBELN AND

AEBELP = BEBELP AND

AABART = BABART AND

AABRUF = BABRUF

WHERE

A~EBELN = WA_PURDOC-EBELN AND

A~EBELP = WA_PURDOC-EBELP AND

A~ABART = '2' AND

B~EINDT = IT_WRKGDATES-EINDT.

ENDLOOP.

SORT IT_RELEASE BY EINDT.

DELETE ADJACENT DUPLICATES FROM IT_RELEASE COMPARING EINDT.</b>

Regards

SAB

Read only

0 Likes
689

Santosh's solution helped, Thanks all.

Read only

Former Member
0 Likes
689

Hi

Check the declaration of IT_WRKGDATES

it refers a dataelement EINDT, it is not a table. change it first

DATA IT_WRKGDATES TYPE STANDARD TABLE OF EINDT WITH HEADER LINE .

then this is not a internal table since WITH HEADER LINE is not added to it.

So It stores a single date field in this case.

what's your requirement for this internal table?

You want an internal table with just one date field?

So it is not possible to fetch the values of this declaration in the where condition.

first change the decalaration then put multiple dates in that and use in the where condition.

Reward points if useful

Regards

Anji

Read only

Former Member
0 Likes
689

HI,

<b>LOOP AT IT_WRKGDATES.</b>

SELECT <b>BEINDT BMENGE</b>

INTO CORRESPONDING FIELDS OF TABLE IT_RELEASE

FROM

EKEK AS A

JOIN EKEH AS B

ON

AEBELN = BEBELN AND

AEBELP = BEBELP AND

AABART = BABART AND

AABRUF = BABRUF

WHERE

A~EBELN = WA_PURDOC-EBELN AND

A~EBELP = WA_PURDOC-EBELP AND

A~ABART = '2' AND

B~EINDT <b>= IT_WRKGDATES-EINDT.

ENDLOOP.</b>

Regards

SAB