Application Development 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: 

Inner join giving error message

Nirojan
Participant
0 Kudos

Hi Team,

I try to join 3 tables I'm getting this type of error "The field 'Addrcomm' does not have a corresponding field in the work area"

TYPES: BEGIN OF FINAL,
       partner TYPE but000-partner,
       add_number TYPE bu-addrcomm,
       remark TYPE ad_remark2,
       email TYPE ad_smtpadr,
       END OF final.

data: it_final type standard table of final.

select bu~partner, bu~addrcomm, at~remark, a6~smtp_addr
from but000 as bu 
inner join adrt as at on at~addrnumber = bu~addrcomm
inner join addr6 as a6 on a6~addrnumber = at~addrnumber
into corresponding fields of table @it_final.

I referred SELECT - JOIN - ABAP Keyword Documentation (sap.com) I couldn't find out

Please help me where I'm doing mistake.

Thanks,

Nirojan.

1 ACCEPTED SOLUTION

abo
Active Contributor

Either use:

bu~addrcomm as add_number

or rename the field in the structure

12 REPLIES 12

abo
Active Contributor

Either use:

bu~addrcomm as add_number

or rename the field in the structure

FredericGirod
Active Contributor

or remove CORRESPONDING FIELDS OF

0 Kudos

Thanks c5e08e0478aa4727abc4482f5be390b2

Hi frdric.girod removing corresponding is its good practice? Use of Into corresponding fields. | SAP Blogs

Thanks all for your quick response.

FredericGirod
Active Contributor
0 Kudos

corresponding is time consuming, I will not say using CORRESPONDING is a good practice.

I think people ask about this option, just to avoid error. But is it better to have error message or to be sure you are doing right ?

matt
Active Contributor

FredericGirod
Active Contributor
0 Kudos

matthew.billingham I am surprised he used SQL trace to mesure the time consuming of INTO CORRESPONDING. For me it is not at database level.

And the argument about dynamic programing is against Clean Code & Security.

I prefer to use it only when the number selected field is different than the internal table.

matt
Active Contributor
0 Kudos

frdric.girod

I must agree concerning clean code and security. It's why I don't like using it with *. But, it isn't less performant. It seems that there's some clever stuff done during compiling so that at runtime, everything is sorted out and the two forms of select end up being pretty much the same.

FredericGirod
Active Contributor

I just finished to make a simple test :

(made with SAT)

*TYPES : BEGIN OF ts_structure,
* matnr TYPE matnr,
* matkl TYPE matkl,
* meins TYPE meins,
* labor TYPE labor,
* END OF ts_structure,
* tt_table TYPE STANDARD TABLE OF ts_structure WITH NON-UNIQUE DEFAULT KEY.
*DATA my_table TYPE tt_table.
data my_table type standard table of mara with NON-UNIQUE default key.
START-OF-SELECTION.

DO 100 TIMES.
SELECT matnr, meins, labor, matkl
INTO CORRESPONDING FIELDS OF TABLE @my_table
* INTO TABLE @my_table
FROM mara
WHERE ersda LT '20210101'.
ENDDO.

15:08 and 15:12 were with structure + INTO CORRESPONDING

15:09 and 15:11 were with structure + no INTO CORRESPONDING

15:13 was with no structure (MARA) + INTO CORRESPONDING

so, there is a little difference between INTO CORRESPONDING or not, but a big difference if you use the full MARA internal table.

anujawani2426
Active Participant

Hi,

In structure, instead of add_number as field name use addrcomm.

TYPES: BEGIN OF FINAL,
       partner TYPE but000-partner,
       addrcomm TYPE bu-addrcomm,
       remark TYPE ad_remark2,
       smtp_addr TYPE ad_smtpadr,
       END OF final.

0 Kudos

Thank you anujawani2426.

roberto_forti
Contributor
0 Kudos

Hi,

SAP best practices (OpenSQL): do not implement "corresponding fields".

Select ... INTO CORRESPONDING FIELDS OF TABLE @my_table

SugguSandeep
Active Participant
0 Kudos

Hi nirojan

Hope you are doing great 🙂

Once Check Out the link in below similar to your question will get more clarity on 3 Table Inner Join:

https://answers.sap.com/questions/13708178/select-query-between-an-internal-table-and-3-joine.html?c...

Thanks,

Suggu Sandeep.