Application Development and Automation 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: 
Read only

Create a program that use transaction FB01L

Former Member
0 Likes
1,771

I need to adapt an existing custom report that reads a file and executes transaction FB01.

Actually, this report call function ‘POSTING_INTERFACE_DOCUMENT’.

CALL FUNCTION 'POSTING_INTERFACE_DOCUMENT'
     
EXPORTING
        i_tcode                 
= 'FB01'
     
TABLES
        t_blntab                
= bln
        t_ftpost                
= fpost
        t_fttax                 
= tax
     
EXCEPTIONS
        account_missing         
= 1
        company_code_missing    
= 2
        posting_key_invalid     
= 3
        posting_key_missing     
= 4
        record_type_invalid     
= 5
        transaction_code_invalid
= 6
        amount_format_error     
= 7
        too_many_line_items     
= 8
        company_code_invalid    
= 9
        screen_not_found        
= 10
        no_authorization        
= 11
       
OTHERS                   = 12.

    

Now, the request is to manage general ledger, so it will call transaction FB01L but if I try to use this call function I received an error "Transaction not exist".

Does it exist a function module for this purpose?

   

The FM_LEDGER_POST_FOR_BL doesn’t solve this problem.

Thank you,

Alessandro Scattola.

I need to adapt an existing custom report that reads a file and executes transaction FB01.

Actually, this report call function ‘POSTING_INTERFACE_DOCUMENT’.

CALL FUNCTION 'POSTING_INTERFACE_DOCUMENT'
     
EXPORTING
        i_tcode                 
= 'FB01'
     
TABLES
        t_blntab                
= bln
        t_ftpost                
= fpost
        t_fttax                 
= tax
     
EXCEPTIONS
        account_missing         
= 1
        company_code_missing    
= 2
        posting_key_invalid     
= 3
        posting_key_missing     
= 4
        record_type_invalid     
= 5
        transaction_code_invalid
= 6
        amount_format_error     
= 7
        too_many_line_items     
= 8
        company_code_invalid    
= 9
        screen_not_found        
= 10
        no_authorization        
= 11
       
OTHERS                   = 12.

    

Now, the request is to manage general ledger, so it will call transaction FB01L but if I try to use this call function I received an error "Transaction not exist".

Does it exist a function module for this purpose?

   

The FM_LEDGER_POST_FOR_BL doesn’t solve this problem.

Thank you,

Alessandro Scattola.

3 REPLIES 3
Read only

VenkatRamesh_V
Active Contributor
0 Likes
1,204

Hi,

View the  code.

REFRESH: IT_BLNTAB,IT_FTCLEAR,IT_FTPOST,IT_FTTAX.

     FREE:    IT_BLNTAB,IT_FTCLEAR,IT_FTPOST,IT_FTTAX.

     DATA:    lv_bal type p decimals 2,

              LV_AMT(20) TYPE C,

              wa_del     type ZBRS_UPLOAD.

     FIELD-SYMBOLS: <fs> type any,

                    <delete> like line of it_del.

     lv_bal   = clear_doc-wrbtr  + post_doc-wrbtr.

     check lv_bal = 0.

     LV_AMT  = clear_doc-wrbtr.

*     replace ',' with space into LV_AMT .

     CONDENSE lv_amt no-gaps.

     w_ftclear-AGKOA  'S'.

     w_ftclear-xnops  = 'X'.

     w_ftclear-AGKON  clear_doc-hkont.

     w_ftclear-AGBUK  = 'AF'.

     w_ftclear-SELFD  = 'BELNR'.

     w_ftclear-XNOPS 'X'.

     w_ftclear-SELVON = clear_doc-belnr.

     w_ftclear-selbis = clear_doc-belnr.

     append w_ftclear to it_ftclear.

     CLEAR  w_ftclear.

     wa_ftpost-count = '001'.

     wa_ftpost-stype = 'K'"   'P'.   "'K'. " .

     wa_ftpost-fnam = 'BKPF-BLDAT'.

     wa_ftpost-fval = clear_doc-bldat.

     CONCATENATE wa_ftpost-fval+6(2) wa_ftpost-fval+4(2) wa_ftpost-fval(4) INTO wa_ftpost-fval.

     APPEND wa_ftpost to it_ftpost.

     CLEAR  wa_ftpost.

     wa_ftpost-stype = 'K'.

     wa_ftpost-count = '001'.

     wa_ftpost-fnam = 'BKPF-BUDAT'.

     wa_ftpost-fval = clear_doc-bldat.

     CONCATENATE wa_ftpost-fval+6(2) wa_ftpost-fval+4(2) wa_ftpost-fval(4) INTO wa_ftpost-fval.

     APPEND wa_ftpost to it_ftpost.

     CLEAR  wa_ftpost.

     wa_ftpost-stype = 'K'.

     wa_ftpost-fnam = 'BKPF-BLART'.

     wa_ftpost-fval = 'ZR'.

     APPEND wa_ftpost to it_ftpost.

     CLEAR  wa_ftpost.

     wa_ftpost-stype = 'K'.

     wa_ftpost-fnam = 'BKPF-BUKRS'.

     wa_ftpost-fval = 'AF'.

     APPEND wa_ftpost to it_ftpost.

     CLEAR  wa_ftpost.

     wa_ftpost-stype = 'K'.

     wa_ftpost-fnam = 'BKPF-WAERS'.

     wa_ftpost-fval = 'INR'.

     APPEND wa_ftpost to it_ftpost.

     CLEAR  wa_ftpost.

     wa_ftpost-stype = 'K'.

     wa_ftpost-fnam = 'BKPF-BKTXT'.

     IF P_NTCL IS NOT INITIAL.

       wa_ftpost-fval = 'ZBRS Neft Clearing'.

     ELSE.

       wa_ftpost-fval = 'ZBRS Cheque Clearing'.

     ENDIF.

     APPEND wa_ftpost to it_ftpost.

     CLEAR  wa_ftpost.

     wa_ftpost-stype = 'P'.

     wa_ftpost-fnam = 'RF05A-AUGTX'.

     IF P_NTCL IS NOT INITIAL.

       wa_ftpost-fval = 'ZBRS Neft Clearing'.

     ELSE.

       wa_ftpost-fval = 'ZBRS Cheque Clearing'.

     ENDIF.

     APPEND wa_ftpost to it_ftpost.

     CLEAR  wa_ftpost.

     IF p_ot IS  NOT INITIAL OR P_NTCL IS NOT INITIAL.

       wa_ftpost-stype = 'P'.

       wa_ftpost-count = '001'.

       wa_ftpost-fnam = 'RF05A-NEWBS'.

       wa_ftpost-fval = '40'.

       APPEND wa_ftpost to it_ftpost.

       CLEAR  wa_ftpost.

     ELSE.

       wa_ftpost-stype = 'P'.

       wa_ftpost-count = '001'.

       wa_ftpost-fnam = 'RF05A-NEWBS'.

       wa_ftpost-fval = '50'.

       APPEND wa_ftpost to it_ftpost.

       CLEAR  wa_ftpost.

     ENDIF.

     wa_ftpost-stype = 'P'.

     wa_ftpost-count = '001'.

     wa_ftpost-fnam = 'RF05A-NEWKO'.

     wa_ftpost-fval = clear_doc-hkont.

     APPEND wa_ftpost to it_ftpost.

     CLEAR  wa_ftpost.

     wa_ftpost-stype = 'P'.

     wa_ftpost-count = '002'.

     wa_ftpost-fnam = 'BSEG-WRBTR'.

     wa_ftpost-fval LV_AMT.           "clear_doc-wrbtr.

     APPEND wa_ftpost to it_ftpost.

     CLEAR  wa_ftpost.

     IF p_ot IS NOT INITIAL OR P_NTCL IS NOT INITIAL.

       wa_ftpost-stype = 'P'.

       wa_ftpost-count = '002'.

       wa_ftpost-fnam = 'RF05A-NEWBS'.

       wa_ftpost-fval = '50'.

       APPEND wa_ftpost to it_ftpost.

       CLEAR  wa_ftpost.

     ELSE.

       wa_ftpost-stype = 'P'.

       wa_ftpost-count = '002'.

       wa_ftpost-fnam = 'RF05A-NEWBS'.

       wa_ftpost-fval = '40'.

       APPEND wa_ftpost to it_ftpost.

       CLEAR  wa_ftpost.

     ENDIF.

     wa_ftpost-stype = 'P'.

     wa_ftpost-count = '002'.

     wa_ftpost-fnam = 'RF05A-NEWKO'.

     wa_ftpost-fval post_doc-hkont.

     APPEND wa_ftpost to it_ftpost.

     CLEAR  wa_ftpost.

     CALL FUNCTION 'POSTING_INTERFACE_START'

       EXPORTING

         I_CLIENT   = sy-mandt

         I_FUNCTION = 'C' "LIKE RFIPI-FUNCT

*       I_GROUP    = SPACE

*       I_HOLDDATE = SPACE

*       I_KEEP     = SPACE

         I_MODE     = 'N' "'N'

         I_UPDATE   = 'S'

         I_USER     = sy-uname.

*                   I_XBDCC = SPACE

     CALL FUNCTION 'POSTING_INTERFACE_CLEARING'

       EXPORTING

         I_AUGLV                    = 'UMBUCHNG'   "  'AUSGZAHL'

         I_TCODE                    = 'FB05'

         I_SGFUNCT                  = l_sgfunct

*       I_NO_AUTH                  = ' '

       IMPORTING

         E_MSGID                    = sy-msgid

         E_MSGNO                    = sy-msgno

         E_MSGTY                    = sy-msgty

         E_MSGV1                    = sy-msgv1

         E_MSGV2                    = sy-msgv2

         E_MSGV3                    = sy-msgv3

         E_MSGV4                    = sy-msgv4

*       E_SUBRC                    =   sy-subrc

       TABLES

         T_BLNTAB                   = IT_BLNTAB

         T_FTCLEAR                  = IT_FTCLEAR

         T_FTPOST                   = IT_FTPOST

         T_FTTAX                    = IT_FTTAX

       EXCEPTIONS

         CLEARING_PROCEDURE_INVALID = 1

         CLEARING_PROCEDURE_MISSING = 2

         TABLE_T041A_EMPTY          = 3

         TRANSACTION_CODE_INVALID   = 4

         AMOUNT_FORMAT_ERROR        = 5

         TOO_MANY_LINE_ITEMS        = 6

         COMPANY_CODE_INVALID       = 7

         SCREEN_NOT_FOUND           = 8

         NO_AUTHORIZATION           = 9

         OTHERS                     = 10.

     IF SY-SUBRC <> 0.

* Implement suitable error handling here

     ENDIF.

     CALL FUNCTION 'POSTING_INTERFACE_END'

       EXPORTING

         I_BDCIMMED              = 'X'

*       I_BDCSTRTDT             = 'NO_DATE'

*       I_BDCSTRTTM             = NO_TIME

       EXCEPTIONS

         SESSION_NOT_PROCESSABLE = 1

         OTHERS                  = 2.


Hope it helpful,

Regards,

Venkat.

Read only

Former Member
0 Likes
1,204

This FM doesn't seem to support transaction FB01L, so I expect you will be limited to batch input.

Rob

Read only

0 Likes
1,204

Or time to convert to BAPI


IF  tcode NE 'FB01'

AND tcode NE 'FBS1'             " Detect demarcation document

AND tcode NE 'FB41'             " Transfer of the tax burden

AND tcode NE 'ABF1'             " FB01 Asset Accounting

AND tcode NE 'FBB1'             " Foreign Currency Valuation

AND tcode NE 'FBVB'             " Book Parked Document

AND tcode NE 'FBV1'             " Park Invoice document

AND tcode NE 'FBD5'.            " Book recurring entry document

  MESSAGE e006 WITH tcode RAISING transaction_code_invalid.

ENDIF.

Regards,

Raymond