09-07-2021 5:46 AM
Hi all,
I have two select queries on QBEW and PRPS table and both the selects have data.
QBEW - matnr,bwkey,bwtar,sobkz,pspnr
PRPS - pspnr,objnr,psphi
Now do a read statement:
READ TABLE lt_qbew INTO DATA(lw_qbew) WITH KEY pspnr = lw_prps-pspnr
bwkey = so_werks BINARY SEARCH.
I have sorted lt_qbew with both pspnr and bwkey.
Yet my read statement is failing. Pls Help.
09-07-2021 6:41 AM
READ TABLE lt_qbew INTO DATA(lw_qbew)
WITH KEY pspnr = lw_prps-pspnr
bwkey = so_werks
BINARY SEARCH
Next time use the [CODE] button to put ABAP Code.
It is a non-sens to make a single read, with binary access, and to specify a range of plant (werks). Because you could have several value in plant, the binary reading is not possible.
Change the way of doing it with a LOOP and and EXIT:
LOOP AT lt_qbew
INTO DATA(lw_qbew)
WHERE pspnr EQ lw_prps-pspnr
AND bwkey IN so_werks.
EXIT.
ENDLOOP.
09-07-2021 6:07 AM
09-07-2021 7:09 AM
That is a link with the right answer, but that makes the forum a jungle for future search https://blogs.sap.com/2013/11/08/posting-links-and-the-jungle-you-end-up-in/
09-07-2021 6:41 AM
READ TABLE lt_qbew INTO DATA(lw_qbew)
WITH KEY pspnr = lw_prps-pspnr
bwkey = so_werks
BINARY SEARCH
Next time use the [CODE] button to put ABAP Code.
It is a non-sens to make a single read, with binary access, and to specify a range of plant (werks). Because you could have several value in plant, the binary reading is not possible.
Change the way of doing it with a LOOP and and EXIT:
LOOP AT lt_qbew
INTO DATA(lw_qbew)
WHERE pspnr EQ lw_prps-pspnr
AND bwkey IN so_werks.
EXIT.
ENDLOOP.
09-07-2021 7:12 AM