Skip to Content
author's profile photo Former Member
Former Member

BDC sample programme

hello,

please send me the sample programme of BDC with screen short i am the beginner please help.

do the needful urgently please

thanks

sujatha

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • Posted on Dec 27, 2007 at 05:47 AM

    REPORT Y730_BDC5 .

    *HANDLING TABLE CONTROL IN BDC

    DATA : BEGIN OF IT_DUMMY OCCURS 0,

    DUMMY(100) TYPE C,

    END OF IT_DUMMY.

    DATA : BEGIN OF IT_XK01 OCCURS 0,

    LIFNR(10) TYPE C,

    BUKRS(4) TYPE C,

    EKORG(4) TYPE C,

    KTOKK(4) TYPE C,

    NAME1(30) TYPE C,

    SORTL(10) TYPE C,

    LAND1(3) TYPE C,

    SPRAS(2) TYPE C,

    AKONT(6) TYPE C,

    FDGRV(2) TYPE C,

    WAERS(3) TYPE C,

    END OF IT_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 : IT_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE,

    IT_BDCMSGCOLL LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.

    CALL FUNCTION 'WS_UPLOAD'

    EXPORTING

    FILENAME = 'C:\VENDOR.TXT'

    FILETYPE = 'ASC'

    TABLES

    DATA_TAB = IT_DUMMY.

    LOOP AT IT_DUMMY.

    IF IT_DUMMY-DUMMY+0(2) = '11'.

    IT_XK01-LIFNR = IT_DUMMY-DUMMY+2(10).

    IT_XK01-BUKRS = IT_DUMMY-DUMMY+12(4).

    IT_XK01-EKORG = IT_DUMMY-DUMMY+16(4).

    IT_XK01-KTOKK = IT_DUMMY-DUMMY+20(4).

    IT_XK01-NAME1 = IT_DUMMY-DUMMY+24(30).

    IT_XK01-SORTL = IT_DUMMY-DUMMY+54(10).

    IT_XK01-LAND1 = IT_DUMMY-DUMMY+64(3).

    IT_XK01-SPRAS = IT_DUMMY-DUMMY+67(2).

    IT_XK01-AKONT = IT_DUMMY-DUMMY+69(6).

    IT_XK01-FDGRV = IT_DUMMY-DUMMY+75(2).

    IT_XK01-WAERS = IT_DUMMY-DUMMY+77(3).

    APPEND IT_XK01.

    ELSE.

    IT_BANK-BANKS = IT_DUMMY-DUMMY+2(3).

    IT_BANK-BANKL = IT_DUMMY-DUMMY+5(10).

    IT_BANK-BANKN = IT_DUMMY-DUMMY+15(10).

    IT_BANK-KOINH = IT_DUMMY-DUMMY+25(30).

    IT_BANK-LIFNR = IT_DUMMY-DUMMY+55(10).

    APPEND IT_BANK.

    ENDIF.

    ENDLOOP.

    LOOP AT IT_XK01.

    REFRESH IT_BDCDATA.

    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'

    IT_XK01-LIFNR.

    perform bdc_field using 'RF02K-BUKRS'

    IT_XK01-BUKRS.

    perform bdc_field using 'RF02K-EKORG'

    IT_XK01-EKORG.

    perform bdc_field using 'RF02K-KTOKK'

    IT_XK01-KTOKK.

    perform bdc_dynpro using 'SAPMF02K' '0110'.

    perform bdc_field using 'BDC_CURSOR'

    'LFA1-TELX1'.

    perform bdc_field using 'BDC_OKCODE'

    '/00'.

    perform bdc_field using 'LFA1-NAME1'

    IT_XK01-NAME1.

    perform bdc_field using 'LFA1-SORTL'

    IT_XK01-SORTL.

    perform bdc_field using 'LFA1-LAND1'

    IT_XK01-LAND1.

    perform bdc_field using 'LFA1-SPRAS'

    IT_XK01-SPRAS.

    perform bdc_dynpro using 'SAPMF02K' '0120'.

    perform bdc_field using 'BDC_CURSOR'

    'LFA1-KUNNR'.

    perform bdc_field using 'BDC_OKCODE'

    '/00'.

    perform bdc_dynpro using 'SAPMF02K' '0130'.

    perform bdc_field using 'BDC_CURSOR'

    'LFBK-KOINH(02)'.

    perform bdc_field using 'BDC_OKCODE'

    '=ENTR'.

    DATA : FNAM(20) TYPE C,

    IDX TYPE C.

    MOVE 1 TO IDX.

    LOOP AT IT_BANK WHERE LIFNR = IT_XK01-LIFNR.

    CONCATENATE 'LFBK-BANKS(' IDX ')' INTO FNAM.

    perform bdc_field using FNAM

    IT_BANK-BANKS.

    CONCATENATE 'LFBK-BANKL(' IDX ')' INTO FNAM.

    perform bdc_field using FNAM

    IT_BANK-BANKL.

    CONCATENATE 'LFBK-BANKN(' IDX ')' INTO FNAM.

    perform bdc_field using FNAM

    IT_BANK-BANKN.

    CONCATENATE 'LFBK-KOINH(' IDX ')' INTO FNAM.

    perform bdc_field using FNAM

    IT_BANK-KOINH.

    IDX = IDX + 1.

    ENDLOOP.

    perform bdc_dynpro using 'SAPMF02K' '0130'.

    perform bdc_field using 'BDC_CURSOR'

    'LFBK-BANKS(01)'.

    perform bdc_field using 'BDC_OKCODE'

    '=ENTR'.

    perform bdc_dynpro using 'SAPMF02K' '0210'.

    perform bdc_field using 'BDC_CURSOR'

    'LFB1-FDGRV'.

    perform bdc_field using 'BDC_OKCODE'

    '/00'.

    perform bdc_field using 'LFB1-AKONT'

    IT_XK01-AKONT.

    perform bdc_field using 'LFB1-FDGRV'

    IT_XK01-FDGRV.

    perform bdc_dynpro using 'SAPMF02K' '0215'.

    perform bdc_field using 'BDC_CURSOR'

    'LFB1-ZTERM'.

    perform bdc_field using 'BDC_OKCODE'

    '/00'.

    perform bdc_dynpro using 'SAPMF02K' '0220'.

    perform bdc_field using 'BDC_CURSOR'

    'LFB5-MAHNA'.

    perform bdc_field using 'BDC_OKCODE'

    '/00'.

    perform bdc_dynpro using 'SAPMF02K' '0310'.

    perform bdc_field using 'BDC_CURSOR'

    'LFM1-WAERS'.

    perform bdc_field using 'BDC_OKCODE'

    '/00'.

    perform bdc_field using 'LFM1-WAERS'

    IT_XK01-WAERS.

    perform bdc_dynpro using 'SAPMF02K' '0320'.

    perform bdc_field using 'BDC_CURSOR'

    'WYT3-PARVW(01)'.

    perform bdc_field using 'BDC_OKCODE'

    '=ENTR'.

    perform bdc_dynpro using 'SAPLSPO1' '0300'.

    perform bdc_field using 'BDC_OKCODE'

    '=YES'.

    CALL TRANSACTION 'XK01' USING IT_BDCDATA

    MODE 'A'

    UPDATE 'S'

    MESSAGES INTO IT_BDCMSGCOLL.

    ENDLOOP.

    FORM BDC_DYNPRO USING PROG SCR.

    CLEAR IT_BDCDATA.

    IT_BDCDATA-PROGRAM = PROG.

    IT_BDCDATA-DYNPRO = SCR.

    IT_BDCDATA-DYNBEGIN = 'X'.

    APPEND IT_BDCDATA.

    ENDFORM.

    FORM BDC_FIELD USING FNAM FVAL.

    CLEAR IT_BDCDATA.

    IT_BDCDATA-FNAM = FNAM.

    IT_BDCDATA-FVAL = FVAL.

    APPEND IT_BDCDATA.

    ENDFORM.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 27, 2007 at 05:48 AM

    Hi,

    Check the following links:

    http://sap-img.com/bdc.htm

    http://sap.niraj.tripod.com/id12.html

    Regards,

    Bhaskar

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 27, 2007 at 05:49 AM

    Download Step by Step: How to Create BDC Program

    in http://www.sap-img.com/bdc.htm

    award points if helpful

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 27, 2007 at 05:50 AM

    BDC PROGRAM FOR VA01 (SALES ORDER)

    report Z_SD_BDC_VA01

    no standard page heading line-size 255.

    include zbdcdata.

    include zbdcrec.

    TYPE-POOLS: truxs.

    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.

    PARAMETERS: V_INFILE OBLIGATORY LIKE RLGRAP-FILENAME DEFAULT

    'C:\va01.xls'.

    selection-screen end of block b1.

    parameters:p_auart like vbak-auart obligatory,

    p_vkorg like vbak-vkorg obligatory,

    p_vtweg like vbak-vtweg obligatory,

    p_spart like vbak-spart obligatory.

    data:BEGIN OF I_data OCCURS 0,

    vbeln like vbak-vbeln,

    BSTKD like vbkd-bstkd,

    BSTDK(10),

    soldp like kuwev-kunnr,

    shipp like kuwev-kunnr,

    ketdat(10),

    werks like RV45A-DWERK,

    lgort like vbap-lgort,

    vstel like vbap-vstel,

    prsdt(10),

    inco1 like vbkd-inco1,

    zterm like vbkd-zterm,

    matnr like vbap-matnr,

    kwmeng(10),

    END OF I_data.

    data:v_data TYPE truxs_t_text_data,v_count type i.

    AT SELECTION-SCREEN ON VALUE-REQUEST FOR v_infile.

    CALL FUNCTION 'F4_FILENAME'

    IMPORTING

    file_name = v_infile

    EXCEPTIONS

    OTHERS = 1.

    AT SELECTION-SCREEN.

    start-of-selection.

    TRANSLATE v_infile TO UPPER CASE.

    CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'

    EXPORTING

    i_tab_raw_data = v_data

    i_filename = v_infile

    TABLES

    i_tab_converted_data = i_data.

    loop at i_data.

    on change of i_data-vbeln or i_data-bstkd or i_data-bstdk or i_data-soldp or i_data-shipp or i_data-ketdat

    or i_data-werks or i_data-prsdt or i_data-inco1 or i_data-zterm.

    clear:int_bdcdata,int_bdcdata[].

    perform bdc_dynpro using 'SAPMV45A' '0101'.

    perform bdc_field using 'BDC_CURSOR'

    'VBAK-SPART'.

    perform bdc_field using 'BDC_OKCODE'

    '/00'.

    perform bdc_field using 'VBAK-AUART'

    p_auart.

    perform bdc_field using 'VBAK-VKORG'

    p_vkorg.

    perform bdc_field using 'VBAK-VTWEG'

    p_vtweg.

    perform bdc_field using 'VBAK-SPART'

    p_spart.

    perform bdc_dynpro using 'SAPMV45A' '4001'.

    perform bdc_field using 'BDC_OKCODE'

    '/00'.

    if i_data-vbeln is initial.

    else.perform bdc_field using 'VBAK-VBELN'

    i_data-vbeln. endif.

    perform bdc_field using 'VBKD-BSTKD'

    i_data-bstkd.

    perform bdc_field using 'VBKD-BSTDK'

    i_data-bstdk.

    perform bdc_field using 'KUAGV-KUNNR'

    i_data-soldp.

    perform bdc_field using 'KUWEV-KUNNR'

    i_data-shipp.

    perform bdc_field using 'RV45A-KETDAT'

    i_data-ketdat.

    perform bdc_field using 'RV45A-KPRGBZ'

    'D'.

    perform bdc_field using 'RV45A-DWERK'

    i_data-werks.

    perform bdc_field using 'VBKD-PRSDT'

    i_data-prsdt.

    perform bdc_field using 'VBKD-INCO1'

    i_data-inco1.

    perform bdc_field using 'VBKD-ZTERM'

    i_data-zterm.

    v_count = 1.

    endon.

    perform bdc_field using 'RV45A-MABNR(01)'

    i_data-matnr.

    perform bdc_field using 'RV45A-KWMENG(01)'

    i_data-kwmeng.

    perform bdc_dynpro using 'SAPMV45A' '4001'.

    perform bdc_field using 'BDC_OKCODE'

    '=PDE2'.

    perform bdc_field using 'BDC_CURSOR'

    'VBAP-POSNR(01)'.

    perform bdc_field using 'RV45A-VBAP_SELKZ(01)'

    'X'.

    perform bdc_dynpro using 'SAPMV45A' '4003'.

    perform bdc_field using 'BDC_OKCODE'

    '=T\04'.

    perform bdc_field using 'BDC_CURSOR'

    'VBAP-VSTEL'.

    *perform bdc_field using 'KUWEV-ABLAD'

    • 'PENUGOLANU'.

    perform bdc_field using 'VBAP-WERKS'

    i_data-werks.

    perform bdc_field using 'VBAP-LGORT'

    i_data-lgort.

    perform bdc_field using 'VBAP-VSTEL'

    i_data-vstel.

    *perform bdc_field using 'VBAP-ANTLF'

    • '9'.

    *perform bdc_field using 'VBAP-NTGEW'

    • ' 10.000'.

    *perform bdc_field using 'VBAP-GEWEI'

    • 'TO'.

    *perform bdc_field using 'VBAP-BRGEW'

    • ' 10.000'.

    *perform bdc_field using 'VBAP-VOLUM'

    • ' 200'.

    *perform bdc_field using 'VBAP-VOLEH'

    • 'M3'.

    *perform bdc_field using 'BDC_CURSOR'

    • 'VBAP-TAXM1'.

    *perform bdc_field using 'VBKD-FKDAT'

    • '02.06.2007'.

    *perform bdc_field using 'VBAP-TAXM1'

    • '1'.

    perform bdc_dynpro using 'SAPMV45A' '4003'.

    perform bdc_field using 'BDC_OKCODE'

    '/EBACK'.

    perform bdc_field using 'BDC_CURSOR'

    'RV45A-KWMENG'.

    perform bdc_dynpro using 'SAPMV45A' '4001'.

    perform bdc_field using 'BDC_OKCODE'

    '=SICH'.

    CALL TRANSACTION 'VA01' USING int_bdcdata MODE 'E'.

    endloop.

    Reward Points if useful.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 27, 2007 at 05:56 AM
    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.