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

BDC in background problem..

vsubbakrishna
Participant
0 Likes
1,048

Hi all,

I am running a BDC program in Foreground and the program posts FI docs in F-43.

If I run the same in background it does not generate any FI docs.

data: begin of i_bdcdata occurs 0. " BDC data table

include structure bdcdata.

data: end of i_bdcdata.

data: begin of i_bdcmessage occurs 0. " BDC Messages

include structure bdcmsgcoll.

data: end of i_bdcmessage.

parameters:p_mode type c.

start-of-selection.

perform bdc_screen using 'SAPMF05A' '0100'.

perform bdc_field_in using 'BDC_OKCODE'

'/00'.

perform bdc_field_in using 'BDC_CURSOR'

'RF05A-NEWKO'.

perform bdc_field_in using 'BKPF-BLDAT'

'06/06/2008'.

perform bdc_field_in using 'BKPF-BLART'

'KR'.

perform bdc_field_in using 'BKPF-XBLNR'

'test'.

perform bdc_field_in using 'RF05A-NEWBS'

'31'.

perform bdc_field_in using 'RF05A-NEWKO'

'FRED'.

perform bdc_screen using 'SAPMF05A' '2302'.

perform bdc_field_in using 'BDC_OKCODE'

'SB'.

perform bdc_field_in using 'BDC_CURSOR'

'BSEG-ZLSCH'.

perform bdc_field_in using 'BSEG-WRBTR'

'224'.

perform bdc_field_in using 'BSEG-GSBER'

'2000'.

perform bdc_field_in using 'BSEG-ZLSCH'

'F'.

perform bdc_screen using 'SAPMF05A' '0310'.

perform bdc_field_in using 'BDC_OKCODE'

'SB'.

perform bdc_field_in using 'BDC_CURSOR'

'BSEG-KOSTL(01)'.

perform bdc_field_in using 'BSEG-BSCHL(01)'

'40'.

perform bdc_field_in using 'RF05A-KONTO(01)'

'705000'.

perform bdc_field_in using 'BSEG-WRBTR(01)'

'224'.

perform bdc_field_in using 'BSEG-GSBER(01)'

'2000'.

perform bdc_field_in using 'BSEG-KOSTL(01)'

'10193031'.

perform bdc_screen using 'SAPMF05A' '0310'.

perform bdc_field_in using 'BDC_OKCODE'

'BU'.

perform bdc_field_in using 'BDC_CURSOR'

'BSEG-BSCHL(01)'.

call transaction 'F-43' using i_bdcdata

mode p_mode

update 'S'

messages into i_bdcmessage.

commit work.

Any reason why?

Thanks,

Subba

7 REPLIES 7
Read only

Former Member
0 Likes
1,003

try with this

DATA : p_mode type c VALUE 'N', " No display mode

Read only

Former Member
0 Likes
1,003

Hi

Probably the error is triggered in foreground too, u should see the message error as successfull message (message type S) so in foreground you can go on and post the document.

U should give us the error to stop the BDC in background: u should see the error in table i_bdcmessage, so after calling the transaction u should write the messages stored in that table.

Max

Edited by: max bianchi on Jun 6, 2008 7:33 PM

Read only

0 Likes
1,003

The BDC works when the Mode is 'A'.

And there is no error in foreground mode.

Is it a Database commit problem or something else?

Subba

Read only

0 Likes
1,003

Hi

No I don't think, try a code like this:

CALL TRANSACTION 'F-43' USING I_BDCDATA
  MODE P_MODE
  UPDATE 'S'
  MESSAGES INTO I_BDCMESSAGE.


DATA MESSAGE TYPE MESSAGE.

LOOP AT I_BDCMESSAGE.

  CALL FUNCTION 'WRITE_MESSAGE'
       EXPORTING
            MSGID = I_BDCMESSAGE-MSGID
            MSGNO = I_BDCMESSAGE-MSGNR
            MSGTY = I_BDCMESSAGE-MSGTYP
            MSGV1 = I_BDCMESSAGE-MSGV1
            MSGV2 = I_BDCMESSAGE-MSGV2
            MSGV3 = I_BDCMESSAGE-MSGV3
            MSGV4 = I_BDCMESSAGE-MSGV4
       IMPORTING
            MESSG = MESSAGE.

  WRITE: / MESSAGE-MSGTX.
ENDLOOP.

In this way u should see all message genearted by BDC

Max

Read only

former_member491305
Active Contributor
0 Likes
1,003

Hi,

One of the good to way to check the BDC code is to run the program in Error only(E) mode.In this mode, if you wrote the program perfectly,then there should not be any pop up while uploading the document.If the pop up comes and ask you to press enter to complete the posting, then your BDC ok code is not handled properly.

While making a Recording for FI document posting:After you enter Posting key for the next line item,then dont press "enter" ,instead click the 'Next' line item button in Menu bar.This will be more clear in what the system doing.In some case what will happen,If you just press 'Enter' to go to the next line item is there might be some pop-up will come for "Additional Data" for current line item.In this case the program will not run successfully in BaCKGROUND MODE.

Regards,

Vigneswaran S

Read only

0 Likes
1,003

Thanks all....solved

Read only

vsubbakrishna
Participant
0 Likes
1,003

solved on own.