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: 

Sample code for F-30 clearing with post

Former Member
0 Kudos
1,345

Hi -

Can anyone suggest me or give sample code to post document thru F-30 transaction code "Post with Clearing". I need to develop a code to post the document for customer bad debit write off and i'm using F-30 transaction code...

Thanks in advance.

Rds,

Kannan

3 REPLIES 3

Former Member
0 Kudos
271

deleted

Edited by: max bianchi on Jun 7, 2009 8:55 AM

Former Member
0 Kudos
271

Hi

U can use BI std program RFBIBL00: F-30 is based on transaction FB05 supported by rfbibl00.

The file for rfbibl00 has to be based on following structures:

BGR00: session data

BBKPF: header data for clearing document

BBSEG: Item data for clearing document

BSELK: to indicate which header fields to be used for open items selection

BBSELP: to indicate which ITEM fields to be used for open items selection

Here my code used to clear open vendor items without a clearing document (so I don't use BBSEG structure):

DATA: BEGIN OF BREAK,
        BUKRS LIKE BSIK-BUKRS,
        LIFNR LIKE BSIK-LIFNR,
        UMSKZ LIKE BSIK-UMSKZ,
        ZUONR LIKE BSIK-ZUONR,
        WAERS LIKE BSIK-WAERS,
      END   OF BREAK.

DATA: OLD_BREAK LIKE BREAK.

    LOOP AT T_BSIK INTO BSIK.
      IF OPEN_FILE = SPACE AND P_TEST = SPACE.
        OPEN_FILE = 'X'.
* Open file
        OPEN DATASET ZFAGTB01-FILENAME FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
* Set session data
        PERFORM FILL_NO_DATA USING BGR00 'BGR00'.
        BGR00-STYPE  = '0'.
        BGR00-GROUP  = <session name>.
        BGR00-MANDT  = SY-MANDT.
        BGR00-USNAM  = SY-UNAME.
        BGR00-START  = SPACE.
        BGR00-XKEEP  = 'X'.
        BGR00-NODATA = '/'.

        TRANSFER BGR00 TO P_FILENAME.
      ENDIF.
* Movimento dati di rottura
      MOVE-CORRESPONDING BSIK TO BREAK.
* Create new clear
      IF BREAK <> OLD_BREAK.
* header data:
        IF P_TEST = SPACE.

MAX

0 Kudos
271
          PERFORM FILL_NO_DATA USING BBKPF 'BBKPF'.
          BBKPF-STYPE = '1'.
          BBKPF-TCODE = 'FB05'.
          BBKPF-BLART = <document type>.
          BBKPF-BUKRS = BSIK-BUKRS.
          BBKPF-WAERS = BSIK-WAERS.
          BBKPF-AUGLV = 'UMBUCHNG'. "Giro conto con pareggio
*        BBKPF-XBLNR = <?????????>.
*        BBKPF-BKTXT = <???????????>.

          WRITE: P_BUDAT TO BBKPF-BUDAT,
                 P_BLDAT TO BBKPF-BLDAT.

          TRANSFER BBKPF TO P_FILENAME.
* header data for open item selection
          PERFORM FILL_NO_DATA USING BSELK 'BSELK'.
          BSELK-STYPE  = '2'.
          BSELK-TBNAM  = 'BSELK'.
          BSELK-AGKON  = BSIK-LIFNR.
          BSELK-AGBUK  = BSIK-BUKRS.
          BSELK-AGKOA  = 'K'.
          IF BSIK-UMSKZ IS INITIAL.
            BSELK-XNOPS = 'X'.
          ELSE.
            BSELK-AGUMS  = BSIK-UMSKZ.
          ENDIF.
          TRANSFER BSELK TO P_FILENAME.
* item data for open item selection
          PERFORM FILL_NO_DATA USING BSELP 'BSELP'.
          BSELP-STYPE    = '2'.
          BSELP-TBNAM    = 'BSELP'.
          BSELP-FELDN_1  = 'ZUONR'.
          BSELP-SLVON_1   = BSIK-ZUONR.
          TRANSFER BSELP TO ZFAGTB01-FILENAME.
        ENDIF.
      ENDIF.
      OLD_BREAK = BREAK.
    ENDLOOP.

Max