This website is not affiliated with, sponsored by, or approved by SAP AG.

Call upon a additional field for new additional field

Development (ABAP Development WorkBench, ABAP/4 programming)

Moderators: Snowy, thx4allthefish, YuriT, Gothmog

Call upon a additional field for new additional field

Postby rpinxt » Mon Feb 03, 2014 8:47 am

Dear All,

Please see this code:
Code: Select all
CLEAR RP_INV.
SELECT SINGLE BELNR FROM BKPF
  INTO RP_INV
  WHERE RP_AWKEY = BKPF-AWKEY.


Code RP_AWKEY I already did code in additional field 1 and I thought this was enough in additional field 2.
But the check says that RP_AWKEY is unknown.

How can I use the already created field AWKEY in this coding?
Thanks!
rpinxt
 
Posts: 146
Joined: Mon Jul 23, 2012 8:02 am

Re: Call upon a additional field for new additional field

Postby Gothmog » Mon Feb 03, 2014 9:19 am

There's no field named RP_AWKEY in table BKPF.
Code RP_AWKEY I already did code in additional field 1 and I thought this was enough in additional field 2.
What do you mean by this?
68 74 74 70 3a 2f 2f 74 69 6e 79 75 72 6c 2e 63 6f 6d 2f 62 64 6f 37 6d 77 67
Gothmog
 
Posts: 1941
Joined: Wed Sep 12, 2007 4:46 am
Location: Probably not home

Re: Call upon a additional field for new additional field

Postby rpinxt » Mon Feb 03, 2014 9:24 am

Ok let met elaborate.

I made this code for first additional field RP_AWKEY:
Code: Select all
CONCATENATE EKBE-BELNR EKBE-GJAHR INTO RP_AWKEY
.

So this makes the key with which I can get the invoice number from BKPF.

Then I wanted to make second additional field RP_INV with this code:
Code: Select all
CLEAR RP_INV.
SELECT SINGLE BELNR FROM BKPF
  INTO RP_INV
  WHERE RP_AWKEY = BKPF-AWKEY.


So additional field 1 is part of the coding of additional field 2.

But somehow the coding of additional field 2 does not recognize additional field 1.
rpinxt
 
Posts: 146
Joined: Mon Jul 23, 2012 8:02 am

Re: Call upon a additional field for new additional field

Postby Gothmog » Mon Feb 03, 2014 9:32 am

So you're looking for a document number in BKPF for wich the Reference Key (BKPF-AWKEY) has the value you concatenated in you (local to you program) data variable RP_AWKEY?
In this was, your WHERE condition is inverted. Try with:
Code: Select all
SELECT SINGLE BELNR FROM BKPF
  INTO RP_INV
  WHERE AWKEY = RP_AWKEY.
68 74 74 70 3a 2f 2f 74 69 6e 79 75 72 6c 2e 63 6f 6d 2f 62 64 6f 37 6d 77 67
Gothmog
 
Posts: 1941
Joined: Wed Sep 12, 2007 4:46 am
Location: Probably not home

Re: Call upon a additional field for new additional field

Postby rpinxt » Mon Feb 03, 2014 9:33 am

damn while I was writing that I saw what was wrong....
I had it backwards.
This would be the correct way:
Code: Select all
CLEAR RP_INV.
SELECT SINGLE BELNR FROM BKPF
  INTO RP_INV
  WHERE AWKEY = RP_AWKEY.


Thanks Gothmog for making me see this.
rpinxt
 
Posts: 146
Joined: Mon Jul 23, 2012 8:02 am

Re: Call upon a additional field for new additional field

Postby rpinxt » Mon Feb 03, 2014 9:34 am

Yes exactly Gothmog....I realised myself already ;)
Thanks for pointing that out.
rpinxt
 
Posts: 146
Joined: Mon Jul 23, 2012 8:02 am


Return to ABAP

Who is online

Users browsing this forum: No registered users and 9 guests





loading...


This website is not affiliated with, sponsored by, or approved by SAP AG.