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: 

linking BSAK with EKBE

aris_hidalgo
Contributor
0 Kudos

Hello experts,

I am currently modifying a report where in I need to change some statements because it gets a PO's balance in table BSAK-wrbtr and instead I need to change it to EKBE-wrbtr. The problem is I don't know if there's a common field where I can link both tables.I have pasted below the code I am trying to modify. Also, How can I know if my report shows details of a PO correctly? where would I verify this? Thanks guys and take care!

SELECT augdt augbl shkzg dmbtr wrbtr FROM bsak

INTO (bsak-augdt,bsak-augbl,bsak-shkzg,

bsak-dmbtr,bsak-wrbtr)

WHERE bukrs = bkpf-bukrs

AND gjahr = bkpf-gjahr

AND belnr = bkpf-belnr.

IF bsak-shkzg = 'H'.

bsak-dmbtr = - bsak-dmbtr.

bsak-wrbtr = - bsak-wrbtr.

ENDIF.

IF t_pohistory-currency <> 'PHP'.

IF bsak-augdt GT pa_augdt.

  • IF bsak-augdt IN so_augdt.

t_amount-tramt = t_amount-tramt + bsak-wrbtr.

ENDIF.

ELSE.

IF bsak-augdt GT pa_augdt.

  • IF bsak-augdt IN so_augdt.

t_amount-tramt = t_amount-tramt + bsak-dmbtr.

ENDIF.

ENDIF.

ENDSELECT.

ENDIF.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi viraylab,

phew! That's not immediate, but let's have a look at it:

1. first of all, take fields BSAK-BUKRS, BSAK-BELNR and BSAK-GJAHR and go to table BKPF.

2. then take field BKPF-AWKEY

3. then BKPF-AWKEY0(10) links to field EKBE-BELNR and BKPF-AWKEY10(4) to EKBE-GJAHR.

I hope it helps. BR,

Alvaro

3 REPLIES 3

Former Member
0 Kudos

Hi viraylab,

phew! That's not immediate, but let's have a look at it:

1. first of all, take fields BSAK-BUKRS, BSAK-BELNR and BSAK-GJAHR and go to table BKPF.

2. then take field BKPF-AWKEY

3. then BKPF-AWKEY0(10) links to field EKBE-BELNR and BKPF-AWKEY10(4) to EKBE-GJAHR.

I hope it helps. BR,

Alvaro

Former Member
0 Kudos

Hi,

You have the EBELN field with the BSAK table.

I think you can use that.

Thanks!

0 Kudos

Hi Karun,

well, you may have several entries in table EKBE for a single EBELN. For example, VGABE = 1 Goods receipt, = 2 Invoice receipt, = 4 Down payment and so on. Even several entries for a single VGABE, for example, several invoices linked to a single purchase item.

I hope it helps. BR,

Alvaro