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: 

BSEG AND BKPF TABLES

Former Member
0 Kudos

Hello Experts,

I am retrieving the vendor invoice information from BKPF and BSEG tables.. there r 3 radio buttons for parked or open or closed invoices...

for this requirement first of all i am taking the records from BKPF table into an internal table then i am taking the records from BSEG table for all entries in BKPF table.

from BSEG table i am taking the fields( WRBTR, EBELN, WERKS, BELNR) .

Here my question is...which one would be better whether i have to use the BSIK table it is containing all the fields except the WERKS or i have to go for BSEG only ... .is there any difference if i use BSIK instead of BSEG...

If i retrieve the records from BSIK table then how to get the werks field...

can anyone guide me plz

thanks alot for your help

SIRI

6 REPLIES 6

Former Member
0 Kudos

Hi

It is always better to avoid using BSEG table to fetch data unless other wise there is no other laternative.

I suggest better to use BSIK/BSAK tables

Take the EBELN field and take WERKS, MATNR etc fields from EKKO/EKPO tables.

Reward points if useful

Regards

Anji

0 Kudos

Anji

you mean to say that if i get the records from the BSIK table instead of BSEG i will get the same results rite

then how to find the open invoices and closed invoices from those tables... what is the key field which differentiates both ....

and based on the EBELN field its better to retrieve the WERKS from ekpo rite..

can u guide me plz..

Former Member
0 Kudos

Hi

U should start to select the items from BSIK/BSAK tables, I don't believe you need to read BSEG if u want to know only the vendor data.

U can extract the BKPF and in AWKEY field you should find the vendor invoice where you can pick up the plant.

Max

0 Kudos

Max,

AWKEY what this key indicates where v can exactly differentiate for the open invoices and closed invoices plz can u gimme some idea...

0 Kudos

Hi

BSAK: here there are close invoices only;

BSIK: here there are open invoices only;

U have 3 radio buttons, so:

- If open is selected you have to do a selection on BSIK;

- if closed is selected you have to do a selection on BSAK;

- if parked is selected: u have to do a selection on BSIK WHERE BSTAT = 'V'

If you want to know the original document:

SELECT SINGLE * FROM BKPF WHERE BUKRS = BSIK(BSAK)-BUKRS
                            AND BELNR = BSIK(BSAK)-BELNR 
                            AND GJAHR = BSIK(BSAK)-GJAHR.

IF BKPF-AWTYP = 'RMRP'.
* It means it's an incoming invoice
 SELECT WERKS FROM RSEG INTO _WERKS WHERE BELNR = BKPF-AWKEY(10)
                                      AND GJAHR = BKPF-AWKEY+10(4).
    EXIT.
 ENDSELECT.
ENDIF.

Max

0 Kudos

Ok Max,

lemme check that....

any how thax alot for your help max