Skip to Content
avatar image
Former Member

Problem exluding reversal Doc from Bseg

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' ).
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Oct 27, 2016 at 12:28 PM

    I think you need to check bkpf field also.

    bkpf-xreversal

    bkpf-stblg

    Add comment
    10|10000 characters needed characters exceeded

    • 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.
      
      
  • avatar image
    Former Member
    Oct 27, 2016 at 01:23 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 27, 2016 at 04:40 PM

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

    Add comment
    10|10000 characters needed characters exceeded