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

Difference between inbound and outbound BDC?

Former Member
0 Likes
1,139

Hi all,

I made a BDC program and I want to know if it is inbound BDC or Outbound? What will I have to do the other...

If you don't want to go through the code below, here is a summary of what the code does:

1) gets a data file from Presentation server, which has the vendor creation data separated by ' '.

2) creates a session using BDC.

So I want to know what should we do to implement the other types of BDC? What about direct input?

*code::::

REPORT zsm_vendor_master_bdc2

NO STANDARD PAGE HEADING LINE-SIZE 255.

INCLUDE bdcrecx1.

*table to store the rows of the data file

DATA : BEGIN OF itab_main OCCURS 0,

row(100) TYPE c,

END OF itab_main.

DATA : BEGIN OF itab_xk01 OCCURS 0,

lifnr(10) TYPE c, "vendor number

bukrs(4) TYPE c, "company code

ekorg(4) TYPE c, "Purchase organization

ktokk(4) TYPE c, "Authorization group

name1(30) TYPE c, "First Name

sort1(10) TYPE c, "search term

country(3) TYPE c, "country

  • SPRAS(2) TYPE C,

akont(6) TYPE c, "Reconciliation Account

fdgrv(2) TYPE c, "cash management group

waers(3) TYPE c, "order currency

END OF itab_xk01.

  • BEGIN OF IT_BANK OCCURS 0,

  • BANKS(3) TYPE C,

  • BANKL(10) TYPE C,

  • BANKN(10) TYPE C,

  • KOINH(30) TYPE C,

  • LIFNR(10) TYPE C,

  • END OF IT_BANK

  • .

DATA: wa_xk01 LIKE itab_xk01.

*----data for BDC and messages

DATA : itab_bdcdata LIKE bdcdata OCCURS 0 WITH HEADER LINE,

itab_bdcmsgcoll LIKE bdcmsgcoll OCCURS 0 WITH HEADER LINE.

START-OF-SELECTION.

*

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = 'c:\bdc_for_xk01_by_sm_pc.txt'

filetype = 'ASC'

has_field_separator = ' '

  • HEADER_LENGTH = 0

  • READ_BY_LINE = 'X'

  • DAT_MODE = ' '

  • CODEPAGE = ' '

  • IGNORE_CERR = ABAP_TRUE

  • REPLACEMENT = '#'

  • CHECK_BOM = ' '

  • IMPORTING

  • FILELENGTH =

  • HEADER =

TABLES

data_tab = itab_main

EXCEPTIONS

file_open_error = 1

file_read_error = 2

no_batch = 3

gui_refuse_filetransfer = 4

invalid_type = 5

no_authority = 6

unknown_error = 7

bad_data_format = 8

header_not_allowed = 9

separator_not_allowed = 10

header_too_long = 11

unknown_dp_error = 12

access_denied = 13

dp_out_of_memory = 14

disk_full = 15

dp_timeout = 16

OTHERS = 17

.

IF sy-subrc <> 0.

WRITE:/ 'no records in the file!!!!!!'.

ENDIF.

LOOP AT itab_main.

*IF itab_main-row+0(2) = '11'.

wa_xk01-lifnr = itab_main-row+0(5).

wa_xk01-bukrs = itab_main-row+6(4).

wa_xk01-ekorg = itab_main-row+11(4).

wa_xk01-ktokk = itab_main-row+16(4).

wa_xk01-name1 = itab_main-row+21(4).

wa_xk01-sort1 = itab_main-row+26(4).

wa_xk01-country = itab_main-row+31(2).

  • wa_xk01-SPRAS = itab_main-row+34(5).

wa_xk01-akont = itab_main-row+34(5).

wa_xk01-fdgrv = itab_main-row+40(2).

wa_xk01-waers = itab_main-row+43(3).

APPEND itab_xk01.

ENDLOOP.

LOOP AT itab_xk01 INTO wa_xk01.

REFRESH itab_bdcdata.

PERFORM open_group.

PERFORM bdc_dynpro USING 'SAPMF02K' '0100'.

PERFORM bdc_field USING 'BDC_CURSOR'

'RF02K-REF_LIFNR'.

PERFORM bdc_field USING 'BDC_OKCODE'

'/00'.

PERFORM bdc_field USING 'RF02K-LIFNR'

wa_xk01-lifnr.

PERFORM bdc_field USING 'RF02K-BUKRS'

wa_xk01-bukrs.

PERFORM bdc_field USING 'RF02K-EKORG'

wa_xk01-ekorg.

PERFORM bdc_field USING 'RF02K-KTOKK'

wa_xk01-ktokk.

PERFORM bdc_dynpro USING 'SAPMF02K' '0110'.

PERFORM bdc_field USING 'BDC_CURSOR'

'RF02K-LIFNR'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=VW'.

PERFORM bdc_field USING 'LFA1-NAME1'

wa_xk01-name1.

PERFORM bdc_field USING 'LFA1-SORTL'

wa_xk01-sort1.

PERFORM bdc_field USING 'LFA1-LAND1'

wa_xk01-country.

PERFORM bdc_dynpro USING 'SAPMF02K' '0120'.

PERFORM bdc_field USING 'BDC_CURSOR'

'LFA1-KUNNR'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=VW'.

PERFORM bdc_dynpro USING 'SAPMF02K' '0130'.

PERFORM bdc_field USING 'BDC_CURSOR'

'LFBK-BANKS(01)'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=VW'.

PERFORM bdc_dynpro USING 'SAPMF02K' '0210'.

PERFORM bdc_field USING 'BDC_CURSOR'

'LFB1-FDGRV'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=VW'.

PERFORM bdc_field USING 'LFB1-AKONT'

wa_xk01-akont.

PERFORM bdc_field USING 'LFB1-FDGRV'

wa_xk01-fdgrv.

PERFORM bdc_dynpro USING 'SAPMF02K' '0215'.

PERFORM bdc_field USING 'BDC_CURSOR'

'LFB1-ZTERM'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=VW'.

PERFORM bdc_dynpro USING 'SAPMF02K' '0220'.

PERFORM bdc_field USING 'BDC_CURSOR'

'LFB5-MAHNA'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=VW'.

PERFORM bdc_dynpro USING 'SAPMF02K' '0310'.

PERFORM bdc_field USING 'BDC_CURSOR'

'LFM1-WAERS'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=VW'.

PERFORM bdc_field USING 'LFM1-WAERS'

wa_xk01-waers.

PERFORM bdc_dynpro USING 'SAPMF02K' '0320'.

PERFORM bdc_field USING 'BDC_CURSOR'

'RF02K-LIFNR'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=VW'.

PERFORM bdc_dynpro USING 'SAPLSPO1' '0300'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=YES'.

PERFORM bdc_transaction USING 'XK01'.

PERFORM close_group.

ENDLOOP.

*----END OF PROGRAM-----

The data file c:\bdc_for_xk01_by_sm_pc.txt I created in Notepad is this:::

22384 1000 0001 0001 aaaa BBBB al 31000 a1 amd

22385 1000 0001 0002 aaab BBBC am 62210 a2 and

22386 1000 0001 0002 aaac BBBD AO 62220 a1 cad

22387 1000 0001 0003 aaad BBBE al 31000 a3 USD

Thanks,

Charles.

++++++++++++++++++++++++++

Hi all,

I made a BDC program and I want to know if it is inbound BDC or Outbound? What will I have to do the other...

If you don't want to go through the code below, here is a summary of what the code does:

1) gets a data file from Presentation server, which has the vendor creation data separated by ' '.

2) creates a session using BDC.

So I want to know what should we do to implement the other types of BDC? What about direct input?

*code::::

REPORT zsm_vendor_master_bdc2

NO STANDARD PAGE HEADING LINE-SIZE 255.

INCLUDE bdcrecx1.

*table to store the rows of the data file

DATA : BEGIN OF itab_main OCCURS 0,

row(100) TYPE c,

END OF itab_main.

DATA : BEGIN OF itab_xk01 OCCURS 0,

lifnr(10) TYPE c, "vendor number

bukrs(4) TYPE c, "company code

ekorg(4) TYPE c, "Purchase organization

ktokk(4) TYPE c, "Authorization group

name1(30) TYPE c, "First Name

sort1(10) TYPE c, "search term

country(3) TYPE c, "country

  • SPRAS(2) TYPE C,

akont(6) TYPE c, "Reconciliation Account

fdgrv(2) TYPE c, "cash management group

waers(3) TYPE c, "order currency

END OF itab_xk01.

  • BEGIN OF IT_BANK OCCURS 0,

  • BANKS(3) TYPE C,

  • BANKL(10) TYPE C,

  • BANKN(10) TYPE C,

  • KOINH(30) TYPE C,

  • LIFNR(10) TYPE C,

  • END OF IT_BANK

  • .

DATA: wa_xk01 LIKE itab_xk01.

*----data for BDC and messages

DATA : itab_bdcdata LIKE bdcdata OCCURS 0 WITH HEADER LINE,

itab_bdcmsgcoll LIKE bdcmsgcoll OCCURS 0 WITH HEADER LINE.

START-OF-SELECTION.

*

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = 'c:\bdc_for_xk01_by_sm_pc.txt'

filetype = 'ASC'

has_field_separator = ' '

  • HEADER_LENGTH = 0

  • READ_BY_LINE = 'X'

  • DAT_MODE = ' '

  • CODEPAGE = ' '

  • IGNORE_CERR = ABAP_TRUE

  • REPLACEMENT = '#'

  • CHECK_BOM = ' '

  • IMPORTING

  • FILELENGTH =

  • HEADER =

TABLES

data_tab = itab_main

EXCEPTIONS

file_open_error = 1

file_read_error = 2

no_batch = 3

gui_refuse_filetransfer = 4

invalid_type = 5

no_authority = 6

unknown_error = 7

bad_data_format = 8

header_not_allowed = 9

separator_not_allowed = 10

header_too_long = 11

unknown_dp_error = 12

access_denied = 13

dp_out_of_memory = 14

disk_full = 15

dp_timeout = 16

OTHERS = 17

.

IF sy-subrc <> 0.

WRITE:/ 'no records in the file!!!!!!'.

ENDIF.

LOOP AT itab_main.

*IF itab_main-row+0(2) = '11'.

wa_xk01-lifnr = itab_main-row+0(5).

wa_xk01-bukrs = itab_main-row+6(4).

wa_xk01-ekorg = itab_main-row+11(4).

wa_xk01-ktokk = itab_main-row+16(4).

wa_xk01-name1 = itab_main-row+21(4).

wa_xk01-sort1 = itab_main-row+26(4).

wa_xk01-country = itab_main-row+31(2).

  • wa_xk01-SPRAS = itab_main-row+34(5).

wa_xk01-akont = itab_main-row+34(5).

wa_xk01-fdgrv = itab_main-row+40(2).

wa_xk01-waers = itab_main-row+43(3).

APPEND itab_xk01.

ENDLOOP.

LOOP AT itab_xk01 INTO wa_xk01.

REFRESH itab_bdcdata.

PERFORM open_group.

PERFORM bdc_dynpro USING 'SAPMF02K' '0100'.

PERFORM bdc_field USING 'BDC_CURSOR'

'RF02K-REF_LIFNR'.

PERFORM bdc_field USING 'BDC_OKCODE'

'/00'.

PERFORM bdc_field USING 'RF02K-LIFNR'

wa_xk01-lifnr.

PERFORM bdc_field USING 'RF02K-BUKRS'

wa_xk01-bukrs.

PERFORM bdc_field USING 'RF02K-EKORG'

wa_xk01-ekorg.

PERFORM bdc_field USING 'RF02K-KTOKK'

wa_xk01-ktokk.

PERFORM bdc_dynpro USING 'SAPMF02K' '0110'.

PERFORM bdc_field USING 'BDC_CURSOR'

'RF02K-LIFNR'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=VW'.

PERFORM bdc_field USING 'LFA1-NAME1'

wa_xk01-name1.

PERFORM bdc_field USING 'LFA1-SORTL'

wa_xk01-sort1.

PERFORM bdc_field USING 'LFA1-LAND1'

wa_xk01-country.

PERFORM bdc_dynpro USING 'SAPMF02K' '0120'.

PERFORM bdc_field USING 'BDC_CURSOR'

'LFA1-KUNNR'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=VW'.

PERFORM bdc_dynpro USING 'SAPMF02K' '0130'.

PERFORM bdc_field USING 'BDC_CURSOR'

'LFBK-BANKS(01)'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=VW'.

PERFORM bdc_dynpro USING 'SAPMF02K' '0210'.

PERFORM bdc_field USING 'BDC_CURSOR'

'LFB1-FDGRV'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=VW'.

PERFORM bdc_field USING 'LFB1-AKONT'

wa_xk01-akont.

PERFORM bdc_field USING 'LFB1-FDGRV'

wa_xk01-fdgrv.

PERFORM bdc_dynpro USING 'SAPMF02K' '0215'.

PERFORM bdc_field USING 'BDC_CURSOR'

'LFB1-ZTERM'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=VW'.

PERFORM bdc_dynpro USING 'SAPMF02K' '0220'.

PERFORM bdc_field USING 'BDC_CURSOR'

'LFB5-MAHNA'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=VW'.

PERFORM bdc_dynpro USING 'SAPMF02K' '0310'.

PERFORM bdc_field USING 'BDC_CURSOR'

'LFM1-WAERS'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=VW'.

PERFORM bdc_field USING 'LFM1-WAERS'

wa_xk01-waers.

PERFORM bdc_dynpro USING 'SAPMF02K' '0320'.

PERFORM bdc_field USING 'BDC_CURSOR'

'RF02K-LIFNR'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=VW'.

PERFORM bdc_dynpro USING 'SAPLSPO1' '0300'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=YES'.

PERFORM bdc_transaction USING 'XK01'.

PERFORM close_group.

ENDLOOP.

*----END OF PROGRAM-----

The data file c:\bdc_for_xk01_by_sm_pc.txt I created in Notepad is this:::

22384 1000 0001 0001 aaaa BBBB al 31000 a1 amd

22385 1000 0001 0002 aaab BBBC am 62210 a2 and

22386 1000 0001 0002 aaac BBBD AO 62220 a1 cad

22387 1000 0001 0003 aaad BBBE al 31000 a3 USD

Thanks,

Charles.

++++++++++++++++++++++++++

4 REPLIES 4
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
823

I have never heard of a BDC referred to as inbound or outbound. I guess all would be inbound as you are taking data from some place whether from external file or data straigth from the SAP Db and doing BDC to put data into the calling system.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
823

Hi Charles,

<b>BDC is always Inbound</b>,

If you are retriving some data from outof SAP and putting it in SAP then it called as Inboud.

If you are retriving data from SAP and thrpughing out of SAP then it is called as Outbound.

so always the BDC is inbound

Regards

Sudheer

Read only

0 Likes
823

> If you are retriving data from SAP and thrpughing out

> of SAP then it is called as Outbound.

> so always the BDC is inbound

>

> Regards

> Sudheer

Then why do say it is always inbound?

Read only

Former Member
0 Likes
823

Hai Brown

Go through the following Document

In ABAP context , interfaces are only of two types.

1) INBOUND interfaces

2)OUTBOUND Interfaces.

INBOUND:(from external system data is fetched as flat files which is moved to SAP database tables).

in this process we get data in the form of flat files(.txt or .xlx). we will read this data from the files using FM like UPLOAD/WS_UPLOAD/GUI_UPLOAD into internal

tables. And using BDC methods or LSMW tool, we will update the database tables with this data.

OUTBOUND:(Data from SAP dtabase is retrieved adn stored as flatfiles on presentaion server or application server)

In this process we retrieve data using select statements from the database tables and will populate the internal tables. based on the requirement, we will use FM like DOWNLOAD/WS_DOWNLAOD/GUI_DOWNLOAD to write data from internal tables to flat files on th presentation server.

*the above mentioned Fm will work for files on presentaion server(local file system) . IF u want to handle files on the application server, use DATASET.

Other technologies that u mentioned like RFC, BAPI, EDI,ALE, IDOCS etc might be used as apart of interface code.

Regards

Sreeni