‎2008 Jun 18 8:13 AM
Hi there,
I wanna select all invoices of a amount of purchase orders (that I selected before). Now I found out, that I have to use table EKBE to get the link to the invoice with field BWETP = 'Q' OR 'R'.
Than I have the data to read table RSEG (the invoices) with the following statement:
DATA: lt_ekbe TYPE TABLE OF ekbe
, lt_rseg TYPE TABLE OF rseg
.
SELECT * INTO TABLE lt_ekbe
FROM ekbe
FOR ALL ENTRIES IN it_order_data
WHERE ebeln = it_order_data-ebeln
AND ebelp = it_order_data-ebelp.
IF NOT lt_ekbe IS INITIAL.
DELETE lt_ekbe WHERE bewtp <> 'Q' AND bewtp <> 'R'.
SELECT * INTO TABLE lt_rseg
FROM rseg
FOR ALL ENTRIES IN lt_ekbe
WHERE belnr = lt_ekbe-belnr
AND gjahr = lt_ekbe-gjahr
AND buzei = lt_ekbe-buzei.
ENDIF.
But now I can't activate this coding because the field "BUZEI" in RSEG and EKBE has not the same data-element and also no similar domain, that means different lengths... But why is this so? Is the selection wrong or can you give me a hint?
Thanks a lot!
Regards,
Markus
‎2008 Jun 18 8:15 AM
HI,
Move to the separate internal table and use FOR ALL ENTRIES.
‎2008 Jun 18 8:18 AM
Okay, that would solve the problem, but is the selection itself also correct?
FOR ALL ENTRIES I use
Edited by: Markus Glubka on Jun 18, 2008 9:18 AM
‎2008 Jun 18 8:19 AM
Hi,
In the second select query in the where clause "buzei = it_rseg-buzei" and not the one u mentioned.
I think the error is becoz of that.
and do remove FOR ALL entries.
Regards,
Bhanu.
Edited by: nanduri bhanu on Jun 18, 2008 9:19 AM
‎2008 Jun 18 8:19 AM
Hi,
Copy the contents of the first internal table into other internal table in which that field is of diffrent type(as it is required in second select query).
Use new internal table in for all netries in second select query.
It will not affect the program flow.
Hope ie helps you.
‎2008 Jun 18 8:25 AM
Hi there,
I wanna select all invoices of a amount of purchase orders (that I selected before). Now I found out, that I have to use table EKBE to get the link to the invoice with field BWETP = 'Q' OR 'R'.
Than I have the data to read table RSEG (the invoices) with the following statement:
DATA: lt_ekbe TYPE TABLE OF ekbe
, lt_rseg TYPE TABLE OF rseg
.
SELECT * INTO TABLE lt_ekbe
FROM ekbe
FOR ALL ENTRIES IN it_order_data
WHERE ebeln = it_order_data-ebeln
AND ebelp = it_order_data-ebelp.
IF NOT lt_ekbe IS INITIAL.
DELETE lt_ekbe WHERE bewtp 'Q' AND bewtp 'R'.
SELECT * INTO TABLE lt_rseg
FROM rseg
FOR ALL ENTRIES IN lt_ekbe
WHERE belnr = lt_ekbe-belnr
AND gjahr = lt_ekbe-gjahr
AND buzei = lt_ekbe-buzei.
ENDIF.
But now I can't activate this coding because the field "BUZEI" in RSEG and EKBE has not the same data-element and also no similar domain, that means different lengths... But why is this so? Is the selection wrong or can you give me a hint?
Thanks a lot!
Regards,
Markus
Hi Markus,
1. You need to move the internal table lt_ekbe into another table with the same fields in lt_ekbe but with the type of the field for buzei as the one in rseg.
2. Move record by record into the new internal table using move statement for each field not with equal sign(i.e. newfield1 = oldfield1 -> don't use it).
Means now in the new internal table we had all the records of lt_ekbe with the field buzei as of type in rseg.
3. Now in the select query use for all entries with the new internal table which all the records were moved from the lt_ekbe( & also the where condition fields should be with the new fields in the new internal table)
you will not get any error message your problem will be solved to my knowledge.
‎2008 Jun 18 8:26 AM
hi
For all enrties wil not work if the field length is not same use something else instead of For all entries
Reward points if helpfull
Snehi