Read sales document flow using a function module


From:
http://www.allsaplinks.com/salesdocumentflow_fm.html

How to read those billing document flow from your ABAP report? Just call the function module. You can also
prefer to read from the SAP table, VBFA.

Code

****  To read the billing document flow from ABAP report.
**** or the SAP Table VBFA ==> Document flow table
REPORT y_doc_flow
MESSAGE-ID rebates.

*Internal Table for VBFA
DATA: BEGIN OF i_vbfa OCCURS 0.
INCLUDE STRUCTURE vbfa.
DATA: END OF i_vbfa.

DATA: i_vbco6 LIKE vbco6.

CLEAR: i_vbfa, i_vbco6.
REFRESH: i_vbfa.


PERFORM input_vbeln_records.

CALL FUNCTION 'RV_ORDER_FLOW_INFORMATION'
EXPORTING
*         aufbereitung  = '2
'*         belegtyp      = beleg_typ
comwa         = i_vbco6
*    IMPORTING
*         BELEGTYP_BACK =
TABLESvbfa_tab      = i_vbfa
EXCEPTIONS
no_vbfa       = 1
no_vbuk_found = 2
OTHERS        = 3.

IF sy-subrc <> 0.
MESSAGE i019 WITH 'No documents found!'.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ELSE.
LOOP AT i_vbfa.
WRITE:/  i_vbfa-vbeln, i_vbfa-posnn, i_vbfa-vbtyp_n.
ENDLOOP.
ENDIF.


*&---------------------------------------------------------------------**
*&      Form  INPUT_VBELN_RECORDS
*&---------------------------------------------------------------------*
FORM input_vbeln_records.
i_vbco6-vbeln = '0060001625'.
i_vbco6-posnr = '000000'.
i_vbco6-etenr = '0000'.
****  APPEND i_vbco6.
ENDFORM.                    " INPUT_VBELN_RECORDS
Converted from CHM to HTML with chm2web Standard 2.7 (unicode)