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: 

Problem exluding reversal Doc from Bseg

0 Kudos

i am getting the result but reversal document is showing. how can i delete reversal document from my report.


selection-screen BEGIN OF block b1 WITH frame title text-000.

PARAMETERS:p_belnr LIKE vbak-vbeln. "  SAles Order

PARAMETERS:p_belnr1 LIKE vbak-bstnk.  "  PO

SELECTION-SCREEN END OF BLOCK b1.


SELECT
belnr
hkont
gsber
zfbdt
wrbtr
sgtxt
vbel2
augbl

FROM
bseg
INTO CORRESPONDING FIELDS OF TABLE
it_items
WHERE
* bseg~belnr = it_items-belnr AND
bseg~vbel2 = p_belnr AND bseg~augbl = '' and
bseg~shkzg = 'S' AND
bseg~hkont IN ('8001030006' , '8001030007','8001030008','8001100002' ).
5 REPLIES 5

former_member196331
Active Contributor
0 Kudos

I think you need to check bkpf field also.

bkpf-xreversal

bkpf-stblg

0 Kudos

actually the query is very slow.

i selecting through sale order no not from belnr

bseg~vbel2 = p_belnr

0 Kudos
SELECT
belnr
hkont
gsber
zfbdt
wrbtr
sgtxt
vbel2
augbl

FROM
bseg
INTOCORRESPONDINGFIELDSOFTABLE
it_items
WHERE
* bseg~belnr = it_items-belnr AND
bseg~vbel2 = p_belnr and
bseg~hkont IN('8001030006','8001030007','8001030008','8001100002').

Now
delete it_items  bseg~augbl = ''.
delete it_items  bseg~shkzg = 'S'.

Any possibility.

Former Member
0 Kudos

Hi

Your query is very bad for performance, BSEG table should be read for main key fields only, so:

- BSEG-BUKRS (Company code)

- BSEG-BELNR (Document Number)

and you don't use them, it should be better to use at least the company code

Anyway if you need to start from Sales Order, it better to use the document flow in order to get the bill and so accounting document

The table for document flow is VBFA, but you can also use the fm RV_ORDER_FLOW_INFORMATION

Max

Jelena
Active Contributor
0 Kudos

What is the definition of "reversal document" and what have you tried yourself so far? What exactly is the challenge here?