BDC Steps

42
For creating a bdc. First I’ll explain hw to create a new table bcz this is a just sample bdc Goto T. Code SE11 Give ur table name and click on create button

Transcript of BDC Steps

Page 1: BDC Steps

For creating a bdc. First I’ll explain hw to create a new table bcz this is a just sample bdcGoto T. Code SE11

Give ur table name and click on create button

Page 2: BDC Steps

Give Short Description

Press F4 at Delivery class & select A

Page 3: BDC Steps

Select Display /Maintenance Allowed

Page 4: BDC Steps

Save it and assign a package for instance $tmp

Click on Fields Tab give ur field and data element

Now double click on data element

Page 5: BDC Steps

Click Yes Button to create new data element

Page 6: BDC Steps

Short Text

Give domain name

After entering domain name press enter then a pop-up will come as shown then press enter

Page 7: BDC Steps

Save it

Page 8: BDC Steps

Assign a package

Page 9: BDC Steps

After pressing enter it will asks u to create new domain then press yes for creating new domain

Page 10: BDC Steps

Fill all the necessary values

Page 11: BDC Steps
Page 12: BDC Steps

Save it and activate it

Page 13: BDC Steps

Go back up to your initial table screen

Page 14: BDC Steps

Now Click on Technical Settings or press Ctrl+ Shift +F9

Page 15: BDC Steps

Select APPL0 and 0

Page 16: BDC Steps
Page 17: BDC Steps

now goto Tcode SHDB to create new recording

At least enter a single entry and save it

Page 18: BDC Steps

Press F5 or click on create button

Page 19: BDC Steps

Recording name

Enter Tcode SE11

Press enter or click on start recording

Page 20: BDC Steps

Now u r directed to the following screen

Page 21: BDC Steps

Click on Contents

Here one more thing u have to remember is each and every step u have done will be recorded and at last that will be reflected in your coding also. If u had made any small mistake while recording it will effected while upload also. So be careful

Page 22: BDC Steps

Enter a new name and number and save it

Go back until u get back to recording program lines

Page 23: BDC Steps

Save here and come back to your recording initial screen

Page 24: BDC Steps

Select ur recording

After selecting your recording click on Program button or press Shift + F5

Page 25: BDC Steps

Give ur program name

Select radio button Transfer from recording then press enter

Page 26: BDC Steps

Fill ur attributes and click on Source code

Page 27: BDC Steps
Page 28: BDC Steps

A code will be generated automatically you just have to declare the internal table and all the required fields

Declare ur internal table

data : begin of itab occurs 0, empno like zbdc_sunitha-empno, name like zbdc_sunitha-empname, end of itab.

Page 29: BDC Steps

Call the function upload

Page 30: BDC Steps
Page 31: BDC Steps

Uncomment the wanted lines and fill with necessary information

Page 32: BDC Steps
Page 33: BDC Steps
Page 34: BDC Steps
Page 35: BDC Steps
Page 36: BDC Steps
Page 37: BDC Steps
Page 38: BDC Steps
Page 39: BDC Steps
Page 40: BDC Steps

complete coding part

report ZSUN_BDC no standard page heading line-size 255.

include bdcrecx1.

data : begin of itab occurs 0, empno like zbdc_sunitha-empno, name like zbdc_sunitha-empname, end of itab.

start-of-selection.

CALL FUNCTION 'UPLOAD' EXPORTING* CODEPAGE = ' ' FILENAME = 'C:\TEST.TXT' FILETYPE = 'DAT'* ITEM = ' '* FILEMASK_MASK = ' '* FILEMASK_TEXT = ' '* FILETYPE_NO_CHANGE = ' '* FILEMASK_ALL = ' '* FILETYPE_NO_SHOW = ' '

Like this loop repeats until the data is completed

Page 41: BDC Steps

* LINE_EXIT = ' '* USER_FORM = ' '* USER_PROG = ' '* SILENT = 'S'* IMPORTING* FILESIZE =* CANCEL =* ACT_FILENAME =* ACT_FILETYPE = TABLES DATA_TAB = itab* EXCEPTIONS* CONVERSION_ERROR = 1* INVALID_TABLE_WIDTH = 2* INVALID_TYPE = 3* NO_BATCH = 4* UNKNOWN_ERROR = 5* GUI_REFUSE_FILETRANSFER = 6* OTHERS = 7 . IF SY-SUBRC <> 0.* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF.

perform open_group.

loop at itab.

perform bdc_dynpro using 'SAPMSRD0' '0102'.perform bdc_field using 'BDC_CURSOR' 'RSRD1-TBMA_VAL'.perform bdc_field using 'BDC_OKCODE' '=SHOW'.perform bdc_field using 'RSRD1-TBMA' 'X'.perform bdc_field using 'RSRD1-TBMA_VAL' 'ZBDC_SUNITHA'.perform bdc_dynpro using 'SAPLSD41' '2200'.perform bdc_field using 'BDC_OKCODE' '=TDSH'.perform bdc_field using 'BDC_CURSOR' 'DD03D-ROLLNAME(01)'.perform bdc_dynpro using '/1BCDWB/DBZBDC_SUNITHA' '1000'.perform bdc_field using 'BDC_CURSOR' 'I2-LOW'.perform bdc_field using 'BDC_OKCODE' '=SPOS'.perform bdc_field using 'I1-LOW'* ' 1211'. itab-empno.perform bdc_field using 'I2-LOW'* 'SUNITHA'. itab-name.perform bdc_field using 'LIST_BRE' ' 250'.perform bdc_field using 'MAX_SEL' ' 1,000'.perform bdc_dynpro using 'SAPMSSY0' '0120'.perform bdc_field using 'BDC_OKCODE'

Page 42: BDC Steps

'/ELEAV'.perform bdc_field using 'BDC_CURSOR' '02/42'.perform bdc_dynpro using '/1BCDWB/DBZBDC_SUNITHA' '1000'.perform bdc_field using 'BDC_OKCODE' '/EE'.perform bdc_field using 'BDC_CURSOR' 'I2-LOW'.perform bdc_dynpro using 'SAPLSD41' '2200'.perform bdc_field using 'BDC_OKCODE' '=WB_BACK'.perform bdc_field using 'BDC_CURSOR' 'DD03D-ROLLNAME(01)'.perform bdc_dynpro using 'SAPMSRD0' '0102'.perform bdc_field using 'BDC_CURSOR' 'RSRD1-TBMA_VAL'.perform bdc_field using 'BDC_OKCODE' '=BACK'.perform bdc_field using 'RSRD1-TBMA' 'X'.perform bdc_field using 'RSRD1-TBMA_VAL' 'ZBDC_SUNITHA'.perform bdc_transaction using 'SE11'.

endloop.

perform close_group.