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: 

Extra field in SQ01

Former Member
0 Kudos

HI ,

I have created a Query on Logical database KDF and Now O am trying to bring the GL code from EKKN table .

I have created a GLAccount 1 extra field and have done below coding Screen shot .

Here POnumber 2 is derived from coding as well which as below.

I am getting the correct value for POnumber2 but GL code is blank

any ideas?

1 ACCEPTED SOLUTION

jogeswararao_kavala
Active Contributor
0 Kudos

The code for GLACCOUNT1 does not look OK. Whether the LDB has the table EKPO? I do not think so. You should try the corresponding structure name of EKPO in place of table name.

8 REPLIES 8

jogeswararao_kavala
Active Contributor
0 Kudos

The code for GLACCOUNT1 does not look OK. Whether the LDB has the table EKPO? I do not think so. You should try the corresponding structure name of EKPO in place of table name.

0 Kudos

LDB does not have EKPO or EKKN  Table but I need to drive the gL code for EKKN table.

That why I defined the Extra field .

I am very beginner in ABAP.

0 Kudos
  • You are getting PONUMBER2 because there is BKPF table in the LDB. So Where BKRS is getting a value in BKPF-BUKRS
  • You are not getting GLACCOUNT1 because there is no EKPO table in LDB. and hence Where condition variables are without any values.
  • So, you need to pass value to the EBELP
  • Also why you are having EBELN twice in where condition?
  • Try by removing the last two where conditions EKPO-EBELN (this is totally unnecessary) and EKPO-EBELP.

0 Kudos

HI ,

I did remove the last code but problem is that some time PO has multiple line and we need all line where it got posted /...

In the case if I remove th Last 2 coding line I get only GL code last line and  I need both Line and both line .

0 Kudos

In shot
my requirement is get the GL code  for vendor line item for open item  for RE document .from EKKN.table

0 Kudos

I understand that. I asked you to remove the line to understand the code. Now you need to incorporate the removed where condition having EKPO-EBELP, but you should know where from the value comes. It is definitely not from LDB. So you should have another select statement to get the value of EBELP into a local variable say lv_ebelp and then your where condition becomes


where EBELP = lv_eblep.

Know that you only can troubleshoot your code and you will be able to do so by understanding what the code exactly doing.

Jelena
Active Contributor
0 Kudos

If the logical database doesn't have two important tables that you need (and likely has tons more you don't need) then why are you using it? Just build your own JOIN and do what you need.

Also, from what I see in the screenshot, you have

WHERE EBELN = ...

AND EBELN = ...

EBELN can only have one value (PO number), how do you expect this to work?

0 Kudos

This (where EBELN) has been pointed out already.

  • Also why you are having EBELN twice in where condition?