Skip to Content
author's profile photo
Former Member

bdc

please give list of sample bdc program

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

8 Answers

  • Best Answer
    author's profile photo
    Former Member
    Posted on Mar 30, 2007 at 11:52 AM

    hi Manoj,

    Please click the below link to see a list of

    sample codes for BDCs.

    List" target="_blank">http://www.sap-img.com/bdc.htm">List of BDC sample codes

    Also, see the below program...a very simple one to understand the flow..

    *&---------------------------------------------------------------------*
    *& Report  ZSJ_BDC_ROOM_CREATE
    *&
    *&---------------------------------------------------------------------*
    *& Batch Data Input to create Room for a building.
    *&---------------------------------------------------------------------*
    
    report  zlso_bdc_room_create no standard page heading.
    
    type-pools:
        slis.
    
    types:
        begin of t_hrvpv6a                   ,
            stext      type hrvpv6a-stext    ,
            short      type hrvpv6a-short    ,
            relobjsrk1 type hrvpv6a-relobjsrk,
            relobjsrk2 type hrvpv6a-relobjsrk,
            kapz1(5)                         ,
            kapz2(5)                         ,
            kapz3(5)                         ,
            build      type hrvpv6a-build    ,
        end of t_hrvpv6a                     .
    data:
        gt_hrvpv6a   type table of t_hrvpv6a     ,
        gs_hrvpv6a   type          t_hrvpv6a     ,
        gt_errorlist type table of t_hrvpv6a     ,
        gs_layout    type slis_layout_alv        ,
        gv_integ     type i                      ,
        gv_filename  type string                 ,
        gt_alsmex    type table of alsmex_tabline,
        gs_alsmex    type          alsmex_tabline,
        gv_title     type sy-title               ,
        nodata       value   '/'                 .
    
    data:
         gt_messtab type table of bdcmsgcoll,
         gt_bdcdata type table of bdcdata   ,
         gs_bdcdata type          bdcdata   .
    
    constants:
        gc_x value 'X',
        gc_pvg1(4) value 'PVG1',
        gc_a       value 'A'   .
    
    selection-screen begin of block b1 with frame title text-001.
    parameters:
        p_file type rlgrap-filename                             .
    selection-screen end of block b1                            .
    
    at selection-screen on value-request for p_file.
        call function 'WS_FILENAME_GET'
        exporting
            def_filename     = ''
            def_path         = ''
            mask             = ',*.xls.'
            mode             = 'O'
            title            = 'Select upload file'
        importing
            filename         = p_file
        exceptions
            inv_winsys       = 1
            no_batch         = 2
            selection_cancel = 3
            selection_error  = 4
            others           = 5.
    
    at selection-screen.
        if p_file is initial.
            message i000(00) with 'Invalid File'.
            exit.
        else.
    *  ***** check if file is existing and not empty
            call function 'GUI_GET_FILE_INFO'
            exporting
                fname          = p_file
            importing
                file_size      = gv_integ
            exceptions
                fileinfo_error = 1
                others         = 2.
            if sy-subrc ne 0 or gv_integ le 0.
                message i000(00) with 'Invalid file'.
                exit.
            else.
                gv_filename = p_file.
            endif.
        endif.
    
    start-of-selection.
    " upload function module
        call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'
        exporting
            filename                      = p_file
            i_begin_col                   = '1'
            i_begin_row                   = '2'
            i_end_col                     = '8'
            i_end_row                     = '9999'
        tables
            intern                        = gt_alsmex
        exceptions
            inconsistent_parameters       = 1
            upload_ole                    = 2
            others                        = 3            .
        if sy-subrc <> 0.
            message i000(00) with 'Invalid file'.
            leave program.
        endif.            .
        sort gt_alsmex by row.
        clear gv_integ.
        describe table gt_alsmex lines gv_integ.
        check not gv_integ is initial.
        read table gt_alsmex into gs_alsmex index gv_integ.
        gv_integ = gs_alsmex-row.
        data:
            lv_rowno(4) type n.
    "   convert the linear data to tabular data
        do gv_integ times.
            lv_rowno = lv_rowno + 1.
            loop at gt_alsmex into gs_alsmex where row = lv_rowno .
                case gs_alsmex-col.
                    when '0001'.
                        gs_hrvpv6a-short      = gs_alsmex-value.
                    when '0002'.
                        gs_hrvpv6a-stext      = gs_alsmex-value.
                    when '0003'.
                        gs_hrvpv6a-relobjsrk1 = gs_alsmex-value.
                    when '0004'.
                        gs_hrvpv6a-relobjsrk2 = gs_alsmex-value.
                    when '0005'.
                        gs_hrvpv6a-kapz1      = gs_alsmex-value.
                    when '0006'.
                        gs_hrvpv6a-kapz2      = gs_alsmex-value.
                    when '0007'.
                       gs_hrvpv6a-kapz3      = gs_alsmex-value.
                    when '0008'.
                         gs_hrvpv6a-build      = gs_alsmex-value.
                endcase.
            endloop.
            append gs_hrvpv6a to gt_hrvpv6a.
            clear gs_hrvpv6a.
        enddo.
    
    end-of-selection.
        loop at gt_hrvpv6a into gs_hrvpv6a.
            perform bdc_dynpro      using 'SAPLRHV6'               '2900'.
            perform bdc_field       using 'HRVPV6A-SRKBEGDA'       '01.10.2006'.
            perform bdc_field       using 'HRVPV6A-GENERSRK'       ''.
            perform bdc_field       using 'HRVPV6A-ISTAT'          '1'.
            perform bdc_field       using 'BDC_OKCODE'             '=INSE'.
    
            perform bdc_dynpro      using 'SAPLRHV6'               '6100'.
            perform bdc_field       using 'HRVPV6A-STEXT'          gs_hrvpv6a-stext.
            perform bdc_field       using 'HRVPV6A-SHORT'          gs_hrvpv6a-short.
            perform bdc_field       using 'HRVPV6A-RELOBJSRK(01)'  gs_hrvpv6a-relobjsrk1.
            perform bdc_field       using 'HRVPV6A-RELOBJSRK(02)'  gs_hrvpv6a-relobjsrk2.
            perform bdc_field       using 'HRVPV6A-KAPZ1'          gs_hrvpv6a-kapz1.
            perform bdc_field       using 'HRVPV6A-KAPZ2'          gs_hrvpv6a-kapz2.
            perform bdc_field       using 'HRVPV6A-KAPZ3'          gs_hrvpv6a-kapz3.
            perform bdc_field       using 'BDC_CURSOR'             'HRVPV6A-BUILD'.
            perform bdc_field       using 'HRVPV6A-BUILD'          gs_hrvpv6a-build.
            perform bdc_field       using 'BDC_OKCODE'             '=SAVE'.
            call transaction gc_pvg1 using  gt_bdcdata
                                     mode   gc_a
                                     update gc_a
                                     messages into gt_messtab.
            clear   gt_bdcdata.
        endloop.
    
        check not gt_messtab is initial.
        gs_layout-colwidth_optimize = gc_x.
        gv_title = 'BDC Error Log'.
        call function 'REUSE_ALV_GRID_DISPLAY'
        exporting
            I_GRID_TITLE        = gv_title
            i_structure_name    = 'BDCMSGCOLL'
            is_layout           = gs_layout
        tables
            t_outtab            = gt_messtab
        exceptions
            program_error       = 1
            others              = 2         .
        if sy-subrc <> 0.
        endif.
    
    *----------------------------------------------------------------------*
    *        Start new screen                                              *
    *----------------------------------------------------------------------*
    form bdc_dynpro using program dynpro.
        clear gs_bdcdata.
        gs_bdcdata-program  = program.
        gs_bdcdata-dynpro   = dynpro.
        gs_bdcdata-dynbegin = 'X'.
        append gs_bdcdata to gt_bdcdata.
    endform.
    *----------------------------------------------------------------------*
    *        Insert field                                                  *
    *----------------------------------------------------------------------*
    form bdc_field using fnam fval.
        if fval <> nodata.
            clear gs_bdcdata.
            gs_bdcdata-fnam = fnam.
            gs_bdcdata-fval = fval.
            append gs_bdcdata to gt_bdcdata.
        endif.
    endform.
    

    Hope this helps,

    Sajan Joseph.

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Mar 30, 2007 at 11:54 AM

    chk this

    bdc

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Mar 30, 2007 at 12:02 PM

    Hi Manoj,

    Check this link for sample bdc program

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

    Check this link for bdc with table control program

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

    Check this weblog for steb by step process to crate simple BDC Program as a template

    /people/milind.upasani/blog/2007/03/07/step-by-step-approach-to-ceate-simple-bdc-session-program-using-reusable-template

    Thanks,

    Vinay

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Mar 30, 2007 at 12:14 PM

    BDC is Batch Data Communication where data is transferred from legacy system to SAP system. Different methods of BDC are

    1. Call Transaction Method.

    2. Session Method

    3. Direct Input method.

    In all the above methods you have to prepare a flat file containing the data in the required format to be uploaded to the SAP system. You need to call the function ' UPLOAD' to do this. Then the contents of the flat file have to copied to your internal table and then u need to call the transaction through which you want to update the database. You internal table should also have the information relating to the structure BDCDATA which is having the details like the module pool program name, screen no. The basic concept of updating the database is same in all the 3 methods but only the method differs.

    In session method after the data transfer program is coded, in order to process that particular session you have to go to TC: SM 35 to process the session.

    Direct input method have some standard programs that have to executed.....

    Well, to be strong you got to try it out.......and check if it works!!!

    And for more details see the links:

    /people/milind.upasani/blog/2007/03/07/step-by-step-approach-to-ceate-simple-bdc-session-program-using-reusable-template

    www.sap-img.com/abap/question-about-bdc-program.htm

    https://wiki.sdn.sap.com/wiki/display/HOME/BDC

    https://wiki.sdn.sap.com/wiki/display/HOME/DataTransfers-LSMW,ALE,+BDC

    http://help.sap.com/saphelp_erp2005/helpdata/en/fa/097119543b11d1898e0000e8322d00/frameset.htm

    http://myweb.dal.ca/hchinni/sap/bdc_home.htm

    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/bdc&

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

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

    http://www.sap-img.com/abap/difference-between-batch-input-and-call-transaction-in-bdc.htm

    http://help.sap.com/saphelp_47x200/helpdata/en/69/c250684ba111d189750000e8322d00/frameset.htm

    http://www.sapbrain.com/TUTORIALS/TECHNICAL/BDC_tutorial.html

    mm01

    bdc-mm01

    bdc-for-material-master

    change-material-master-throu-bdc

    For BDC:

    http://myweb.dal.ca/hchinni/sap/bdc_home.htm

    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/bdc&

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

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

    http://www.sap-img.com/abap/difference-between-batch-input-and-call-transaction-in-bdc.htm

    http://help.sap.com/saphelp_47x200/helpdata/en/69/c250684ba111d189750000e8322d00/frameset.htm

    http://www.sapbrain.com/TUTORIALS/TECHNICAL/BDC_tutorial.html

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Mar 30, 2007 at 05:26 PM
  • author's profile photo
    Former Member
    Posted on Mar 30, 2007 at 09:35 PM

    The following single link should give you a good idea about BDC:

    bdc

    Regards

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Aug 20, 2007 at 12:47 PM

    hiii

    given are the standard Interface programs

    RFBIKR00- batch input for vendor master

    RFBIBLG0 - Generating Report: Batch Input for Documents

    RFBIDEG0- Generating Report: Batch Input for Customer Master Data

    RFBIDE00-Batch Input Interface for Customers

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Aug 20, 2007 at 01:34 PM

    <b>sample call transaction</b>

    &----


    *& Report ZRKCALLTRANS *

    *& *

    &----


    *& *

    *& *

    &----


    REPORT ZRKCALLTRANS.

    TABLES:MARA,MAKT.

    DATA:BEGIN OF ITAB OCCURS 0,

    MATNR LIKE MARA-MATNR,

    MBRSH LIKE MARA-MBRSH,

    MTART LIKE MARA-MTART,

    MAKTX LIKE MAKT-MAKTX,

    MEINS LIKE MARA-MEINS,

    MATKL LIKE MARA-MATKL,

    END OF ITAB.

    CALL FUNCTION 'WS_UPLOAD'

    EXPORTING

    FILENAME = 'd:\bdc1.TXT '

    FILETYPE = 'ASC'

    TABLES

    DATA_TAB = ITAB.

    .

    DATA : BDCDATA1 LIKE BDCDATA OCCURS 0 WITH HEADER LINE.

    LOOP AT ITAB.

    REFRESH BDCDATA1.

    *SCREEN 1

    BDCDATA1-PROGRAM = 'SAPLMGMM'.

    BDCDATA1-DYNPRO = '60'.

    BDCDATA1-DYNBEGIN = 'X'.

    APPEND BDCDATA1.

    CLEAR BDCDATA1.

    • FIELD1:MATNR MATERIAL NUMBER

    BDCDATA1-FNAM = 'RMMG1-MATNR'.

    BDCDATA1-FVAL = ITAB-MATNR.

    APPEND BDCDATA1.

    CLEAR BDCDATA1.

    • FIELD2:MBRSH INDUSTRY SECTOR

    BDCDATA1-FNAM = 'RMMG1-MBRSH'.

    BDCDATA1-FVAL = ITAB-MBRSH.

    APPEND BDCDATA1.

    CLEAR BDCDATA1.

    • FIELD3:MTAR1 MATERIAL TYPE

    BDCDATA1-FNAM = 'RMMG1-MTART'.

    BDCDATA1-FVAL = ITAB-MTART.

    APPEND BDCDATA1.

    CLEAR BDCDATA1.

    • CLICKING RIGHT BUTTON

    BDCDATA1-FNAM = 'BDC_OKCODE'.

    BDCDATA1-FVAL = '/00'.

    APPEND BDCDATA1.

    CLEAR BDCDATA1.

    • SCREEN 2

    BDCDATA1-PROGRAM = 'SAPLMGMM'.

    BDCDATA1-DYNPRO = '0070'.

    BDCDATA1-DYNBEGIN = 'X'.

    APPEND BDCDATA1.

    CLEAR BDCDATA1.

    • SELECTING AND CLICKING BASICDATA1

    BDCDATA1-FNAM = 'MSICHTAUSW-KZSEL(01)'.

    BDCDATA1-FVAL = 'X'.

    APPEND BDCDATA1.

    CLEAR bdcdata1.

    • CLICKING ENTER BUTTON

    BDCDATA1-FNAM = 'BDC_OKCODE'.

    BDCDATA1-FVAL = '=ENTR'.

    APPEND BDCDATA1.

    CLEAR BDCDATA1.

    • SCREEN 3

    BDCDATA1-PROGRAM = 'SAPLMGMM'.

    BDCDATA1-DYNBEGIN = '4004'.

    BDCDATA1-DYNBEGIN = 'X'.

    APPEND BDCDATA1.

    CLEAR BDCDATA1.

    • ENTERING MATERIAL DESCRIPTION =COCOCOLA

    BDCDATA1-FNAM = 'MAKT-MAKTX'.

    BDCDATA1-FVAL = ITAB-MAKTX.

    APPEND BDCDATA1.

    CLEAR BDCDATA1.

    • ENTERING BASIC UNIT OF MEASURE = BT

    BDCDATA1-FNAM = 'MARA-MEINS'.

    BDCDATA1-FVAL = ITAB-MEINS.

    APPEND BDCDATA1.

    CLEAR BDCDATA1.

    • ENTERING MATERIAL GROUP = 02004

    BDCDATA1-FNAM = 'MARA-MATKL'.

    BDCDATA1-FVAL = ITAB-MATKL.

    APPEND BDCDATA1.

    CLEAR BDCDATA1.

    • CLICKING SAVE BUTTON

    BDCDATA1-FNAM = 'BDC_OKCODE'.

    BDCDATA1-FVAL = '=BU'.

    APPEND BDCDATA1.

    CLEAR BDCDATA1.

    CALL TRANSACTION 'MM01' USING BDCDATA1 MODE 'A' UPDATE 'A'.

    ENDLOOP.

    <b>sample session method</b>

    &----


    *& Report ZSAG_BS *

    *& *

    &----


    *& *

    *& *

    &----


    REPORT ZSAG_BS .

    ********TABLES

    TABLES : MARA,MAKT .

    *******INTERNAL TABLE

    DATA : BEGIN OF ITAB OCCURS 0 ,

    MATNR LIKE MARA-MATNR,

    MBRSH LIKE MARA-MBRSH,

    MTART LIKE MARA-MTART ,

    MAKTX LIKE MAKT-MAKTX,

    MEINS LIKE MARA-MEINS ,

    END OF ITAB.

    DATA : BDCTAB LIKE BDCDATA OCCURS 0 WITH HEADER LINE .

    ********WS_UPLOAD

    CALL FUNCTION 'WS_UPLOAD'

    EXPORTING

    FILENAME = 'C:\DAT1.TXT'

    FILETYPE = 'DAT'

    TABLES

    DATA_TAB = ITAB .

    ****************BDC_OPEN_GROUP

    CALL FUNCTION 'BDC_OPEN_GROUP'

    EXPORTING

    CLIENT = SY-MANDT

    GROUP = 'CHANDU'

    KEEP = 'X'

    USER = SY-UNAME

    PROG = SY-CPROG .

    LOOP AT ITAB .

    REFRESH BDCTAB .

    *********FIRST SCREEN

    BDCTAB-PROGRAM = 'SAPLMGMM'.

    BDCTAB-DYNPRO = '0060'.

    BDCTAB-DYNBEGIN = 'X' .

    APPEND BDCTAB .

    CLEAR BDCTAB.

    BDCTAB-FNAM = 'RMMG1-MATNR' .

    BDCTAB-FVAL = ITAB-MATNR .

    APPEND BDCTAB .

    CLEAR BDCTAB.

    BDCTAB-FNAM = 'RMMG1-MBRSH' .

    BDCTAB-FVAL = ITAB-MBRSH .

    APPEND BDCTAB .

    CLEAR BDCTAB.

    BDCTAB-FNAM = 'RMMG1-MTART' .

    BDCTAB-FVAL = ITAB-MTART .

    APPEND BDCTAB .

    CLEAR BDCTAB.

    BDCTAB-FNAM = 'BDC_OKCODE'.

    BDCTAB-FVAL = '=AUSW' .

    APPEND BDCTAB .

    CLEAR BDCTAB.

    ********SECOND SCREEN

    BDCTAB-PROGRAM = 'SAPLMGMM'.

    BDCTAB-DYNPRO = '0070'.

    BDCTAB-DYNBEGIN = 'X' .

    APPEND BDCTAB .

    CLEAR BDCTAB.

    BDCTAB-FNAM = 'MSICHTAUSW-KZSEL(01)' .

    BDCTAB-FVAL = 'X' .

    APPEND BDCTAB .

    CLEAR BDCTAB.

    BDCTAB-FNAM = 'BDC_OKCODE'.

    BDCTAB-FVAL = '=ENTR' .

    APPEND BDCTAB .

    CLEAR BDCTAB.

    ***************THIRD SCREEN

    BDCTAB-PROGRAM = 'SAPLMGMM'.

    BDCTAB-DYNPRO = '4004'.

    BDCTAB-DYNBEGIN = 'X' .

    APPEND BDCTAB .

    CLEAR BDCTAB.

    BDCTAB-FNAM = 'MAKT-MAKTX' .

    BDCTAB-FVAL = ITAB-MAKTX.

    APPEND BDCTAB .

    CLEAR BDCTAB.

    BDCTAB-FNAM = 'MARA-MEINS'.

    BDCTAB-FVAL = ITAB-MEINS .

    APPEND BDCTAB .

    CLEAR BDCTAB.

    BDCTAB-FNAM = 'BDC_OKCODE'.

    BDCTAB-FVAL = '=BU' .

    APPEND BDCTAB .

    CLEAR BDCTAB.

    CALL FUNCTION 'BDC_INSERT'

    EXPORTING

    TCODE = 'MM01'

    TABLES

    DYNPROTAB = BDCTAB .

    ENDLOOP .

    CALL FUNCTION 'BDC_CLOSE_GROUP' .

    <b>sample code with both methods in same program</b>

    DATA : BEGIN OF ITAB OCCURS 0,

    EMPID LIKE ZNNR-EMPID,

    EMPNAME LIKE ZNNR-EMPNAME,

    EMPADR LIKE ZNNR-EMPADR,

    END OF ITAB.

    DATA : BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.

    CALL FUNCTION 'GUI_UPLOAD'

    EXPORTING

    FILENAME = 'C:\NARESH\NARESH.TXT'

    • FILETYPE = 'ASC'

    HAS_FIELD_SEPARATOR = 'X'

    • HEADER_LENGTH = 0

    • READ_BY_LINE = 'X'

    • DAT_MODE = ' '

    • CODEPAGE = ' '

    • IGNORE_CERR = ABAP_TRUE

    • REPLACEMENT = '#'

    • CHECK_BOM = ' '

    • VIRUS_SCAN_PROFILE =

    • NO_AUTH_CHECK = ' '

    • IMPORTING

    • FILELENGTH =

    • HEADER =

    TABLES

    DATA_TAB = ITAB

    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.

    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

    ENDIF.

    CALL FUNCTION 'BDC_OPEN_GROUP'

    EXPORTING

    CLIENT = SY-MANDT

    • DEST = FILLER8

    GROUP = 'NARESH'

    • HOLDDATE = FILLER8

    KEEP = 'X'

    USER = SY-UNAME

    • RECORD = FILLER1

    • PROG = SY-CPROG

    • IMPORTING

    • QID =

    EXCEPTIONS

    CLIENT_INVALID = 1

    DESTINATION_INVALID = 2

    GROUP_INVALID = 3

    GROUP_IS_LOCKED = 4

    HOLDDATE_INVALID = 5

    INTERNAL_ERROR = 6

    QUEUE_ERROR = 7

    RUNNING = 8

    SYSTEM_LOCK_ERROR = 9

    USER_INVALID = 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.

    LOOP AT ITAB.

    REFRESH BDCDATA.

    PERFORM BDC_DYNPRO USING 'ZNNR_MODULE' '0100'.

    PERFORM BDC_FIELD USING 'BDC_CURSOR'

    'ZNNR-EMPADR'.

    PERFORM BDC_FIELD USING 'BDC_OKCODE'

    '=CRT'.

    PERFORM BDC_FIELD USING 'ZNNR-EMPID'

    ITAB-EMPID.

    PERFORM BDC_FIELD USING 'ZNNR-EMPNAME'

    ITAB-EMPNAME.

    PERFORM BDC_FIELD USING 'ZNNR-EMPADR'

    ITAB-EMPADR.

    • PERFORM BDC_TRANSACTION USING 'ZNNC'.

    CALL FUNCTION 'BDC_INSERT'

    EXPORTING

    TCODE = 'ZNNC'

    • POST_LOCAL = NOVBLOCAL

    • PRINTING = NOPRINT

    • SIMUBATCH = ' '

    • CTUPARAMS = ' '

    TABLES

    DYNPROTAB = BDCDATA

    EXCEPTIONS

    INTERNAL_ERROR = 1

    NOT_OPEN = 2

    QUEUE_ERROR = 3

    TCODE_INVALID = 4

    PRINTING_INVALID = 5

    POSTING_INVALID = 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.

    ENDLOOP.

    CALL FUNCTION 'BDC_CLOSE_GROUP'

    EXCEPTIONS

    NOT_OPEN = 1

    QUEUE_ERROR = 2

    OTHERS = 3

    .

    IF SY-SUBRC <> 0.

    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

    ENDIF.

    WRITE :/ 'SESSION CREATED SUCCESSFULLY'.

    FORM BDC_DYNPRO USING PROGRAM DYNPRO.

    CLEAR BDCDATA.

    BDCDATA-PROGRAM = PROGRAM.

    BDCDATA-DYNPRO = DYNPRO.

    BDCDATA-DYNBEGIN = 'X'.

    APPEND BDCDATA.

    ENDFORM.

    FORM BDC_FIELD USING FNAM FVAL.

    • IF FVAL <> NODATA.

    CLEAR BDCDATA.

    BDCDATA-FNAM = FNAM.

    BDCDATA-FVAL = FVAL.

    APPEND BDCDATA.

    • ENDIF.

    ENDFORM.

    regards,

    srinivas

    <b>*reward for useful answers*</b>

    Add comment
    10|10000 characters needed characters exceeded