Questions on BDC program statements.....

Hi,
Currently i am checking below BDC program for packing material use.
But there is a statement that i am not very clear what it is for...
    PERFORM bdc_field       USING 'BDC_CURSOR'
                                  'V51VE-EXIDV(01)'.
For the  'V51VE-EXIDV(01)', here why need to add an (01) at the end.  What does the (01) means??
Thanks!!!!
  LOOP AT i_lips.
    CLEAR: i_bdc_tab,i_msg_tab.
    REFRESH: i_bdc_tab,i_msg_tab.
    PERFORM bdc_dynpro      USING 'SAPMV50A' '4004'.
    PERFORM bdc_field       USING 'BDC_CURSOR'
                                  'LIKP-VBELN'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '/00'.
    PERFORM bdc_field       USING 'LIKP-VBELN'
                                  i_lips-vbeln.
    PERFORM bdc_dynpro      USING 'SAPMV50A' '1000'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '=VERP_T'.
*perform bdc_field       using 'LIKP-BLDAT'
*                              record-BLDAT_002.
    PERFORM bdc_field       USING 'BDC_CURSOR'
                                  'LIPS-POSNR(01)'.
*perform bdc_field       using 'LIKP-WADAT'
*                              record-WADAT_003.
*perform bdc_field       using 'LIKP-WAUHR'
*                              record-WAUHR_004.
*perform bdc_field       using 'LIKP-BTGEW'
*                              record-BTGEW_005.
*perform bdc_field       using 'LIKP-GEWEI'
*                              record-GEWEI_006.
    PERFORM bdc_dynpro      USING 'SAPLV51G' '6000'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '=ENTR'.
    PERFORM bdc_field       USING 'BDC_CURSOR'
                                  'V51VE-VHILM(01)'.
    PERFORM bdc_field       USING 'V51VE-VHILM(01)'
                                  'BOX'.
*Select all materails
    PERFORM bdc_dynpro      USING 'SAPLV51G' '6000'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '=HU_MARKA'.
*Select all Boxes
    PERFORM bdc_dynpro      USING 'SAPLV51G' '6000'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '=HUMARKHU'.
*perform bdc_field       using 'V51VE-SELKZ(01)'
*                              record-SELKZ_01_008.
    PERFORM bdc_dynpro      USING 'SAPLV51G' '6000'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '=HU_VERP'.
    PERFORM bdc_field       USING 'BDC_CURSOR'
                                  'V51VE-EXIDV(01)'.
    PERFORM bdc_dynpro      USING 'SAPLV51G' '6000'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '=SICH'.
    PERFORM bdc_field       USING 'BDC_CURSOR'
                                  'V51VE-EXIDV(01)'.
    CALL TRANSACTION 'VL02N' USING i_bdc_tab
                      MODE p_mode
                      MESSAGES INTO i_msg_tab.
Message was edited by:
        Hoo Laa

And if this is a BDC running in background, or a call transaction, then placing the cursor on a given field has no effect unless it is needed for navigation to the next screen. 
When you record a BDC using SHDB there are a lot of statements like this that are added in but are not needed for the BDC to work. 
Another example is the "BDC_SUBSCR" field name - this does not in most cases appear to have any effect on how the BDC is processed.
Also, the recording will include fields which have default values on the screen that you do not need to overwrite with the same value from the BDC.
I often delete these statements from the recording, taking care that I understand what the impact is.  You can try commenting out the line and see what difference it makes to processing. 
When using a BDC for updating a lot of records, having less of these types of lines in the BDCDATA table will speed performance a bit.
Andrew

Similar Messages

  • Question about BDC program

    I wanna to write a program for creating profit center (KE51). Here are part of the codes:
    form create_profit_center.
      refresh bdctab.
      perform fill_screen using:
        'SAPLRKPM' '0200' 'X' space space,
        space space space 'PRCT_V-PRCTR' 'TEST1',
        space space space 'BDC_OKCODE' '/0',
        'SAPLRKPM' '0298' 'X' space space,
        space space space 'PRCT_V-DATAB' '01.01.2005',
        space space space 'PRCT_V-DATBI' '31.12.9999',
        space space space 'PRCT_V-KTEXT' 'Test Profit Center 3',
        space space space 'PRCT_V-LTEXT' 'Test Profit Center 3',
        space space space 'PRCT_V-VERAK' 'ABC',
        space space space 'PRCT_V-KHINR' '1001',
        space space space 'BDC_OKCODE' 'PRCT_SCREEN_CC'.
        call transaction 'KE51' using bdctab mode 'A' update 'S'.
        if sy-subrc <> 0.
          write :/ 'Error when creating profit center.'.
        endif.
    endform.
    form fill_screen using program
                           dynpro
                           dynbegin
                           fnam
                           fval.
      clear bdctab.
      bdctab-program = program.
      bdctab-dynpro = dynpro.
      bdctab-dynbegin = dynbegin.
      bdctab-fnam = fnam.
      bdctab-fval = fval.
      append bdctab.
    endform.
    When I execute the program in mode 'A' (view all the input screen), the program got stuck to the first screen. I can't see any fields (at least I expected the field 'PRCT_V-PRCTR is filled with the value 'Test1')being filled but only an error 'Make an entry in all required fields'.
    Can anyone please help? Thanks!

    Thanks for your reply.
    I have tried to add
    Data: V_kokrs like csks-kokrs value 'CA01'.
    SET PARAMETER ID 'CIC' FIELD V_KOKRS.
    OR
    perform fill_screen using:
    'SAPLSPO4' '0300' 'X' space space,
    space space space 'SVALD-VALUE'<Controlling Area>,
    space space space 'BDC_OKCODE' 'FURT'.
    but it does not work. The error still exists.
    I know that it is required to enter the controlling area before creating profit center. But when you have once saved the controlling area, it will no longer automatically prompt out when using t-code ke51 again. You need to go to the menu 'Extras -> set controlling area' if you wanna to set the controlling area again. So during recording, the starting screen is 'SAPLRKPM' '0200' instead of 'SAPLSPO4' '0300'. I just wonder in normal case you got stuck in a screen, your input value will be colored in red. But in my case, even I have set the value of profit center, the field is still blank.
    I will now try to do it via BAPI. But I am still have interest in what's wrong with the BDC. Thanks!

  • BDC programming and table controls selColumns

    Hello,
    I have a small question regarding BDC programming. I am already quite familiar with the process in creating one but I have one question regarding table control and its selColumns.
    Transactions like pa40 would require its users to select one of the rows in the table controls via SelColumns. My questions is how would you simulate this using BDC.
    Thanks people and take care.

    Hai Chad Cheng
    report Z_TAB_CONTRL_01
           no standard page heading line-size 255.
    data : begin of it_kna1 occurs 0,
           kunnr like RF02D-KUNNR,
           D0130 like RF02D-D0130,
           end of it_kna1.
    data : begin of it_kna2 occurs 0,
           kunnr like RF02D-KUNNR,
           BANKS like KNBK-BANKS,
           BANKL like KNBK-BANKL,
           BANKN like KNBK-BANKN,
           koinh like KNBK-koinh,
           end of it_kna2.
    data : V_Count(2) type n.
    data : V_Val(15).
    include bdcrecx1.
    start-of-selection.
      perform Get_Data1.
      perform Get_Data2.
    perform open_group.
    loop at it_kna1.
    V_Count = '04'.
    perform bdc_dynpro      using 'SAPMF02D' '0106'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RF02D-D0130'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'RF02D-KUNNR'
                                  '10002103'.
    perform bdc_field       using 'RF02D-D0130'
                                  'X'.
    perform bdc_dynpro      using 'SAPMF02D' '0130'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=P+'.
    perform bdc_dynpro      using 'SAPMF02D' '0130'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=P+'.
    perform bdc_dynpro      using 'SAPMF02D' '0130'.
    loop at it_kna2 where kunnr = it_kna1-kunnr.
    if v_count = '10'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=P+'.
    perform bdc_dynpro      using 'SAPMF02D' '0130'.
    v_count = '00'.
    endif.
    V_Count = V_Count + 1.
    concatenate 'KNBK-KOINH(' V_Count ')' into V_Val.
    perform bdc_field       using 'BDC_CURSOR'
                                   'KNBK-KOINH(09)'.
    concatenate 'KNBK-BANKS(' V_Count ')' into V_Val.
    perform bdc_field       using V_Val
                                  it_kna2-BANKS.
    concatenate 'KNBK-BANKL(' V_Count ')' into V_Val.
    perform bdc_field       using V_Val
                                  it_kna2-BANKL.
    concatenate 'KNBK-BANKN(' V_Count ')' into V_Val.
    perform bdc_field       using V_Val
                                  it_kna2-BANKN.
    concatenate 'KNBK-KOINH(' V_Count ')' into V_Val.
    perform bdc_field       using V_Val
                                  it_kna2-KOINH.
    endloop.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=UPDA'.
    perform bdc_transaction using 'FD02'.
    clear : it_kna1,it_kna2.
    endloop.
    perform close_group.
    *&      Form  Get_Data1
          text
    -->  p1        text
    <--  p2        text
    FORM Get_Data1 .
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
      CODEPAGE                      = ' '
       FILENAME                      = 'C:\tab_contl.txt'
       FILETYPE                      = 'ASC'
      ITEM                          = ' '
      FILEMASK_MASK                 = ' '
      FILEMASK_TEXT                 = ' '
      FILETYPE_NO_CHANGE            = ' '
      FILEMASK_ALL                  = ' '
      FILETYPE_NO_SHOW              = ' '
      LINE_EXIT                     = ' '
      USER_FORM                     = ' '
      USER_PROG                     = ' '
      SILENT                        = 'S'
    IMPORTING
      FILESIZE                      =
      CANCEL                        =
      ACT_FILENAME                  =
      ACT_FILETYPE                  =
      TABLES
        DATA_TAB                      = it_kna1
    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.
    ENDFORM.                    " Get_Data1
    *&      Form  Get_Data2
          text
    -->  p1        text
    <--  p2        text
    FORM Get_Data2 .
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
      CODEPAGE                      = ' '
       FILENAME                      = 'C:\tab_cont1.txt'
       FILETYPE                      = 'ASC'
      ITEM                          = ' '
      FILEMASK_MASK                 = ' '
      FILEMASK_TEXT                 = ' '
      FILETYPE_NO_CHANGE            = ' '
      FILEMASK_ALL                  = ' '
      FILETYPE_NO_SHOW              = ' '
      LINE_EXIT                     = ' '
      USER_FORM                     = ' '
      USER_PROG                     = ' '
      SILENT                        = 'S'
    IMPORTING
      FILESIZE                      =
      CANCEL                        =
      ACT_FILENAME                  =
      ACT_FILETYPE                  =
      TABLES
        DATA_TAB                      = it_kna2
    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.
    ENDFORM.                    " Get_Data2
    Thanks & regards
    Sreenivasulu P

  • Multiple questions on BDC

    Hi everyone
    I have multiple questions on BDC.Would u please answer them with explanations ASAP...
    1. How do you create a batch input session for a transaction?
    a) We create a bdc and use &#8216;call transaction&#8217; in background mode.
    b) We create a bdc and use &#8216;call transaction&#8217; in error mode.
    c) We create a bdc and use &#8216;bdc_insert&#8217; for the transaction.
    d) None of the above.
    2. What is the alternative to batch input session?
    a) Load module
    b) Call transaction
    c) BAPI
    d) Idoc segment
    3. Which SAP table stores the BDC session queue information?
    a) APQD
    b) APQL
    c) APQQ
    d) APQI
    4. Which program can be used to release BDC sessions within a job?
    a) RSBDCSUB
    b) RSBDCJOB
    c) RSSUBBDC
    d) BDCRECXX
    5. Which one of the following is output to the job log when included in an ABAP program running in the background?
    a) Write statements
    b) message statements
    c) report parameters
    d) Submit statements
    6. Your program specs call for you to read the first 10 records from a text file (fname1), and write them out to another text file (fname2).
    Which block of code will accomplish the result desired in the above scenario?
    a) Open dataset fname2 for input in text mode.
    Do 10 times.
    Read dataset fname1 into hold_var.
    Transfer hold_var to fname2.
    Enddo.
    b) open file fname1 for output.
    Open file fname2 for input.
    Read dataset fname1 into hold_var 10 times.
    Transfer hold_var to fname2.
    c) open file fname1 for input.
    Open file fname2 for output.
    Do 10 times.
    Read file fname1 into hold_var.
    Transfer hold_var into fname2.
    Enddo.
    d) open dataset fname1 for input in text mode.
    Open dataset fname2 for output in text mode.
    Do 10 times.
    Read fname1 into hold_var.
    Write hold_var to fname2.
    Enddo.
    7. sy-dynpro is
    a) screen no
    b) program
    c) table
    d) field name
    8. Which of the following are NOT correct usage of BDC_cursor?
    a) To position the cursor on a particular field.
    <bdc_tab>-FNAM = 'BDC_CURSOR'.
    <bdc_tab>-FVAL = &#8216;fieldx&#8217; .
    b) To position the cursor on a particular field.
    <bdc_tab>-FNAM = &#8216;fieldx&#8217;
    <bdc_tab>-FVAL = 'BDC_CURSOR'. .
    c) For fifth row of Table control
    <bdc_tab>-FVAL = 'fieldx(5)'.
    d) For fifth row of Table control
    <bdc_tab>-FNAM = 'BDC_CURSOR(5) '.
    9. In case of background processing of a BI session, which authorization is checked?
    a) Developer of the program that schedules BI Session
    b) User who executes the BI session
    c) User who executes the program that schedules BI Session
    d) User ID that is passed to the BDC_OPN_GROUP function module inside the calling program
    10. Which of the following are TRUE about Transaction Recorder?
    a) Transaction Code is SHDB
    b) Transaction Code is SM35
    c) It can generate ABAP code for the BDC program automatically
    d) It can generate ABAP code for the Call Transaction program automatically
    Regards,
    Pratibha

    Hi,
    1) C We create a bdc and use ‘bdc_insert’ for the transaction
    2) b) Call transaction
    3. d) APQI
    4. a) RSBDCSUB
    5. b) message statements
    6. d) open dataset fname1 for input in text mode.
    Open dataset fname2 for output in text mode.
    Do 10 times.
    Read fname1 into hold_var.
    Write hold_var to fname2.
    Enddo.
    7. a) screen no
    8.  b) To position the cursor on a particular field.
    <bdc_tab>-FNAM = ‘fieldx’
    <bdc_tab>-FVAL = 'BDC_CURSOR'. .
    9.b) User who executes the BI session (or)
    c) User who executes the program that schedules BI Session
    10.  a) Transaction Code is SHDB
    c) It can generate ABAP code for the BDC program automatically
    Regards

  • Standard BDC program used for FI

    hi all ,
    i would like to know the standard BDC program used in FI , like for tcode fb01 or somethings else.
    Appreciate for any segguestion.
    thanks and regards.

    hi siddu m 
    thanks for replay ,
    i have anohter question
    provided the transaction A was contianed in the first batch file,
    and also  contained in the second batch file , how the tcode treated as the duplicate posting ?
    many thanks

  • Few questions on Report programming

    Hi guys,
    I have few questions on report programming.
    1. What is the purpose of the statement REPORT zxxx. Even if i gave a name other than my report name i don't find any difference in syntax check/Functionality.
    2. What is the purpose of list headings in report program? This option will come along with the text elements and selection texts.
    3. What is the purpose of logical data base. Even if it is efficient why don't we use it frequently in our reports? Is there any limitations?
    All usefull answers will be rewarded as usuall:-)
    Thanks,
    Vinod.

    1. As u told that you dint get any syntax errors even after changing the Report Name,there are chances of getting Runtime errors.
    2. The usage of List Headings is when you create a list in a program, you can also create your own list and column headings.
    Refer this link for further info.
    http://help.sap.com/saphelp_nw70/helpdata/en/e3/960a05eb0711d194d100a0c94260a5/content.htm
    3. The Limitation of LDB  is the usage of GET statements which act similar to SELECT - ENDSELECT And also if you dont choose the proper LDB,a  single LDB may contain data retrieval from so many tables ,that it would make the entire process very slow and it is very hard to find LDBs for other modules than HR.
    Only in HR module the data is organized in such a way thatusing LDBs would be much simpler.
    Reward points if useful.

  • Issue while inserting a BDC program in Inbound Proxy.JDBC-- PI-- SAP.

    The scenerio is jdbcsender-sappi-inboundproxy(ECC6.0).
    The issue is related to SAP Plant Maintenance Module where  We have a requirement for creating Maintenance item
    programmatically from (SQLDatabase)Legacy Data for one of the interface.
    since there are no standard BAPIS/Idocs or function modules available from SAP side for creating the maintenance item. So I
    have written BDC program and with the help of submit statement in inbound proxy program, I am calling BDC program for
    creation of the maintenance item.
    When I tested the program independently on proxy side  the Maintenance Item is getting created successfully but when I
    executed from end-to-end ie.  SQLDATABASE->SAP PI-->SAP. The message is getting strucked into the queue and queue  got stopped on SAP.
    ECC side and the status of the message is scheduled state  on SXMB_MONI  transaction of SAP ECC.
    As the message  is in scheduled state multiple number of Maintenance Items are getting created with the same values.
    Has any one of our SAP friends, encountered this type of issue while inserting a BDC program in inbound proxy, please help 
    in fixing this issue. FYI... I am using sap pi7.0 with service pack 24 and ecc6.0
    Waiting for your kind expert guidance...
    cheers,
    Ram

    Raj,
    Thanks for the reply. I have tried registering the queues but still the same problem. the message got stuck in the queue of ECC and showing below message in queue.
    function module                                    StatusText
    SXMS_ASYNC_EXEC                  connection closed (no data)
    I have checked in the forums especially  for this issue but no one has provided the answer for this.
    Thanks and Regards
    Ram

  • BDC program or standard function module to change data in PFCG TCode.

    Gurus,
    I have programatically change the validity date of SAP security role (TCode PFCG). Are there any standard function module available for this ? If not then does PFCG supports update vida BDC programming ?
    Regards,
    Rajesh.

    Cross-posting. Thread locked.
    Please read [the rules|https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/rulesofEngagement].
    PS: Please clean up / follow up on all your hundreds of unresolved questions.

  • Call transaction in a BDC program...

    Hi,
    I can see in one of the BDC program, the call transaction command is used. This BDC program updates the Vendor master table.
    CALL TRANSACTION BLF00-TCODE USING  FT
                                     MODE   ANZ_MODE
                                     UPDATE UPDATE.
    Now, I am trying to know what transaction code it is using in above call transaction to update vendor master.
    Regards,
    Rajesh.

    Put a break point on that statement in that program and run your program using MODE 'A', step thru the screens, when you get to that statement in debug mode, simply click on the BLF00-TCODE and see the value. 
    Regards,
    Rich Heilman

  • Regarding leave program statement.

    Because of using LEAVE PROGRAM statement in LOAD-OF-PROGRAM event the BDC report is going to dump can any one tell me the alternation for LEAVE PROGRAM statement its urgent please?

    You're technically not allowed to do anything that would cause the program to exit in the LOAD-OF-PROGRAM event, STOP is also not allowed.
    The best way I know to make sure the program exits completely is to set a flag in the LOAD-OF-PROGRAM event, and then use "RETURN" or something similar to leave the event.  The next event to run will be INITIALIZATION, from which you can check the flag and call "LEAVE PROGRAM". With no problems.
    (You can also sometimes move everything to the INITIALIZATION event, depending upon your needs.)

  • Can we call a bdc program from report program

    hi
    can we call a bdc program from report program

    Yes you can any program from another program using
    SUBMIT <repname>   statement
    SUBMIT <repname> USING SELECTION-SCREEN dynnr.
    or
    SUBMIT <repname> VIA SELECTION-SCREEN USING SELECTION-SET variant
    SUBMIT <repname> VIA SELECTION-SCREEN WITH SELECTION-TABLE rspar
    etc.
    Regards
    Prax

  • The standard BDC program for FI

    hi all ,
    i would like to know the standard BDC program usd in FI , like for tcode fb01 or somethings else.
    Appreciate for any segguestion.
    thanks and regards.

    thanks
    another question,
    how the fb01 check a duplicated entry?
    any materials about this , i have seen that somewhere but can't remember it
    thansk

  • Budget Document Entry Upload via LSMW or BDC Program not working!

    Hi All,
    I tried creating a LSMW and a BDC program for upload of budgets by recording Tcode FMBB.  Unfortunately, I didn't succeed because some fields in Tcode FMBB are not input ready.  I therefore seek an alternative solution to upload the budgets.  I have the following questions:-
    1.  Is there a standard program that can be used to upload the budgets?  If so, please give a the name or   Tcode for the program.
    2. I have checked in this site and confirmed I can use BAPI BAPI_0050_CREATE to upload the budgets.  Unfortunately, I have never used BAPIs before. How do I the BAPI to upload my data in Excel? Do I call the BAPI as a function in a program? How do I format the data in Excel for Upload.  Kindly provide a step by step procedure on how this can be done and also explain how the data is formatted in Excel.
    Thank you.
    Robeth

    Hi Alok,
    May be ur recording a table control in the transaction FB01 for accounting line items..
    When recording line items.. u need to record the page "page down" button...
    If it is so..
    You can control the line item table control , by recording the line item in the second row, then recording the 'page down' button..
    This will move your line item to first row and the next line item will be recorded in the second row....and it continues on...
    But i am unaware that BDC is tuff for enjoy transactions... If it is so, please go for the bapi specified by Kishan..
    Awrd and close the thread if answered...
    Thanks
    Rajiv

  • How can we write BDC program to upload data in to line items(VA01) ?

    Error in processing BDC table control program...
    How can i populate data through bdc program dynamically, when some of the lines are in disable mode....
    for e.g ...
    in va01 transaction code ....
    1 to 5 lines are not in disable mode....
    but 5 to 10 lines are in disable mode...
    so hw u process those remaining disable lines at runtime and populate data in to the fields of line items...through bdc program..

    hi..friends.,
    yea actually this question has been raised by interviewer ...
    but just the same i replied as you did...
    but he told that we can upload the data....towards in to disabled line items
    at run time..with using change trasaction va02..with implementing bdc programm...
    so i just want to know the steps of how to perform it..
    Can anyone....my friends..
    byeeee.....

  • BDC Program with recording

    Hi All,
    I have a requirement to create a bdc program for asset creation with recording. Any have this, please send the step-by-step procedure.
    I am very thankful to you in advance.
    Thanks,
    Nagarjuna.

    HI Nagarjuna,
    Step by Step approach to ceate simple BDC session program using reusable template.
    Batch Data Communication is one of the vital data upload / transaction automation option in many SAP components . I am suggesting here a way out to simplify the programming for a BDC application . It utilizes a template program and gives steps to use it to create your own BDC program on the fly.
    This step by step approach can be used to create a Simple BDC program i.e for a transaction which does not have any table control / looping at screen table. The same can also be enhanced to develop a program for transactions involving table controls .
    1. Create a new program as executable program using SE38 transaction code.
    2. Copy the following template code into your program .
    ---- Start of Template -
    REPORT
    NO STANDARD PAGE HEADING
    LINE-SIZE 200
    LINE-COUNT 300.
    *-- DATA DECLARATION--
    *---Types
    DATA : BEGIN OF t_upload,
    FIELD1(10),
    FIELD2(2),
    FIELD3(18),
    FIELD4(35),
    END OF t_upload.
    *--- Tables
    DATA : BEGIN OF i_bdcdata OCCURS 0."to hold the transaction record
    INCLUDE STRUCTURE bdcdata.
    DATA: END OF i_bdcdata.
    DATA: i_upload LIKE STANDARD TABLE OF t_upload," to hold file data.
    i_upload1 LIKE STANDARD TABLE OF t_upload." to hold file data.
    *--- Work Areas
    DATA: wa_upload2 LIKE t_upload,
    wa_upload LIKE t_upload,
    wa_upload1 LIKE t_upload.
    *--- Variables
    DATA: v_count1(4) TYPE n,
    v_error TYPE c,
    v_session(12),
    v_field(21) TYPE c,
    v_message(60) type 'C'.
    *--Constants
    DATA: c_open TYPE c VALUE '(',
    c_close TYPE c VALUE ')',
    c_x TYPE c VALUE 'X'.
    *---Initialisation
    initialization.
    refresh : i_upload , i_upload1 ,i_bdcdata.
    -------Selection Screen Design -
    *Selection screen for input of upload file address
    SELECTION-SCREEN SKIP 2.
    SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME.
    PARAMETERS : p_file LIKE rlgrap-filename OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK blk1.
    ---AT SELECTION SCREEN -
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
    *--For popup to select file.
    PERFORM give_help.
    -----START OF SELECTION -
    START-OF-SELECTION.
    *--Data upload using WS_Upload.
    PERFORM get_data.
    *-- OPEN SESSION
    PERFORM open_group.
    *--Insert transactions using BDCDATA table in the session.
    PERFORM do_transaction .
    *-- Close the session.
    PERFORM close_group.
    END-OF-SELECTION.
    *& Form f_get_data
    For data upload from external file.
    FORM get_data.
    CALL FUNCTION 'WS_UPLOAD'
    EXPORTING
    filename = p_file
    filetype = 'DAT'
    TABLES
    data_tab = i_upload
    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
    OTHERS = 10.
    IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ELSE.
    DELETE I_UPLOAD INDEX 1.
    ENDIF.
    ENDFORM. " f_get_data
    *& Form F_open_group
    To open session in session management.
    FORM open_group.
    v_session = 'TCODE'.
    CALL FUNCTION 'BDC_OPEN_GROUP'
    EXPORTING
    client = sy-mandt
    group = v_session
    user = sy-uname
    keep = 'X'.
    ENDFORM. " F_open_group
    *& Form f_do_transaction
    Insert transactions in session after passing values to BDCDATA
    FORM do_transaction.
    LOOP AT i_upload INTO wa_upload .
    *---- insert your generated codes from recording at SHDB here
    *----- insertion ends
    perform bdc_transaction using 'TCODE'.
    REFRESH : I_BDCDATA.
    CLEAR : WA_UPLOAD.
    ENDIF.
    ENDLOOP.
    ENDFORM. " f_do_transaction
    *& Form bdc_dynpro
    For appending screen details to BDCDATA
    FORM bdc_dynpro USING program dynpro.
    CLEAR i_bdcdata.
    i_bdcdata-program = program.
    i_bdcdata-dynpro = dynpro.
    i_bdcdata-dynbegin = 'X'.
    APPEND i_bdcdata.
    CLEAR i_bdcdata.
    ENDFORM. "bdc_dynpro
    *& Form bdc_field
    For appending field details to bdcdata table
    FORM bdc_field USING fnam fval.
    CLEAR i_bdcdata.
    i_bdcdata-fnam = fnam.
    i_bdcdata-fval = fval.
    APPEND i_bdcdata.
    CLEAR i_bdcdata.
    ENDFORM. " bdc_field
    *& Form bdc_transaction
    For inserting Transaction in the session
    FORM bdc_transaction USING tcode.
    CALL FUNCTION 'BDC_INSERT'
    EXPORTING
    tcode = tcode
    TABLES
    dynprotab = i_bdcdata.
    ENDFORM. " bdc_transaction
    *& Form F_close_group
    For closing the session created in Session manager SM35
    FORM close_group.
    CALL FUNCTION 'BDC_CLOSE_GROUP'.
    concatenate 'Session ' v_session 'successfully created' into v_field.
    MESSAGE v_field type 'I'..
    CALL TRANSACTION 'SM35'.
    ENDFORM. "f_close_group
    *& Form f_give_help
    For user help to select file
    FORM give_help.
    CALL FUNCTION 'WS_FILENAME_GET'
    EXPORTING
    mask = ',.,..'
    mode = 'O'
    IMPORTING
    filename = p_file
    EXCEPTIONS
    inv_winsys = 1
    no_batch = 2
    selection_cancel = 3
    selection_error = 4
    OTHERS = 5.
    IF sy-subrc <> 0 AND NOT sy-msgty IS INITIAL.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    ENDFORM. " f_give_help
    ---- End of Template -
    3.Go to the transaction SHDB in another session ( you can also give TCODE - OSHDB in transaction code window and hit enter ).
    4.Create you transaction recording in SHDB . Ensure your transaction recording takes care of input values to all the
    fields to which you intend to pass values in the BDC.
    5.Once your recording is done correctly create the program from recording in the SHDB transction . You will find the button to create program in SHDB . Choose the option of creating from file when you proceed through the subsequent steps.
    6. Define data type t_upload and structure wa_upload in the template program with fields of structure 'RECORD' from the program generated using SHDB recording ( replace the field1, field2 and so on as per your requirement). For your understanding you can remove the suffixes to the
    field name but keep the field size unchanged.
    7.Copy the coding existing between 'do' and 'enddo' statement from the generated program . Insert the copied code between the loop and endloop code of form 'Do_transaction '. Replace fields of structure 'RECORD' with respective fields of structure wa_upload.Insert constant values wherever possible in transaction recording.You can also handle customised data conversions here.
    8.Replace 'TCODE' in the template program with the transaction code you intend to process in this BDC.
    9.Please carry out further syntax check and resolve the related issues.
    This program will provide for input help to select upload file from local machine. The file needs to be in Tab delimited format and is assumed to have first row as column headers .
    On successful creation of session you will be prompted with a Information popup giving the name of session ,and will take you to the SM35 transaction to process your session.
    thanks
    karthik

Maybe you are looking for

  • How to search for a set of string in a column

    Dear all, From a client application I have a Text field where the user can enter a text or a sentence for instance like : "Home for rent" How to make an efficient search in my table for records containing the search patter ? Knowing that it could be

  • Problem linking css style sheet

    I am trying to link a css style sheet to a new root file. When I try to link the css sheet I get an error - A recursive style import was found while trying to add CFTtemp.css. Please resolve this error by editing the file in an external text editor a

  • Credit Check at Line Item Level

    We are trying to carry out credit checking at the line item level. So that user can release each line item from VKM1 or VKM3. Need to know how to achive this does any boday know any enhancements or notes we can apply to achieve this as Standard SD on

  • .MOD to .MOV File gew very large following conversion

    I had a .MOD file on my JVC that was 1.5GB in size (approximately 27mins in length) and I wanted to get it over to iMovie HD. I used software called 'mpegstreamclip' to covert it to a .MOV file. The conversion was successful and the video quality is

  • UnloadingMovie problem

    i am working with pre-existing files. one swf (lets call it 'the portal') has four buttons, and each button loads another swif in a container (we'll just call them all the 'swf') . i have that done successfully. however, each of the four swf's files