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

eban table

aris_hidalgo
Contributor
0 Likes
1,414

hello experts,

I am trying to modify a select statement where instead of using cooi-matnr I want to use eban-matnr. The problem is how can I join the table EBAN with PRPS and COOI? Do I really need to add eban using join? or can I make another select statement?I have pasted below the select statement that I am trying to modify. Thanks guys and take care!

SELECT apsphi brefbn b~lifnr

FROM prps AS a INNER JOIN cooi AS b

ON aobjnr = bobjnr

INTO CORRESPONDING FIELDS OF it_hdr

WHERE a~psphi IN so_psphi

AND a~pbukr = pa_bukrs

AND a~erdat LE v_budat

AND b~refbn IN so_ebeln

AND b~lifnr IN so_lifnr

AND b~matnr IN so_matnr

AND b~rfart = 'P'.

7 REPLIES 7
Read only

aris_hidalgo
Contributor
0 Likes
1,194

ooops, here is the complete code:

SELECT apsphi brefbn b~lifnr

FROM prps AS a INNER JOIN cooi AS b

ON aobjnr = bobjnr

INTO CORRESPONDING FIELDS OF it_hdr

WHERE a~psphi IN so_psphi

AND a~pbukr = pa_bukrs

AND a~erdat LE v_budat

  • AND a~erdat in so_augdt

AND b~refbn IN so_ebeln

AND b~lifnr IN so_lifnr

AND b~matnr IN so_matnr

AND b~rfart = 'P'.

SELECT SINGLE name1 FROM lfa1 INTO it_hdr-name1

WHERE lifnr = it_hdr-lifnr.

if not pa_augdt is initial.

  • IF NOT so_augdt[] IS INITIAL.

CLEAR ekko.

SELECT SINGLE * FROM ekko

WHERE ebeln = it_hdr-refbn

  • AND bedat IN so_augdt.

and bedat LE pa_augdt.

IF sy-subrc EQ 0.

APPEND it_hdr.

CLEAR it_hdr.

ENDIF.

ELSE.

APPEND it_hdr.

CLEAR it_hdr.

ENDIF.

ENDSELECT.

Read only

Former Member
0 Likes
1,194

SELECT apsphi brefbn b~lifnr

FROM ( prps AS a INNER JOIN cooi AS b

ON aobjnr = bobjnr ) INNER JOIN eban

ON bmatnr = ebanmatnr

INTO CORRESPONDING FIELDS OF it_hdr

WHERE a~psphi IN so_psphi

AND eban~lifnr IN so_lifnr

AND a~pbukr = pa_bukrs

AND a~erdat LE v_budat

AND b~refbn IN so_ebeln

AND blifnr EQ ebanlifnr

AND b~matnr IN so_matnr

AND b~rfart = 'P'.

Read only

0 Likes
1,194

Hello wenceslaus,

I tried using your code but I still seem not to find any records when I type a certain matnr in the selection screen. But it works fine when I use other selection instead of putting the material number.

Read only

Former Member
0 Likes
1,194

SELECT apsphi brefbn b~lifnr

FROM ( prps AS a INNER JOIN cooi AS b

ON aobjnr = bobjnr )

-


u can try this join eban and c on the same as matnr is common .

-


<<<<<<<<<<<<<<<<<<<<<<

as b INNER JOIN eban as c on

ON bmatnr = cmatnr

*************************

INTO CORRESPONDING FIELDS OF it_hdr

WHERE a~psphi IN so_psphi

AND eban~lifnr IN so_lifnr

AND a~pbukr = pa_bukrs

AND a~erdat LE v_budat

AND b~refbn IN so_ebeln

AND blifnr EQ ebanlifnr

AND b~matnr IN so_matnr

AND b~rfart = 'P'.

Read only

0 Likes
1,194

Hello Kan,

Should I change the bmatnr in so_matnr to cmatnr in so_matnr?Also, will joining cooi and eban on matnr affect the selection of records?Thanks!

Read only

Former Member
0 Likes
1,194

The common fields are EBAN( banfn , bnfpo)

And COOI(refbn,rfpos) for the two tables here is the main join criteria.

And matnr is in both the tables, in addition to the above So u can go for it .

The flow as per ur code is from COOI to EBAN so no need t change so_matnr.

In case u don’t get a hit try that option.

hi ,

Joining cooi and eban will not affect the code just check for a particular record in cooi table the first criteria as u need to look into items as well .

Initially select the record for minimum range in ur select options okay.

Then next check the same in the table cooi and eban.

Don’t worry as both the tables are transparent table.

let us know after joining the eban with cooi if u ra able to retrieve the correct record .

vijay.

Read only

0 Likes
1,194

If its not too much, can you please give me a sample code.Thanks so much!