<?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 session method in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/bdc-session-method/m-p/3334697#M799149</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;Hope it will help you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Reward if help.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How to deal with table control / step loop in BDC&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Steploop and table contol is inevitable in certain transactions. When we run BDC for such transactions, we will face the situation: how many visible lines of steploop/tablecontrol are on the screen? Although we can always find certain method to deal with it, such as function code 'NP', 'POPO', considering some extreme situation: there is only one line visible one the screen, our BDC program should display an error message. (See transaction 'ME21', we you resize your screen to let only one row visible, you can not enter mutiple lines on this screen even you use 'NP')&lt;/P&gt;&lt;P&gt;Now with the help of Poonam on sapfans.com developement forum, I find a method with which we can determine the number of visible lines on Transaction Screen from our Calling BDC program. Maybe it is useless to you, but I think it will give your some idea.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Demo ABAP code has two purposes:&lt;/P&gt;&lt;P&gt;1. how to determine number of visible lines and how to calculte page number;&lt;/P&gt;&lt;P&gt;(the 'calpage' routine has been modify to meet general purpose usage)&lt;/P&gt;&lt;P&gt;2. using field symbol in BDC program, please pay special attention to the difference in Static ASSIGN and Dynamic ASSIGN.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now I begin to describe the step to implement my method:&lt;/P&gt;&lt;P&gt;(I use transaction 'ME21', screen 121 for sample,&lt;/P&gt;&lt;P&gt;the method using is Call Transation Using..)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Step1: go to screen painter to display the screen 121, then we can count the fixed line on this screen, there is 7 lines above the steploop and 2 lines below the steploop, so there are total 9 fixed lines on this screen. This means except these 9 lines, all the other line is for step loop. Then have a look at steploop itselp, one entry of it will occupy two lines.&lt;/P&gt;&lt;P&gt;(Be careful, for table control, the head and the bottom scroll bar will possess another two fixed lines, and there is a maximum number for table line)&lt;/P&gt;&lt;P&gt;Now we have : FixedLine = 9&lt;/P&gt;&lt;P&gt;LoopLine = 2(for table control, LoopLine is always equal to 1)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Step2: go to transaction itself(ME21) to see how it roll page, in ME21, the first line of new page is always occupied by the last line of last page, so it begin with index '02', but in some other case, fisrt line is empty and ready for input.&lt;/P&gt;&lt;P&gt;Now we have: FirstLine = 0&lt;/P&gt;&lt;P&gt;or FirstLine = 1 ( in our case, FirstLine is 1 because the first line of new page is fulfilled)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Step3: write a subroutine calcalculating number of pages&lt;/P&gt;&lt;P&gt;(here, the name of actual parameter is the same as formal parameter)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;global data: FixedLine type i, " number of fixed line on a certain screen&lt;/P&gt;&lt;P&gt;LoopLine type i, " the number of lines occupied by one steploop item&lt;/P&gt;&lt;P&gt;FirstLine type i, " possbile value 0 or 1, 0 stand for the first line of new " scrolling screen is empty, otherwise is 1&lt;/P&gt;&lt;P&gt;Dataline type i, " number of items you will use in BDC, using DESCRIBE to get&lt;/P&gt;&lt;P&gt;pageno type i, " you need to scroll screen how many times.&lt;/P&gt;&lt;P&gt;line type i, " number of lines appears on the screen.&lt;/P&gt;&lt;P&gt;index(2) type N, " the screen index for certain item&lt;/P&gt;&lt;P&gt;begin type i, " from parameter of loop&lt;/P&gt;&lt;P&gt;end type i. " to parameter of loop&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*in code sample, the DataTable-linindex stands for the table index number of this line&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form calpage using FixedLine type i (see step 1)&lt;/P&gt;&lt;P&gt;LoopLine type i (see step 1)&lt;/P&gt;&lt;P&gt;FirstLine type i (see step 2)&lt;/P&gt;&lt;P&gt;DataLine type i ( this is the item number you will enter in transaction)&lt;/P&gt;&lt;P&gt;changing pageno type i (return the number of page, depends on run-time visible line in table control/ Step Loop)&lt;/P&gt;&lt;P&gt;changing line type i.(visible lines one the screen)&lt;/P&gt;&lt;P&gt;data: midd type i,&lt;/P&gt;&lt;P&gt;vline type i, "visible lines&lt;/P&gt;&lt;P&gt;if DataLine eq 0.&lt;/P&gt;&lt;P&gt;Message eXXX.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;vline = ( sy-srows - FixedLine ) div LoopLine.&lt;/P&gt;&lt;P&gt;*for table control, you should compare vline with maximum line of&lt;/P&gt;&lt;P&gt;*table control, then take the small one that is min(vline, maximum)&lt;/P&gt;&lt;P&gt;*here only illustrate step loop&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if FirstLine eq 0.&lt;/P&gt;&lt;P&gt;pageno = DataLine div vline.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if pageno eq 0.&lt;/P&gt;&lt;P&gt;pageno = pageno + 1.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;elseif FirstLine eq 1.&lt;/P&gt;&lt;P&gt;pageno = ( DataLine - 1 ) div ( vline - 1 ) + 1.&lt;/P&gt;&lt;P&gt;midd = ( DataLine - 1 ) mod ( vline - 1).&lt;/P&gt;&lt;P&gt;if midd = 0 and DataLine gt 1.&lt;/P&gt;&lt;P&gt;pageno = pageno - 1.&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;line = vline.&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;Step4 write a subroutine to calculate the line index for each item.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form calindex using Line type i (visible lines on the screen)&lt;/P&gt;&lt;P&gt;FirstLine type i(see step 2)&lt;/P&gt;&lt;P&gt;LineIndex type i(item index)&lt;/P&gt;&lt;P&gt;changing Index type n. (index on the screen)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if FirstLine = 0.&lt;/P&gt;&lt;P&gt;index = LineIndex mod Line.&lt;/P&gt;&lt;P&gt;if index = '00'.&lt;/P&gt;&lt;P&gt;index = Line.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;elseif FirstLine = 1.&lt;/P&gt;&lt;P&gt;index = LineIndex mod ( Line - 1 ).&lt;/P&gt;&lt;P&gt;if ( index between 1 and 0 ) and LineIndex gt 1.&lt;/P&gt;&lt;P&gt;index = index + Line - 1.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;if Line = 2.&lt;/P&gt;&lt;P&gt;index = index + Line - 1.&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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Step5 write a subroutine to calculate the loop range.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form calrange using Line type i ( visible lines on the screen)&lt;/P&gt;&lt;P&gt;DataLine type i&lt;/P&gt;&lt;P&gt;FirstLine type i&lt;/P&gt;&lt;P&gt;loopindex like sy-index&lt;/P&gt;&lt;P&gt;changing begin type i&lt;/P&gt;&lt;P&gt;end type i.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If FirstLine = 0.&lt;/P&gt;&lt;P&gt;if loopindex = 1.&lt;/P&gt;&lt;P&gt;begin = 1.&lt;/P&gt;&lt;P&gt;if DataLine &amp;lt;= Line.&lt;/P&gt;&lt;P&gt;end = DataLine.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;end = Line.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;elseif loopindex gt 1.&lt;/P&gt;&lt;P&gt;begin = Line * ( loopindex - 1 ) + 1.&lt;/P&gt;&lt;P&gt;end = Line * loopindex.&lt;/P&gt;&lt;P&gt;if end gt DataLine.&lt;/P&gt;&lt;P&gt;end = DataLine.&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;elseif FirstLine = 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if loopindex = 1.&lt;/P&gt;&lt;P&gt;begin = 1.&lt;/P&gt;&lt;P&gt;if DataLine &amp;lt;= Line.&lt;/P&gt;&lt;P&gt;end = DataLine.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;end = Line.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;elseif loop index gt 1.&lt;/P&gt;&lt;P&gt;begin = ( Line - 1 ) * ( loopindex - 1 ) + 2.&lt;/P&gt;&lt;P&gt;end = ( Line - 1 ) * ( loopindex - 1 ) + Line.&lt;/P&gt;&lt;P&gt;if end gt DataLine.&lt;/P&gt;&lt;P&gt;end = DataLine.&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;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;Step6 using field sysbol in your BDC, for example: in ME21, but you should calculate each item will correponding to which index in steploop/Table Control&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form creat_bdc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;field-symbols: &amp;lt;material&amp;gt;, &amp;lt;quan&amp;gt;, &amp;lt;indicator&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: name1(14) value 'EKPO-EMATN(XX)',&lt;/P&gt;&lt;P&gt;name2(14) value 'EKPO-MENGE(XX)',&lt;/P&gt;&lt;P&gt;name3(15) value 'RM06E-SELKZ(XX)'.&lt;/P&gt;&lt;P&gt;assign: name1 to &amp;lt;material&amp;gt;,&lt;/P&gt;&lt;P&gt;name2 to &amp;lt;quan&amp;gt;,&lt;/P&gt;&lt;P&gt;name3 to &amp;lt;indicator&amp;gt;.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;do pageno times.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-index gt 1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*insert scroll page ok_code"&lt;/P&gt;&lt;P&gt;&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;perform calrange using Line DataLine FirstLine sy-index&lt;/P&gt;&lt;P&gt;changing begin end.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;loop at DataTable from begin to end.&lt;/P&gt;&lt;P&gt;perform calindex using Line FirstLine DataTable-LineIndex changing Index.&lt;/P&gt;&lt;P&gt;name1+11(2) = Index.&lt;/P&gt;&lt;P&gt;name2+11(2) = Index.&lt;/P&gt;&lt;P&gt;name3+12(2) = Index.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;perform bdcfield using &amp;lt;material&amp;gt; DataTable-matnr.&lt;/P&gt;&lt;P&gt;perform bdcfield using &amp;lt;quan&amp;gt; DataTable-menge.&lt;/P&gt;&lt;P&gt;perform bdcfield using &amp;lt;indicator&amp;gt; DataTable-indicator.&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;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;enddo.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 01 Feb 2008 05:00:35 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-02-01T05:00:35Z</dc:date>
    <item>
      <title>BDC session method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bdc-session-method/m-p/3334693#M799145</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hai, I am Ramesh&lt;/P&gt;&lt;P&gt;can you please clarify my doubt that is how to process the session log(error) in BDC session method&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Feb 2008 02:03:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bdc-session-method/m-p/3334693#M799145</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-01T02:03:41Z</dc:date>
    </item>
    <item>
      <title>Re: BDC session method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bdc-session-method/m-p/3334694#M799146</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;SM35.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you can not process the error lo. but u can process the session.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;to view the error log select the session and press analysis, you can see the information about how many records updated and not updated, &lt;/P&gt;&lt;P&gt;if if it is not updated, it show on which screen it got error, etc...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards.&lt;/P&gt;&lt;P&gt;santhosh reddy&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rectify the error records in flat file and run the bdc program for rectified flat file&lt;/P&gt;&lt;P&gt;just u can analyze the errors in sm35&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;reward all useful&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Santhosh Reddy on Feb 1, 2008 8:01 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Feb 2008 02:20:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bdc-session-method/m-p/3334694#M799146</guid>
      <dc:creator>SantoshKallem</dc:creator>
      <dc:date>2008-02-01T02:20:25Z</dc:date>
    </item>
    <item>
      <title>Re: BDC session method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bdc-session-method/m-p/3334695#M799147</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hai Santhos&lt;/P&gt;&lt;P&gt;can't we process the error log then how to update our records to database&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Feb 2008 02:29:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bdc-session-method/m-p/3334695#M799147</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-01T02:29:06Z</dc:date>
    </item>
    <item>
      <title>Re: BDC session method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bdc-session-method/m-p/3334696#M799148</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;Hope it will help you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Reward if help.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SESSION METHOD &lt;/P&gt;&lt;P&gt;- It is one of the BDC techniques for uploading legacy data into SAP&lt;/P&gt;&lt;P&gt;- The data is transferring from the internal table to database table&lt;/P&gt;&lt;P&gt;through sessions. &lt;/P&gt;&lt;P&gt;- Data along with its action is stored in session. &lt;/P&gt;&lt;P&gt;- When the program has finished generating the session, you can run &lt;/P&gt;&lt;P&gt;the session to execute the transaction. &lt;/P&gt;&lt;P&gt;- Unless session is processed, the data is not transferred to &lt;/P&gt;&lt;P&gt;database tables. &lt;/P&gt;&lt;P&gt;- The following Function Modules are used in the session method. &lt;/P&gt;&lt;P&gt;1. BDC_OPEN_GROUP (Used to create the session) &lt;/P&gt;&lt;P&gt;Import Parameters : &lt;/P&gt;&lt;P&gt;USER - User Name &lt;/P&gt;&lt;P&gt;CLIENT - Client &lt;/P&gt;&lt;P&gt;GROUP - Name of the session &lt;/P&gt;&lt;P&gt;HOLD - The date when you want to process the session &lt;/P&gt;&lt;P&gt;KEEP - &amp;#145;X&amp;#146; &amp;#150; retain session even after processing it &lt;/P&gt;&lt;P&gt;' ' - Delete the session after processing. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. BDC_INSERT (Data is transferred to session) &lt;/P&gt;&lt;P&gt;Import Parameters : &lt;/P&gt;&lt;P&gt;TCODE - Transaction code &lt;/P&gt;&lt;P&gt;DYNPROTAB &amp;#150; BDCDATA table &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. BDC_CLOSE_GROUP (Used to close a session) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Processing Steps &lt;/P&gt;&lt;P&gt;1. Generate the batch input session using function module &lt;/P&gt;&lt;P&gt;BDC_OPEN_GROUP. &lt;/P&gt;&lt;P&gt;2. The proceed as follows for each transaction that the session &lt;/P&gt;&lt;P&gt;contains: &lt;/P&gt;&lt;P&gt;a. In the BDCDATA structure, enter the value for all screens &lt;/P&gt;&lt;P&gt;and fields that must be processed in the transaction. &lt;/P&gt;&lt;P&gt;b. Use BDC_INSERT to transfer the transaction and the BDCDATA &lt;/P&gt;&lt;P&gt;structure to the session. &lt;/P&gt;&lt;P&gt;3. Close the batch input session with BDC_CLOSE_GROUP. &lt;/P&gt;&lt;P&gt;4. Start to process the generated session in T.Code SM35. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WT IS CALL TRANSACTION METHOD? WT IS SYNTAX/PROCEDURE?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL TRANSACTION :&lt;/P&gt;&lt;P&gt;1. It is compatible for small amount of data only. &lt;/P&gt;&lt;P&gt;2. It process the data Synchronously. i.e., The data is updated&lt;/P&gt;&lt;P&gt;at the time of execution. &lt;/P&gt;&lt;P&gt;3. It updates data both Synchronously and Asynchronously. When&lt;/P&gt;&lt;P&gt;we use Synchronous mode, it always verify all the data updated&lt;/P&gt;&lt;P&gt;successfully in the database. &lt;/P&gt;&lt;P&gt;When we use Asynchronous mode, the system can not wait till &lt;/P&gt;&lt;P&gt;all the data updated in the database. &lt;/P&gt;&lt;P&gt;4. It can handle only one application at a time. &lt;/P&gt;&lt;P&gt;5. It does not have Log file, we need to design logfile explicitly&lt;/P&gt;&lt;P&gt;using BDCMSGCOLL stucture. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Syntax :&lt;/P&gt;&lt;P&gt;CALL TRANSACTION &amp;lt;T.Code&amp;gt; USING &amp;lt;BDCTAB&amp;gt; MODE &amp;lt;A/N/E&amp;gt; UPDATE &amp;lt;S/A&amp;gt;&lt;/P&gt;&lt;P&gt;MESSAGES INTO &amp;lt;BDCMSGCOLL Int.Table&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Parameter 1 : Transaction Code&lt;/P&gt;&lt;P&gt;Parameter 2 : It is name of BDCDATA table.&lt;/P&gt;&lt;P&gt;Parameter 3 : Specifying Mode in which you execute transaction. &lt;/P&gt;&lt;P&gt;A - All screen mode. All the screen of transaction&lt;/P&gt;&lt;P&gt;are displayed. &lt;/P&gt;&lt;P&gt;N - No screen mode. No screen is displayed when you &lt;/P&gt;&lt;P&gt;execute the transaction. &lt;/P&gt;&lt;P&gt;E - Error screen. Only those screens are displayed &lt;/P&gt;&lt;P&gt;where you have error record. &lt;/P&gt;&lt;P&gt;Parameter 4 : Specifying Update type by which data base table is &lt;/P&gt;&lt;P&gt;updated.&lt;/P&gt;&lt;P&gt;S - It is for Synchronous update in which if you &lt;/P&gt;&lt;P&gt;change data for one table then all the relacted &lt;/P&gt;&lt;P&gt;tables gets updated. And then sy-subrc is returned&lt;/P&gt;&lt;P&gt;i.e., sy-subrc is returned for once and all. &lt;/P&gt;&lt;P&gt;A - It is for Asynchronous update, when you change &lt;/P&gt;&lt;P&gt;data of one table, the sy-subrc is returned. And&lt;/P&gt;&lt;P&gt;then updation of other affected tables takes place&lt;/P&gt;&lt;P&gt;If system fails to update other tables still&lt;/P&gt;&lt;P&gt;sy-subrc returned is 0.&lt;/P&gt;&lt;P&gt;Parameter 5 : When you update database table, operation is either&lt;/P&gt;&lt;P&gt;successful or unsuccessful or operation is successful&lt;/P&gt;&lt;P&gt;with some warning. These messages are stored in &lt;/P&gt;&lt;P&gt;internal table which you specify along with MESSAGE&lt;/P&gt;&lt;P&gt;statement. This internal table should be declared like&lt;/P&gt;&lt;P&gt;BDCMSGCOLL structure. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Steps for CALL TRANSACTION Method :&lt;/P&gt;&lt;P&gt;1. Interanal table for the data (structure similler to local file)&lt;/P&gt;&lt;P&gt;2. BDCTAB like BDCDATA.&lt;/P&gt;&lt;P&gt;3. Use UPLOAD/WS_UPLOAD/GUI_UPLOAD or DATASETS for upload data from&lt;/P&gt;&lt;P&gt;local file to internal table (i.e. ITAB). &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;T.Code&amp;gt; USING &amp;lt;BDCTAB&amp;gt; MODE &amp;lt;A/N/E&amp;gt;&lt;/P&gt;&lt;P&gt;UPDATE &amp;lt;S/A&amp;gt; MESSAGES INTO &amp;lt;BDCMSGCOLL Int.Table&amp;gt;&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>Fri, 01 Feb 2008 04:59:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bdc-session-method/m-p/3334696#M799148</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-01T04:59:55Z</dc:date>
    </item>
    <item>
      <title>Re: BDC session method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bdc-session-method/m-p/3334697#M799149</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;Hope it will help you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Reward if help.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How to deal with table control / step loop in BDC&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Steploop and table contol is inevitable in certain transactions. When we run BDC for such transactions, we will face the situation: how many visible lines of steploop/tablecontrol are on the screen? Although we can always find certain method to deal with it, such as function code 'NP', 'POPO', considering some extreme situation: there is only one line visible one the screen, our BDC program should display an error message. (See transaction 'ME21', we you resize your screen to let only one row visible, you can not enter mutiple lines on this screen even you use 'NP')&lt;/P&gt;&lt;P&gt;Now with the help of Poonam on sapfans.com developement forum, I find a method with which we can determine the number of visible lines on Transaction Screen from our Calling BDC program. Maybe it is useless to you, but I think it will give your some idea.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Demo ABAP code has two purposes:&lt;/P&gt;&lt;P&gt;1. how to determine number of visible lines and how to calculte page number;&lt;/P&gt;&lt;P&gt;(the 'calpage' routine has been modify to meet general purpose usage)&lt;/P&gt;&lt;P&gt;2. using field symbol in BDC program, please pay special attention to the difference in Static ASSIGN and Dynamic ASSIGN.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now I begin to describe the step to implement my method:&lt;/P&gt;&lt;P&gt;(I use transaction 'ME21', screen 121 for sample,&lt;/P&gt;&lt;P&gt;the method using is Call Transation Using..)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Step1: go to screen painter to display the screen 121, then we can count the fixed line on this screen, there is 7 lines above the steploop and 2 lines below the steploop, so there are total 9 fixed lines on this screen. This means except these 9 lines, all the other line is for step loop. Then have a look at steploop itselp, one entry of it will occupy two lines.&lt;/P&gt;&lt;P&gt;(Be careful, for table control, the head and the bottom scroll bar will possess another two fixed lines, and there is a maximum number for table line)&lt;/P&gt;&lt;P&gt;Now we have : FixedLine = 9&lt;/P&gt;&lt;P&gt;LoopLine = 2(for table control, LoopLine is always equal to 1)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Step2: go to transaction itself(ME21) to see how it roll page, in ME21, the first line of new page is always occupied by the last line of last page, so it begin with index '02', but in some other case, fisrt line is empty and ready for input.&lt;/P&gt;&lt;P&gt;Now we have: FirstLine = 0&lt;/P&gt;&lt;P&gt;or FirstLine = 1 ( in our case, FirstLine is 1 because the first line of new page is fulfilled)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Step3: write a subroutine calcalculating number of pages&lt;/P&gt;&lt;P&gt;(here, the name of actual parameter is the same as formal parameter)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;global data: FixedLine type i, " number of fixed line on a certain screen&lt;/P&gt;&lt;P&gt;LoopLine type i, " the number of lines occupied by one steploop item&lt;/P&gt;&lt;P&gt;FirstLine type i, " possbile value 0 or 1, 0 stand for the first line of new " scrolling screen is empty, otherwise is 1&lt;/P&gt;&lt;P&gt;Dataline type i, " number of items you will use in BDC, using DESCRIBE to get&lt;/P&gt;&lt;P&gt;pageno type i, " you need to scroll screen how many times.&lt;/P&gt;&lt;P&gt;line type i, " number of lines appears on the screen.&lt;/P&gt;&lt;P&gt;index(2) type N, " the screen index for certain item&lt;/P&gt;&lt;P&gt;begin type i, " from parameter of loop&lt;/P&gt;&lt;P&gt;end type i. " to parameter of loop&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*in code sample, the DataTable-linindex stands for the table index number of this line&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form calpage using FixedLine type i (see step 1)&lt;/P&gt;&lt;P&gt;LoopLine type i (see step 1)&lt;/P&gt;&lt;P&gt;FirstLine type i (see step 2)&lt;/P&gt;&lt;P&gt;DataLine type i ( this is the item number you will enter in transaction)&lt;/P&gt;&lt;P&gt;changing pageno type i (return the number of page, depends on run-time visible line in table control/ Step Loop)&lt;/P&gt;&lt;P&gt;changing line type i.(visible lines one the screen)&lt;/P&gt;&lt;P&gt;data: midd type i,&lt;/P&gt;&lt;P&gt;vline type i, "visible lines&lt;/P&gt;&lt;P&gt;if DataLine eq 0.&lt;/P&gt;&lt;P&gt;Message eXXX.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;vline = ( sy-srows - FixedLine ) div LoopLine.&lt;/P&gt;&lt;P&gt;*for table control, you should compare vline with maximum line of&lt;/P&gt;&lt;P&gt;*table control, then take the small one that is min(vline, maximum)&lt;/P&gt;&lt;P&gt;*here only illustrate step loop&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if FirstLine eq 0.&lt;/P&gt;&lt;P&gt;pageno = DataLine div vline.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if pageno eq 0.&lt;/P&gt;&lt;P&gt;pageno = pageno + 1.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;elseif FirstLine eq 1.&lt;/P&gt;&lt;P&gt;pageno = ( DataLine - 1 ) div ( vline - 1 ) + 1.&lt;/P&gt;&lt;P&gt;midd = ( DataLine - 1 ) mod ( vline - 1).&lt;/P&gt;&lt;P&gt;if midd = 0 and DataLine gt 1.&lt;/P&gt;&lt;P&gt;pageno = pageno - 1.&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;line = vline.&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;Step4 write a subroutine to calculate the line index for each item.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form calindex using Line type i (visible lines on the screen)&lt;/P&gt;&lt;P&gt;FirstLine type i(see step 2)&lt;/P&gt;&lt;P&gt;LineIndex type i(item index)&lt;/P&gt;&lt;P&gt;changing Index type n. (index on the screen)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if FirstLine = 0.&lt;/P&gt;&lt;P&gt;index = LineIndex mod Line.&lt;/P&gt;&lt;P&gt;if index = '00'.&lt;/P&gt;&lt;P&gt;index = Line.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;elseif FirstLine = 1.&lt;/P&gt;&lt;P&gt;index = LineIndex mod ( Line - 1 ).&lt;/P&gt;&lt;P&gt;if ( index between 1 and 0 ) and LineIndex gt 1.&lt;/P&gt;&lt;P&gt;index = index + Line - 1.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;if Line = 2.&lt;/P&gt;&lt;P&gt;index = index + Line - 1.&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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Step5 write a subroutine to calculate the loop range.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form calrange using Line type i ( visible lines on the screen)&lt;/P&gt;&lt;P&gt;DataLine type i&lt;/P&gt;&lt;P&gt;FirstLine type i&lt;/P&gt;&lt;P&gt;loopindex like sy-index&lt;/P&gt;&lt;P&gt;changing begin type i&lt;/P&gt;&lt;P&gt;end type i.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If FirstLine = 0.&lt;/P&gt;&lt;P&gt;if loopindex = 1.&lt;/P&gt;&lt;P&gt;begin = 1.&lt;/P&gt;&lt;P&gt;if DataLine &amp;lt;= Line.&lt;/P&gt;&lt;P&gt;end = DataLine.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;end = Line.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;elseif loopindex gt 1.&lt;/P&gt;&lt;P&gt;begin = Line * ( loopindex - 1 ) + 1.&lt;/P&gt;&lt;P&gt;end = Line * loopindex.&lt;/P&gt;&lt;P&gt;if end gt DataLine.&lt;/P&gt;&lt;P&gt;end = DataLine.&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;elseif FirstLine = 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if loopindex = 1.&lt;/P&gt;&lt;P&gt;begin = 1.&lt;/P&gt;&lt;P&gt;if DataLine &amp;lt;= Line.&lt;/P&gt;&lt;P&gt;end = DataLine.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;end = Line.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;elseif loop index gt 1.&lt;/P&gt;&lt;P&gt;begin = ( Line - 1 ) * ( loopindex - 1 ) + 2.&lt;/P&gt;&lt;P&gt;end = ( Line - 1 ) * ( loopindex - 1 ) + Line.&lt;/P&gt;&lt;P&gt;if end gt DataLine.&lt;/P&gt;&lt;P&gt;end = DataLine.&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;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;Step6 using field sysbol in your BDC, for example: in ME21, but you should calculate each item will correponding to which index in steploop/Table Control&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form creat_bdc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;field-symbols: &amp;lt;material&amp;gt;, &amp;lt;quan&amp;gt;, &amp;lt;indicator&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: name1(14) value 'EKPO-EMATN(XX)',&lt;/P&gt;&lt;P&gt;name2(14) value 'EKPO-MENGE(XX)',&lt;/P&gt;&lt;P&gt;name3(15) value 'RM06E-SELKZ(XX)'.&lt;/P&gt;&lt;P&gt;assign: name1 to &amp;lt;material&amp;gt;,&lt;/P&gt;&lt;P&gt;name2 to &amp;lt;quan&amp;gt;,&lt;/P&gt;&lt;P&gt;name3 to &amp;lt;indicator&amp;gt;.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;do pageno times.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-index gt 1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*insert scroll page ok_code"&lt;/P&gt;&lt;P&gt;&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;perform calrange using Line DataLine FirstLine sy-index&lt;/P&gt;&lt;P&gt;changing begin end.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;loop at DataTable from begin to end.&lt;/P&gt;&lt;P&gt;perform calindex using Line FirstLine DataTable-LineIndex changing Index.&lt;/P&gt;&lt;P&gt;name1+11(2) = Index.&lt;/P&gt;&lt;P&gt;name2+11(2) = Index.&lt;/P&gt;&lt;P&gt;name3+12(2) = Index.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;perform bdcfield using &amp;lt;material&amp;gt; DataTable-matnr.&lt;/P&gt;&lt;P&gt;perform bdcfield using &amp;lt;quan&amp;gt; DataTable-menge.&lt;/P&gt;&lt;P&gt;perform bdcfield using &amp;lt;indicator&amp;gt; DataTable-indicator.&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;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;enddo.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Feb 2008 05:00:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bdc-session-method/m-p/3334697#M799149</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-01T05:00:35Z</dc:date>
    </item>
  </channel>
</rss>

