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

Can anyone tell me the flow of BDC program?

Hi

Can anyone tell me the flow of BDC program and also what is the significance of each step?

Thanks

Gagan

Add a comment
10|10000 characters needed characters exceeded

Related questions

5 Answers

  • Best Answer
    Posted on Dec 08, 2005 at 07:44 PM

    Not sure what you are asking here. A BDC program is a recording over an SAP transaction. The flow is determined by the screen sequence of the transaction which is being recorded.

    What you do is fill an internal table with screen numbers and fields with values and fcodes. Then call the transaction using the internal table.

    For example, the following program calls PA30 and enters a time event.

    
    report zrich_0001
           no standard page heading.
    
    
    parameters: p_pernr type pa0002-pernr,
                p_plans type t528b-plans.
    
    data: mode type c value 'N'.
    
    data:   bdcdata type table of bdcdata    with header line.
    data:   messtab type table of bdcmsgcoll with header line.
    
    start-of-selection.
    
      perform do_transaction using 'P10'
                             p_pernr
                             p_plans.
    
    ************************************************************************
    *       FORM do_transaction                                            *
    ************************************************************************
    form do_transaction using timev
                              pernr
                              plans.
    
      data: bdcdate(10) type c,
            bdctime(8) type c.
    
      call function 'CONVERT_DATE_TO_EXTERNAL'
           exporting
                date_internal = sy-datum
           importing
                date_external = bdcdate.
    
      write sy-uzeit to bdctime.
    
      clear bdcdata.  refresh bdcdata.
      clear messtab.  refresh messtab.
    
      perform bdc_dynpro      using 'SAPMP50A' '1000'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=INS'.
      perform bdc_field       using 'RP50G-PERNR'
                              pernr.
      perform bdc_field       using 'RP50G-TIMR6'
                                    'X'.
      perform bdc_field       using 'BDC_CURSOR'
                                    'RP50G-CHOIC'.
      perform bdc_field       using 'RP50G-CHOIC'
                              '2011'.
      perform bdc_dynpro      using 'MP200000' '2500'.
      perform bdc_field       using 'BDC_CURSOR'
                                    'T705H-GTEXT'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=DIFP'.
      perform bdc_field       using 'P2011-LDATE'
                              bdcdate.
      perform bdc_field       using 'P2011-LTIME'
                              bdctime.
      perform bdc_field       using 'P2011-SATZA'
                              timev.
    
      if timev = 'P10'.
        perform bdc_dynpro      using 'MP200000' '2221'.
        perform bdc_field       using 'BDC_CURSOR'
                                      'P2APL-PLANS'.
        perform bdc_field       using 'BDC_OKCODE'
                                      '=DOIT'.
        perform bdc_field       using 'P2APL-OTYPE'
                                'A'.
        perform bdc_field       using 'P2APL-PLANS'
                                plans.
        perform bdc_field       using 'P2APL-WAERS'
                                'USD'.
    
      endif.
    
      perform bdc_dynpro      using 'MP200000' '2500'.
      perform bdc_field       using 'BDC_CURSOR'
                                    'P2011-LDATE'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=UPD'.
    
      call transaction 'PA30' using bdcdata
                                    mode mode
                                    messages into messtab.
    * If error occurs, give message and come out.
      if sy-subrc <> 0.
    
      endif.
    
      clear bdcdata.  refresh bdcdata.
      clear messtab.  refresh messtab.
    
    
    endform.
    
    ************************************************************************
    *       bdc_dynpro
    ************************************************************************
    form bdc_dynpro using program dynpro.
      clear bdcdata.
      bdcdata-program  = program.
      bdcdata-dynpro   = dynpro.
      bdcdata-dynbegin = 'X'.
      append bdcdata.
    endform.
    
    ************************************************************************
    *        bdc_field
    ************************************************************************
    form bdc_field using fnam fval.
      clear bdcdata.
      bdcdata-fnam = fnam.
      bdcdata-fval = fval.
      append bdcdata.
    endform.
    
    

    Regards,

    Rich Heilman

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 08, 2005 at 07:47 PM

    BDC - Transferring of large/external/legacy data into SAP system using Batch Input programming. Batch input is a automatic procedure referred to as BDC(Batch Data Communications).The central component of the transfer is a queue file which receives the data vie a batch input programs and groups associated data into “sessions”.

    check this link:

    http://www.sappoint.com/abap.html

    under BDC concept you can find out everything about BDC.

    Please reward points if the solution was useful

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 08, 2005 at 07:48 PM

    There are two methods for BDC

    1. Session Method

    2.Call transaction

    For session method, you will have to use the FMs

    BDC_OPEN

    You will create a session with this FM

    BDC_INSERT

    You will have to populate a BDC table and pass it to this FM.This internal table will contain the screen flow.

    BDC_CLOSE

    This FM will close the session which you created with BDC_OPEN

    Call Transaction is simple than session method.

    Populate the BDC table and use the syntax

    Call Transaction 'tcode' using BDCTAB

    mode mode

    messages into message.

    if sy-subrc <> 0.

    handle messages

    endif.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 08, 2005 at 08:03 PM

    Hi

    The flow of BDC program depend on the transaction you need to use, anyway what you have to do is to fill the BDC table for run the transaction:

    CALL TRANSACTION <....> USING <BDC_TABLE>.

    The BDC_TABLE is structurated as structure BDCDATA (use trx SE11 to see it), where you find these field:

    PROGRAM -


    > Name of program of dynpro

    DYNPRO -


    > Nr of dynpro

    DYNBEGIN -


    > flag to set the first time to run dynpro

    FNAM -


    > Field name

    FVAL -


    > Field value

    So your BDC program should correctly fill the BDC table:

    1 - The first step is to insert the first screen called by your trx:

    CLEAR BDC_TABLE.

    BDC_TABLE-PROGRAM = PROGRAM.

    BDC_TABLE-DYNPRO = DYNPRO.

    BDC_TABLE-DYNBEGIN = 'X'.

    APPEND BDC_TABLE.

    2- The next steps depend on your transactions:

    ---> You can transfer the data of input/output fields:

    CLEAR BDC_TABLE.

    BDC_TABLE-FNAM = <FIELD NAME>.

    BDC_TABLE-FVAL = <FIELD VALUE>.

    APPEND BDC_TABLE.

    ---> You can indicate which function (ok-code) has to be done:

    CLEAR BDC_TABLE.

    BDC_TABLE-FNAM = 'BDC_OKCODE'.

    BDC_TABLE-FVAL = <ok_code>.

    APPEND BDC_TABLE.

    After inserting ok-code step you always indicate which the dynpro is run:

    CLEAR BDC_TABLE.

    BDC_TABLE-PROGRAM = PROGRAM.

    BDC_TABLE-DYNPRO = DYNPRO.

    BDC_TABLE-DYNBEGIN = 'X'.

    APPEND BDC_TABLE.

    and so

    AT the end you can us e the CALL TRANSACTION or create a bdc session by fm of group SBDC:

    BDC_OPEN_GROUP, BDC_INSERT.

    Max

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 08, 2005 at 07:55 PM

    Hi,

    There are 2 ways of doing BDC acll transaction and Insert.

    Record ur transaction thru SHDB.After recording press Create Program so system will generate code for you.

    Or use this sample code for Call transaction:

    **********************************************************************

    *---- Data definition -


    DATA: BEGIN OF BDCDATA OCCURS 5.

    INCLUDE STRUCTURE BDCDATA.

    DATA: END OF BDCDATA.

    DATA: C_TCODE LIKE BKPF-TCODE VALUE 'FB01'.

    DATA BEGIN OF MESSTAB OCCURS 10.

    INCLUDE STRUCTURE BDCMSGCOLL.

    DATA END OF MESSTAB.

    **********************************************************************

    *---- Call transaction -


    FORM Main_Program

    REFRESH BDCDATA.

    PERFORM APPEND_BDC USING 'SAPMF05A' '0100' ' ' ' '.

    PERFORM APPEND_BDC USING ' ' ' ' 'BKPF-BLDAT' '09031998'.

    PERFORM APPEND_BDC USING ' ' ' ' 'BDC_OKCODE' '/00'.

    PERFORM APPEND_BDC USING 'SAPMF05A' '0300' ' ' ' '.

    PERFORM APPEND_BDC USING ' ' ' ' 'BSEG-WRBTR' '*'.

    PERFORM APPEND_BDC USING ' ' ' ' 'BDC_OKCODE' 'BU'.

    CALL TRANSACTION 'FB01' USING BDCDATA MODE 'N' UPDATE 'S'.

    PERFORM UPDATE_IDOC_STATUS.

    ENDFORM.

    **********************************************************************

    *--- Call transaction with errors to BDC -


    REFRESH MESSTAB.

    CALL TRANSACTION C_TCODE USING BDCDATA MODE 'N' UPDATE 'S'

    MESSAGES INTO MESSTAB.

    RETURN_CODE = SY-SUBRC.

    IF RETURN_CODE = 0.

    LOOP AT MESSTAB.

    IF MESSTAB-MSGTYP = 'E'.

    RETURN_CODE = MESSTAB-MSGNR.

    SY-MSGID = 'B1'.

    SY-MSGNO = 999.

    SY-MSGV1 = 'Error: Check BDC'.

    ENDIF.

    ENDLOOP.

    ENDIF.

    *--- Here we check the return code, if there was an error, we put the

    • transaction in a BDC session for the user to review and correct.

    IF RETURN_CODE NE 0.

    CALL FUNCTION 'BDC_OPEN_GROUP'

    EXPORTING

    CLIENT = SY-MANDT

    GROUP = 'ZKJW'

    USER = SY-UNAME

    KEEP = 'X'.

    CALL FUNCTION 'BDC_INSERT'

    EXPORTING

    TCODE = C_TCODE

    TABLES

    DYNPROTAB = BDCDATA.

    CALL FUNCTION 'BDC_CLOSE_GROUP'

    EXCEPTIONS

    NOT_OPEN = 1

    QUEUE_ERROR = 2

    OTHERS = 3.

    ENDIF.

    **********************************************************************

    *--- Append BDCDATA internal table -


    FORM APPEND_BDC USING VALUE(P_PROG)

    VALUE(P_SCREEN)

    VALUE(P_NAM)

    VALUE(P_VAL).

    CLEAR BDCDATA.

    IF P_PROG NE SPACE.

    BDCDATA-PROGRAM = P_PROG.

    BDCDATA-DYNPRO = P_SCREEN.

    BDCDATA-DYNBEGIN = 'X'.

    BDCDATA-FNAM = P_NAM.

    BDCDATA-FVAL = P_VAL.

    ELSE.

    BDCDATA-FNAM = P_NAM.

    BDCDATA-FVAL = P_VAL.

    ENDIF.

    APPEND BDCDATA.

    ENDFORM.

    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.