<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: BDC in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/bdc/m-p/3310952#M793010</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi Suresh, this will guide u.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLASSICAL BATCH INPUT (Session Method)&lt;/P&gt;&lt;P&gt;CALL TRANSACTION&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BATCH INPUT METHOD:&lt;/P&gt;&lt;P&gt;This method is also called as &amp;#145;CLASSICAL METHOD&amp;#146;.&lt;/P&gt;&lt;P&gt;Features:&lt;/P&gt;&lt;P&gt;Asynchronous processing.&lt;/P&gt;&lt;P&gt;Synchronous Processing in database update.&lt;/P&gt;&lt;P&gt;Transfer data for more than one transaction.&lt;/P&gt;&lt;P&gt;Batch input processing log will be generated.&lt;/P&gt;&lt;P&gt;During processing, no transaction is started until the previous transaction has been written to the database.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL TRANSACTION METHOD :&lt;/P&gt;&lt;P&gt;This is another method to transfer data from the legacy system.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Features:&lt;/P&gt;&lt;P&gt;Synchronous processing. The system performs a database commit immediately before and after the CALL TRANSACTION USING statement.&lt;/P&gt;&lt;P&gt;Updating the database can be either synchronous or asynchronous. The program specifies the update type.&lt;/P&gt;&lt;P&gt;Transfer data for a single transaction.&lt;/P&gt;&lt;P&gt;Transfers data for a sequence of dialog screens.&lt;/P&gt;&lt;P&gt;No batch input processing log is generated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sap-img.com/abap/difference-between-batch-input-and-call-transaction-in-bdc.htm" target="test_blank"&gt;http://www.sap-img.com/abap/difference-between-batch-input-and-call-transaction-in-bdc.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Among the two methods call transaction is better compared to session bcoz data transfer is faster in it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Differences between call transaction and session.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Session Method:&lt;/P&gt;&lt;P&gt;1) Data is not updated in the database table until the session is processed.&lt;/P&gt;&lt;P&gt;2) No sy-subrc is returned.&lt;/P&gt;&lt;P&gt;3) Error log is created for error records.&lt;/P&gt;&lt;P&gt;4) Updation is always synchronous.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Call Transaction Method:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) Immediate updation in the database table.&lt;/P&gt;&lt;P&gt;2) sy-subrc is returned.&lt;/P&gt;&lt;P&gt;3)Error need to be handled explicitly.&lt;/P&gt;&lt;P&gt;4) updation can be synchronous as well as asynchronous.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) ya u can use using the N mode no screen.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3)u can't handle multiple transaction in call transaction.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4) u can handle multiple transaction in session using the BDC_INSERT fm.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;5)When u go to SM35 u can able to see the error records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Which is best?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That depends on your requirement. Both of them have there advantages.&lt;/P&gt;&lt;P&gt;According to the situation u can choose any one of these.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;difference between batch input and call transaction in BDC Session method.&lt;/P&gt;&lt;P&gt;1) synchronous processing.&lt;/P&gt;&lt;P&gt;2) can tranfer large amount of data.&lt;/P&gt;&lt;P&gt;3) processing is slower.&lt;/P&gt;&lt;P&gt;4) error log is created&lt;/P&gt;&lt;P&gt;5) data is not updated until session is processed.&lt;/P&gt;&lt;P&gt;Call transaction.&lt;/P&gt;&lt;P&gt;1) asynchronous processing&lt;/P&gt;&lt;P&gt;2) can transfer small amount of data&lt;/P&gt;&lt;P&gt;3) processing is faster.&lt;/P&gt;&lt;P&gt;4) errors need to be handled explicitly&lt;/P&gt;&lt;P&gt;5) data is updated automatically&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For session method,these are the function modules to b used.&lt;/P&gt;&lt;P&gt;BDC_OPEN_GROUP&lt;/P&gt;&lt;P&gt;BDC_INSERT&lt;/P&gt;&lt;P&gt;BDC_CLOSE_GROUP&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For call transaction,this is the syntax.&lt;/P&gt;&lt;P&gt;CALL TRANSACTION TCODE USING BDCDATA&lt;/P&gt;&lt;P&gt;MODE A or E or N&lt;/P&gt;&lt;P&gt;UPDATE A or S&lt;/P&gt;&lt;P&gt;MESSAGES INTO MESSTAB.&lt;/P&gt;&lt;P&gt;Take a scenario where we need to post documents in FB01 and the input file has say 2000 records (2000 documents, not line items in FB01 but 2000 records)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the BDC call transaction method&lt;/P&gt;&lt;P&gt;We call the transaction FB01 2000 times (once for each record posting) and if the processing fails in record no 3 it can be captured and start with reocord 4.&lt;/P&gt;&lt;P&gt;Eg: Loop at itab.&lt;/P&gt;&lt;P&gt;call transaction FB01&lt;/P&gt;&lt;P&gt;capture errors&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the session method.&lt;/P&gt;&lt;P&gt;We do not explicity call the transaction 2000 times, but all the records are appeneded into a session and this session is stored. The processinf of the session is done wwhenever the user wants it to be done. Hence the errors cannot be captured in the program itself&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check these link:&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sap-img.com/abap/difference-between-batch-input-and-call-transaction-in-bdc.htm" target="test_blank"&gt;http://www.sap-img.com/abap/difference-between-batch-input-and-call-transaction-in-bdc.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sap-img.com/abap/question-about-bdc-program.htm" target="test_blank"&gt;http://www.sap-img.com/abap/question-about-bdc-program.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.itcserver.com/blog/2006/06/30/batch-input-vs-call-transaction/" target="test_blank"&gt;http://www.itcserver.com/blog/2006/06/30/batch-input-vs-call-transaction/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.planetsap.com/bdc_main_page.htm" target="test_blank"&gt;http://www.planetsap.com/bdc_main_page.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Batch Input Session method is asynchronous as told by others here. But the advantage of this is that you have all the error messages and the data for each transaction held persistantly. You don't have to code anything for processing them or writing the logs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But at the same time, the same feature can be disadvantageous if you need to react to an error or if there are too many errors to manually correct in a session. Since the session are created in the program and its execution is done seperately, you loose the trackability of such transactions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With a call transaction, what was a disadvantage above will become an advantage. Call transaction immediately gives you messages back and you can react to it in your program. But the disadvantage is that, if you have several hundreds of transactions to run, running them from within the program can be resource crunching affair. It will hamper the system performance and you cannot really distribute the load. Of course, you have some mechanisms with which you can overcome this, but you will have to code for it. Also, storing the messages and storing the errored transaction data etc will have to be handled by you in the program. Whereas, in batch input session, your program's job is to just create the session, after that everything is standard SAP system's responsibility.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ideally, you should do a call transaction if the resources are not a problem and if it fails, put the errored transaction into a session.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can decide based on the data volume that your BDC is processing. If data volume is high go for session else call transaction will do.The call transaction updates will be instantaneous where as session needs to be processed explictly after creation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Session Method&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) Session method supports both small amount of data aswell as large amount of data&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) data processing is asynchronus and data updation is synchronus.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3) it process multiple apllication while perfomaning validations.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4) in session method data will be updated in data base only after processing session only.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;5) system provide by default logfile for handling error records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;6) it supports both foreground aswell as background process&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in bdc we use FM ...&lt;/P&gt;&lt;P&gt;bdc_open_group " for creating Session&lt;/P&gt;&lt;P&gt;bdc_insert " adding transaction and bdcdata table for updating database&lt;/P&gt;&lt;P&gt;bdc_close_group " for closing Session&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Call Transaction&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) Call transaction exclusively for small amout of data&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) it supports only one apllication while perfoming validations&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3) there is no default logfile, We can explicitly provide logic for creating logfile for handling error records.&lt;/P&gt;&lt;P&gt;we can create logfile by using structure....BDCMSGCOLL&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4) it doesn't support background processing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;5) data processing is synchronous and Data updation is Synchronous( default), in&lt;/P&gt;&lt;P&gt;this method also supports daya updation in asynchronus process also.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;syntax:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Call transaction &amp;lt;transaction-name&amp;gt; using BDCDATA&lt;/P&gt;&lt;P&gt;mode &amp;lt;A/N/E&amp;gt;&lt;/P&gt;&lt;P&gt;update &amp;lt;L/A/S&amp;gt;&lt;/P&gt;&lt;P&gt;messages into BDCMSGCOLL.&lt;/P&gt;&lt;P&gt;BDC:&lt;/P&gt;&lt;P&gt;Batch Data Communication (BDC) is the process of transferring data from one SAP System to another SAP system or from a non-SAP system to SAP System.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Features :&lt;/P&gt;&lt;P&gt;BDC is an automatic procedure.&lt;/P&gt;&lt;P&gt;This method is used to transfer large amount of data that is available in electronic medium.&lt;/P&gt;&lt;P&gt;BDC can be used primarily when installing the SAP system and when transferring data from a legacy system (external system).&lt;/P&gt;&lt;P&gt;BDC uses normal transaction codes to transfer data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Types of BDC :&lt;/P&gt;&lt;P&gt;CLASSICAL BATCH INPUT (Session Method)&lt;/P&gt;&lt;P&gt;CALL TRANSACTION&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BATCH INPUT METHOD:&lt;/P&gt;&lt;P&gt;This method is also called as &amp;#145;CLASSICAL METHOD&amp;#146;.&lt;/P&gt;&lt;P&gt;Features:&lt;/P&gt;&lt;P&gt;Asynchronous processing.&lt;/P&gt;&lt;P&gt;Synchronous Processing in database update.&lt;/P&gt;&lt;P&gt;Transfer data for more than one transaction.&lt;/P&gt;&lt;P&gt;Batch input processing log will be generated.&lt;/P&gt;&lt;P&gt;During processing, no transaction is started until the previous transaction has been written to the database.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL TRANSACTION METHOD :&lt;/P&gt;&lt;P&gt;This is another method to transfer data from the legacy system.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Features:&lt;/P&gt;&lt;P&gt;Synchronous processing. The system performs a database commit immediately before and after the CALL TRANSACTION USING statement.&lt;/P&gt;&lt;P&gt;Updating the database can be either synchronous or asynchronous. The program specifies the update type.&lt;/P&gt;&lt;P&gt;Transfer data for a single transaction.&lt;/P&gt;&lt;P&gt;Transfers data for a sequence of dialog screens.&lt;/P&gt;&lt;P&gt;No batch input processing log is generated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For BDC:&lt;/P&gt;&lt;P&gt;&lt;A href="http://myweb.dal.ca/hchinni/sap/bdc_home.htm" target="test_blank"&gt;http://myweb.dal.ca/hchinni/sap/bdc_home.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/bdc&amp;amp;" target="test_blank"&gt;https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/bdc&amp;amp;&lt;/A&gt;;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sap-img.com/abap/learning-bdc-programming.htm" target="test_blank"&gt;http://www.sap-img.com/abap/learning-bdc-programming.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sapdevelopment.co.uk/bdc/bdchome.htm" target="test_blank"&gt;http://www.sapdevelopment.co.uk/bdc/bdchome.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sap-img.com/abap/difference-between-batch-input-and-call-transaction-in-bdc.htm" target="test_blank"&gt;http://www.sap-img.com/abap/difference-between-batch-input-and-call-transaction-in-bdc.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_47x200/helpdata/en/69/c250684ba111d189750000e8322d00/frameset.htm" target="test_blank"&gt;http://help.sap.com/saphelp_47x200/helpdata/en/69/c250684ba111d189750000e8322d00/frameset.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sapbrain.com/TUTORIALS/TECHNICAL/BDC_tutorial.html" target="test_blank"&gt;http://www.sapbrain.com/TUTORIALS/TECHNICAL/BDC_tutorial.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check these link:&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sap-img.com/abap/difference-between-batch-input-and-call-transaction-in-bdc.htm" target="test_blank"&gt;http://www.sap-img.com/abap/difference-between-batch-input-and-call-transaction-in-bdc.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sap-img.com/abap/question-about-bdc-program.htm" target="test_blank"&gt;http://www.sap-img.com/abap/question-about-bdc-program.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.itcserver.com/blog/2006/06/30/batch-input-vs-call-transaction/" target="test_blank"&gt;http://www.itcserver.com/blog/2006/06/30/batch-input-vs-call-transaction/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.planetsap.com/bdc_main_page.htm" target="test_blank"&gt;http://www.planetsap.com/bdc_main_page.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="2491514"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check the following links:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sap-img.com/bdc.htm" target="test_blank"&gt;http://www.sap-img.com/bdc.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See below example code :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Call three FM : BDC_OPEN_GROUP,BDC_INSERT and BDC_CLOSE_GROUP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Once you execute the program and it creates the session at SM35 Transaction.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;************************************************************************&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Report : ZMPPC011&lt;/P&gt;&lt;P&gt;Type : Data upload&lt;/P&gt;&lt;P&gt;Author : Chetan Shah&lt;/P&gt;&lt;P&gt;Date : 05/05/2005&lt;/P&gt;&lt;P&gt;Transport : DV3K919557&lt;/P&gt;&lt;P&gt;Transaction: ??&lt;/P&gt;&lt;P&gt;Description: This ABAP/4 Program creates new Production Versions&lt;/P&gt;&lt;P&gt;(C223). It accepts tab-delimited spreadsheet input and&lt;/P&gt;&lt;P&gt;creates BDC sessions.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;************************************************************************&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Modification Log&lt;/P&gt;&lt;P&gt;Date Programmer Request # Description&lt;/P&gt;&lt;P&gt;************************************************************************&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;06/10/2005 Chetan Shah DV3K919557 Initial coding&lt;/P&gt;&lt;P&gt;************************************************************************&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;report zmppc011 no standard page heading line-size 120 line-count 55&lt;/P&gt;&lt;P&gt;message-id zz.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;pool of form routines&lt;/P&gt;&lt;P&gt;include zmppn001.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Define BDC Table Structure&lt;/P&gt;&lt;P&gt;data: begin of itab_bdc_tab occurs 0.&lt;/P&gt;&lt;P&gt;include structure bdcdata.&lt;/P&gt;&lt;P&gt;data: end of itab_bdc_tab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Input record layout of Leagcy File&lt;/P&gt;&lt;P&gt;data: begin of itab_xcel occurs 0,&lt;/P&gt;&lt;P&gt;matnr(18) type c,&lt;/P&gt;&lt;P&gt;werks(4) type c,&lt;/P&gt;&lt;P&gt;alnag(2) type c,&lt;/P&gt;&lt;P&gt;verid(4) type c,&lt;/P&gt;&lt;P&gt;text1(40) type c,&lt;/P&gt;&lt;P&gt;bstmi like mkal-bstmi,&lt;/P&gt;&lt;P&gt;bstma like mkal-bstma,&lt;/P&gt;&lt;P&gt;adatu(10) type c,&lt;/P&gt;&lt;P&gt;bdatu(10) type c,&lt;/P&gt;&lt;P&gt;stlal(2) type c,&lt;/P&gt;&lt;P&gt;stlan(1) type c,&lt;/P&gt;&lt;P&gt;serkz(1) type c,&lt;/P&gt;&lt;P&gt;mdv01(8) type c,&lt;/P&gt;&lt;P&gt;elpro(4) type c,&lt;/P&gt;&lt;P&gt;alort(4) type c,&lt;/P&gt;&lt;P&gt;end of itab_xcel.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: begin of lt_pp04_cache occurs 0,&lt;/P&gt;&lt;P&gt;matnr like itab_xcel-matnr,&lt;/P&gt;&lt;P&gt;werks like itab_xcel-werks,&lt;/P&gt;&lt;P&gt;alnag like itab_xcel-alnag,&lt;/P&gt;&lt;P&gt;plnnr like mapl-plnnr,&lt;/P&gt;&lt;P&gt;arbpl like crhd-arbpl,&lt;/P&gt;&lt;P&gt;ktext like crtx-ktext,&lt;/P&gt;&lt;P&gt;end of lt_pp04_cache.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: v_ssnnr(4) type n,&lt;/P&gt;&lt;P&gt;v_lines_in_xcel like sy-tabix,&lt;/P&gt;&lt;P&gt;v_ssnname like apqi-groupid,&lt;/P&gt;&lt;P&gt;v_trans_in_ssn type i,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa_xcel LIKE itab_xcel,&lt;/P&gt;&lt;P&gt;l_tabix like sy-tabix,&lt;/P&gt;&lt;P&gt;v_matnr like rc27m-matnr,&lt;/P&gt;&lt;P&gt;v_plnnr like mapl-plnnr,&lt;/P&gt;&lt;P&gt;v_plnal like mapl-plnal,&lt;/P&gt;&lt;P&gt;v_tcode like sy-tcode value 'C223',&lt;/P&gt;&lt;P&gt;v_plnty like plas-plnty value 'R',&lt;/P&gt;&lt;P&gt;v_objty like crhd-objty value 'A',&lt;/P&gt;&lt;P&gt;v_plpo_steus like plpo-steus value 'PP04',&lt;/P&gt;&lt;P&gt;v_verwe like crhd-verwe value '0007'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Parameters&lt;/P&gt;&lt;P&gt;selection-screen: skip 3.&lt;/P&gt;&lt;P&gt;selection-screen: begin of block 1 with frame.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;parameters: p_name like rlgrap-filename&lt;/P&gt;&lt;P&gt;default 'C:\My Documents\InputFile.txt'&lt;/P&gt;&lt;P&gt;obligatory,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;bdc session name prefix&lt;/P&gt;&lt;P&gt;p_bdcpfx(6) default 'ZPVCRT'&lt;/P&gt;&lt;P&gt;obligatory,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;number for transction per BDC session&lt;/P&gt;&lt;P&gt;p_trnssn type i&lt;/P&gt;&lt;P&gt;default 2000 obligatory,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;retain the BDC session after successfull execution&lt;/P&gt;&lt;P&gt;p_keep like apqi-qerase&lt;/P&gt;&lt;P&gt;default 'X',&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;user who will be executing BDC session&lt;/P&gt;&lt;P&gt;p_uname like apqi-userid&lt;/P&gt;&lt;P&gt;default sy-uname&lt;/P&gt;&lt;P&gt;obligatory.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;selection-screen: end of block 1.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;********************************************************&lt;/P&gt;&lt;P&gt;********************************************************&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;possible entry list (F4 dropdown) for input file name&lt;/P&gt;&lt;P&gt;at selection-screen on value-request for p_name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*-SELECT FILE FROM USERS LOCAL PC&lt;/P&gt;&lt;P&gt;call function 'WS_FILENAME_GET'&lt;/P&gt;&lt;P&gt;exporting&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DEF_FILENAME = ' '&lt;/P&gt;&lt;P&gt;def_path = 'C:\Temp\'&lt;/P&gt;&lt;P&gt;mask = ',.,..'&lt;/P&gt;&lt;P&gt;mode = 'O'&lt;/P&gt;&lt;P&gt;title = 'Select File '(007)&lt;/P&gt;&lt;P&gt;importing&lt;/P&gt;&lt;P&gt;filename = p_name&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;RC =&lt;/P&gt;&lt;P&gt;exceptions&lt;/P&gt;&lt;P&gt;inv_winsys = 1&lt;/P&gt;&lt;P&gt;no_batch = 2&lt;/P&gt;&lt;P&gt;selection_cancel = 3&lt;/P&gt;&lt;P&gt;selection_error = 4&lt;/P&gt;&lt;P&gt;others = 5.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno&lt;/P&gt;&lt;P&gt;WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;********************************************************&lt;/P&gt;&lt;P&gt;********************************************************&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;begin the show &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;start-of-selection.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;read data from input file&lt;/P&gt;&lt;P&gt;perform transfer_xcel_to_itab.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;loop at itab_xcel.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hang on to xcel line num&lt;/P&gt;&lt;P&gt;l_tabix = sy-tabix.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;each line in the xcel file marks begining of new prod.version defn&lt;/P&gt;&lt;P&gt;if num-of-trnas-in-session = 0, create new BDC session&lt;/P&gt;&lt;P&gt;if v_trans_in_ssn is initial.&lt;/P&gt;&lt;P&gt;perform bdc_session_open.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;begin new bdc script for rtg create trans&lt;/P&gt;&lt;P&gt;fill in bdc-data for prod.version maintenance screens&lt;/P&gt;&lt;P&gt;perform bdc_build_script.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;insert the bdc script as a BDC transaction&lt;/P&gt;&lt;P&gt;perform bdc_submit_transaction.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;keep track of how many BDC transactions were inserted in the BDC&lt;/P&gt;&lt;P&gt;session&lt;/P&gt;&lt;P&gt;add 1 to v_trans_in_ssn.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if the user-specified num of trans in BDC session is reached OR&lt;/P&gt;&lt;P&gt;if end of input file is reached, close the BDC session&lt;/P&gt;&lt;P&gt;if v_trans_in_ssn = p_trnssn or&lt;/P&gt;&lt;P&gt;l_tabix = v_lines_in_xcel.&lt;/P&gt;&lt;P&gt;perform bdc_session_close.&lt;/P&gt;&lt;P&gt;clear v_trans_in_ssn.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;top-of-page.&lt;/P&gt;&lt;P&gt;call function 'Z_HEADER'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;FLEX_TEXT1 =&lt;/P&gt;&lt;P&gt;FLEX_TEXT2 =&lt;/P&gt;&lt;P&gt;FLEX_TEXT3 =&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM TRANSFER_XCEL_TO_ITAB *&lt;/P&gt;&lt;P&gt;Transfer Xcel Spreadsheet to SAP Internal Table * form transfer_xcel_to_itab.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Read the tab-delimited file into itab&lt;/P&gt;&lt;P&gt;call function 'WS_UPLOAD'&lt;/P&gt;&lt;P&gt;exporting&lt;/P&gt;&lt;P&gt;filename = p_name&lt;/P&gt;&lt;P&gt;filetype = 'DAT'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IMPORTING&lt;/P&gt;&lt;P&gt;filelength = flength&lt;/P&gt;&lt;P&gt;tables&lt;/P&gt;&lt;P&gt;data_tab = itab_xcel&lt;/P&gt;&lt;P&gt;exceptions&lt;/P&gt;&lt;P&gt;conversion_error = 1&lt;/P&gt;&lt;P&gt;file_open_error = 2&lt;/P&gt;&lt;P&gt;file_read_error = 3&lt;/P&gt;&lt;P&gt;invalid_table_width = 4&lt;/P&gt;&lt;P&gt;invalid_type = 5&lt;/P&gt;&lt;P&gt;no_batch = 6&lt;/P&gt;&lt;P&gt;unknown_error = 7&lt;/P&gt;&lt;P&gt;others = 8.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort the data&lt;/P&gt;&lt;P&gt;sort itab_xcel by matnr werks.&lt;/P&gt;&lt;P&gt;clear v_lines_in_xcel.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if no data in the file - error out&lt;/P&gt;&lt;P&gt;describe table itab_xcel lines v_lines_in_xcel.&lt;/P&gt;&lt;P&gt;if v_lines_in_xcel is initial.&lt;/P&gt;&lt;P&gt;write: / 'No data in input file'.&lt;/P&gt;&lt;P&gt;stop.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if file upload failed - error out&lt;/P&gt;&lt;P&gt;write: / 'Error reading input file'.&lt;/P&gt;&lt;P&gt;stop.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM BDC_SESSION_OPEN *&lt;/P&gt;&lt;P&gt;Open BDC Session * form bdc_session_open.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;create bdc session name = prefix-from-selectn-screen + nnnn&lt;/P&gt;&lt;P&gt;add 1 to v_ssnnr.&lt;/P&gt;&lt;P&gt;concatenate p_bdcpfx v_ssnnr into v_ssnname.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;open new bdc session&lt;/P&gt;&lt;P&gt;call function 'BDC_OPEN_GROUP'&lt;/P&gt;&lt;P&gt;exporting&lt;/P&gt;&lt;P&gt;client = sy-mandt&lt;/P&gt;&lt;P&gt;group = v_ssnname&lt;/P&gt;&lt;P&gt;keep = p_keep&lt;/P&gt;&lt;P&gt;user = p_uname&lt;/P&gt;&lt;P&gt;exceptions&lt;/P&gt;&lt;P&gt;client_invalid = 1&lt;/P&gt;&lt;P&gt;destination_invalid = 2&lt;/P&gt;&lt;P&gt;group_invalid = 3&lt;/P&gt;&lt;P&gt;group_is_locked = 4&lt;/P&gt;&lt;P&gt;holddate_invalid = 5&lt;/P&gt;&lt;P&gt;internal_error = 6&lt;/P&gt;&lt;P&gt;queue_error = 7&lt;/P&gt;&lt;P&gt;running = 8&lt;/P&gt;&lt;P&gt;system_lock_error = 9&lt;/P&gt;&lt;P&gt;user_invalid = 10&lt;/P&gt;&lt;P&gt;others = 11.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM BDC_BUILD_SCRIPT *&lt;/P&gt;&lt;P&gt;Build BDC * form bdc_build_script.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: l_arbpl like crhd-arbpl,&lt;/P&gt;&lt;P&gt;l_text1 like mkal-text1,&lt;/P&gt;&lt;P&gt;l_mdv01 like mkal-mdv01,&lt;/P&gt;&lt;P&gt;l_mapl like mapl.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;clear bdc-data itab - begin of new bdc transaction&lt;/P&gt;&lt;P&gt;clear itab_bdc_tab.&lt;/P&gt;&lt;P&gt;refresh itab_bdc_tab.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;read material cross reference tables to determine sap part#&lt;/P&gt;&lt;P&gt;clear : v_matnr, v_plnnr, v_plnal.&lt;/P&gt;&lt;P&gt;perform read_matnr_cross_ref using itab_xcel-matnr&lt;/P&gt;&lt;P&gt;itab_xcel-werks&lt;/P&gt;&lt;P&gt;changing v_matnr.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;determine the version description to use&lt;/P&gt;&lt;P&gt;if itab_xcel-text1 is initial.&lt;/P&gt;&lt;P&gt;l_text1 = itab_xcel-verid.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;l_text1 = itab_xcel-text1.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;determine the routing group# and group ctr# to use&lt;/P&gt;&lt;P&gt;perform read_routing .&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;determine the production line to use&lt;/P&gt;&lt;P&gt;if itab_xcel-mdv01 is initial.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if not provided in the file then:&lt;/P&gt;&lt;P&gt;prod line = work ctr on the last PP04 op of the rtg determined above&lt;/P&gt;&lt;P&gt;perform read_wc_on_last_pp04 using v_plnnr v_plnal&lt;/P&gt;&lt;P&gt;changing l_mdv01.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NOTE: when executing the above form\routine, if v_plnnr is initial&lt;/P&gt;&lt;P&gt;or v_plnal is initial, THEN l_mdv01 will automatically be&lt;/P&gt;&lt;P&gt;returned blank (ie initial)&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;l_mdv01 = itab_xcel-mdv01.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;build bdc script&lt;/P&gt;&lt;P&gt;perform bdc_build_script_record&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;fill in initial screen&lt;/P&gt;&lt;P&gt;using: 'X' 'SAPLCMFV' '1000',&lt;/P&gt;&lt;P&gt;' ' 'BDC_OKCODE' '=ENTE',&lt;/P&gt;&lt;P&gt;' ' 'MKAL-WERKS' itab_xcel-werks,&lt;/P&gt;&lt;P&gt;' ' 'MKAL-MATNR' v_matnr,&lt;/P&gt;&lt;P&gt;' ' 'MKAL_ADMIN-DISPO' space,&lt;/P&gt;&lt;P&gt;' ' 'MKAL-PLNNR' space,&lt;/P&gt;&lt;P&gt;' ' 'MKAL_ADMIN-STTAG' space,&lt;/P&gt;&lt;P&gt;' ' 'MKAL-PLNNG' space,&lt;/P&gt;&lt;P&gt;' ' 'MKAL-MDV01' space,&lt;/P&gt;&lt;P&gt;' ' 'MKAL-PLNNM' space,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;click create button on initial screen and go to detail screen&lt;/P&gt;&lt;P&gt;'X' 'SAPLCMFV' '1000',&lt;/P&gt;&lt;P&gt;' ' 'BDC_OKCODE' '=CREA',&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;fill in the detail screen and go back to initial screen&lt;/P&gt;&lt;P&gt;'X' 'SAPLCMFV' '2000',&lt;/P&gt;&lt;P&gt;' ' 'BDC_OKCODE' '=CLOS',&lt;/P&gt;&lt;P&gt;' ' 'MKAL_EXPAND-MATNR' v_matnr,&lt;/P&gt;&lt;P&gt;' ' 'MKAL_EXPAND-VERID' itab_xcel-verid,&lt;/P&gt;&lt;P&gt;' ' 'MKAL_EXPAND-TEXT1' l_text1,&lt;/P&gt;&lt;P&gt;' ' 'MKAL_EXPAND-BSTMI' itab_xcel-bstmi,&lt;/P&gt;&lt;P&gt;' ' 'MKAL_EXPAND-BSTMA' itab_xcel-bstma,&lt;/P&gt;&lt;P&gt;' ' 'MKAL_EXPAND-ADATU' itab_xcel-adatu,&lt;/P&gt;&lt;P&gt;' ' 'MKAL_EXPAND-BDATU' itab_xcel-bdatu,&lt;/P&gt;&lt;P&gt;' ' 'MKAL_EXPAND-PLTYG' v_plnty,&lt;/P&gt;&lt;P&gt;' ' 'MKAL_EXPAND-PLNNG' v_plnnr,&lt;/P&gt;&lt;P&gt;' ' 'MKAL_EXPAND-ALNAG' v_plnal,&lt;/P&gt;&lt;P&gt;' ' 'MKAL_EXPAND-STLAL' itab_xcel-stlal,&lt;/P&gt;&lt;P&gt;' ' 'MKAL_EXPAND-STLAN' itab_xcel-stlan,&lt;/P&gt;&lt;P&gt;' ' 'MKAL_EXPAND-SERKZ' itab_xcel-serkz,&lt;/P&gt;&lt;P&gt;' ' 'MKAL_EXPAND-MDV01' l_mdv01,&lt;/P&gt;&lt;P&gt;' ' 'MKAL_EXPAND-ELPRO' itab_xcel-elpro,&lt;/P&gt;&lt;P&gt;' ' 'MKAL_EXPAND-ALORT' itab_xcel-alort,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;save the production version from initial screen&lt;/P&gt;&lt;P&gt;'X' 'SAPLCMFV' '1000',&lt;/P&gt;&lt;P&gt;' ' 'BDC_OKCODE' '=SAVE'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM BDC_SUBMIT_TRANSACTION *&lt;/P&gt;&lt;P&gt;Submit BDC Session * form bdc_submit_transaction.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Load BDC script as a trqansction in BDC session&lt;/P&gt;&lt;P&gt;call function 'BDC_INSERT'&lt;/P&gt;&lt;P&gt;exporting&lt;/P&gt;&lt;P&gt;tcode = v_tcode&lt;/P&gt;&lt;P&gt;tables&lt;/P&gt;&lt;P&gt;dynprotab = itab_bdc_tab&lt;/P&gt;&lt;P&gt;exceptions&lt;/P&gt;&lt;P&gt;internal_error = 01&lt;/P&gt;&lt;P&gt;not_open = 02&lt;/P&gt;&lt;P&gt;queue_error = 03&lt;/P&gt;&lt;P&gt;tcode_invalid = 04.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM BDC_BUILD_SCRIPT_RECORD * form bdc_build_script_record using dynbegin name value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;clear itab_bdc_tab.&lt;/P&gt;&lt;P&gt;if dynbegin = 'X'.&lt;/P&gt;&lt;P&gt;move: name to itab_bdc_tab-program,&lt;/P&gt;&lt;P&gt;value to itab_bdc_tab-dynpro,&lt;/P&gt;&lt;P&gt;'X' to itab_bdc_tab-dynbegin.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;move: name to itab_bdc_tab-fnam,&lt;/P&gt;&lt;P&gt;value to itab_bdc_tab-fval.&lt;/P&gt;&lt;P&gt;shift itab_bdc_tab-fval left deleting leading space.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;append itab_bdc_tab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM BDC_SESSION_CLOSE *&lt;/P&gt;&lt;P&gt;Close BDC Session * form bdc_session_close.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;close the session&lt;/P&gt;&lt;P&gt;call function 'BDC_CLOSE_GROUP'&lt;/P&gt;&lt;P&gt;exceptions&lt;/P&gt;&lt;P&gt;not_open = 1&lt;/P&gt;&lt;P&gt;queue_error = 2&lt;/P&gt;&lt;P&gt;others = 3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;skip 2.&lt;/P&gt;&lt;P&gt;if sy-subrc ne 0.&lt;/P&gt;&lt;P&gt;write: / 'Error Closing BDC Session ' , 'RETURN CODE: ', sy-subrc.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;write : / 'Session created:', v_ssnname,&lt;/P&gt;&lt;P&gt;50 '# of transactions:', v_trans_in_ssn.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform.&lt;/P&gt;&lt;P&gt;&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;*&amp;amp; Form read_routing_cache&lt;/P&gt;&lt;P&gt;&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;*FORM read_routing_cache USING pi_matnr&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;pi_werks&lt;/P&gt;&lt;P&gt;pi_alnag&lt;/P&gt;&lt;P&gt;pi_verid&lt;/P&gt;&lt;P&gt;pi_mdv01.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF lt_plpo OCCURS 0,&lt;/P&gt;&lt;P&gt;vornr LIKE plpo-vornr,&lt;/P&gt;&lt;P&gt;objty LIKE crhd-objty,&lt;/P&gt;&lt;P&gt;objid LIKE crhd-objid,&lt;/P&gt;&lt;P&gt;arbpl LIKE crhd-arbpl,&lt;/P&gt;&lt;P&gt;END OF lt_plpo,&lt;/P&gt;&lt;P&gt;l_mapl_plnnr LIKE mapl-plnnr.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;determine the routing group#&lt;/P&gt;&lt;P&gt;CLEAR lt_pp04_cache.&lt;/P&gt;&lt;P&gt;chk if its in the cache first, if not then get it from MAPL table&lt;/P&gt;&lt;P&gt;and put it in the cache&lt;/P&gt;&lt;P&gt;READ TABLE lt_pp04_cache WITH KEY matnr = pi_matnr&lt;/P&gt;&lt;P&gt;werks = pi_werks&lt;/P&gt;&lt;P&gt;alnag = pi_alnag.&lt;/P&gt;&lt;P&gt;IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;do nothing - lt_pp04_cache header line has rtg#&lt;/P&gt;&lt;P&gt;ELSE.&lt;/P&gt;&lt;P&gt;get the routing group # from MAPL&lt;/P&gt;&lt;P&gt;SELECT plnnr INTO l_mapl_plnnr&lt;/P&gt;&lt;P&gt;FROM mapl UP TO 1 ROWS&lt;/P&gt;&lt;P&gt;WHERE matnr = pi_matnr AND&lt;/P&gt;&lt;P&gt;werks = pi_werks AND&lt;/P&gt;&lt;P&gt;plnty = 'R' AND&lt;/P&gt;&lt;P&gt;plnal = pi_alnag AND&lt;/P&gt;&lt;P&gt;loekz = space.&lt;/P&gt;&lt;P&gt;ENDSELECT.&lt;/P&gt;&lt;P&gt;put it in the cache internal table&lt;/P&gt;&lt;P&gt;IF NOT l_mapl_plnnr IS INITIAL.&lt;/P&gt;&lt;P&gt;lt_pp04_cache-matnr = pi_matnr.&lt;/P&gt;&lt;P&gt;lt_pp04_cache-werks = pi_werks.&lt;/P&gt;&lt;P&gt;lt_pp04_cache-alnag = pi_alnag.&lt;/P&gt;&lt;P&gt;lt_pp04_cache-plnnr = l_mapl_plnnr.&lt;/P&gt;&lt;P&gt;APPEND lt_pp04_cache.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if the rtg# was determined AND&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    *&lt;/P&gt;&lt;P&gt;          o the work center was not determined yet AND&lt;/P&gt;&lt;P&gt;          o work center was really needed for this line in the input file&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    *&lt;/P&gt;&lt;P&gt;          o read the work center from last PP04 operation on the routing&lt;/P&gt;&lt;P&gt;          o update the cache accordingly&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF NOT lt_pp04_cache-plnnr IS INITIAL AND&lt;/P&gt;&lt;P&gt;lt_pp04_cache-arbpl IS INITIAL AND&lt;/P&gt;&lt;P&gt;( pi_verid IS INITIAL OR&lt;/P&gt;&lt;P&gt;pi_mdv01 IS INITIAL ).&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;read the last PP04 operation&lt;/P&gt;&lt;P&gt;CLEAR lt_plpo.&lt;/P&gt;&lt;P&gt;REFRESH lt_plpo.&lt;/P&gt;&lt;P&gt;SELECT vornr e&lt;SUB&gt;objty e&lt;/SUB&gt;objid e~arbpl&lt;/P&gt;&lt;P&gt;INTO CORRESPONDING FIELDS OF TABLE lt_plpo&lt;/P&gt;&lt;P&gt;FROM plas AS b&lt;/P&gt;&lt;P&gt;INNER JOIN plpo AS c&lt;/P&gt;&lt;P&gt;ON b&lt;SUB&gt;plnty = c&lt;/SUB&gt;plnty AND&lt;/P&gt;&lt;P&gt;b&lt;SUB&gt;plnnr = c&lt;/SUB&gt;plnnr AND&lt;/P&gt;&lt;P&gt;b&lt;SUB&gt;zaehl = c&lt;/SUB&gt;zaehl&lt;/P&gt;&lt;P&gt;INNER JOIN crhd AS e&lt;/P&gt;&lt;P&gt;ON c&lt;SUB&gt;arbid = e&lt;/SUB&gt;objid&lt;/P&gt;&lt;P&gt;WHERE b~plnty = v_plnty AND&lt;/P&gt;&lt;P&gt;b~plnnr = lt_pp04_cache-plnnr AND&lt;/P&gt;&lt;P&gt;b~plnal = lt_pp04_cache-alnag AND&lt;/P&gt;&lt;P&gt;c~loekz = space AND&lt;/P&gt;&lt;P&gt;c~steus = v_plpo_steus AND&lt;/P&gt;&lt;P&gt;e~objty = v_objty AND&lt;/P&gt;&lt;P&gt;e~werks = lt_pp04_cache-werks AND&lt;/P&gt;&lt;P&gt;e~verwe = v_verwe.&lt;/P&gt;&lt;P&gt;SORT lt_plpo BY vornr DESCENDING.&lt;/P&gt;&lt;P&gt;READ TABLE lt_plpo INDEX 1.&lt;/P&gt;&lt;P&gt;**&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF NOT lt_plpo-arbpl IS INITIAL.&lt;/P&gt;&lt;P&gt;lt_pp04_cache-arbpl = lt_plpo-arbpl.&lt;/P&gt;&lt;P&gt;read work center description&lt;/P&gt;&lt;P&gt;SELECT SINGLE ktext INTO lt_pp04_cache-ktext&lt;/P&gt;&lt;P&gt;FROM crtx WHERE objty = lt_plpo-objty AND&lt;/P&gt;&lt;P&gt;objid = lt_plpo-objid AND&lt;/P&gt;&lt;P&gt;spras = sy-langu.&lt;/P&gt;&lt;P&gt;the following read will get the index of the correct record to be&lt;/P&gt;&lt;P&gt;updated in the cache&lt;/P&gt;&lt;P&gt;READ TABLE lt_pp04_cache&lt;/P&gt;&lt;P&gt;WITH KEY matnr = pi_matnr&lt;/P&gt;&lt;P&gt;werks = pi_werks&lt;/P&gt;&lt;P&gt;alnag = pi_alnag.&lt;/P&gt;&lt;P&gt;MODIFY lt_pp04_cache&lt;/P&gt;&lt;P&gt;INDEX sy-tabix&lt;/P&gt;&lt;P&gt;TRANSPORTING arbpl ktext.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;*ENDFORM. " read_last_pp04_operation_cache&lt;/P&gt;&lt;P&gt;&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;*&amp;amp; Form read_routing&lt;/P&gt;&lt;P&gt;&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;form read_routing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: begin of lt_mapl occurs 0,&lt;/P&gt;&lt;P&gt;plnnr like mapl-plnnr,&lt;/P&gt;&lt;P&gt;plnal like mapl-plnal,&lt;/P&gt;&lt;P&gt;end of lt_mapl,&lt;/P&gt;&lt;P&gt;l_arbpl like crhd-arbpl.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;get all the rtg# and grp ctr# from MAPL&lt;/P&gt;&lt;P&gt;select plnnr plnal&lt;/P&gt;&lt;P&gt;into corresponding fields of table lt_mapl&lt;/P&gt;&lt;P&gt;from mapl&lt;/P&gt;&lt;P&gt;where matnr = v_matnr and&lt;/P&gt;&lt;P&gt;werks = itab_xcel-werks and&lt;/P&gt;&lt;P&gt;plnty = v_plnty and "Rate Routing&lt;/P&gt;&lt;P&gt;loekz = space. "with del flag = OFF&lt;/P&gt;&lt;P&gt;sort lt_mapl by plnal.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if not itab_xcel-verid is initial.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if the verid=0001 then use the 1st good rtg-grp# and grp-ctr#&lt;/P&gt;&lt;P&gt;if itab_xcel-verid = '0001'.&lt;/P&gt;&lt;P&gt;read table lt_mapl index 1.&lt;/P&gt;&lt;P&gt;v_plnnr = lt_mapl-plnnr.&lt;/P&gt;&lt;P&gt;v_plnal = lt_mapl-plnal.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if the verid0001 then use the rtg-grp# and grp-ctr# of the routing&lt;/P&gt;&lt;P&gt;whose work center on the last PP04 operation matches the given verid&lt;/P&gt;&lt;P&gt;loop at lt_mapl.&lt;/P&gt;&lt;P&gt;clear l_arbpl.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;get the work center from the last PP04 operation&lt;/P&gt;&lt;P&gt;perform read_wc_on_last_pp04 using lt_mapl-plnnr&lt;/P&gt;&lt;P&gt;lt_mapl-plnal&lt;/P&gt;&lt;P&gt;changing l_arbpl.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;if itab_xcel-verid = l_arbpl.&lt;/P&gt;&lt;P&gt;v_plnnr = lt_mapl-plnnr.&lt;/P&gt;&lt;P&gt;v_plnal = lt_mapl-plnal.&lt;/P&gt;&lt;P&gt;exit.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;do nothing&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For version IDs that are other then '0000' or 'ZWIP' :--&lt;/P&gt;&lt;P&gt;if itab_xcel-verid NE '0000' and&lt;/P&gt;&lt;P&gt;itab_xcel-verid NE 'ZWIP'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if routing group# or group counter was not determined, make the&lt;/P&gt;&lt;P&gt;valid-to date 99/99/9999 so that the BDC, on execution, errors out.&lt;/P&gt;&lt;P&gt;if v_plnnr is initial or&lt;/P&gt;&lt;P&gt;v_plnal is initial.&lt;/P&gt;&lt;P&gt;itab_xcel-bdatu = '99/99/9999'.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;determine the routing group#&lt;/P&gt;&lt;P&gt;CLEAR lt_pp04_cache.&lt;/P&gt;&lt;P&gt;chk if its in the cache first, if not then get it from MAPL table&lt;/P&gt;&lt;P&gt;and put it in the cache&lt;/P&gt;&lt;P&gt;READ TABLE lt_pp04_cache WITH KEY matnr = pi_matnr&lt;/P&gt;&lt;P&gt;werks = pi_werks&lt;/P&gt;&lt;P&gt;alnag = pi_alnag.&lt;/P&gt;&lt;P&gt;IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;do nothing - lt_pp04_cache header line has rtg#&lt;/P&gt;&lt;P&gt;ELSE.&lt;/P&gt;&lt;P&gt;get the routing group # from MAPL&lt;/P&gt;&lt;P&gt;put it in the cache internal table&lt;/P&gt;&lt;P&gt;IF NOT l_mapl_plnnr IS INITIAL.&lt;/P&gt;&lt;P&gt;lt_pp04_cache-matnr = pi_matnr.&lt;/P&gt;&lt;P&gt;lt_pp04_cache-werks = pi_werks.&lt;/P&gt;&lt;P&gt;lt_pp04_cache-alnag = pi_alnag.&lt;/P&gt;&lt;P&gt;lt_pp04_cache-plnnr = l_mapl_plnnr.&lt;/P&gt;&lt;P&gt;APPEND lt_pp04_cache.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if the rtg# was determined AND&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    *&lt;/P&gt;&lt;P&gt;          o the work center was not determined yet AND&lt;/P&gt;&lt;P&gt;          o work center was really needed for this line in the input file&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    *&lt;/P&gt;&lt;P&gt;          o read the work center from last PP04 operation on the routing&lt;/P&gt;&lt;P&gt;          o update the cache accordingly&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF NOT lt_pp04_cache-plnnr IS INITIAL AND&lt;/P&gt;&lt;P&gt;lt_pp04_cache-arbpl IS INITIAL AND&lt;/P&gt;&lt;P&gt;( pi_verid IS INITIAL OR&lt;/P&gt;&lt;P&gt;pi_mdv01 IS INITIAL ).&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;read the last PP04 operation&lt;/P&gt;&lt;P&gt;CLEAR lt_plpo.&lt;/P&gt;&lt;P&gt;REFRESH lt_plpo.&lt;/P&gt;&lt;P&gt;SELECT vornr e&lt;SUB&gt;objty e&lt;/SUB&gt;objid e~arbpl&lt;/P&gt;&lt;P&gt;INTO CORRESPONDING FIELDS OF TABLE lt_plpo&lt;/P&gt;&lt;P&gt;FROM plas AS b&lt;/P&gt;&lt;P&gt;INNER JOIN plpo AS c&lt;/P&gt;&lt;P&gt;ON b&lt;SUB&gt;plnty = c&lt;/SUB&gt;plnty AND&lt;/P&gt;&lt;P&gt;b&lt;SUB&gt;plnnr = c&lt;/SUB&gt;plnnr AND&lt;/P&gt;&lt;P&gt;b&lt;SUB&gt;zaehl = c&lt;/SUB&gt;zaehl&lt;/P&gt;&lt;P&gt;INNER JOIN crhd AS e&lt;/P&gt;&lt;P&gt;ON c&lt;SUB&gt;arbid = e&lt;/SUB&gt;objid&lt;/P&gt;&lt;P&gt;WHERE b~plnty = v_plnty AND&lt;/P&gt;&lt;P&gt;b~plnnr = lt_pp04_cache-plnnr AND&lt;/P&gt;&lt;P&gt;b~plnal = lt_pp04_cache-alnag AND&lt;/P&gt;&lt;P&gt;c~loekz = space AND&lt;/P&gt;&lt;P&gt;c~steus = v_plpo_steus AND&lt;/P&gt;&lt;P&gt;e~objty = v_objty AND&lt;/P&gt;&lt;P&gt;e~werks = lt_pp04_cache-werks AND&lt;/P&gt;&lt;P&gt;e~verwe = v_verwe.&lt;/P&gt;&lt;P&gt;SORT lt_plpo BY vornr DESCENDING.&lt;/P&gt;&lt;P&gt;READ TABLE lt_plpo INDEX 1.&lt;/P&gt;&lt;P&gt;**&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF NOT lt_plpo-arbpl IS INITIAL.&lt;/P&gt;&lt;P&gt;lt_pp04_cache-arbpl = lt_plpo-arbpl.&lt;/P&gt;&lt;P&gt;read work center description&lt;/P&gt;&lt;P&gt;SELECT SINGLE ktext INTO lt_pp04_cache-ktext&lt;/P&gt;&lt;P&gt;FROM crtx WHERE objty = lt_plpo-objty AND&lt;/P&gt;&lt;P&gt;objid = lt_plpo-objid AND&lt;/P&gt;&lt;P&gt;spras = sy-langu.&lt;/P&gt;&lt;P&gt;the following read will get the index of the correct record to be&lt;/P&gt;&lt;P&gt;updated in the cache&lt;/P&gt;&lt;P&gt;READ TABLE lt_pp04_cache&lt;/P&gt;&lt;P&gt;WITH KEY matnr = pi_matnr&lt;/P&gt;&lt;P&gt;werks = pi_werks&lt;/P&gt;&lt;P&gt;alnag = pi_alnag.&lt;/P&gt;&lt;P&gt;MODIFY lt_pp04_cache&lt;/P&gt;&lt;P&gt;INDEX sy-tabix&lt;/P&gt;&lt;P&gt;TRANSPORTING arbpl ktext.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. " read_last_pp04_operation_cache&lt;/P&gt;&lt;P&gt;&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;*&amp;amp; Form read_wc_on_last_pp04&lt;/P&gt;&lt;P&gt;&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;form read_wc_on_last_pp04 using pi_plnnr&lt;/P&gt;&lt;P&gt;pi_plnal&lt;/P&gt;&lt;P&gt;changing pe_arbpl.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: begin of lt_plpo occurs 0,&lt;/P&gt;&lt;P&gt;vornr like plpo-vornr,&lt;/P&gt;&lt;P&gt;objty like crhd-objty,&lt;/P&gt;&lt;P&gt;objid like crhd-objid,&lt;/P&gt;&lt;P&gt;arbpl like crhd-arbpl,&lt;/P&gt;&lt;P&gt;end of lt_plpo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;get all the PP04 operations for the given rtg# &amp;amp; grp-ctr#&lt;/P&gt;&lt;P&gt;select vornr e&lt;SUB&gt;objty e&lt;/SUB&gt;objid e~arbpl&lt;/P&gt;&lt;P&gt;into corresponding fields of table lt_plpo&lt;/P&gt;&lt;P&gt;from plas as b&lt;/P&gt;&lt;P&gt;inner join plpo as c&lt;/P&gt;&lt;P&gt;on b&lt;SUB&gt;plnty = c&lt;/SUB&gt;plnty and&lt;/P&gt;&lt;P&gt;b&lt;SUB&gt;plnnr = c&lt;/SUB&gt;plnnr and&lt;/P&gt;&lt;P&gt;b&lt;SUB&gt;zaehl = c&lt;/SUB&gt;zaehl&lt;/P&gt;&lt;P&gt;inner join crhd as e&lt;/P&gt;&lt;P&gt;on c&lt;SUB&gt;arbid = e&lt;/SUB&gt;objid&lt;/P&gt;&lt;P&gt;where b~plnty = v_plnty and "Rate Routing&lt;/P&gt;&lt;P&gt;b~plnnr = pi_plnnr and&lt;/P&gt;&lt;P&gt;b~plnal = pi_plnal and&lt;/P&gt;&lt;P&gt;c~loekz = space and "Oper Del Flag = OFF&lt;/P&gt;&lt;P&gt;c~steus = v_plpo_steus and "PP04&lt;/P&gt;&lt;P&gt;e~objty = v_objty. "WC Obj Type = 'A'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;read the last operation&lt;/P&gt;&lt;P&gt;sort lt_plpo by vornr descending.&lt;/P&gt;&lt;P&gt;read table lt_plpo index 1.&lt;/P&gt;&lt;P&gt;pe_arbpl = lt_plpo-arbpl.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. " read_wc_on_last_pp04&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Goto LSMW-&amp;gt; Select Direct Input method in 1st step. These are the standard programs for data transfer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Otherwise goto SPRO-&amp;gt;SAP Reference IMG-&amp;gt; Under this you'll find standard data transfer programs module wise.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regs,&lt;/P&gt;&lt;P&gt;Hema.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 03 Feb 2008 06:11:23 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-02-03T06:11:23Z</dc:date>
    <item>
      <title>BDC</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bdc/m-p/3310948#M793006</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI,&lt;/P&gt;&lt;P&gt;    In BDC , wat is the difference between a call transaction method and a session method.?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 03 Feb 2008 05:47:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bdc/m-p/3310948#M793006</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-03T05:47:11Z</dc:date>
    </item>
    <item>
      <title>Re: BDC</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bdc/m-p/3310949#M793007</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BDC allows you to perform database updates in the background using standard SAP transactions. &lt;/P&gt;&lt;P&gt;The resultant entries will be as if the user had manually entered the data via SAP. This means&lt;/P&gt;&lt;P&gt;that you do not bypass any of the standard SAP consistency checks, authorisations etc. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are two main methods of ABAP BDC, these are Call Transaction and Batch Input. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Difference between batch input and call transaction in BDC &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Session method. &lt;/P&gt;&lt;P&gt;1) synchronous processing. &lt;/P&gt;&lt;P&gt;2) can tranfer large amount of data. &lt;/P&gt;&lt;P&gt;3) processing is slower. &lt;/P&gt;&lt;P&gt;4) error log is created &lt;/P&gt;&lt;P&gt;5) data is not updated until session is processed. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Call transaction. &lt;/P&gt;&lt;P&gt;1) asynchronous processing &lt;/P&gt;&lt;P&gt;2) can transfer small amount of data &lt;/P&gt;&lt;P&gt;3) processing is faster. &lt;/P&gt;&lt;P&gt;4) errors need to be handled explicitly &lt;/P&gt;&lt;P&gt;5) data is updated automatically &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;Reward if helpful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 03 Feb 2008 05:48:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bdc/m-p/3310949#M793007</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-03T05:48:46Z</dc:date>
    </item>
    <item>
      <title>Re: BDC</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bdc/m-p/3310950#M793008</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;Session Method&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) Session method supports both small amount of data aswell as large amount of data&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) data processing is asynchronus and data updation is synchronus.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3) it process multiple apllication while perfomaning validations.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4) in session method data will be updated in data base only after processing session only.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;5) system provide by default logfile for handling error records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;6) it supports both foreground aswell as background process&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in bdc we use FM ...&lt;/P&gt;&lt;P&gt;bdc_open_group " for creating Session&lt;/P&gt;&lt;P&gt;bdc_insert " adding transaction and bdcdata table for updating database&lt;/P&gt;&lt;P&gt;bdc_close_group " for closing Session&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Call Transaction&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) Call transaction exclusively for small amout of data&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) it supports only one apllication while perfoming validations&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3) there is no default logfile, We can explicitly provide logic for creating logfile for handling error records.&lt;/P&gt;&lt;P&gt;we can create logfile by using structure....BDCMSGCOLL&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4) it doesn't support background processing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;5) data processing is synchronous and Data updation is Synchronous( default), in &lt;/P&gt;&lt;P&gt;this method also supports daya updation in asynchronus process also.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;syntax:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Call transaction &amp;lt;transaction-name&amp;gt; using BDCDATA &lt;/P&gt;&lt;P&gt;mode &amp;lt;A/N/E&amp;gt;&lt;/P&gt;&lt;P&gt;update &amp;lt;L/A/S&amp;gt;&lt;/P&gt;&lt;P&gt;messages into BDCMSGCOLL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Session&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;The most important aspects of the batch SESSION interface are: - Asynchronous processing - Transfers data for multiple transactions - Synchronous database update During processing, no transaction is started until the previous transaction has been written to the database. - A batch input processing log is generated for each session - Sessions cannot be generated in parallel &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Call Transcation&lt;/STRONG&gt; &lt;/P&gt;&lt;P&gt;The most important aspects of the CALL TRANSACTION USING interface are: - Synchronous processing - Transfers data for a single transaction - Synchronous and asynchronous database updating both possible The program specifies which kind of updating is desired. - Separate LUW for the transaction The system performs a database commit immediately before and after the CALL TRANSACTION USING statement. - No batch input processing log is generated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 03 Feb 2008 05:50:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bdc/m-p/3310950#M793008</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-03T05:50:19Z</dc:date>
    </item>
    <item>
      <title>Re: BDC</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bdc/m-p/3310951#M793009</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;About Data Transfer In R/3 System&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When a company decides to implement the SAP R/3 to manage business-critical data, it usually does not start from a no-data situation. Normally, a SAP R/3 project comes into replace or complement existing application.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the process of replacing current applications and transferring application data, two situations might occur:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;#149; The first is when application data to be replaced is transferred at once, and only once.&lt;/P&gt;&lt;P&gt;&amp;#149; The second situation is to transfer data periodically from external systems to SAP and vice versa.&lt;/P&gt;&lt;P&gt;&amp;#149; There is a period of time when information has to be transferred from existing application, to SAP R/3, and often this process will be repetitive.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The SAP system offers two primary methods for transferring data into SAP systems. From non-SAP systems or legacy system. These two methods are collectively called &amp;#147;batch input&amp;#148; or &amp;#147;batch data communication&amp;#148;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. SESSION METHOD&lt;/P&gt;&lt;P&gt;2. CALL TRANSACTION&lt;/P&gt;&lt;P&gt;3. DIRECT INPUT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Advantages offered by BATCH INPUT method:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Can process large data volumes in batch.&lt;/P&gt;&lt;P&gt;2. Can be planned and submitted in the background.&lt;/P&gt;&lt;P&gt;3. No manual interaction is required when data is transferred.&lt;/P&gt;&lt;P&gt;4. Data integrity is maintained as whatever data is transferred to the table is through transaction. Hence batch input data is submitted to all the checks and validations.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To implement one of the supported data transfers, you must often write the program that exports the data from your non-SAP system. This program, known as a &amp;#147;data transfer&amp;#148; program must map the data from the external system into the data structure required by the SAP batch input program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The batch input program must build all of the input to execute the SAP transaction.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Two main steps are required: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;#149; To build an internal table containing every screen and every field to be filled in during the execution of an SAP transaction.&lt;/P&gt;&lt;P&gt;&amp;#149; To pass the table to SAP for processing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Prerequisite for Data Transfer Program&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Writing a Data Transfer Program involves following prerequisites:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Analyzing data from local file&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Analyzing transaction&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Analyzing transaction involves following steps:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;#149; The transaction code, if you do not already know it.&lt;/P&gt;&lt;P&gt;&amp;#149; Which fields require input i.e., mandatory.&lt;/P&gt;&lt;P&gt;&amp;#149; Which fields can you allow to default to standard values.&lt;/P&gt;&lt;P&gt;&amp;#149; The names, types, and lengths of the fields that are used by a transaction.&lt;/P&gt;&lt;P&gt;&amp;#149; Screen number and Name of module pool program behind a particular transaction.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To analyze a transaction::&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;#149; Start the transaction by menu or by entering the transaction code in the command box.&lt;/P&gt;&lt;P&gt;(You can determine the transaction name by choosing System &amp;#150; Status.)&lt;/P&gt;&lt;P&gt;&amp;#149; Step through the transaction, entering the data will be required for processing your batch input data.&lt;/P&gt;&lt;P&gt;&amp;#149; On each screen, note the program name and screen (dynpro) number.&lt;/P&gt;&lt;P&gt;(dynpro = dyn + pro. Dyn = screen, pro = number)&lt;/P&gt;&lt;P&gt;&amp;#149; Display these by choosing System &amp;#150; Status. The relevant fields are Program (dynpro) and Dynpro number. If pop-up windows occur during execution, you can get the program name and screen number by pressing F1 on any field or button on the screen.&lt;/P&gt;&lt;P&gt;The technical info pop-up shows not only the field information but also the program and screen.&lt;/P&gt;&lt;P&gt;&amp;#149; For each field, check box, and radio button on each screen, press F1 (help) and then choose Technical Info.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note the following information:&lt;/P&gt;&lt;P&gt;- The field name for batch input, which you&amp;#146;ll find in its own box.&lt;/P&gt;&lt;P&gt;- The length and data type of the field. You can display this information by double clicking on the Data Element field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;#149; Find out the identification code for each function (button or menu) that you must execute to process the batch-input data (or to go to new screen).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Place the cursor on the button or menu entry while holding down the left mouse button. Then press F1.&lt;/P&gt;&lt;P&gt;In the pop-up window that follows, choose Technical info and note the code that is shown in the Function field.&lt;/P&gt;&lt;P&gt;You can also run any function that is assigned to a function key by way of the function key number. To display the list of available function keys, click on the right mouse button. Note the key number that is assigned to the functions you want to run.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Once you have program name, screen number, field name (screen field name), you can start writing.&lt;/P&gt;&lt;P&gt;DATA TRANSFER program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Declaring internal table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First Integral Table similar to structure like local file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Declaring internal table like BDCDATA&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The data from internal table is not transferred directly to database table, it has to go through transaction. You need to pass data to particular screen and to particular screen-field. Data is passed to transaction in particular format, hence there is a need for batch input structure.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The batch input structure stores the data that is to be entered into SAP system and the actions that are necessary to process the data. The batch input structure is used by all of the batch input methods. You can use the same structure for all types of batch input, regardless of whether you are creating a session in the batch input queue or using CALL TRANSACTION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This structure is BDCDATA, which can contain the batch input data for only a single run of a transaction. The typical processing loop in a program is as follows:&lt;/P&gt;&lt;P&gt;&amp;#149; Create a BDCDATA structure&lt;/P&gt;&lt;P&gt;&amp;#149; Write the structure out to a session or process it with CALL TRANSACTION USING; and then&lt;/P&gt;&lt;P&gt;&amp;#149; Create a BDCDATA structure for the next transaction that is to be processed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Within a BDCDATA structure, organize the data of screens in a transaction. Each screen that is processed in the course of a transaction must be identified with a BDCDATA record. This record uses the Program, Dynpro, and Dynbegin fields of the structure.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The screen identifier record is followed by a separate BDCDATA record for each value, to be entered into a field. These records use the FNAM and FVAL fields of the BDCDATA structure. Values to be entered in a field can be any of the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;#149; Data that is entered into screen fields.&lt;/P&gt;&lt;P&gt;&amp;#149; Function codes that are entered into the command field. Such function codes execute functions in a transaction, such as Save or Enter.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The BDCDATA structure contains the following fields:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;#149; PROGRAM: Name of module pool program associated with the screen. Set this field only for the first record for the screen.&lt;/P&gt;&lt;P&gt;&amp;#149; DYNPRO: Screen Number. Set this field only in the first record for the screen.&lt;/P&gt;&lt;P&gt;&amp;#149; DYNBEGIN: Indicates the first record for the screen. Set this field to X, only for the first record for the screen. (Reset to &amp;#145; &amp;#145; (blank) for all other records.)&lt;/P&gt;&lt;P&gt;&amp;#149; FNAM: Field Name. The FNAM field is not case-sensitive.&lt;/P&gt;&lt;P&gt;&amp;#149; FVAL: Value for the field named in FNAM. The FVAL field is case-sensitive. Values assigned to this field are always padded on the right, if they are less than 132 characters. Values must be in character format.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Transferring data from local file to internal table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data is uploaded to internal table by UPLOAD of WS_UPLOAD function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Population of BDCDATA&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For each record of internal table, you need to populate Internal table, which is similar to BDCDATA structure.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All these five initial steps are necessary for any type of BDC interface.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA TRANSFER program can call SESSION METHOD or CALL TRANSACTION. The initial steps for both the methods are same.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First step for both the methods is to upload the data to internal table. From Internal Table, the data is transferred to database table by two ways i.e., Session method and Call transaction.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SESSION METHOD&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;About Session method&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this method you transfer data from internal table to database table through sessions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this method, an ABAP/4 program reads the external data that is to be entered in the SAP System and stores the data in session. A session stores the actions that are required to enter your data using normal SAP transaction i.e., Data is transferred to session which in turn transfers data to database table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Session is intermediate step between internal table and database table. Data along with its action is stored in session i.e., data for screen fields, to which screen it is passed, the program name behind it, and how the next screen is processed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When the program has finished generating the session, you can run the session to execute the SAP transactions in it. You can either explicitly start and monitor a session or have the session run in the background processing system.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Unless session is processed, the data is not transferred to database table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BDC_OPEN_GROUP&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You create the session through program by BDC_OPEN_GROUP function. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Parameters to this function are: &lt;/P&gt;&lt;P&gt;&amp;#149; User Name: User name &lt;/P&gt;&lt;P&gt;&amp;#149; Group: Name of the session&lt;/P&gt;&lt;P&gt;&amp;#149; Lock Date: The date on which you want to process the session.&lt;/P&gt;&lt;P&gt;&amp;#149; Keep: This parameter is passed as &amp;#145;X&amp;#146; when you want to retain session after&lt;/P&gt;&lt;P&gt;processing it or &amp;#145; &amp;#145; to delete it after processing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BDC_INSERT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This function creates the session &amp;amp; data is transferred to Session.&lt;/P&gt;&lt;P&gt;Parameters to this function are:&lt;/P&gt;&lt;P&gt;&amp;#149; Tcode: Transaction Name &lt;/P&gt;&lt;P&gt;&amp;#149; Dynprotab: BDC Data&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BDC_CLOSE_GROUP&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This function closes the BDC Group. No Parameters.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Some additional information for session processing&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When the session is generated using the KEEP option within the BDC_OPEN_GROUP, the system always keeps the sessions in the queue, whether it has been processed successfully or not.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, if the session is processed, you have to delete it manually. When session processing is completed successfully while KEEP option was not set, it will be removed automatically from the session queue. Log is not removed for that session.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the batch-input session is terminated with errors, then it appears in the list of INCORRECT session and it can be processed again. To correct incorrect session, you can analyze the session. The Analysis function allows to determine which screen and value has produced the error. If you find small errors in data, you can correct them interactively, otherwise you need to modify batch input program, which has generated the session or many times even the data file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL TRANSACTION&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;About CALL TRANSACTION&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A technique similar to SESSION method, while batch input is a two-step procedure, Call Transaction does both steps online, one after the other. In this method, you call a transaction from your program by&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Call transaction &amp;lt;tcode&amp;gt; using &amp;lt;BDCTAB&amp;gt;&lt;/P&gt;&lt;P&gt;Mode &amp;lt;A/N/E&amp;gt;&lt;/P&gt;&lt;P&gt;Update &amp;lt;S/A&amp;gt;&lt;/P&gt;&lt;P&gt;Messages into &amp;lt;MSGTAB&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Parameter &amp;#150; 1 is transaction code.&lt;/P&gt;&lt;P&gt;Parameter &amp;#150; 2 is name of BDCTAB table.&lt;/P&gt;&lt;P&gt;Parameter &amp;#150; 3 here you are specifying mode in which you execute transaction&lt;/P&gt;&lt;P&gt;A is all screen mode. All the screen of transaction are displayed.&lt;/P&gt;&lt;P&gt;N is no screen mode. No screen is displayed when you execute the transaction.&lt;/P&gt;&lt;P&gt;E is error screen. Only those screens are displayed wherein you have error record.&lt;/P&gt;&lt;P&gt;Parameter &amp;#150; 4 here you are specifying update type by which database table is updated.&lt;/P&gt;&lt;P&gt;S is for Synchronous update in which if you change data of one table then all the related Tables gets updated. And sy-subrc is returned i.e., sy-subrc is returned for once and all.&lt;/P&gt;&lt;P&gt;A is for Asynchronous update. When you change data of one table, the sy-subrc is returned. And then updating of other affected tables takes place. So if system fails to update other tables, still sy-subrc returned is 0 (i.e., when first table gets updated).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Parameter &amp;#150; 5 when you update database table, operation is either successful or unsuccessful or operation is successful with some warning. These messages are stored in internal table, which you specify along with MESSAGE statement. This internal table should be declared like BDCMSGCOLL, a structure available in ABAP/4. It contains the following fields:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Tcode: Transaction code&lt;/P&gt;&lt;P&gt;2. Dyname: Batch point module name&lt;/P&gt;&lt;P&gt;3. Dynumb: Batch input Dyn number&lt;/P&gt;&lt;P&gt;4. Msgtyp: Batch input message type (A/E/W/I/S)&lt;/P&gt;&lt;P&gt;5. Msgspra: Batch input Lang, id of message&lt;/P&gt;&lt;P&gt;6. Msgid: Message id&lt;/P&gt;&lt;P&gt;7. MsgvN: Message variables (N = 1 - 4)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For each entry, which is updated in database, table message is available in BDCMSGCOLL. As BDCMSGCOLL is structure, you need to declare a internal table which can contain multiple records (unlike structure).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Steps for CALL TRANSACTION method&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Internal table for the data (structure similar to your local file)&lt;/P&gt;&lt;P&gt;2. BDCTAB like BDCDATA&lt;/P&gt;&lt;P&gt;3. UPLOAD or WS_UPLOAD function to upload the data from local file to itab. (Considering file is local file)&lt;/P&gt;&lt;P&gt;4. Loop at itab.&lt;/P&gt;&lt;P&gt;Populate BDCTAB table.&lt;/P&gt;&lt;P&gt;Call transaction &amp;lt;tcode&amp;gt; using &amp;lt;BDCTAB&amp;gt;&lt;/P&gt;&lt;P&gt;Mode &amp;lt;A/N/E&amp;gt;&lt;/P&gt;&lt;P&gt;Update &amp;lt;S/A&amp;gt;.&lt;/P&gt;&lt;P&gt;Refresh BDCTAB.&lt;/P&gt;&lt;P&gt;Endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(To populate BDCTAB, You need to transfer each and every field)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The major differences between Session method and Call transaction are as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SESSION METHOD CALL TRANSACTION&lt;/P&gt;&lt;P&gt;1. Data is not updated in database table unless Session is processed. Immediate updation in database table.&lt;/P&gt;&lt;P&gt;2. No sy-subrc is returned. Sy-subrc is returned.&lt;/P&gt;&lt;P&gt;3. Error log is created for error records. Errors need to be handled explicitly &lt;/P&gt;&lt;P&gt;4. Updation in database table is always synchronous Updation in database table can be synchronous Or Asynchronous.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Error Handling in CALL TRANSACTION&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When Session Method updates the records in database table, error records are stored in the log file. In Call transaction there is no such log file available and error record is lost unless handled. Usually you need to give report of all the error records i.e., records which are not inserted or updated in the database table. This can be done by the following method:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Steps for the error handling in CALL TRANSACTION&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Internal table for the data (structure similar to your local file)&lt;/P&gt;&lt;P&gt;2. BDCTAB like BDCDATA&lt;/P&gt;&lt;P&gt;3. Internal table BDCMSG like BDCMSGCOLL&lt;/P&gt;&lt;P&gt;4. Internal table similar to Ist internal table&lt;/P&gt;&lt;P&gt;(Third and fourth steps are for error handling)&lt;/P&gt;&lt;P&gt;5. UPLOAD or WS_UPLOAD function to upload the data from the local file to itab. (Considering file is local file)&lt;/P&gt;&lt;P&gt;6. Loop at itab.&lt;/P&gt;&lt;P&gt;Populate BDCTAB table.&lt;/P&gt;&lt;P&gt;Call transaction &amp;lt;tr.code&amp;gt; using &amp;lt;Bdctab&amp;gt;&lt;/P&gt;&lt;P&gt;Mode &amp;lt;A/N/E&amp;gt;&lt;/P&gt;&lt;P&gt;Update &amp;lt;S/A&amp;gt;&lt;/P&gt;&lt;P&gt;Messages &amp;lt;BDCMSG&amp;gt;.&lt;/P&gt;&lt;P&gt;Perform check.&lt;/P&gt;&lt;P&gt;Refresh BDCTAB.&lt;/P&gt;&lt;P&gt;Endloop.&lt;/P&gt;&lt;P&gt;7 Form check.&lt;/P&gt;&lt;P&gt;IF sy-subrc &amp;lt;&amp;gt; 0. (Call transaction returns the sy-subrc if updating is not successful).&lt;/P&gt;&lt;P&gt;Call function Format_message.&lt;/P&gt;&lt;P&gt;(This function is called to store the message given by system and to display it along with record)&lt;/P&gt;&lt;P&gt;Append itab2.&lt;/P&gt;&lt;P&gt;Display the record and message.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DIRECT INPUT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;About Direct Input&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In contrast to batch input, this technique does not create sessions, but stores the data directly. It does not simulate the online transaction. To enter the data into the corresponding database tables directly, the system calls a number of function modules that execute any necessary checks. In case of errors, the direct input technique provides a restart mechanism. However, to be able to activate the restart mechanism, direct input programs must be executed in the background only. Direct input checks the data thoroughly and then updates the database directly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can start a Direct Input program in two ways;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Start the program directly&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the quickest way to see if the program works with your flat file. This option is possible with all direct input programs. If the program ends abnormally, you will not have any logs telling you what has or has not been posted. To minimize the chance of this happening, always use the check file option for the first run with your flat file. This allows you to detect format errors before transfer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Starting the program via the DI administration transaction&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This transaction restarts the processing, if the data transfer program aborts. Since DI document are immediately posted into the SAP D/B, the restart option prevents the duplicate document posting that occurs during a program restart (i.e., without adjusting your flat file).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Direct input is usually done for standard data like material master, FI accounting document, SD sales order and Classification for which SAP has provided standard programs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First time you work with the Direct Input administration program, you will need to do some preparation before you can transfer data:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Create variant&lt;/P&gt;&lt;P&gt;- Define job&lt;/P&gt;&lt;P&gt;- Start job&lt;/P&gt;&lt;P&gt;- Restart job&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Common batch input errors&lt;/P&gt;&lt;P&gt;- The batch input BDCDATA structure tries to assign values to fields which do not exist in the current transaction screen.&lt;/P&gt;&lt;P&gt;- The screen in the BDCDATA structure does not match the right sequence, or an intermediate screen is missing.&lt;/P&gt;&lt;P&gt;- On exceptional occasions, the logic flow of batch input session does not exactly match that of manual online processing. Testing the sessions online can discover by this.&lt;/P&gt;&lt;P&gt;- The BDCDATA structure contains fields, which are longer than the actual definition.&lt;/P&gt;&lt;P&gt;- Authorization problems.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;RECORDING A BATCH INPUT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A B recording allows you to record a R/3 transaction and generate a program that contains all screens and field information in the required BDC-DATA format.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can either use SHDB transaction for recording or&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; EDIT&amp;amp;#61614; BATCH INPUT &amp;amp;#61614; SERVICES &amp;amp;#61614;SYSTEM &lt;/P&gt;&lt;P&gt;And from here click recording.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Enter name for the recording.&lt;/P&gt;&lt;P&gt;(Dates are optional)&lt;/P&gt;&lt;P&gt;Click recording.&lt;/P&gt;&lt;P&gt;Enter transaction code.&lt;/P&gt;&lt;P&gt;Enter.&lt;/P&gt;&lt;P&gt;Click Save button.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You finally come to a screen where, you have all the information for each screen including BDC_OKCODE.&lt;/P&gt;&lt;P&gt;&amp;#149; Click Get Transaction.&lt;/P&gt;&lt;P&gt;&amp;#149; Return to BI.&lt;/P&gt;&lt;P&gt;&amp;#149; Click overview.&lt;/P&gt;&lt;P&gt;&amp;#149; Position the cursor on the just recorded entry and click generate program.&lt;/P&gt;&lt;P&gt;&amp;#149; Enter program name.&lt;/P&gt;&lt;P&gt;&amp;#149; Click enter&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The program is generated for the particular transaction.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BACKGROUND PROCESSING&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Need for Background processing&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When a large volume of data is involved, usually all batch inputs are done in background.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The R/3 system includes functions that allow users to work non-interactively or offline. The background processing systems handle these functions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Non-interactively means that instead of executing the ABAP/4 programs and waiting for an answer, user can submit those programs for execution at a more convenient planned time. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are several reasons to submit programs for background execution. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;#149; The maximum time allowed for online execution should not exceed 300 seconds. User gets TIMEOUT error and an aborted transaction, if time for execution exceeds 300 seconds. To avoid these types of error, you can submit jobs for background processing.&lt;/P&gt;&lt;P&gt;&amp;#149; You can use the system while your program is executing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This does not mean that interactive or online work is not useful. Both type of processing have their own purposes. Online work is the most common one entering business data, displaying information, printing small reports, managing the system and so on. Background jobs are mainly used for the following tasks; to process large amount of data, to execute periodic jobs without human intervention, to run program at a more convenient, planned time other than during normal working hours i.e., Nights or weekends.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The transaction for background processing is SM36.&lt;/P&gt;&lt;P&gt;Or&lt;/P&gt;&lt;P&gt; Define jobs&amp;amp;#61614; Jobs &amp;amp;#61614; Administration &amp;amp;#61614;Tools &lt;/P&gt;&lt;P&gt;Or&lt;/P&gt;&lt;P&gt; Jobs&amp;amp;#61614; services &amp;amp;#61614;System &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Components of the background jobs&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A job in Background processing is a series of steps that can be scheduled and step is a program for background processing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;#149; Job name. Define the name of assigned to the job. It identifies the job. You can specify up to 32 characters for the name.&lt;/P&gt;&lt;P&gt;&amp;#149; Job class. Indicates the type of background processing priority assigned to the job.&lt;/P&gt;&lt;P&gt;The job class determines the priority of a job. The background system admits three types of job classes: A B &amp;amp; C, which correspond to job priority.&lt;/P&gt;&lt;P&gt;&amp;#149; Job steps. Parameters to be passed for this screen are as follows:&lt;/P&gt;&lt;P&gt;Program name.&lt;/P&gt;&lt;P&gt;Variant if it is report program&lt;/P&gt;&lt;P&gt;Start criteria for the job: Option available for this are as follows:&lt;/P&gt;&lt;P&gt;Immediate - allows you to start a job immediately.&lt;/P&gt;&lt;P&gt;Date/Time - allows you to start a job at a specific name.&lt;/P&gt;&lt;P&gt;After job - you can start a job after a particular job.&lt;/P&gt;&lt;P&gt;After event - allows you to start a job after a particular event.&lt;/P&gt;&lt;P&gt;At operation mode - allows you to start a job when the system switches to a particular operation mode.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Defining Background jobs&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is two step process: Firstly, you define the job and then release it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When users define a job and save it, they are actually scheduling the report i.e., specifying the job components, the steps, the start time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When users schedule program for background processing, they are instructing the system to execute an ABAP/4 report or an external program in the background. Scheduled jobs are not executed until they are released. When jobs are released, they are sent for execution to the background processing system at the specified start time. Both scheduling and releasing of jobs require authorizations.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HANDLING OF POP UP SCREEN IN BDC&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many times in transaction pop up screen appears and for this screen you don&amp;#146;t pass any record but some indication to system telling it to proceed further. For example: The following screen&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To handle such screen, system has provided a variable called BDC_CURSOR. You pass this variable to BDCDATA and process the screen.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Usually such screen appears in many transactions, in this case you are just passing information, that YES you want to save the information, that means YES should be clicked. So you are transferring this information to BDCDATA i.e., field name of YES which is usually SPOT_OPTION. Instead of BDC_OKCODE, you are passing BDC_CURSOR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BDC_CURSOR is also used to place cursor on particular field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AN EXAMPLE WITH SESSION METHOD&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Following program demonstrates how data is passed from flat file to SAP transaction and further to database table by using SESSION method.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The transaction is TFBA (to change customer).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A simple transaction where you are entering customer number on first screen and on next screen data is displayed for the particular customer number. Field, which we are changing here, are name and city. When you click on save, the changed record gets saved.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Prerequisite to write this BDC interface as indicated earlier is:&lt;/P&gt;&lt;P&gt;1. To find screen number&lt;/P&gt;&lt;P&gt;2. To find screen field names, type of the field and length of the field.&lt;/P&gt;&lt;P&gt;3. To find BDC_OKCODE for each screen&lt;/P&gt;&lt;P&gt;4. Create flat file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Flat file can be created in your hard disk as follows: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1 Vinod Krishna Hyderabad&lt;/P&gt;&lt;P&gt;2 Kavitha Secunderabad&lt;/P&gt;&lt;P&gt;3 Kishore Hyderabad&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(Where 1st character field is Customer number, 2nd field is Customer name and 3rd field is City.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To transfer this data to database table SCUSTOM following interface can be used.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT DEMO1.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Following internal table is to upload flat file.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;DATA: BEGIN OF ITAB OCCURS 0,&lt;/P&gt;&lt;P&gt;ID(10),&lt;/P&gt;&lt;P&gt;NAME(25),&lt;/P&gt;&lt;P&gt;CITY(25),&lt;/P&gt;&lt;P&gt;END OF ITAB.&lt;/P&gt;&lt;P&gt;*Following internal table BDCDATA is to pass date from internal table to session.&lt;/P&gt;&lt;P&gt;DATA: BDCTAB LIKE BDCDATA OCCURS 0 WITH HEADER LINE.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Variables&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;DATA: DATE1 LIKE SY-DATUM. DATE1 = SY-DATUM - 1. &amp;#147; This is for Hold Date&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;To upload flat file to internal table. &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;CALL FUNCTION UPLOAD&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;FILE NAME = &amp;#145;C:\FF.TXT&amp;#146;&lt;/P&gt;&lt;P&gt;FILE TYPE = &amp;#145;ASC&amp;#148;&lt;/P&gt;&lt;P&gt;TABLES&lt;/P&gt;&lt;P&gt;DATA_TAB = ITAB&lt;/P&gt;&lt;P&gt;EXCEPTIONS&lt;/P&gt;&lt;P&gt;CONVERSION_ERROR = 1&lt;/P&gt;&lt;P&gt;INVALID_TABLE_WIDTH = 2&lt;/P&gt;&lt;P&gt;INVALID_TYPE = 3&lt;/P&gt;&lt;P&gt;NO_BATCH = 4&lt;/P&gt;&lt;P&gt;UNKNOWN_ERROR = 5&lt;/P&gt;&lt;P&gt;OTHERS = 6.&lt;/P&gt;&lt;P&gt;If sy-subrc = 0.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Calling Function to Create a Session&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;CALL FUNCTION &amp;#145;BDC_OPEN_GROUP&amp;#146;&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;CLIENT = SY-MANDT&lt;/P&gt;&lt;P&gt;GROUP = &amp;#145;POTHURI&amp;#146;&lt;/P&gt;&lt;P&gt;HOLDDATE = DATE1&lt;/P&gt;&lt;P&gt;KEEP = &amp;#145;X&amp;#146;&lt;/P&gt;&lt;P&gt;USER = SY-UNAME&lt;/P&gt;&lt;P&gt;EXCEPTIONS&lt;/P&gt;&lt;P&gt;CLIENT_INVALID = 1&lt;/P&gt;&lt;P&gt;DESTINATION_INVALID = 2&lt;/P&gt;&lt;P&gt;GROUP_INVALID = 3&lt;/P&gt;&lt;P&gt;GROUP_IS_LOCKED = 4&lt;/P&gt;&lt;P&gt;HOLDDATE_INVALID = 5&lt;/P&gt;&lt;P&gt;INTERNAL_ERROR = 6&lt;/P&gt;&lt;P&gt;QUEUE_ERROR = 7&lt;/P&gt;&lt;P&gt;RUNNING = 8&lt;/P&gt;&lt;P&gt;SYSTEM_LOCK_ERROR = 9&lt;/P&gt;&lt;P&gt;USER_INVALID = 10&lt;/P&gt;&lt;P&gt;OTHERS = 11.&lt;/P&gt;&lt;P&gt;If sy-subrc = 0.&lt;/P&gt;&lt;P&gt;*--&lt;DEL&gt;&lt;/DEL&gt;&lt;/P&gt;&lt;HR originaltext="---------------------" /&gt; MAIN Logic--&lt;P&gt;&lt;/P&gt;&lt;HR originaltext="-------------------------" /&gt;&lt;P&gt;LOOP AT ITAB&lt;/P&gt;&lt;P&gt;PERFORM GENERATE_DATA. &amp;#147; Populating BDCDATA Table&lt;/P&gt;&lt;P&gt;CALL FUNCTION &amp;#145;BDC_INSERT&amp;#146;&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;TCODE = &amp;#145;TFBA&amp;#146;&lt;/P&gt;&lt;P&gt;TABLES&lt;/P&gt;&lt;P&gt;DYNPROTAB = BDCTAB&lt;/P&gt;&lt;P&gt;EXCEPTIONS&lt;/P&gt;&lt;P&gt;INTERNAL_ERROR = 1&lt;/P&gt;&lt;P&gt;NOT_OPEN = 2&lt;/P&gt;&lt;P&gt;QUEUE_ERROR = 3&lt;/P&gt;&lt;P&gt;TCODE_INVALID = 4&lt;/P&gt;&lt;P&gt;PRINTING_INVALID = 5&lt;/P&gt;&lt;P&gt;POSTING_INVALID = 6&lt;/P&gt;&lt;P&gt;OTHERS = 7.&lt;/P&gt;&lt;P&gt;REFRESH BDCTAB&lt;/P&gt;&lt;P&gt;ENDLOOP. &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Calling function to close the session&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;CALL FUNCTION &amp;#145;BDC_CLOSE_GROUP&amp;#146;&lt;/P&gt;&lt;P&gt;EXCEPTIONS&lt;/P&gt;&lt;P&gt;NOT_OPEN = 1&lt;/P&gt;&lt;P&gt;QUEUE_ERROR = 2&lt;/P&gt;&lt;P&gt;OTHERS = 3.&lt;/P&gt;&lt;P&gt;Endif.&lt;/P&gt;&lt;P&gt;Endif.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Form GENERATE_DATA&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Create BDC Data&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM GENERATE_DATA&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Passing information for 1st screen on BDCDATA&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;BDCTAB-PROGRAM = &amp;#145;SAPMTFBA&amp;#146;.&lt;/P&gt;&lt;P&gt;BDCTAX-DYNPRO = 100.&lt;/P&gt;&lt;P&gt;BDCTAP-DYNBEGIN = &amp;#145;X&amp;#146;.&lt;/P&gt;&lt;P&gt;APPEND BCDTAB.CLEAR BDCTAB.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Passing field information to BDCDATA&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;BDCTAB-FNAM = &amp;#145;SCUSTOM-ID&amp;#146;&lt;/P&gt;&lt;P&gt;BDCTAB-FVAL = ITAB-ID.&lt;/P&gt;&lt;P&gt;APPEND BDCTAB.CLEAR BDCTAB.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Passing BDC_OKCODE to BDCDATA&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;BDCTAB-FNAM = &amp;#145;BDC_OKCODE&amp;#146;.&lt;/P&gt;&lt;P&gt;BDCTAB-FVAL = &amp;#145;/5&amp;#146;.&lt;/P&gt;&lt;P&gt;APPEND BDCTAB.CLEAR BDCTAB.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Passing screen information for next screen to BDCDATA&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;BDCTAB-PROGRAM = &amp;#145;SAPMTFBA&amp;#146;.&lt;/P&gt;&lt;P&gt;BDCTAB-DYNPRO = 200.&lt;/P&gt;&lt;P&gt;BDCTAB-DYNBEGIN = &amp;#145;X&amp;#146;.&lt;/P&gt;&lt;P&gt;APPEND BDCTAB.CLEAR BDCTAB.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Passing screen information to BDCDATA&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;BDCTAB-FNAM = &amp;#145;SCUSTOM-NAME&amp;#146;.&lt;/P&gt;&lt;P&gt;BDCTAB-FVAL = ITAB-NAME.&lt;/P&gt;&lt;P&gt;APPEND BDCTAB.CLEAR BDCTAB.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Passing screen information to BDCDATA&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;BDCTAB-FNAM = &amp;#145;SCUSTOM-CITY&amp;#146;.&lt;/P&gt;&lt;P&gt;BDCTAB-FVAL = ITAB-CITY.&lt;/P&gt;&lt;P&gt;APPEND BDCTAB.CLEAR BDCTAB.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Passing BDC_OKCODE to BDCDATA&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;BDCTAB-FNAM = &amp;#145;BDC_OKCODE&amp;#146;.&lt;/P&gt;&lt;P&gt;BDCTAB-FVAL = &amp;#145;SAVE&amp;#146;.&lt;/P&gt;&lt;P&gt;APPEND BDCTAB.CLEAR BDCTAB.&lt;/P&gt;&lt;P&gt;ENDFORM. &amp;#147;GENERATE_DATA&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AN EXAMPLE WITH CALL TRANSACTION&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Same steps to be repeated for CALL TRANSACTION&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The only difference between the two types of interface is in Session method, you create session and store information about screen and data into session. When session is processed the data is transferred to database. While in CALL TRANSACTION, data is transferred directly to database table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT DEMO1.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Follow above Code till MAIN Logic. Even the Subroutine should be copied&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;LOOP AT ITAB&lt;/P&gt;&lt;P&gt;PERFORM GENERATE_DATA, &amp;#147;Populating BDCDATA Table&lt;/P&gt;&lt;P&gt;Call transaction &amp;#145;TFBA&amp;#146; using BCDDATA Mode &amp;#145;A&amp;#146; Update &amp;#145;S&amp;#146;.&lt;/P&gt;&lt;P&gt;REFRESH BDCTAB&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 03 Feb 2008 05:57:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bdc/m-p/3310951#M793009</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-03T05:57:09Z</dc:date>
    </item>
    <item>
      <title>Re: BDC</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bdc/m-p/3310952#M793010</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi Suresh, this will guide u.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLASSICAL BATCH INPUT (Session Method)&lt;/P&gt;&lt;P&gt;CALL TRANSACTION&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BATCH INPUT METHOD:&lt;/P&gt;&lt;P&gt;This method is also called as &amp;#145;CLASSICAL METHOD&amp;#146;.&lt;/P&gt;&lt;P&gt;Features:&lt;/P&gt;&lt;P&gt;Asynchronous processing.&lt;/P&gt;&lt;P&gt;Synchronous Processing in database update.&lt;/P&gt;&lt;P&gt;Transfer data for more than one transaction.&lt;/P&gt;&lt;P&gt;Batch input processing log will be generated.&lt;/P&gt;&lt;P&gt;During processing, no transaction is started until the previous transaction has been written to the database.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL TRANSACTION METHOD :&lt;/P&gt;&lt;P&gt;This is another method to transfer data from the legacy system.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Features:&lt;/P&gt;&lt;P&gt;Synchronous processing. The system performs a database commit immediately before and after the CALL TRANSACTION USING statement.&lt;/P&gt;&lt;P&gt;Updating the database can be either synchronous or asynchronous. The program specifies the update type.&lt;/P&gt;&lt;P&gt;Transfer data for a single transaction.&lt;/P&gt;&lt;P&gt;Transfers data for a sequence of dialog screens.&lt;/P&gt;&lt;P&gt;No batch input processing log is generated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sap-img.com/abap/difference-between-batch-input-and-call-transaction-in-bdc.htm" target="test_blank"&gt;http://www.sap-img.com/abap/difference-between-batch-input-and-call-transaction-in-bdc.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Among the two methods call transaction is better compared to session bcoz data transfer is faster in it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Differences between call transaction and session.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Session Method:&lt;/P&gt;&lt;P&gt;1) Data is not updated in the database table until the session is processed.&lt;/P&gt;&lt;P&gt;2) No sy-subrc is returned.&lt;/P&gt;&lt;P&gt;3) Error log is created for error records.&lt;/P&gt;&lt;P&gt;4) Updation is always synchronous.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Call Transaction Method:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) Immediate updation in the database table.&lt;/P&gt;&lt;P&gt;2) sy-subrc is returned.&lt;/P&gt;&lt;P&gt;3)Error need to be handled explicitly.&lt;/P&gt;&lt;P&gt;4) updation can be synchronous as well as asynchronous.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) ya u can use using the N mode no screen.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3)u can't handle multiple transaction in call transaction.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4) u can handle multiple transaction in session using the BDC_INSERT fm.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;5)When u go to SM35 u can able to see the error records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Which is best?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That depends on your requirement. Both of them have there advantages.&lt;/P&gt;&lt;P&gt;According to the situation u can choose any one of these.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;difference between batch input and call transaction in BDC Session method.&lt;/P&gt;&lt;P&gt;1) synchronous processing.&lt;/P&gt;&lt;P&gt;2) can tranfer large amount of data.&lt;/P&gt;&lt;P&gt;3) processing is slower.&lt;/P&gt;&lt;P&gt;4) error log is created&lt;/P&gt;&lt;P&gt;5) data is not updated until session is processed.&lt;/P&gt;&lt;P&gt;Call transaction.&lt;/P&gt;&lt;P&gt;1) asynchronous processing&lt;/P&gt;&lt;P&gt;2) can transfer small amount of data&lt;/P&gt;&lt;P&gt;3) processing is faster.&lt;/P&gt;&lt;P&gt;4) errors need to be handled explicitly&lt;/P&gt;&lt;P&gt;5) data is updated automatically&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For session method,these are the function modules to b used.&lt;/P&gt;&lt;P&gt;BDC_OPEN_GROUP&lt;/P&gt;&lt;P&gt;BDC_INSERT&lt;/P&gt;&lt;P&gt;BDC_CLOSE_GROUP&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For call transaction,this is the syntax.&lt;/P&gt;&lt;P&gt;CALL TRANSACTION TCODE USING BDCDATA&lt;/P&gt;&lt;P&gt;MODE A or E or N&lt;/P&gt;&lt;P&gt;UPDATE A or S&lt;/P&gt;&lt;P&gt;MESSAGES INTO MESSTAB.&lt;/P&gt;&lt;P&gt;Take a scenario where we need to post documents in FB01 and the input file has say 2000 records (2000 documents, not line items in FB01 but 2000 records)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the BDC call transaction method&lt;/P&gt;&lt;P&gt;We call the transaction FB01 2000 times (once for each record posting) and if the processing fails in record no 3 it can be captured and start with reocord 4.&lt;/P&gt;&lt;P&gt;Eg: Loop at itab.&lt;/P&gt;&lt;P&gt;call transaction FB01&lt;/P&gt;&lt;P&gt;capture errors&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the session method.&lt;/P&gt;&lt;P&gt;We do not explicity call the transaction 2000 times, but all the records are appeneded into a session and this session is stored. The processinf of the session is done wwhenever the user wants it to be done. Hence the errors cannot be captured in the program itself&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check these link:&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sap-img.com/abap/difference-between-batch-input-and-call-transaction-in-bdc.htm" target="test_blank"&gt;http://www.sap-img.com/abap/difference-between-batch-input-and-call-transaction-in-bdc.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sap-img.com/abap/question-about-bdc-program.htm" target="test_blank"&gt;http://www.sap-img.com/abap/question-about-bdc-program.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.itcserver.com/blog/2006/06/30/batch-input-vs-call-transaction/" target="test_blank"&gt;http://www.itcserver.com/blog/2006/06/30/batch-input-vs-call-transaction/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.planetsap.com/bdc_main_page.htm" target="test_blank"&gt;http://www.planetsap.com/bdc_main_page.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Batch Input Session method is asynchronous as told by others here. But the advantage of this is that you have all the error messages and the data for each transaction held persistantly. You don't have to code anything for processing them or writing the logs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But at the same time, the same feature can be disadvantageous if you need to react to an error or if there are too many errors to manually correct in a session. Since the session are created in the program and its execution is done seperately, you loose the trackability of such transactions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With a call transaction, what was a disadvantage above will become an advantage. Call transaction immediately gives you messages back and you can react to it in your program. But the disadvantage is that, if you have several hundreds of transactions to run, running them from within the program can be resource crunching affair. It will hamper the system performance and you cannot really distribute the load. Of course, you have some mechanisms with which you can overcome this, but you will have to code for it. Also, storing the messages and storing the errored transaction data etc will have to be handled by you in the program. Whereas, in batch input session, your program's job is to just create the session, after that everything is standard SAP system's responsibility.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ideally, you should do a call transaction if the resources are not a problem and if it fails, put the errored transaction into a session.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can decide based on the data volume that your BDC is processing. If data volume is high go for session else call transaction will do.The call transaction updates will be instantaneous where as session needs to be processed explictly after creation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Session Method&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) Session method supports both small amount of data aswell as large amount of data&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) data processing is asynchronus and data updation is synchronus.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3) it process multiple apllication while perfomaning validations.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4) in session method data will be updated in data base only after processing session only.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;5) system provide by default logfile for handling error records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;6) it supports both foreground aswell as background process&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in bdc we use FM ...&lt;/P&gt;&lt;P&gt;bdc_open_group " for creating Session&lt;/P&gt;&lt;P&gt;bdc_insert " adding transaction and bdcdata table for updating database&lt;/P&gt;&lt;P&gt;bdc_close_group " for closing Session&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Call Transaction&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) Call transaction exclusively for small amout of data&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) it supports only one apllication while perfoming validations&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3) there is no default logfile, We can explicitly provide logic for creating logfile for handling error records.&lt;/P&gt;&lt;P&gt;we can create logfile by using structure....BDCMSGCOLL&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4) it doesn't support background processing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;5) data processing is synchronous and Data updation is Synchronous( default), in&lt;/P&gt;&lt;P&gt;this method also supports daya updation in asynchronus process also.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;syntax:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Call transaction &amp;lt;transaction-name&amp;gt; using BDCDATA&lt;/P&gt;&lt;P&gt;mode &amp;lt;A/N/E&amp;gt;&lt;/P&gt;&lt;P&gt;update &amp;lt;L/A/S&amp;gt;&lt;/P&gt;&lt;P&gt;messages into BDCMSGCOLL.&lt;/P&gt;&lt;P&gt;BDC:&lt;/P&gt;&lt;P&gt;Batch Data Communication (BDC) is the process of transferring data from one SAP System to another SAP system or from a non-SAP system to SAP System.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Features :&lt;/P&gt;&lt;P&gt;BDC is an automatic procedure.&lt;/P&gt;&lt;P&gt;This method is used to transfer large amount of data that is available in electronic medium.&lt;/P&gt;&lt;P&gt;BDC can be used primarily when installing the SAP system and when transferring data from a legacy system (external system).&lt;/P&gt;&lt;P&gt;BDC uses normal transaction codes to transfer data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Types of BDC :&lt;/P&gt;&lt;P&gt;CLASSICAL BATCH INPUT (Session Method)&lt;/P&gt;&lt;P&gt;CALL TRANSACTION&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BATCH INPUT METHOD:&lt;/P&gt;&lt;P&gt;This method is also called as &amp;#145;CLASSICAL METHOD&amp;#146;.&lt;/P&gt;&lt;P&gt;Features:&lt;/P&gt;&lt;P&gt;Asynchronous processing.&lt;/P&gt;&lt;P&gt;Synchronous Processing in database update.&lt;/P&gt;&lt;P&gt;Transfer data for more than one transaction.&lt;/P&gt;&lt;P&gt;Batch input processing log will be generated.&lt;/P&gt;&lt;P&gt;During processing, no transaction is started until the previous transaction has been written to the database.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL TRANSACTION METHOD :&lt;/P&gt;&lt;P&gt;This is another method to transfer data from the legacy system.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Features:&lt;/P&gt;&lt;P&gt;Synchronous processing. The system performs a database commit immediately before and after the CALL TRANSACTION USING statement.&lt;/P&gt;&lt;P&gt;Updating the database can be either synchronous or asynchronous. The program specifies the update type.&lt;/P&gt;&lt;P&gt;Transfer data for a single transaction.&lt;/P&gt;&lt;P&gt;Transfers data for a sequence of dialog screens.&lt;/P&gt;&lt;P&gt;No batch input processing log is generated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For BDC:&lt;/P&gt;&lt;P&gt;&lt;A href="http://myweb.dal.ca/hchinni/sap/bdc_home.htm" target="test_blank"&gt;http://myweb.dal.ca/hchinni/sap/bdc_home.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/bdc&amp;amp;" target="test_blank"&gt;https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/bdc&amp;amp;&lt;/A&gt;;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sap-img.com/abap/learning-bdc-programming.htm" target="test_blank"&gt;http://www.sap-img.com/abap/learning-bdc-programming.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sapdevelopment.co.uk/bdc/bdchome.htm" target="test_blank"&gt;http://www.sapdevelopment.co.uk/bdc/bdchome.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sap-img.com/abap/difference-between-batch-input-and-call-transaction-in-bdc.htm" target="test_blank"&gt;http://www.sap-img.com/abap/difference-between-batch-input-and-call-transaction-in-bdc.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_47x200/helpdata/en/69/c250684ba111d189750000e8322d00/frameset.htm" target="test_blank"&gt;http://help.sap.com/saphelp_47x200/helpdata/en/69/c250684ba111d189750000e8322d00/frameset.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sapbrain.com/TUTORIALS/TECHNICAL/BDC_tutorial.html" target="test_blank"&gt;http://www.sapbrain.com/TUTORIALS/TECHNICAL/BDC_tutorial.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check these link:&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sap-img.com/abap/difference-between-batch-input-and-call-transaction-in-bdc.htm" target="test_blank"&gt;http://www.sap-img.com/abap/difference-between-batch-input-and-call-transaction-in-bdc.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sap-img.com/abap/question-about-bdc-program.htm" target="test_blank"&gt;http://www.sap-img.com/abap/question-about-bdc-program.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.itcserver.com/blog/2006/06/30/batch-input-vs-call-transaction/" target="test_blank"&gt;http://www.itcserver.com/blog/2006/06/30/batch-input-vs-call-transaction/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.planetsap.com/bdc_main_page.htm" target="test_blank"&gt;http://www.planetsap.com/bdc_main_page.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="2491514"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check the following links:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sap-img.com/bdc.htm" target="test_blank"&gt;http://www.sap-img.com/bdc.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See below example code :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Call three FM : BDC_OPEN_GROUP,BDC_INSERT and BDC_CLOSE_GROUP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Once you execute the program and it creates the session at SM35 Transaction.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;************************************************************************&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Report : ZMPPC011&lt;/P&gt;&lt;P&gt;Type : Data upload&lt;/P&gt;&lt;P&gt;Author : Chetan Shah&lt;/P&gt;&lt;P&gt;Date : 05/05/2005&lt;/P&gt;&lt;P&gt;Transport : DV3K919557&lt;/P&gt;&lt;P&gt;Transaction: ??&lt;/P&gt;&lt;P&gt;Description: This ABAP/4 Program creates new Production Versions&lt;/P&gt;&lt;P&gt;(C223). It accepts tab-delimited spreadsheet input and&lt;/P&gt;&lt;P&gt;creates BDC sessions.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;************************************************************************&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Modification Log&lt;/P&gt;&lt;P&gt;Date Programmer Request # Description&lt;/P&gt;&lt;P&gt;************************************************************************&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;06/10/2005 Chetan Shah DV3K919557 Initial coding&lt;/P&gt;&lt;P&gt;************************************************************************&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;report zmppc011 no standard page heading line-size 120 line-count 55&lt;/P&gt;&lt;P&gt;message-id zz.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;pool of form routines&lt;/P&gt;&lt;P&gt;include zmppn001.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Define BDC Table Structure&lt;/P&gt;&lt;P&gt;data: begin of itab_bdc_tab occurs 0.&lt;/P&gt;&lt;P&gt;include structure bdcdata.&lt;/P&gt;&lt;P&gt;data: end of itab_bdc_tab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Input record layout of Leagcy File&lt;/P&gt;&lt;P&gt;data: begin of itab_xcel occurs 0,&lt;/P&gt;&lt;P&gt;matnr(18) type c,&lt;/P&gt;&lt;P&gt;werks(4) type c,&lt;/P&gt;&lt;P&gt;alnag(2) type c,&lt;/P&gt;&lt;P&gt;verid(4) type c,&lt;/P&gt;&lt;P&gt;text1(40) type c,&lt;/P&gt;&lt;P&gt;bstmi like mkal-bstmi,&lt;/P&gt;&lt;P&gt;bstma like mkal-bstma,&lt;/P&gt;&lt;P&gt;adatu(10) type c,&lt;/P&gt;&lt;P&gt;bdatu(10) type c,&lt;/P&gt;&lt;P&gt;stlal(2) type c,&lt;/P&gt;&lt;P&gt;stlan(1) type c,&lt;/P&gt;&lt;P&gt;serkz(1) type c,&lt;/P&gt;&lt;P&gt;mdv01(8) type c,&lt;/P&gt;&lt;P&gt;elpro(4) type c,&lt;/P&gt;&lt;P&gt;alort(4) type c,&lt;/P&gt;&lt;P&gt;end of itab_xcel.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: begin of lt_pp04_cache occurs 0,&lt;/P&gt;&lt;P&gt;matnr like itab_xcel-matnr,&lt;/P&gt;&lt;P&gt;werks like itab_xcel-werks,&lt;/P&gt;&lt;P&gt;alnag like itab_xcel-alnag,&lt;/P&gt;&lt;P&gt;plnnr like mapl-plnnr,&lt;/P&gt;&lt;P&gt;arbpl like crhd-arbpl,&lt;/P&gt;&lt;P&gt;ktext like crtx-ktext,&lt;/P&gt;&lt;P&gt;end of lt_pp04_cache.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: v_ssnnr(4) type n,&lt;/P&gt;&lt;P&gt;v_lines_in_xcel like sy-tabix,&lt;/P&gt;&lt;P&gt;v_ssnname like apqi-groupid,&lt;/P&gt;&lt;P&gt;v_trans_in_ssn type i,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa_xcel LIKE itab_xcel,&lt;/P&gt;&lt;P&gt;l_tabix like sy-tabix,&lt;/P&gt;&lt;P&gt;v_matnr like rc27m-matnr,&lt;/P&gt;&lt;P&gt;v_plnnr like mapl-plnnr,&lt;/P&gt;&lt;P&gt;v_plnal like mapl-plnal,&lt;/P&gt;&lt;P&gt;v_tcode like sy-tcode value 'C223',&lt;/P&gt;&lt;P&gt;v_plnty like plas-plnty value 'R',&lt;/P&gt;&lt;P&gt;v_objty like crhd-objty value 'A',&lt;/P&gt;&lt;P&gt;v_plpo_steus like plpo-steus value 'PP04',&lt;/P&gt;&lt;P&gt;v_verwe like crhd-verwe value '0007'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Parameters&lt;/P&gt;&lt;P&gt;selection-screen: skip 3.&lt;/P&gt;&lt;P&gt;selection-screen: begin of block 1 with frame.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;parameters: p_name like rlgrap-filename&lt;/P&gt;&lt;P&gt;default 'C:\My Documents\InputFile.txt'&lt;/P&gt;&lt;P&gt;obligatory,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;bdc session name prefix&lt;/P&gt;&lt;P&gt;p_bdcpfx(6) default 'ZPVCRT'&lt;/P&gt;&lt;P&gt;obligatory,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;number for transction per BDC session&lt;/P&gt;&lt;P&gt;p_trnssn type i&lt;/P&gt;&lt;P&gt;default 2000 obligatory,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;retain the BDC session after successfull execution&lt;/P&gt;&lt;P&gt;p_keep like apqi-qerase&lt;/P&gt;&lt;P&gt;default 'X',&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;user who will be executing BDC session&lt;/P&gt;&lt;P&gt;p_uname like apqi-userid&lt;/P&gt;&lt;P&gt;default sy-uname&lt;/P&gt;&lt;P&gt;obligatory.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;selection-screen: end of block 1.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;********************************************************&lt;/P&gt;&lt;P&gt;********************************************************&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;possible entry list (F4 dropdown) for input file name&lt;/P&gt;&lt;P&gt;at selection-screen on value-request for p_name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*-SELECT FILE FROM USERS LOCAL PC&lt;/P&gt;&lt;P&gt;call function 'WS_FILENAME_GET'&lt;/P&gt;&lt;P&gt;exporting&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DEF_FILENAME = ' '&lt;/P&gt;&lt;P&gt;def_path = 'C:\Temp\'&lt;/P&gt;&lt;P&gt;mask = ',.,..'&lt;/P&gt;&lt;P&gt;mode = 'O'&lt;/P&gt;&lt;P&gt;title = 'Select File '(007)&lt;/P&gt;&lt;P&gt;importing&lt;/P&gt;&lt;P&gt;filename = p_name&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;RC =&lt;/P&gt;&lt;P&gt;exceptions&lt;/P&gt;&lt;P&gt;inv_winsys = 1&lt;/P&gt;&lt;P&gt;no_batch = 2&lt;/P&gt;&lt;P&gt;selection_cancel = 3&lt;/P&gt;&lt;P&gt;selection_error = 4&lt;/P&gt;&lt;P&gt;others = 5.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno&lt;/P&gt;&lt;P&gt;WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;********************************************************&lt;/P&gt;&lt;P&gt;********************************************************&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;begin the show &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;start-of-selection.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;read data from input file&lt;/P&gt;&lt;P&gt;perform transfer_xcel_to_itab.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;loop at itab_xcel.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hang on to xcel line num&lt;/P&gt;&lt;P&gt;l_tabix = sy-tabix.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;each line in the xcel file marks begining of new prod.version defn&lt;/P&gt;&lt;P&gt;if num-of-trnas-in-session = 0, create new BDC session&lt;/P&gt;&lt;P&gt;if v_trans_in_ssn is initial.&lt;/P&gt;&lt;P&gt;perform bdc_session_open.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;begin new bdc script for rtg create trans&lt;/P&gt;&lt;P&gt;fill in bdc-data for prod.version maintenance screens&lt;/P&gt;&lt;P&gt;perform bdc_build_script.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;insert the bdc script as a BDC transaction&lt;/P&gt;&lt;P&gt;perform bdc_submit_transaction.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;keep track of how many BDC transactions were inserted in the BDC&lt;/P&gt;&lt;P&gt;session&lt;/P&gt;&lt;P&gt;add 1 to v_trans_in_ssn.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if the user-specified num of trans in BDC session is reached OR&lt;/P&gt;&lt;P&gt;if end of input file is reached, close the BDC session&lt;/P&gt;&lt;P&gt;if v_trans_in_ssn = p_trnssn or&lt;/P&gt;&lt;P&gt;l_tabix = v_lines_in_xcel.&lt;/P&gt;&lt;P&gt;perform bdc_session_close.&lt;/P&gt;&lt;P&gt;clear v_trans_in_ssn.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;top-of-page.&lt;/P&gt;&lt;P&gt;call function 'Z_HEADER'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;FLEX_TEXT1 =&lt;/P&gt;&lt;P&gt;FLEX_TEXT2 =&lt;/P&gt;&lt;P&gt;FLEX_TEXT3 =&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM TRANSFER_XCEL_TO_ITAB *&lt;/P&gt;&lt;P&gt;Transfer Xcel Spreadsheet to SAP Internal Table * form transfer_xcel_to_itab.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Read the tab-delimited file into itab&lt;/P&gt;&lt;P&gt;call function 'WS_UPLOAD'&lt;/P&gt;&lt;P&gt;exporting&lt;/P&gt;&lt;P&gt;filename = p_name&lt;/P&gt;&lt;P&gt;filetype = 'DAT'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IMPORTING&lt;/P&gt;&lt;P&gt;filelength = flength&lt;/P&gt;&lt;P&gt;tables&lt;/P&gt;&lt;P&gt;data_tab = itab_xcel&lt;/P&gt;&lt;P&gt;exceptions&lt;/P&gt;&lt;P&gt;conversion_error = 1&lt;/P&gt;&lt;P&gt;file_open_error = 2&lt;/P&gt;&lt;P&gt;file_read_error = 3&lt;/P&gt;&lt;P&gt;invalid_table_width = 4&lt;/P&gt;&lt;P&gt;invalid_type = 5&lt;/P&gt;&lt;P&gt;no_batch = 6&lt;/P&gt;&lt;P&gt;unknown_error = 7&lt;/P&gt;&lt;P&gt;others = 8.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort the data&lt;/P&gt;&lt;P&gt;sort itab_xcel by matnr werks.&lt;/P&gt;&lt;P&gt;clear v_lines_in_xcel.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if no data in the file - error out&lt;/P&gt;&lt;P&gt;describe table itab_xcel lines v_lines_in_xcel.&lt;/P&gt;&lt;P&gt;if v_lines_in_xcel is initial.&lt;/P&gt;&lt;P&gt;write: / 'No data in input file'.&lt;/P&gt;&lt;P&gt;stop.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if file upload failed - error out&lt;/P&gt;&lt;P&gt;write: / 'Error reading input file'.&lt;/P&gt;&lt;P&gt;stop.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM BDC_SESSION_OPEN *&lt;/P&gt;&lt;P&gt;Open BDC Session * form bdc_session_open.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;create bdc session name = prefix-from-selectn-screen + nnnn&lt;/P&gt;&lt;P&gt;add 1 to v_ssnnr.&lt;/P&gt;&lt;P&gt;concatenate p_bdcpfx v_ssnnr into v_ssnname.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;open new bdc session&lt;/P&gt;&lt;P&gt;call function 'BDC_OPEN_GROUP'&lt;/P&gt;&lt;P&gt;exporting&lt;/P&gt;&lt;P&gt;client = sy-mandt&lt;/P&gt;&lt;P&gt;group = v_ssnname&lt;/P&gt;&lt;P&gt;keep = p_keep&lt;/P&gt;&lt;P&gt;user = p_uname&lt;/P&gt;&lt;P&gt;exceptions&lt;/P&gt;&lt;P&gt;client_invalid = 1&lt;/P&gt;&lt;P&gt;destination_invalid = 2&lt;/P&gt;&lt;P&gt;group_invalid = 3&lt;/P&gt;&lt;P&gt;group_is_locked = 4&lt;/P&gt;&lt;P&gt;holddate_invalid = 5&lt;/P&gt;&lt;P&gt;internal_error = 6&lt;/P&gt;&lt;P&gt;queue_error = 7&lt;/P&gt;&lt;P&gt;running = 8&lt;/P&gt;&lt;P&gt;system_lock_error = 9&lt;/P&gt;&lt;P&gt;user_invalid = 10&lt;/P&gt;&lt;P&gt;others = 11.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM BDC_BUILD_SCRIPT *&lt;/P&gt;&lt;P&gt;Build BDC * form bdc_build_script.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: l_arbpl like crhd-arbpl,&lt;/P&gt;&lt;P&gt;l_text1 like mkal-text1,&lt;/P&gt;&lt;P&gt;l_mdv01 like mkal-mdv01,&lt;/P&gt;&lt;P&gt;l_mapl like mapl.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;clear bdc-data itab - begin of new bdc transaction&lt;/P&gt;&lt;P&gt;clear itab_bdc_tab.&lt;/P&gt;&lt;P&gt;refresh itab_bdc_tab.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;read material cross reference tables to determine sap part#&lt;/P&gt;&lt;P&gt;clear : v_matnr, v_plnnr, v_plnal.&lt;/P&gt;&lt;P&gt;perform read_matnr_cross_ref using itab_xcel-matnr&lt;/P&gt;&lt;P&gt;itab_xcel-werks&lt;/P&gt;&lt;P&gt;changing v_matnr.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;determine the version description to use&lt;/P&gt;&lt;P&gt;if itab_xcel-text1 is initial.&lt;/P&gt;&lt;P&gt;l_text1 = itab_xcel-verid.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;l_text1 = itab_xcel-text1.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;determine the routing group# and group ctr# to use&lt;/P&gt;&lt;P&gt;perform read_routing .&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;determine the production line to use&lt;/P&gt;&lt;P&gt;if itab_xcel-mdv01 is initial.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if not provided in the file then:&lt;/P&gt;&lt;P&gt;prod line = work ctr on the last PP04 op of the rtg determined above&lt;/P&gt;&lt;P&gt;perform read_wc_on_last_pp04 using v_plnnr v_plnal&lt;/P&gt;&lt;P&gt;changing l_mdv01.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NOTE: when executing the above form\routine, if v_plnnr is initial&lt;/P&gt;&lt;P&gt;or v_plnal is initial, THEN l_mdv01 will automatically be&lt;/P&gt;&lt;P&gt;returned blank (ie initial)&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;l_mdv01 = itab_xcel-mdv01.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;build bdc script&lt;/P&gt;&lt;P&gt;perform bdc_build_script_record&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;fill in initial screen&lt;/P&gt;&lt;P&gt;using: 'X' 'SAPLCMFV' '1000',&lt;/P&gt;&lt;P&gt;' ' 'BDC_OKCODE' '=ENTE',&lt;/P&gt;&lt;P&gt;' ' 'MKAL-WERKS' itab_xcel-werks,&lt;/P&gt;&lt;P&gt;' ' 'MKAL-MATNR' v_matnr,&lt;/P&gt;&lt;P&gt;' ' 'MKAL_ADMIN-DISPO' space,&lt;/P&gt;&lt;P&gt;' ' 'MKAL-PLNNR' space,&lt;/P&gt;&lt;P&gt;' ' 'MKAL_ADMIN-STTAG' space,&lt;/P&gt;&lt;P&gt;' ' 'MKAL-PLNNG' space,&lt;/P&gt;&lt;P&gt;' ' 'MKAL-MDV01' space,&lt;/P&gt;&lt;P&gt;' ' 'MKAL-PLNNM' space,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;click create button on initial screen and go to detail screen&lt;/P&gt;&lt;P&gt;'X' 'SAPLCMFV' '1000',&lt;/P&gt;&lt;P&gt;' ' 'BDC_OKCODE' '=CREA',&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;fill in the detail screen and go back to initial screen&lt;/P&gt;&lt;P&gt;'X' 'SAPLCMFV' '2000',&lt;/P&gt;&lt;P&gt;' ' 'BDC_OKCODE' '=CLOS',&lt;/P&gt;&lt;P&gt;' ' 'MKAL_EXPAND-MATNR' v_matnr,&lt;/P&gt;&lt;P&gt;' ' 'MKAL_EXPAND-VERID' itab_xcel-verid,&lt;/P&gt;&lt;P&gt;' ' 'MKAL_EXPAND-TEXT1' l_text1,&lt;/P&gt;&lt;P&gt;' ' 'MKAL_EXPAND-BSTMI' itab_xcel-bstmi,&lt;/P&gt;&lt;P&gt;' ' 'MKAL_EXPAND-BSTMA' itab_xcel-bstma,&lt;/P&gt;&lt;P&gt;' ' 'MKAL_EXPAND-ADATU' itab_xcel-adatu,&lt;/P&gt;&lt;P&gt;' ' 'MKAL_EXPAND-BDATU' itab_xcel-bdatu,&lt;/P&gt;&lt;P&gt;' ' 'MKAL_EXPAND-PLTYG' v_plnty,&lt;/P&gt;&lt;P&gt;' ' 'MKAL_EXPAND-PLNNG' v_plnnr,&lt;/P&gt;&lt;P&gt;' ' 'MKAL_EXPAND-ALNAG' v_plnal,&lt;/P&gt;&lt;P&gt;' ' 'MKAL_EXPAND-STLAL' itab_xcel-stlal,&lt;/P&gt;&lt;P&gt;' ' 'MKAL_EXPAND-STLAN' itab_xcel-stlan,&lt;/P&gt;&lt;P&gt;' ' 'MKAL_EXPAND-SERKZ' itab_xcel-serkz,&lt;/P&gt;&lt;P&gt;' ' 'MKAL_EXPAND-MDV01' l_mdv01,&lt;/P&gt;&lt;P&gt;' ' 'MKAL_EXPAND-ELPRO' itab_xcel-elpro,&lt;/P&gt;&lt;P&gt;' ' 'MKAL_EXPAND-ALORT' itab_xcel-alort,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;save the production version from initial screen&lt;/P&gt;&lt;P&gt;'X' 'SAPLCMFV' '1000',&lt;/P&gt;&lt;P&gt;' ' 'BDC_OKCODE' '=SAVE'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM BDC_SUBMIT_TRANSACTION *&lt;/P&gt;&lt;P&gt;Submit BDC Session * form bdc_submit_transaction.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Load BDC script as a trqansction in BDC session&lt;/P&gt;&lt;P&gt;call function 'BDC_INSERT'&lt;/P&gt;&lt;P&gt;exporting&lt;/P&gt;&lt;P&gt;tcode = v_tcode&lt;/P&gt;&lt;P&gt;tables&lt;/P&gt;&lt;P&gt;dynprotab = itab_bdc_tab&lt;/P&gt;&lt;P&gt;exceptions&lt;/P&gt;&lt;P&gt;internal_error = 01&lt;/P&gt;&lt;P&gt;not_open = 02&lt;/P&gt;&lt;P&gt;queue_error = 03&lt;/P&gt;&lt;P&gt;tcode_invalid = 04.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM BDC_BUILD_SCRIPT_RECORD * form bdc_build_script_record using dynbegin name value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;clear itab_bdc_tab.&lt;/P&gt;&lt;P&gt;if dynbegin = 'X'.&lt;/P&gt;&lt;P&gt;move: name to itab_bdc_tab-program,&lt;/P&gt;&lt;P&gt;value to itab_bdc_tab-dynpro,&lt;/P&gt;&lt;P&gt;'X' to itab_bdc_tab-dynbegin.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;move: name to itab_bdc_tab-fnam,&lt;/P&gt;&lt;P&gt;value to itab_bdc_tab-fval.&lt;/P&gt;&lt;P&gt;shift itab_bdc_tab-fval left deleting leading space.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;append itab_bdc_tab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM BDC_SESSION_CLOSE *&lt;/P&gt;&lt;P&gt;Close BDC Session * form bdc_session_close.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;close the session&lt;/P&gt;&lt;P&gt;call function 'BDC_CLOSE_GROUP'&lt;/P&gt;&lt;P&gt;exceptions&lt;/P&gt;&lt;P&gt;not_open = 1&lt;/P&gt;&lt;P&gt;queue_error = 2&lt;/P&gt;&lt;P&gt;others = 3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;skip 2.&lt;/P&gt;&lt;P&gt;if sy-subrc ne 0.&lt;/P&gt;&lt;P&gt;write: / 'Error Closing BDC Session ' , 'RETURN CODE: ', sy-subrc.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;write : / 'Session created:', v_ssnname,&lt;/P&gt;&lt;P&gt;50 '# of transactions:', v_trans_in_ssn.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform.&lt;/P&gt;&lt;P&gt;&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;*&amp;amp; Form read_routing_cache&lt;/P&gt;&lt;P&gt;&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;*FORM read_routing_cache USING pi_matnr&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;pi_werks&lt;/P&gt;&lt;P&gt;pi_alnag&lt;/P&gt;&lt;P&gt;pi_verid&lt;/P&gt;&lt;P&gt;pi_mdv01.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF lt_plpo OCCURS 0,&lt;/P&gt;&lt;P&gt;vornr LIKE plpo-vornr,&lt;/P&gt;&lt;P&gt;objty LIKE crhd-objty,&lt;/P&gt;&lt;P&gt;objid LIKE crhd-objid,&lt;/P&gt;&lt;P&gt;arbpl LIKE crhd-arbpl,&lt;/P&gt;&lt;P&gt;END OF lt_plpo,&lt;/P&gt;&lt;P&gt;l_mapl_plnnr LIKE mapl-plnnr.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;determine the routing group#&lt;/P&gt;&lt;P&gt;CLEAR lt_pp04_cache.&lt;/P&gt;&lt;P&gt;chk if its in the cache first, if not then get it from MAPL table&lt;/P&gt;&lt;P&gt;and put it in the cache&lt;/P&gt;&lt;P&gt;READ TABLE lt_pp04_cache WITH KEY matnr = pi_matnr&lt;/P&gt;&lt;P&gt;werks = pi_werks&lt;/P&gt;&lt;P&gt;alnag = pi_alnag.&lt;/P&gt;&lt;P&gt;IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;do nothing - lt_pp04_cache header line has rtg#&lt;/P&gt;&lt;P&gt;ELSE.&lt;/P&gt;&lt;P&gt;get the routing group # from MAPL&lt;/P&gt;&lt;P&gt;SELECT plnnr INTO l_mapl_plnnr&lt;/P&gt;&lt;P&gt;FROM mapl UP TO 1 ROWS&lt;/P&gt;&lt;P&gt;WHERE matnr = pi_matnr AND&lt;/P&gt;&lt;P&gt;werks = pi_werks AND&lt;/P&gt;&lt;P&gt;plnty = 'R' AND&lt;/P&gt;&lt;P&gt;plnal = pi_alnag AND&lt;/P&gt;&lt;P&gt;loekz = space.&lt;/P&gt;&lt;P&gt;ENDSELECT.&lt;/P&gt;&lt;P&gt;put it in the cache internal table&lt;/P&gt;&lt;P&gt;IF NOT l_mapl_plnnr IS INITIAL.&lt;/P&gt;&lt;P&gt;lt_pp04_cache-matnr = pi_matnr.&lt;/P&gt;&lt;P&gt;lt_pp04_cache-werks = pi_werks.&lt;/P&gt;&lt;P&gt;lt_pp04_cache-alnag = pi_alnag.&lt;/P&gt;&lt;P&gt;lt_pp04_cache-plnnr = l_mapl_plnnr.&lt;/P&gt;&lt;P&gt;APPEND lt_pp04_cache.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if the rtg# was determined AND&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    *&lt;/P&gt;&lt;P&gt;          o the work center was not determined yet AND&lt;/P&gt;&lt;P&gt;          o work center was really needed for this line in the input file&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    *&lt;/P&gt;&lt;P&gt;          o read the work center from last PP04 operation on the routing&lt;/P&gt;&lt;P&gt;          o update the cache accordingly&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF NOT lt_pp04_cache-plnnr IS INITIAL AND&lt;/P&gt;&lt;P&gt;lt_pp04_cache-arbpl IS INITIAL AND&lt;/P&gt;&lt;P&gt;( pi_verid IS INITIAL OR&lt;/P&gt;&lt;P&gt;pi_mdv01 IS INITIAL ).&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;read the last PP04 operation&lt;/P&gt;&lt;P&gt;CLEAR lt_plpo.&lt;/P&gt;&lt;P&gt;REFRESH lt_plpo.&lt;/P&gt;&lt;P&gt;SELECT vornr e&lt;SUB&gt;objty e&lt;/SUB&gt;objid e~arbpl&lt;/P&gt;&lt;P&gt;INTO CORRESPONDING FIELDS OF TABLE lt_plpo&lt;/P&gt;&lt;P&gt;FROM plas AS b&lt;/P&gt;&lt;P&gt;INNER JOIN plpo AS c&lt;/P&gt;&lt;P&gt;ON b&lt;SUB&gt;plnty = c&lt;/SUB&gt;plnty AND&lt;/P&gt;&lt;P&gt;b&lt;SUB&gt;plnnr = c&lt;/SUB&gt;plnnr AND&lt;/P&gt;&lt;P&gt;b&lt;SUB&gt;zaehl = c&lt;/SUB&gt;zaehl&lt;/P&gt;&lt;P&gt;INNER JOIN crhd AS e&lt;/P&gt;&lt;P&gt;ON c&lt;SUB&gt;arbid = e&lt;/SUB&gt;objid&lt;/P&gt;&lt;P&gt;WHERE b~plnty = v_plnty AND&lt;/P&gt;&lt;P&gt;b~plnnr = lt_pp04_cache-plnnr AND&lt;/P&gt;&lt;P&gt;b~plnal = lt_pp04_cache-alnag AND&lt;/P&gt;&lt;P&gt;c~loekz = space AND&lt;/P&gt;&lt;P&gt;c~steus = v_plpo_steus AND&lt;/P&gt;&lt;P&gt;e~objty = v_objty AND&lt;/P&gt;&lt;P&gt;e~werks = lt_pp04_cache-werks AND&lt;/P&gt;&lt;P&gt;e~verwe = v_verwe.&lt;/P&gt;&lt;P&gt;SORT lt_plpo BY vornr DESCENDING.&lt;/P&gt;&lt;P&gt;READ TABLE lt_plpo INDEX 1.&lt;/P&gt;&lt;P&gt;**&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF NOT lt_plpo-arbpl IS INITIAL.&lt;/P&gt;&lt;P&gt;lt_pp04_cache-arbpl = lt_plpo-arbpl.&lt;/P&gt;&lt;P&gt;read work center description&lt;/P&gt;&lt;P&gt;SELECT SINGLE ktext INTO lt_pp04_cache-ktext&lt;/P&gt;&lt;P&gt;FROM crtx WHERE objty = lt_plpo-objty AND&lt;/P&gt;&lt;P&gt;objid = lt_plpo-objid AND&lt;/P&gt;&lt;P&gt;spras = sy-langu.&lt;/P&gt;&lt;P&gt;the following read will get the index of the correct record to be&lt;/P&gt;&lt;P&gt;updated in the cache&lt;/P&gt;&lt;P&gt;READ TABLE lt_pp04_cache&lt;/P&gt;&lt;P&gt;WITH KEY matnr = pi_matnr&lt;/P&gt;&lt;P&gt;werks = pi_werks&lt;/P&gt;&lt;P&gt;alnag = pi_alnag.&lt;/P&gt;&lt;P&gt;MODIFY lt_pp04_cache&lt;/P&gt;&lt;P&gt;INDEX sy-tabix&lt;/P&gt;&lt;P&gt;TRANSPORTING arbpl ktext.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;*ENDFORM. " read_last_pp04_operation_cache&lt;/P&gt;&lt;P&gt;&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;*&amp;amp; Form read_routing&lt;/P&gt;&lt;P&gt;&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;form read_routing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: begin of lt_mapl occurs 0,&lt;/P&gt;&lt;P&gt;plnnr like mapl-plnnr,&lt;/P&gt;&lt;P&gt;plnal like mapl-plnal,&lt;/P&gt;&lt;P&gt;end of lt_mapl,&lt;/P&gt;&lt;P&gt;l_arbpl like crhd-arbpl.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;get all the rtg# and grp ctr# from MAPL&lt;/P&gt;&lt;P&gt;select plnnr plnal&lt;/P&gt;&lt;P&gt;into corresponding fields of table lt_mapl&lt;/P&gt;&lt;P&gt;from mapl&lt;/P&gt;&lt;P&gt;where matnr = v_matnr and&lt;/P&gt;&lt;P&gt;werks = itab_xcel-werks and&lt;/P&gt;&lt;P&gt;plnty = v_plnty and "Rate Routing&lt;/P&gt;&lt;P&gt;loekz = space. "with del flag = OFF&lt;/P&gt;&lt;P&gt;sort lt_mapl by plnal.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if not itab_xcel-verid is initial.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if the verid=0001 then use the 1st good rtg-grp# and grp-ctr#&lt;/P&gt;&lt;P&gt;if itab_xcel-verid = '0001'.&lt;/P&gt;&lt;P&gt;read table lt_mapl index 1.&lt;/P&gt;&lt;P&gt;v_plnnr = lt_mapl-plnnr.&lt;/P&gt;&lt;P&gt;v_plnal = lt_mapl-plnal.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if the verid0001 then use the rtg-grp# and grp-ctr# of the routing&lt;/P&gt;&lt;P&gt;whose work center on the last PP04 operation matches the given verid&lt;/P&gt;&lt;P&gt;loop at lt_mapl.&lt;/P&gt;&lt;P&gt;clear l_arbpl.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;get the work center from the last PP04 operation&lt;/P&gt;&lt;P&gt;perform read_wc_on_last_pp04 using lt_mapl-plnnr&lt;/P&gt;&lt;P&gt;lt_mapl-plnal&lt;/P&gt;&lt;P&gt;changing l_arbpl.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;if itab_xcel-verid = l_arbpl.&lt;/P&gt;&lt;P&gt;v_plnnr = lt_mapl-plnnr.&lt;/P&gt;&lt;P&gt;v_plnal = lt_mapl-plnal.&lt;/P&gt;&lt;P&gt;exit.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;do nothing&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For version IDs that are other then '0000' or 'ZWIP' :--&lt;/P&gt;&lt;P&gt;if itab_xcel-verid NE '0000' and&lt;/P&gt;&lt;P&gt;itab_xcel-verid NE 'ZWIP'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if routing group# or group counter was not determined, make the&lt;/P&gt;&lt;P&gt;valid-to date 99/99/9999 so that the BDC, on execution, errors out.&lt;/P&gt;&lt;P&gt;if v_plnnr is initial or&lt;/P&gt;&lt;P&gt;v_plnal is initial.&lt;/P&gt;&lt;P&gt;itab_xcel-bdatu = '99/99/9999'.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;determine the routing group#&lt;/P&gt;&lt;P&gt;CLEAR lt_pp04_cache.&lt;/P&gt;&lt;P&gt;chk if its in the cache first, if not then get it from MAPL table&lt;/P&gt;&lt;P&gt;and put it in the cache&lt;/P&gt;&lt;P&gt;READ TABLE lt_pp04_cache WITH KEY matnr = pi_matnr&lt;/P&gt;&lt;P&gt;werks = pi_werks&lt;/P&gt;&lt;P&gt;alnag = pi_alnag.&lt;/P&gt;&lt;P&gt;IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;do nothing - lt_pp04_cache header line has rtg#&lt;/P&gt;&lt;P&gt;ELSE.&lt;/P&gt;&lt;P&gt;get the routing group # from MAPL&lt;/P&gt;&lt;P&gt;put it in the cache internal table&lt;/P&gt;&lt;P&gt;IF NOT l_mapl_plnnr IS INITIAL.&lt;/P&gt;&lt;P&gt;lt_pp04_cache-matnr = pi_matnr.&lt;/P&gt;&lt;P&gt;lt_pp04_cache-werks = pi_werks.&lt;/P&gt;&lt;P&gt;lt_pp04_cache-alnag = pi_alnag.&lt;/P&gt;&lt;P&gt;lt_pp04_cache-plnnr = l_mapl_plnnr.&lt;/P&gt;&lt;P&gt;APPEND lt_pp04_cache.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if the rtg# was determined AND&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    *&lt;/P&gt;&lt;P&gt;          o the work center was not determined yet AND&lt;/P&gt;&lt;P&gt;          o work center was really needed for this line in the input file&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    *&lt;/P&gt;&lt;P&gt;          o read the work center from last PP04 operation on the routing&lt;/P&gt;&lt;P&gt;          o update the cache accordingly&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF NOT lt_pp04_cache-plnnr IS INITIAL AND&lt;/P&gt;&lt;P&gt;lt_pp04_cache-arbpl IS INITIAL AND&lt;/P&gt;&lt;P&gt;( pi_verid IS INITIAL OR&lt;/P&gt;&lt;P&gt;pi_mdv01 IS INITIAL ).&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;read the last PP04 operation&lt;/P&gt;&lt;P&gt;CLEAR lt_plpo.&lt;/P&gt;&lt;P&gt;REFRESH lt_plpo.&lt;/P&gt;&lt;P&gt;SELECT vornr e&lt;SUB&gt;objty e&lt;/SUB&gt;objid e~arbpl&lt;/P&gt;&lt;P&gt;INTO CORRESPONDING FIELDS OF TABLE lt_plpo&lt;/P&gt;&lt;P&gt;FROM plas AS b&lt;/P&gt;&lt;P&gt;INNER JOIN plpo AS c&lt;/P&gt;&lt;P&gt;ON b&lt;SUB&gt;plnty = c&lt;/SUB&gt;plnty AND&lt;/P&gt;&lt;P&gt;b&lt;SUB&gt;plnnr = c&lt;/SUB&gt;plnnr AND&lt;/P&gt;&lt;P&gt;b&lt;SUB&gt;zaehl = c&lt;/SUB&gt;zaehl&lt;/P&gt;&lt;P&gt;INNER JOIN crhd AS e&lt;/P&gt;&lt;P&gt;ON c&lt;SUB&gt;arbid = e&lt;/SUB&gt;objid&lt;/P&gt;&lt;P&gt;WHERE b~plnty = v_plnty AND&lt;/P&gt;&lt;P&gt;b~plnnr = lt_pp04_cache-plnnr AND&lt;/P&gt;&lt;P&gt;b~plnal = lt_pp04_cache-alnag AND&lt;/P&gt;&lt;P&gt;c~loekz = space AND&lt;/P&gt;&lt;P&gt;c~steus = v_plpo_steus AND&lt;/P&gt;&lt;P&gt;e~objty = v_objty AND&lt;/P&gt;&lt;P&gt;e~werks = lt_pp04_cache-werks AND&lt;/P&gt;&lt;P&gt;e~verwe = v_verwe.&lt;/P&gt;&lt;P&gt;SORT lt_plpo BY vornr DESCENDING.&lt;/P&gt;&lt;P&gt;READ TABLE lt_plpo INDEX 1.&lt;/P&gt;&lt;P&gt;**&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF NOT lt_plpo-arbpl IS INITIAL.&lt;/P&gt;&lt;P&gt;lt_pp04_cache-arbpl = lt_plpo-arbpl.&lt;/P&gt;&lt;P&gt;read work center description&lt;/P&gt;&lt;P&gt;SELECT SINGLE ktext INTO lt_pp04_cache-ktext&lt;/P&gt;&lt;P&gt;FROM crtx WHERE objty = lt_plpo-objty AND&lt;/P&gt;&lt;P&gt;objid = lt_plpo-objid AND&lt;/P&gt;&lt;P&gt;spras = sy-langu.&lt;/P&gt;&lt;P&gt;the following read will get the index of the correct record to be&lt;/P&gt;&lt;P&gt;updated in the cache&lt;/P&gt;&lt;P&gt;READ TABLE lt_pp04_cache&lt;/P&gt;&lt;P&gt;WITH KEY matnr = pi_matnr&lt;/P&gt;&lt;P&gt;werks = pi_werks&lt;/P&gt;&lt;P&gt;alnag = pi_alnag.&lt;/P&gt;&lt;P&gt;MODIFY lt_pp04_cache&lt;/P&gt;&lt;P&gt;INDEX sy-tabix&lt;/P&gt;&lt;P&gt;TRANSPORTING arbpl ktext.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. " read_last_pp04_operation_cache&lt;/P&gt;&lt;P&gt;&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;*&amp;amp; Form read_wc_on_last_pp04&lt;/P&gt;&lt;P&gt;&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;form read_wc_on_last_pp04 using pi_plnnr&lt;/P&gt;&lt;P&gt;pi_plnal&lt;/P&gt;&lt;P&gt;changing pe_arbpl.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: begin of lt_plpo occurs 0,&lt;/P&gt;&lt;P&gt;vornr like plpo-vornr,&lt;/P&gt;&lt;P&gt;objty like crhd-objty,&lt;/P&gt;&lt;P&gt;objid like crhd-objid,&lt;/P&gt;&lt;P&gt;arbpl like crhd-arbpl,&lt;/P&gt;&lt;P&gt;end of lt_plpo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;get all the PP04 operations for the given rtg# &amp;amp; grp-ctr#&lt;/P&gt;&lt;P&gt;select vornr e&lt;SUB&gt;objty e&lt;/SUB&gt;objid e~arbpl&lt;/P&gt;&lt;P&gt;into corresponding fields of table lt_plpo&lt;/P&gt;&lt;P&gt;from plas as b&lt;/P&gt;&lt;P&gt;inner join plpo as c&lt;/P&gt;&lt;P&gt;on b&lt;SUB&gt;plnty = c&lt;/SUB&gt;plnty and&lt;/P&gt;&lt;P&gt;b&lt;SUB&gt;plnnr = c&lt;/SUB&gt;plnnr and&lt;/P&gt;&lt;P&gt;b&lt;SUB&gt;zaehl = c&lt;/SUB&gt;zaehl&lt;/P&gt;&lt;P&gt;inner join crhd as e&lt;/P&gt;&lt;P&gt;on c&lt;SUB&gt;arbid = e&lt;/SUB&gt;objid&lt;/P&gt;&lt;P&gt;where b~plnty = v_plnty and "Rate Routing&lt;/P&gt;&lt;P&gt;b~plnnr = pi_plnnr and&lt;/P&gt;&lt;P&gt;b~plnal = pi_plnal and&lt;/P&gt;&lt;P&gt;c~loekz = space and "Oper Del Flag = OFF&lt;/P&gt;&lt;P&gt;c~steus = v_plpo_steus and "PP04&lt;/P&gt;&lt;P&gt;e~objty = v_objty. "WC Obj Type = 'A'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;read the last operation&lt;/P&gt;&lt;P&gt;sort lt_plpo by vornr descending.&lt;/P&gt;&lt;P&gt;read table lt_plpo index 1.&lt;/P&gt;&lt;P&gt;pe_arbpl = lt_plpo-arbpl.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. " read_wc_on_last_pp04&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Goto LSMW-&amp;gt; Select Direct Input method in 1st step. These are the standard programs for data transfer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Otherwise goto SPRO-&amp;gt;SAP Reference IMG-&amp;gt; Under this you'll find standard data transfer programs module wise.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regs,&lt;/P&gt;&lt;P&gt;Hema.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 03 Feb 2008 06:11:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bdc/m-p/3310952#M793010</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-03T06:11:23Z</dc:date>
    </item>
  </channel>
</rss>

