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

How to join internal table?

Former Member
0 Likes
14,883

i don't know how to join 2 or more internal table

SELECT

c~bukrs

c~waers

v~dmbtr

i~dmbtr

FROM

(i_curr as c

LEFT OUTER JOIN i_vendor_p as v

ON cbukrs = vbukrs AND

cwaers = vwaers)

LEFT OUTER JOIN i_intrcpny_vendor_p as i

ON cbukrs = ibukrs AND

cwaers = iwaers

INTO TABLE i_data.

that query return error

" Fields "I_CURR AS C JOIN I_VENDOR_P AS V ON CBUKRS = VBUKRS AND CWAERS = VWAERS" is unknown. It is neither in one of the specified table nor defined by a "DATA" statement"

i have search this problem, and i get syntax PROVIDE ENDPROVIDE to solve this problem. but i can implement to this query.

Please expert, let me know how to jin this internal table with PROVIDE.

1 ACCEPTED SOLUTION
Read only

Former Member
4,007

Hello Muhammad Ridwan Nawawi,

You can not join the internal tables. Join operation is only for Database tables.

For your query, You can use loop and read statements to get the required data among the internal tables you have into a new internal table.

Best Regards,

Sasidhar Reddy Matli.

i don't know how to join 2 or more internal table

SELECT

c~bukrs

c~waers

v~dmbtr

i~dmbtr

FROM

(i_curr as c

LEFT OUTER JOIN i_vendor_p as v

ON cbukrs = vbukrs AND

cwaers = vwaers)

LEFT OUTER JOIN i_intrcpny_vendor_p as i

ON cbukrs = ibukrs AND

cwaers = iwaers

INTO TABLE i_data.

that query return error

" Fields "I_CURR AS C JOIN I_VENDOR_P AS V ON CBUKRS = VBUKRS AND CWAERS = VWAERS" is unknown. It is neither in one of the specified table nor defined by a "DATA" statement"

i have search this problem, and i get syntax PROVIDE ENDPROVIDE to solve this problem. but i can implement to this query.

Please expert, let me know how to jin this internal table with PROVIDE.

6 REPLIES 6
Read only

Former Member
0 Likes
4,007

>

> i don't know how to join 2 or more internal table

>

> SELECT

> c~bukrs

> c~waers

> v~dmbtr

> i~dmbtr

> FROM

> (i_curr as c

> LEFT OUTER JOIN i_vendor_p as v

> ON cbukrs = vbukrs AND

> cwaers = vwaers)

> LEFT OUTER JOIN i_intrcpny_vendor_p as i

> ON cbukrs = ibukrs AND

> cwaers = iwaers

> INTO TABLE i_data.

>

> that query return error

> " Fields "I_CURR AS C JOIN I_VENDOR_P AS V ON CBUKRS = VBUKRS AND CWAERS = VWAERS" is unknown. It is neither in one of the specified table nor defined by a "DATA" statement"

>

> i have search this problem, and i get syntax PROVIDE ENDPROVIDE to solve this problem. but i can implement to this query.

>

> Please expert, let me know how to jin this internal table with PROVIDE.

u cant join normal internal tables with provide and endprovide u have to use infotype internal tables

Read only

0 Likes
4,007

how to use infotype, ?

i'm have not use this syntax.

please give me some example

Read only

Former Member
4,008

Hello Muhammad Ridwan Nawawi,

You can not join the internal tables. Join operation is only for Database tables.

For your query, You can use loop and read statements to get the required data among the internal tables you have into a new internal table.

Best Regards,

Sasidhar Reddy Matli.

Read only

Former Member
Read only

0 Likes
4,007

thank you, this is useful for me, but i'm still can't implement this with my code.

Any body can make me the example?

please...

Edited by: Muhammad Ridwan Nawawi on Jul 21, 2008 11:32 AM

Read only

Former Member
0 Likes
4,007

Yeah, finally i'm using this method, i got it from http://www.sapfans.com/forums/viewtopic.php?t=306015&sid=b51315650710d01b526c3feb17f44c8b

LOOP AT i_data ASSIGNING <fs_data>.

READ TABLE i_vendor_p TRANSPORTING NO FIELDS

WITH KEY

bukrs = <fs_data>-bukrs

waers = <fs_data>-waers.

  • Join vendor payment

IF sy-subrc = 0.

idx = sy-tabix.

CLEAR wa_amount.

LOOP AT i_vendor_p INTO wa_amount

FROM idx TO idx

WHERE

bukrs = <fs_data>-bukrs AND

waers = <fs_data>-waers.

<fs_data>-tvndp = wa_amount-dmbtr.

ENDLOOP.

ENDIF.

  • Join inter-company vendor payment

READ TABLE i_intrcpny_vendor_p TRANSPORTING NO FIELDS

WITH KEY

bukrs = <fs_data>-bukrs

waers = <fs_data>-waers.

IF sy-subrc = 0.

idx = sy-tabix.

CLEAR wa_amount.

LOOP AT i_intrcpny_vendor_p INTO wa_amount

FROM idx TO idx

WHERE

bukrs = <fs_data>-bukrs AND

waers = <fs_data>-waers.

<fs_data>-ticvp = wa_amount-dmbtr.

ENDLOOP.

ENDIF.

  • Calculate total net payment

<fs_data>-tnetp = <fs_data>-tvndp - <fs_data>-ticvp.

ENDLOOP.

please tell me if you know another solution to join internal table. Or another method that has high performance than this metode.

Thanks for your answer.

regards,

Muhammad Ridwan Nawawi

http://www.ridwanforge.net