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

How To Create BDC

Former Member
0 Likes
1,594

Plz guide me how to create BDC Program.what are the steps i follow for creating BDC program.

Plz guide me how to create BDC Program.what are the steps i follow for creating BDC program.

7 REPLIES 7
Read only

Former Member
Read only

Former Member
0 Likes
1,164

Hi Rakesh,

First you use the transaction code SHDB to record your transaction. You can then generate the program code from this transaction.

The below links will give you more detail idea:

http://www.sapdevelopment.co.uk/bdc/bdchome.htm

http://www.sap-img.com/abap/learning-bdc-programming.htm

http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm

Thanks

Read only

Former Member
0 Likes
1,164

Hi

You will get so many links in sdn ..search for it.

Iam pasting sample code i got from here.

REPORT ZMM_BDC_CONFIRMATION_UPLOAD

NO STANDARD page heading

message-id ZV.

include bdcrecx1.

TABLES: EKPO,EKES.

data : begin of t_itab occurs 0,

ebeln like ekko-ebeln,

ebelp like ekpo-ebelp,

bstae like ekpo-bstae,

ebtyp like ekes-ebtyp ,

eindt(10),

menge like ekes-menge,

xblnr like ekes-xblnr,

end of t_itab.

DATA: BEGIN OF record,

ebeln type ebeln,

ebelp type ebelp,

END OF record.

      • creating an internal table containg the Items***

DATA : t_tab LIKE record OCCURS 0 WITH HEADER LINE.

PARAMETER : filename LIKE rlgrap-filename OBLIGATORY.

***declaring temporary variables

DATA :

v_cnt(2) TYPE n,

v_bst(2) TYPE n,

v_bn type i,

v_bstpo(25),

v_ebtyp(25),

v_menge(25),

v_eeind(25),

v_xblnr(25),

v_xblnr1(25),

v_ebelp(2) type n,

v_ebelpt(2),

v_menge1(11),

v_ebt type i,

v_vebtyp like ekes-ebtyp,

V_EB(2) TYPE N,

v_tcselflag(40),

v_tem(2) type n,

v_file type string.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR filename.

CALL FUNCTION 'KD_GET_FILENAME_ON_F4'

EXPORTING

field_name = filename

CHANGING

file_name = filename.

START-OF-SELECTION.

v_file = filename.

***uploading from flat file into internal table

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = v_file

filetype = 'ASC'

has_field_separator = 'X'

  • HEADER_LENGTH = 0

  • READ_BY_LINE = 'X'

  • DAT_MODE = ' '

  • CODEPAGE = ' '

  • IGNORE_CERR = ABAP_TRUE

  • REPLACEMENT = '#'

  • IMPORTING

  • FILELENGTH =

  • HEADER =

TABLES

data_tab = t_itab.

loop at t_itab.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

INPUT = t_itab-ebeln

IMPORTING

OUTPUT = t_itab-ebeln

.

modify t_itab.

clear t_itab.

endloop.

      • checking the item numbers in the flat file.

loop at t_itab.

select ebeln ebelp from ekpo into table t_tab

where ebeln = t_itab-ebeln.

endloop.

IF t_tab[] is not initial.

perform open_group.

***looping at purchase order level.

LOOP at t_itab.

clear v_bn.

clear v_ebt.

perform bdc_dynpro using 'SAPMM06E' '0105'.

perform bdc_field using 'BDC_CURSOR'

'RM06E-BSTNR'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'RM06E-BSTNR'

t_itab-ebeln.

**Changing alphanumeric fields and quantity fields to character type**

v_ebelp = t_itab-ebelp.

clear v_ebelpt.

v_menge1 = t_itab-menge.

v_ebelpt = v_ebelp.

**End Of Changing**

**Checking for the exact number of the item**

loop at t_tab where ebeln = t_itab-ebeln.

if t_tab-ebelp = t_itab-ebelp.

exit.

else.

v_bn = v_bn + 1.

endif.

endloop.

v_bst = v_bn + 1.

**End Of Checking**

**Mapping items**

v_tem = 1.

CONCATENATE 'RM06E-BSTPO(' v_bst ')' INTO v_bstpo.

CONCATENATE 'RM06E-TCSELFLAG(' v_tem ')' INTO v_tcselflag.

perform bdc_dynpro using 'SAPMM06E' '0120'.

perform bdc_field using 'BDC_CURSOR'

v_bstpo.

perform bdc_field using 'BDC_OKCODE'

'=DETA'.

perform bdc_field using 'RM06E-EBELP'

v_ebelpt.

perform bdc_dynpro using 'SAPMM06E' '0111'.

perform bdc_field using 'BDC_CURSOR'

'EKPO-BSTAE'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_dynpro using 'SAPMM06E' '0120'.

perform bdc_field using 'BDC_CURSOR'

v_bstpo.

perform bdc_field using 'BDC_OKCODE'

'=BSTA'.

perform bdc_field using 'RM06E-EBELP'

v_ebelpt.

perform bdc_field using v_tcselflag

'X'.

**Checking weather Confirmation category already exists**

select ebtyp from ekes into v_vebtyp where ebelp =

t_itab-ebelp and ebeln = t_itab-ebeln.

endselect.

if sy-dbcnt > 0.

v_ebt = sy-dbcnt.

endif.

V_EB = V_EBT + 1.

**End Of Checking**

**For Line items**

CONCATENATE 'EKES-EBTYP(' v_eb ')' INTO v_ebtyp.

CONCATENATE 'EKES-MENGE(' v_eb ')' INTO v_menge.

CONCATENATE 'RM06E-EEIND(' v_eb ')' INTO v_eeind.

CONCATENATE 'EKES-XBLNR(' v_eb ')' INTO v_xblnr.

**End**

perform bdc_dynpro using 'SAPLEINB' '0200'.

perform bdc_field using 'BDC_CURSOR'

v_xblnr.

perform bdc_field using 'BDC_OKCODE'

'=BU'.

perform bdc_field using v_ebtyp

t_itab-ebtyp.

perform bdc_field using v_eeind

t_itab-eindt.

perform bdc_field using v_menge

v_menge1.

perform bdc_field using v_xblnr

t_itab-xblnr.

**End Of Mappings**

perform bdc_transaction using 'ME22'.

ENDLOOP.

**End Of Purchase Order Loop**

perform close_group.

ELSE.

MESSAGE I083(zv).

ENDIF.

may be it will be useful

Read only

satykumar
Product and Topic Expert
Product and Topic Expert
0 Likes
1,164
Read only

Former Member
0 Likes
1,164

hi

The first step in a BDC session is to identify the screens of the transaction that the program will process. Next step is to write a program to build the BDC table that will be used to submit the data to SAP. The final step is to submit the BDC table to the system in the batch mode or as a single transaction by the CALL TRANSACTION command.

Check out the folloeing link for more details:

http://www.sapbrain.com/FAQs/TECHNICAL/SAP_ABAP_BDC_FAQ.html

-

Santosh

Read only

Former Member
0 Likes
1,164

Hi,

Check the following link.

http://www.sapdevelopment.co.uk/bdc/bdc_recording.htm

Hope this helps.

Reward if helpful.

Regards,

Sipra