cancel
Showing results for 
Search instead for 
Did you mean: 

T-CODE FB01 In Mass creation

Former Member

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

You can also use LSMW(available free of cost to customers of SAP, but needs to be downloaded from service.sap.com).

Using this tool you can easily upload data for many objects. It is a kind of cockpit for all kinds of available interfacing techniques(BAPI, IDOC, Batch Input, BDC, Business Objects). You can define a project and create an object for FB01. You can choose your own input format and then map it to the RFBIBL00 structures using an easy-to-understand mapping tool.

Srinivas

LucianoBentiveg
Active Contributor
0 Kudos

You can use function 'POSTING_INTERFACE_DOCUMENT', works really fine. Example code bellow:

REPRT ztest.

************************************************************************

  • TYPES

************************************************************************

TYPES: BEGIN OF ge_account,

source(12) TYPE c, "Source Interface

bukrs(4) TYPE c, "Company code

operid(13) TYPE c, "Operation ID

date(10) TYPE c, "Date

blart(2) TYPE c, "Document type

waers(5) TYPE c, "Currency

free(10) TYPE c, "Free

newko(10) TYPE c, "Gl account

kostl(10) TYPE c, "Cost center

newbs(2) TYPE c, "Posting key

wrbtr(14) TYPE c, "Amount

sgtxt(25) TYPE c, "Description

zuonr(8) TYPE c, "Reference 1

ref2(8) TYPE c, "Reference 2

END OF ge_account.

TYPES: BEGIN OF ge_account_new,

source(12) TYPE c, "Source Interface

bukrs(4) TYPE c, "Company code

operid(13) TYPE c, "Operation ID

date(10) TYPE c, "Date

blart(2) TYPE c, "Document type

waers(5) TYPE c, "Currency

free(10) TYPE c, "Free

newko(10) TYPE c, "Gl account

kostl(10) TYPE c, "Cost center

newbs(2) TYPE c, "Posting key

wrbtr LIKE bseg-wrbtr, "Amount

sgtxt(25) TYPE c, "Description

zuonr(8) TYPE c, "Reference 1

ref2(8) TYPE c, "Reference 2

END OF ge_account_new.

TYPES: BEGIN OF ge_ftpost.

INCLUDE STRUCTURE ftpost.

TYPES: END OF ge_ftpost.

TYPES: BEGIN OF ge_blntab.

INCLUDE STRUCTURE blntab.

TYPES: END OF ge_blntab.

TYPES: BEGIN OF ge_blntabdoc.

INCLUDE STRUCTURE blntab.

TYPES: END OF ge_blntabdoc.

TYPES: BEGIN OF ge_fttax.

INCLUDE STRUCTURE fttax.

TYPES: END OF ge_fttax.

TYPES: BEGIN OF ge_message,

text(110),

flag,

END OF ge_message.

*TYPES: BEGIN OF ge_zlscf008.

  • INCLUDE STRUCTURE zlscf008.

*TYPES: END OF ge_zlscf008.

TYPES: tyt_account_aux TYPE TABLE OF ge_account.

TYPES: tyt_account TYPE TABLE OF ge_account_new.

TYPES: tyt_ftpost TYPE TABLE OF ge_ftpost.

TYPES: tyt_blntab TYPE TABLE OF ge_blntab.

TYPES: tyt_blntabdoc TYPE TABLE OF ge_blntabdoc.

TYPES: tyt_fttax TYPE TABLE OF ge_fttax.

TYPES: tyt_message TYPE TABLE OF ge_message.

DATA: it_blntab TYPE tyt_blntab WITH HEADER LINE.

DATA: it_blntabdoc TYPE tyt_blntabdoc WITH HEADER LINE.

DATA: it_fttax TYPE tyt_fttax WITH HEADER LINE.

DATA: it_ftpost TYPE tyt_ftpost WITH HEADER LINE.

DATA: v_lines_doc(3) TYPE n,

v_user LIKE sy-uname,

v_msgid LIKE sy-msgid,

v_msgno LIKE sy-msgno,

v_msgty LIKE sy-msgty,

v_msgv1 LIKE sy-msgv1,

v_msgv2 LIKE sy-msgv2,

v_msgv3 LIKE sy-msgv3,

v_msgv4 LIKE sy-msgv4,

v_subrc LIKE sy-subrc,

v_subrc1 LIKE sy-subrc,

v_tcode LIKE sy-tcode VALUE 'FB01',

v_msg(110),

v_err,

v_mode,

  • v_blart LIKE zlscf007-blart,

  • v_hkont LIKE zlscf007-hkont,

  • v_sources LIKE zlscf007-sources,

v_operid(13),

v_bierr(2) TYPE n,

v_xdate(8),

v_bktxt LIKE bkpf-bktxt,

v_kokrs LIKE csks-kokrs.

PERFORM f_fill_doc_header.

PERFORM f_fill_doc_position.

*Inicio el post del documento

CALL FUNCTION 'POSTING_INTERFACE_START'

EXPORTING

i_client = sy-mandt

i_function = 'C'

i_mode = 'A'

i_update = 'S'

i_user = sy-uname

EXCEPTIONS

client_incorrect = 1

function_invalid = 2

group_name_missing = 3

mode_invalid = 4

update_invalid = 5

OTHERS = 6.

*Postin document.

CLEAR it_blntab.

REFRESH it_blntab.

CALL FUNCTION 'POSTING_INTERFACE_DOCUMENT'

EXPORTING

i_tcode = v_tcode

IMPORTING

e_msgid = v_msgid

e_msgno = v_msgno

e_msgty = v_msgty

e_msgv1 = v_msgv1

e_msgv2 = v_msgv2

e_msgv3 = v_msgv3

e_msgv4 = v_msgv4

e_subrc = v_subrc

TABLES

t_blntab = it_blntab

t_ftpost = it_ftpost

t_fttax = it_fttax

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

OTHERS = 9.

CALL FUNCTION 'POSTING_INTERFACE_END'

EXPORTING

i_bdcimmed = 'X'

EXCEPTIONS

session_not_processable = 1

OTHERS = 2.

&----


*& Form f_fill_doc_header

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM f_fill_doc_header.

REFRESH it_ftpost.

CLEAR it_ftpost.

ADD 1 TO v_lines_doc.

it_ftpost-stype = 'K'.

it_ftpost-count = v_lines_doc.

it_ftpost-fnam = 'BKPF-BLDAT'.

it_ftpost-fval = '06092004'.

APPEND it_ftpost.

it_ftpost-fnam = 'BKPF-BUDAT'.

it_ftpost-fval = '06092004'.

APPEND it_ftpost.

it_ftpost-fnam = 'BKPF-BLART'.

it_ftpost-fval = 'K3'.

APPEND it_ftpost.

it_ftpost-fnam = 'BKPF-BUKRS'.

it_ftpost-fval = 'CTIU'.

APPEND it_ftpost.

it_ftpost-fnam = 'BKPF-WAERS'.

it_ftpost-fval = 'ARS'.

APPEND it_ftpost.

it_ftpost-fnam = 'BKPF-BKTXT'.

it_ftpost-fval = 'Prueba'.

APPEND it_ftpost.

CLEAR v_lines_doc.

ENDFORM. " f_fill_doc_header

&----


*& Form f_fill_doc_position

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM f_fill_doc_position.

it_ftpost-stype = 'P'.

ADD 1 TO v_lines_doc.

it_ftpost-count = v_lines_doc.

it_ftpost-fnam = 'RF05A-NEWBS'.

it_ftpost-fval = '11'.

APPEND it_ftpost.

it_ftpost-fnam = 'RF05A-NEWKO'.

it_ftpost-fval = '55'.

APPEND it_ftpost.

it_ftpost-fnam = 'BSEG-WRBTR'.

it_ftpost-fval = '1.00'.

APPEND it_ftpost.

it_ftpost-stype = 'P'.

ADD 1 TO v_lines_doc.

it_ftpost-count = '2'.

it_ftpost-fnam = 'RF05A-NEWBS'.

it_ftpost-fval = '21'.

APPEND it_ftpost.

it_ftpost-fnam = 'RF05A-NEWKO'.

it_ftpost-fval = '55'.

APPEND it_ftpost.

it_ftpost-fnam = 'BSEG-WRBTR'.

it_ftpost-fval = '*'.

APPEND it_ftpost.

ENDFORM. " f_fill_doc_position

andreas_mann3
Active Contributor
0 Kudos

or <b>AC_DOCUMENT_DIRECT_INPUT</b>

-> for mass data

Grx Andreas

FredericGirod
Active Contributor
0 Kudos

Hi,

The structure of the file using RFBIBL00 is :

BGR00 (head of the file)

BBKPF (head of the document)

BBSEG (post of the document).

Or you can use the BAPI :

BAPI_ACC_GL_POSTING_POST.

Frédéric.