Skip to Content
0

Problem exluding reversal Doc from Bseg

Oct 27, 2016 at 12:21 PM

42

avatar image

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' ).
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Kali Charan Oct 27, 2016 at 12:28 PM
0

I think you need to check bkpf field also.

bkpf-xreversal

bkpf-stblg

Show 2 Share
10 |10000 characters needed characters left characters exceeded

actually the query is very slow.

i selecting through sale order no not from belnr

bseg~vbel2 = p_belnr
0
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.

0
max bianchi Oct 27, 2016 at 01:23 PM
0

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

Share
10 |10000 characters needed characters left characters exceeded
Jelena Perfiljeva
Oct 27, 2016 at 04:40 PM
0

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

Share
10 |10000 characters needed characters left characters exceeded