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: 

help required BDC

Former Member
0 Kudos
568

Hi All,

I have to make BDC for maintaining customer data in those transaction codes at one go,

XD01

VK11

FD32

JI1D

Can any body suggest me how we can solve that.

8 REPLIES 8

raymond_giuseppi
Active Contributor
0 Kudos
133

- Try LSMW

- Or try SHDB

Regards

0 Kudos
133

yes i am using the SHDB for BDC but how i can insert data in different tcodes at one time like start from XD01 , XK11,FD32 .

Please suggest i did the recording fro tcode XD01 and what is the next step for me.

Your hep will highly valuable for me.

Thanks & Regards

0 Kudos
133

Do the SHDB recording for each transaction one after one. Then in your program build a batch-input session or use CALL TRANSACTION for each transaction in sequence.

If you use an internal range number for Customer, the created Customer number should be stored in MEMORY ID 'KUN' so don't fill this field in the BDCDATA for the subsequent calls. Another solution would be to CALL TRANSACTION 'XD01' receiving MESSAGE back, and look for the success message with contain the New Customer number.

Regards

0 Kudos
133

Hi ,

I created recording for XD01 and program also but when i am executing this BDC program and after that by SM35

when i am runing the session then its giving some error.

just clear these thing to me in BDC.

1. BDC recording sequenceI

2. The sequence of the fields in the .txt file

3. The sequence of internal table fields sequence

all three case the sequence of the fields should be same.

can you tell me what thing i am doing wrong here.

This is the my BDC code blow:

report ZCUST_SNKS01

no standard page heading line-size 255.

PARAMETERS:

group(12) obligatory DEFAULT 'CUST',

user(12) obligatory DEFAULT SY-UNAME,

pmode(1) obligatory default 'A'.

data: session,ctu.

ctu = 'X'.

*----


* Table/Structure declarations. *

*----


TABLES : KNA1,KNVV,KNVP. "Customer master

DATA: BEGIN OF BDCDATA OCCURS 0.

INCLUDE STRUCTURE BDCDATA.

DATA: END OF BDCDATA.

PARAMETER : P_FNAME LIKE RLGRAP-FILENAME

DEFAULT 'C:\BDC\FINISHED.txt'.

**----


**u2022 Variable declarations. *

**----


*

*DATA : V_FNAME(15) VALUE SPACE, " Name of file to be created

*V_FAILREC TYPE I, " No of failed records

*V_MSG(255), " Message Text

*V_ERRREC TYPE I, " No of failed records

*V_LINES TYPE I, " No of records

*V_BANKS(15), " Table column BANKS

*V_BANKL(15), " Table column BANKL

*V_BANKN(15), " Table column BANKN

*V_TIDX(2) TYPE N. " Table row index

*

*

*----


*u2022 Structures / Internal table declarations *

*----


*

*TYPES : BEGIN OF T_BDCTABLE.

  • INCLUDE STRUCTURE BDCDATA.

*TYPES END OF T_BDCTABLE.

** Structure to trap BDC messages

TYPES : BEGIN OF T_MSG.

INCLUDE STRUCTURE BDCMSGCOLL.

TYPES : END OF T_MSG.

*******Structure to trap ERROR messages

TYPES : BEGIN OF T_ERR_MSG,

MESSAGE(255),

END OF T_ERR_MSG.

*--Internal table to store flat file data

DATA: BEGIN OF it_Itab OCCURS 0,

bukrs(4), "Company Code

vkorg(4), "Sales Organization

vtweg(2), "Distribution Channel

spart(2), "Division

ktokd(4), "Customer Account Group

  • zav(1), "checkbox- use central address management

addr1(35), "Name 1

addr2(35), "Name 2

addr3(35), "Name 3

addr4(35), "Name 4

SORT1(20), "Search Term 1

STREET(35), "Street

STR_SUPPL1(40), "Street 2

POST_CODE1(10), "City postal code

CITY1(40), "City

COUNTRY(3), "Country Key

REGION(3), "Region (State, Province, County)

TRANSPZONE(10), "Transportation zone to or from which the goods are delivered

LANGU(2), "Language Key

TEL_NUMBER(30), "First telephone no.: dialling code+number

  • FAX_NUMBER(10), "First fax no.: dialling code+number

SMTP_ADDR(241), "E-Mail Address

kdkg1(2), "Ideal Truck type

BEGRU(4), "Authorization Group

STCDT(2), "Tax Number Type

FITYP(2), "Tax type

COUNC(3), "County Code

CITYC(4), "City Code

  • BANKS(3), "Bank country key

  • BANKL(15), "Bank Key

  • BVTYP(4), "Partner bank type

name1(35), "first name

name1235), "Name 1

AKONT(10), "Reconciliation Account in General Ledger

ZUAWA(3), "Key for sorting according to assignment numbers

BEGRU2(4), "Authorization Group

ZTERM(4), "Terms of payment key

TOGRU(4), "Tolerance group for the business partner/G/L account

ZWELS(10), "List of the Payment Methods to be Considered

  • XAUSZ(1), "Indicator for periodic account statements

bzirk(6), "Sales district

  • awahr(3), "Order probability of the item

vkbur(4), "Marketing Unit

vkgrp(3), "Unit Office

kdgrp(2), "Customer group

waers(5), "Currency

konda(2), "Discount zone

kalks(1), "Pricing procedure assigned to this customer

versg(1), "Customer statistics group

kzazu(1), "Order combination indicator

vwerk(4), "Delivering Plant (Own or External)

  • antlf(1), "Maximum Number of Partial Deliveries Allowed Per Item

uebto(4), "Overdelivery tolerance limit

inco1(3), "Inco Terms

  • zterm2(4),

ktgrd(2), "Account assignment group for this customer

  • parvw(2), "Partner function

ktonr(10), "Number of an SD business partner

kvgr1(3), "CE Territory

kvgr2(3), "Geographical District

kvgr3(3), "Price Zone

kvgr4(3), "Demographic Classification

kvgr5(3), "Size - case wise

AWAHR(3), "Order probability of the item

PLTYP(2), "Price list

LPRIO(2),

VSBED(2), "Shipping conditions

ANTLF(1),

UNTTO(1),

TAXKD_01(1),

TAXKD_02(1),

TAXKD_03(1),

TAXKD(1),

kkber(4), "Credit control area

PARVW(5),

  • check1, "Process data

  • check2, "Process data

  • klimg(20), "Credit limit: Total limit across all control areas

  • klime(20), "Credit limit: Limit for individual control area

  • klimk(20), "Customer's credit limit

  • knkli(10), "Customer's account number with credit limit reference

  • horda(8), "Date of credit horizon

  • ctlpc(5), "Credit management: Risk category

  • sbgrp(3), "Credit representative group for credit management

  • nxtrv(10), "Next internal review

  • tlimit(10), "Transit Limit ( CAS )

  • llimit(10), "LCR LIMIT ( CAS )

END OF it_Itab.

**--Internal table to store bank details

*DATA : BEGIN OF IT_BANK OCCURS 0,

*BANKS LIKE KNBK-BANKS,

*BANKL LIKE KNBK-BANKL,

*BANKN LIKE KNBK-BANKN,

*END OF IT_BANK.

***Internal table to hold BDC data

*include bdcrecx1.

start-of-selection.

PERFORM UP_GEN.

*PERFORM UPLOAD.

perform open_group.

PERFORM FILL_BDCDATA.

perform CLOSE_group.

&----


*& Form FILL_BDCDATA

&----


FORM FILL_BDCDATA.

Loop at it_itab.

perform bdc_dynpro using 'SAPMF02D' '0100'.

perform bdc_field using 'BDC_CURSOR'

'USE_ZAV'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'RF02D-BUKRS'

IT_ITAB-BUKRS.

perform bdc_field using 'RF02D-VKORG'

IT_ITAB-VKORG.

perform bdc_field using 'RF02D-VTWEG'

IT_ITAb-VTWEG.

perform bdc_field using 'RF02D-SPART'

IT_ITAB-SPART.

perform bdc_field using 'RF02D-KTOKD'

IT_ITAB-KTOKD.

perform bdc_field using 'USE_ZAV'

'X'.

perform bdc_dynpro using 'SAPMF02D' '0111'.

perform bdc_field using 'BDC_OKCODE'

'=ZUDA'.

perform bdc_field using 'BDC_CURSOR'

'SZA1_D0100-TEL_NUMBER'.

perform bdc_field using 'ADDR1_DATA-NAME1'

IT_ITAB-NAME1.

perform bdc_field using 'ADDR1_DATA-NAMEv'

IT_ITAB-NAMEv.

perform bdc_field using 'ADDR1_DATA-SORT1'

IT_ITAB-SORT1.

perform bdc_field using 'ADDR1_DATA-STREET'

IT_ITAB-STREET.

perform bdc_field using 'ADDR1_DATA-POST_CODE1'

IT_ITAB-POST_CODE1.

perform bdc_field using 'ADDR1_DATA-COUNTRY'

IT_ITAB-COUNTRY.

perform bdc_field using 'ADDR1_DATA-REGION'

IT_ITAB-REGION.

perform bdc_field using 'ADDR1_DATA-TRANSPZONE'

IT_ITAB-TRANSPZONE.

perform bdc_field using 'ADDR1_DATA-LANGU'

IT_ITAB-LANGU.

perform bdc_field using 'SZA1_D0100-TEL_NUMBER'

IT_ITAB-TEL_NUMBER.

perform bdc_dynpro using 'SAPLV02Z' '0100'.

perform bdc_field using 'BDC_CURSOR'

'KNA1-KDKG1'.

perform bdc_field using 'BDC_OKCODE'

'=BACK'.

perform bdc_field using 'KNA1-KDKG1'

IT_ITAB-KDKG1.

perform bdc_dynpro using 'SAPMF02D' '0111'.

perform bdc_field using 'BDC_OKCODE'

'=VW'.

perform bdc_field using 'BDC_CURSOR'

'ADDR1_DATA-TIME_ZONE'.

perform bdc_field using 'ADDR1_DATA-NAME1'

IT_ITAB-NAME1.

perform bdc_field using 'ADDR1_DATA-NAME2'

IT_ITAB-NAMEv.

perform bdc_field using 'ADDR1_DATA-SORT1'

IT_ITAB-SORT1.

perform bdc_field using 'ADDR1_DATA-STREET'

IT_ITAB-STREET.

perform bdc_field using 'ADDR1_DATA-POST_CODE1'

IT_ITAB-POST_CODE1.

perform bdc_field using 'ADDR1_DATA-COUNTRY'

IT_ITAB-COUNTRY.

perform bdc_field using 'ADDR1_DATA-REGION'

IT_ITAB-REGION.

perform bdc_field using 'ADDR1_DATA-TRANSPZONE'

IT_ITAB-TRANSPZONE.

perform bdc_field using 'ADDR1_DATA-LANGU'

IT_ITAB-LANGU.

perform bdc_field using 'SZA1_D0100-TEL_NUMBER'

IT_ITAB-TEL_NUMBER.

perform bdc_dynpro using 'SAPMF02D' '0120'.

perform bdc_field using 'BDC_CURSOR'

'KNA1-FITYP'.

perform bdc_field using 'BDC_OKCODE'

'=VW'.

perform bdc_field using 'KNA1-BEGRU'

IT_ITAB-BEGRU.

perform bdc_field using 'KNA1-STCDT'

IT_ITAB-STCDT.

perform bdc_field using 'KNA1-FITYP'

IT_ITAB-FITYP.

perform bdc_field using 'KNA1-COUNC'

IT_ITAB-COUNC.

perform bdc_field using 'KNA1-CITYC'

IT_ITAB-CITYC.

perform bdc_dynpro using 'SAPMF02D' '0130'.

perform bdc_field using 'BDC_CURSOR'

'KNBK-BANKS(01)'.

perform bdc_field using 'BDC_OKCODE'

'=VW'.

perform bdc_dynpro using 'SAPMF02D' '0360'.

perform bdc_field using 'BDC_CURSOR'

'KNVK-NAME1(01)'.

perform bdc_field using 'BDC_OKCODE'

'=VW'.

perform bdc_field using 'KNVK-NAMEV(01)'

IT_ITAB-NAMEV.

perform bdc_field using 'KNVK-NAME1(01)'

IT_ITAB-NAME1.

perform bdc_dynpro using 'SAPMF02D' '0210'.

perform bdc_field using 'BDC_CURSOR'

'KNB1-ZUAWA'.

perform bdc_field using 'BDC_OKCODE'

'=VW'.

perform bdc_field using 'KNB1-AKONT'

IT_ITAB-AKONT.

perform bdc_field using 'KNB1-ZUAWA'

IT_ITAB-ZUAWA.

perform bdc_field using 'KNB1-BEGRU'

IT_ITAB-ZUAWA.

perform bdc_dynpro using 'SAPMF02D' '0215'.

perform bdc_field using 'BDC_CURSOR'

'KNB1-ZWELS'.

perform bdc_field using 'BDC_OKCODE'

'=VW'.

perform bdc_field using 'KNB1-ZTERM'

IT_ITAB-ZTERM.

perform bdc_field using 'KNB1-TOGRU'

IT_ITAB-TOGRU.

perform bdc_field using 'KNB1-ZWELS'

IT_ITAB-ZWELS.

perform bdc_dynpro using 'SAPMF02D' '0220'.

perform bdc_field using 'BDC_CURSOR'

'KNB1-XAUSZ'.

perform bdc_field using 'BDC_OKCODE'

'=VW'.

perform bdc_field using 'KNB1-XAUSZ'

'1'.

perform bdc_dynpro using 'SAPMF02D' '0310'.

perform bdc_field using 'BDC_CURSOR'

'KNVV-VERSG'.

perform bdc_field using 'BDC_OKCODE'

'=ZUDA'.

perform bdc_field using 'KNVV-BZIRK'

IT_ITAB-BZIRK.

perform bdc_field using 'KNVV-AWAHR'

IT_ITAB-AWAHR.

perform bdc_field using 'KNVV-VKBUR'

IT_ITAB-VKBUR.

perform bdc_field using 'KNVV-BEGRU'

IT_ITAB-BEGRU.

perform bdc_field using 'KNVV-VKGRP'

IT_ITAB-VKGRP.

perform bdc_field using 'KNVV-KDGRP'

IT_ITAB-KDGRP.

perform bdc_field using 'KNVV-WAERS'

IT_ITAB-WAERS.

perform bdc_field using 'KNVV-KONDA'

IT_ITAB-KONDA.

perform bdc_field using 'KNVV-KALKS'

IT_ITAB-KALKS.

perform bdc_field using 'KNVV-PLTYP'

IT_ITAB-PLTYP.

perform bdc_field using 'KNVV-VERSG'

IT_ITAB-VERSG.

perform bdc_dynpro using 'SAPLV02Z' '0200'.

perform bdc_field using 'BDC_CURSOR'

'KNVV-KVGR5'.

perform bdc_field using 'BDC_OKCODE'

'=BACK'.

perform bdc_field using 'KNVV-KVGR1'

IT_ITAB-KVGR1.

perform bdc_field using 'KNVV-KVGR2'

IT_ITAB-KVGR2.

perform bdc_field using 'KNVV-KVGR3'

IT_ITAB-KVGR3.

perform bdc_field using 'KNVV-KVGR4'

IT_ITAB-KVGR4.

perform bdc_field using 'KNVV-KVGR5'

IT_ITAB-KVGR5.

perform bdc_dynpro using 'SAPMF02D' '0310'.

perform bdc_field using 'BDC_CURSOR'

'KNVV-BZIRK'.

perform bdc_field using 'BDC_OKCODE'

'=VW'.

perform bdc_field using 'KNVV-BZIRK'

IT_ITAB-BZIRK.

perform bdc_field using 'KNVV-AWAHR'

IT_ITAB-AWAHR.

perform bdc_field using 'KNVV-VKBUR'

IT_ITAB-VKBUR.

perform bdc_field using 'KNVV-BEGRU'

IT_ITAB-BEGRU.

perform bdc_field using 'KNVV-VKGRP'

IT_ITAB-VKGRP.

perform bdc_field using 'KNVV-KDGRP'

IT_ITAB-KDGRP.

perform bdc_field using 'KNVV-WAERS'

IT_ITAB-WAERS.

perform bdc_field using 'KNVV-KONDA'

IT_ITAB-KONDA.

perform bdc_field using 'KNVV-KALKS'

IT_ITAB-KALKS.

perform bdc_field using 'KNVV-PLTYP'

IT_ITAB-PLTYP.

perform bdc_field using 'KNVV-VERSG'

IT_ITAB-VERSG.

perform bdc_dynpro using 'SAPMF02D' '0315'.

perform bdc_field using 'BDC_CURSOR'

'KNVV-UEBTO'.

perform bdc_field using 'BDC_OKCODE'

'=VW'.

perform bdc_field using 'KNVV-LPRIO'

IT_ITAB-LPRIO.

perform bdc_field using 'KNVV-KZAZU'

'X'.

perform bdc_field using 'KNVV-VSBED'

IT_ITAB-VSBED.

perform bdc_field using 'KNVV-VWERK'

IT_ITAB-VWERK.

perform bdc_field using 'KNVV-ANTLF'

IT_ITAB-ANTLF.

perform bdc_field using 'KNVV-UNTTO'

IT_ITAB-UNTTO.

perform bdc_field using 'KNVV-UEBTO'

IT_ITAB-UEBTO.

perform bdc_dynpro using 'SAPMF02D' '0320'.

perform bdc_field using 'BDC_CURSOR'

'KNVV-KTGRD'.

perform bdc_field using 'BDC_OKCODE'

'=VW'.

perform bdc_field using 'KNVV-INCO1'

IT_ITAB-INCO1.

perform bdc_field using 'KNVV-ZTERM'

IT_ITAB-ZTERM.

perform bdc_field using 'KNVV-KTGRD'

IT_ITAB-KTGRD.

perform bdc_dynpro using 'SAPMF02D' '1350'.

perform bdc_field using 'BDC_CURSOR'

'KNVI-TAXKD(04)'.

perform bdc_field using 'BDC_OKCODE'

'=VW'.

perform bdc_field using 'KNVI-TAXKD(04)'

IT_ITAB-TAXKD.

perform bdc_dynpro using 'SAPMF02D' '0324'.

perform bdc_field using 'BDC_CURSOR'

'RF02D-KTONR(05)'.

perform bdc_field using 'BDC_OKCODE'

'=VW'.

perform bdc_field using 'KNVP-PARVW(05)'

IT_ITAB-PARVW.

perform bdc_field using 'RF02D-KTONR(05)'

IT_ITAB-KTONR.

perform bdc_transaction using 'XD01'.

  • perform close_group.

endloop.

ENDFORM.

----


  • FORM UP_GEN *

----


  • ........ *

----


FORM UP_GEN.

CALL FUNCTION 'UPLOAD'

EXPORTING

FILENAME = 'C:\FINISHED.TXT'

FILETYPE = 'DAT'

TABLES

DATA_TAB = IT_ITAB.

ENDFORM.

----


  • create batchinput session *

----


----


  • Start new screen *

----


FORM BDC_DYNPRO USING PROGRAM DYNPRO.

CLEAR BDCDATA.

BDCDATA-PROGRAM = PROGRAM.

BDCDATA-DYNPRO = DYNPRO.

BDCDATA-DYNBEGIN = 'X'.

APPEND BDCDATA.

ENDFORM.

----


  • Insert field *

----


FORM BDC_FIELD USING FNAM FVAL.

CLEAR BDCDATA.

BDCDATA-FNAM = FNAM.

BDCDATA-FVAL = FVAL.

APPEND BDCDATA.

ENDFORM.

----


  • create batchinput session *

----


form open_group.

  • open batchinput group

call function 'BDC_OPEN_GROUP'

exporting

client = sy-mandt

group = group

user = user.

endform.

----


  • end batchinput session *

----


form close_group.

  • close batchinput group

call function 'BDC_CLOSE_GROUP'.

endform.

----


  • Start new transaction *

----


form bdc_transaction using tcode.

call function 'BDC_INSERT'

exporting

tcode = tcode

tables

dynprotab = bdcdata.

endform.

&----


*& Form UPLOAD

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM UPLOAD .

call function 'WS_UPLOAD'

exporting

  • CODEPAGE = ' '

filename = P_FNAME

filetype = 'DAT'

  • HEADLEN = ' '

  • LINE_EXIT = ' '

  • TRUNCLEN = ' '

  • USER_FORM = ' '

  • USER_PROG = ' '

  • DAT_D_FORMAT = ' '

  • IMPORTING

  • FILELENGTH =

Tables

data_tab = it_itab

exceptions

conversion_error = 1

file_open_error = 2

file_read_error = 3

invalid_type = 4

no_batch = 5

unknown_error = 6

invalid_table_width = 7

gui_refuse_filetransfer = 8

customer_error = 9

no_authority = 10

others = 11

.

if sy-subrc <> 0.

message id sy-msgid type sy-msgty number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

endif.

endform.

Former Member
0 Kudos
133

Hi,

U need to use session method for this.... first record alll the tocdes which u want ... then use session method ....

u need to call BDC_INSERT FM , how many tcodes u want to update the data ...

Raghunath.S

0 Kudos
133

Hi Thanks for your reply,

I need to create BDC for customer master WITH XD01 where some information will entered in these codes also VK11, J1ID,FD32.

can you suggest me how i can go further.

Thanks

0 Kudos
133

Hi Rashi,

First you need to create BDC for all transacstions seperately with some test data. Once the BDC code is ready with you, you can create a report program where you give the BDC codes in sequence as you need. For example, First u can call XK01 BDC and from that u can pass the vendor number created using XK01 into VK11 and so on.

U can use call transaction method for this.

Hope this solves ur problem.

Regards,

Asif Ali Khan

former_member585060
Active Contributor
0 Kudos
133

Check this links