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: 

function 'POSTING_INTERFACE_DOCUMENT'

Former Member
0 Kudos

Hello,

I'm using this function , and I have got it to work, but what I am now trying to do is add multiple lines and headers to the Internal table FTPOST, being passed into the function.

The way I enter it at the momment is like below and it does not work, how do I match the Headers to the line items, I understand that the headers have a type 'K'

and the line items type'P'. And each has a counter,

Do I increment the line counter for new headers or not, please see how I have doen it, which does not seem to work

1 STYPE COUNT FNAM

P |004 |BSEG-SGTXT

1 K |001 |BKPF-BLDAT

2 K |001 |BKPF-BLART

3 K |001 |BKPF-BUKRS

4 K |001 |BKPF-BUDAT

5 K |001 |BKPF-WAERS

6 K |001 |BKPF-XBLNR

7 K |001 |BKPF-STGRD

8 K |001 |BKPF-STODT

9 K |001 |FS006-DOCID

10 P |001 |RF05A-NEWBS

11 P |001 |BSEG-HKONT

12 P |001 |BSEG-WRBTR

13 P |001 |BSEG-MWSKZ

14 P |001 |BSEG-ZUONR

15 P |001 |BSEG-SGTXT

16 P |001 |BDC_SUBSCR

17 P |001 |DKACB-FMORE

18 P |001 |COBL-KOSTL

19 P |001 |COBL-FIPOS

20 P |001 |COBL-AUFNR

.....

002

..... 003

then for the next header and records

1 K |002 |BKPF-BLART

2 K |002 |BKPF-BUKRS

3 K |003 |BKPF-BUDAT

and line items

11 P |001 |BSEG-HKONT

12 P |001 |BSEG-WRBTR

13 P |001 |BSEG-MWSKZ

I think it is the line items in the second batch whic is causing the confusion.

Thanks

<

6 REPLIES 6

Former Member
0 Kudos

Hello

What I am really getting at , is how are the Headers matched to the line items in this function?

Thanks

Former Member
0 Kudos

You should append the records to your internal table(FTPOST) in this way.

HEADER1

ITEM1 OF HEADER1

ITEM2 OF HEADER1

HEADER2

ITEM1 OF HEADER2

ITEM2 OF HEADER2.

It is the occurance of the next header that tells the system that it is a new transaction and any lines following it belong to this new header.

0 Kudos

STYPE COUNT FNAM

-


K 1 'Field name 1'

K 1 'Field Name 2'

P 1 'Field Name 1'

P 1 'Field Name 2'

.

.

K 2 'Field name 1'

K 2 'Field Name 2'

P 2 'Field Name 1'

P 2 'Field Name 2'

Or does the field counter in the second set turn 1 again?

Thanks

0 Kudos

Actually, I am looking at this function module and I don't think it can post multiple documents in a single call. So you will have loop and call this, something like this.

loop at myitab.

fill FTPOST itab for one transaction.

at the end of one transaction, call function.

refresh FTPOST itab.

endloop.

0 Kudos

Hi,

are you sure, because one of the parameters

tables

t_blntab

gives back an Itab of all the documents it created, otherwise it would be just 1 value.

My data is fine, what I have is 2 headers and then 2 line items in each, when I delete one set, and run the program, it is fine, then I deleted the other set and it was fine, but when I try it with both sets, it comes back with an error message, like it see one or some of the lines, any ideas?

regards Sims

0 Kudos

for the colleagues that could not use this function with multiple documents yet.

The answer was:

1- first, call the start interface

CALL FUNCTION 'POSTING_INTERFACE_START'
    EXPORTING
      i_client           = sy-mandt
      i_function         = 'B' "C=Call/B=BDC
      i_group            = pv_goup "Generar Juego de datos
      i_mode             = modo
      i_update           = 'S'
      i_user             = sy-uname
      i_xbdcc            = 'X'     "Generar Juego de datos
    EXCEPTIONS
      client_incorrect   = 1
      function_invalid   = 2
      group_name_missing = 3
      mode_invalid       = 4
      update_invalid     = 5
      OTHERS             = 6.

2- call the posting function n times as documents you need

CALL FUNCTION 'POSTING_INTERFACE_DOCUMENT'

3- finally, Close de interface

CALL FUNCTION 'POSTING_INTERFACE_END'
    EXPORTING
      i_bdcimmed              =  space "'X' "Ejecutar el juego de datos solo para BDC
    EXCEPTIONS
      session_not_processable = 1
      OTHERS                  = 2.

Hope it will be useful