<?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: ABAP Function Module for BW in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-function-module-for-bw/m-p/4003217#M956417</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You cannot use open cursor with internal tables, it works with database tables only. Open cursor , fetch, close cursor statements are used to fetch data from database but in ur case if i am not mistaking, u r creating a final table form 6 diff. tables.So you cannot use Open cursor concept here.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN CURSOR [WITH HOLD] dbcur FOR &lt;/P&gt;&lt;P&gt;  SELECT result &lt;/P&gt;&lt;P&gt;         FROM source &lt;/P&gt;&lt;P&gt;         [[FOR ALL ENTRIES IN itab] WHERE sql_cond] &lt;/P&gt;&lt;P&gt;         [GROUP BY group] [HAVING group_cond] &lt;/P&gt;&lt;P&gt;         [ORDER BY sort_key]. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Addition: &lt;/P&gt;&lt;P&gt;... WITH HOLD &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Effect: &lt;/P&gt;&lt;P&gt;This statement opens a database cursor for the selection defined after FOR, and links a cursor variable dbcur with this database cursor. For dbcur, a declared variable with the specific predefined data type cursor must be entered. A database cursor dbcur that has already been opened cannot be opened again. A line of the resulting set is always assigned to an opened database cursor as a cursor position. After the OPEN CURSOR statement, the database cursor is positioned in front of the first line of the resulting set. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After FOR, the syntax of a SELECT statement can be entered, which contains all the additions of the normal SELECT statement, except for INTO and APPENDING. In the addition result, the addition SINGLE can also not be used after SELECT. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Only a limited number of database cursors can be open at the same time. An open database cursor can be closed using the statement CLOSE CURSOR . In addition, an open database cursor is closed for a database commit or a database rollback. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If a cursor variable dbcur of an open database cursor is assigned to another cursor variable, the latter is linked to the same database cursor at the same position. A cursor variable of an open database cursor can also be transferred to procedures that have been called externally, to enable the database cursor to be accessed from there. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note &lt;/P&gt;&lt;P&gt;It is not recommended to assign cursor variables to each other, but rather to set them exclusively using the statements OPEN CURSOR and CLOSE CURSOR. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Joy.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 18 Jun 2008 20:57:09 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-06-18T20:57:09Z</dc:date>
    <item>
      <title>ABAP Function Module for BW</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-function-module-for-bw/m-p/4003216#M956416</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have crreated a function module that does a lot of data manipulation and creates  6 tables, I then loop at each of these tables into 1 table. My problem is that it has to go to BW. Having seen a few BW modules I see they have to use open cursor and fetch statements. Is it possible to use open cursor and fetch in a loop? if not is it possible to use these commands on internal tables? Below is the table I need recognized by a data source. Any help would be appreciated it is quite urgent.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES: BEGIN OF ST_OUT,&lt;/P&gt;&lt;P&gt;       VTGTYPNR       LIKE /MSG/RVTG-VTGTYPNR,&lt;/P&gt;&lt;P&gt;       YEAR(1)        TYPE N,&lt;/P&gt;&lt;P&gt;       BRCHNR         LIKE /MSG/RD_ABR_BU-BRCHNR,&lt;/P&gt;&lt;P&gt;       QTR(2)         TYPE N,&lt;/P&gt;&lt;P&gt;       EARNPREM       LIKE /MSG/RD_ABR_BU-OW_BETR,&lt;/P&gt;&lt;P&gt;       PAIDLOSS       LIKE /MSG/RD_ABR_BU-OW_BETR,&lt;/P&gt;&lt;P&gt;       OSLR           LIKE /MSG/RD_ABR_BU-OW_BETR,&lt;/P&gt;&lt;P&gt;       INCUR          LIKE /MSG/RD_ABR_BU-OW_BETR,&lt;/P&gt;&lt;P&gt;       END OF ST_OUT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: T_OUT          TYPE ST_OUT    OCCURS 0,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  LOOP AT T_YR_1 INTO WA_T_YR.&lt;/P&gt;&lt;P&gt;    MOVE WA_T_YR-VTGTYPNR TO WA_T_OUT-VTGTYPNR.&lt;/P&gt;&lt;P&gt;    MOVE '6'              TO WA_T_OUT-YEAR.&lt;/P&gt;&lt;P&gt;    MOVE WA_T_YR-BRCHNR   TO WA_T_OUT-BRCHNR.&lt;/P&gt;&lt;P&gt;    MOVE WA_T_YR-QTR      TO WA_T_OUT-QTR.&lt;/P&gt;&lt;P&gt;    MOVE WA_T_YR-EARNPREM TO WA_T_OUT-EARNPREM.&lt;/P&gt;&lt;P&gt;    MOVE WA_T_YR-PAIDLOSS TO WA_T_OUT-PAIDLOSS.&lt;/P&gt;&lt;P&gt;    MOVE WA_T_YR-OSLR     TO WA_T_OUT-OSLR.&lt;/P&gt;&lt;P&gt;    MOVE WA_T_YR-INCUR    TO WA_T_OUT-INCUR.&lt;/P&gt;&lt;P&gt;    APPEND WA_T_OUT TO T_OUT.&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;  LOOP AT T_YR_2 INTO WA_T_YR.&lt;/P&gt;&lt;P&gt;    MOVE WA_T_YR-VTGTYPNR TO WA_T_OUT-VTGTYPNR.&lt;/P&gt;&lt;P&gt;    MOVE '5'              TO WA_T_OUT-YEAR.&lt;/P&gt;&lt;P&gt;    MOVE WA_T_YR-BRCHNR   TO WA_T_OUT-BRCHNR.&lt;/P&gt;&lt;P&gt;    MOVE WA_T_YR-QTR      TO WA_T_OUT-QTR.&lt;/P&gt;&lt;P&gt;    MOVE WA_T_YR-EARNPREM TO WA_T_OUT-EARNPREM.&lt;/P&gt;&lt;P&gt;    MOVE WA_T_YR-PAIDLOSS TO WA_T_OUT-PAIDLOSS.&lt;/P&gt;&lt;P&gt;    MOVE WA_T_YR-OSLR     TO WA_T_OUT-OSLR.&lt;/P&gt;&lt;P&gt;    MOVE WA_T_YR-INCUR    TO WA_T_OUT-INCUR.&lt;/P&gt;&lt;P&gt;    APPEND WA_T_OUT TO T_OUT.&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;  LOOP AT T_YR_3 INTO WA_T_YR.&lt;/P&gt;&lt;P&gt;    MOVE WA_T_YR-VTGTYPNR TO WA_T_OUT-VTGTYPNR.&lt;/P&gt;&lt;P&gt;    MOVE '4'              TO WA_T_OUT-YEAR.&lt;/P&gt;&lt;P&gt;    MOVE WA_T_YR-BRCHNR   TO WA_T_OUT-BRCHNR.&lt;/P&gt;&lt;P&gt;    MOVE WA_T_YR-QTR      TO WA_T_OUT-QTR.&lt;/P&gt;&lt;P&gt;    MOVE WA_T_YR-EARNPREM TO WA_T_OUT-EARNPREM.&lt;/P&gt;&lt;P&gt;    MOVE WA_T_YR-PAIDLOSS TO WA_T_OUT-PAIDLOSS.&lt;/P&gt;&lt;P&gt;    MOVE WA_T_YR-OSLR     TO WA_T_OUT-OSLR.&lt;/P&gt;&lt;P&gt;    MOVE WA_T_YR-INCUR    TO WA_T_OUT-INCUR.&lt;/P&gt;&lt;P&gt;    APPEND WA_T_OUT TO T_OUT.&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;  LOOP AT T_YR_4 INTO WA_T_YR.&lt;/P&gt;&lt;P&gt;    MOVE WA_T_YR-VTGTYPNR TO WA_T_OUT-VTGTYPNR.&lt;/P&gt;&lt;P&gt;    MOVE '3'              TO WA_T_OUT-YEAR.&lt;/P&gt;&lt;P&gt;    MOVE WA_T_YR-BRCHNR   TO WA_T_OUT-BRCHNR.&lt;/P&gt;&lt;P&gt;    MOVE WA_T_YR-QTR      TO WA_T_OUT-QTR.&lt;/P&gt;&lt;P&gt;    MOVE WA_T_YR-EARNPREM TO WA_T_OUT-EARNPREM.&lt;/P&gt;&lt;P&gt;    MOVE WA_T_YR-PAIDLOSS TO WA_T_OUT-PAIDLOSS.&lt;/P&gt;&lt;P&gt;    MOVE WA_T_YR-OSLR     TO WA_T_OUT-OSLR.&lt;/P&gt;&lt;P&gt;    MOVE WA_T_YR-INCUR    TO WA_T_OUT-INCUR.&lt;/P&gt;&lt;P&gt;    APPEND WA_T_OUT TO T_OUT.&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;  LOOP AT T_YR_5 INTO WA_T_YR.&lt;/P&gt;&lt;P&gt;    MOVE WA_T_YR-VTGTYPNR TO WA_T_OUT-VTGTYPNR.&lt;/P&gt;&lt;P&gt;    MOVE '2'              TO WA_T_OUT-YEAR.&lt;/P&gt;&lt;P&gt;    MOVE WA_T_YR-BRCHNR   TO WA_T_OUT-BRCHNR.&lt;/P&gt;&lt;P&gt;    MOVE WA_T_YR-QTR      TO WA_T_OUT-QTR.&lt;/P&gt;&lt;P&gt;    MOVE WA_T_YR-EARNPREM TO WA_T_OUT-EARNPREM.&lt;/P&gt;&lt;P&gt;    MOVE WA_T_YR-PAIDLOSS TO WA_T_OUT-PAIDLOSS.&lt;/P&gt;&lt;P&gt;    MOVE WA_T_YR-OSLR     TO WA_T_OUT-OSLR.&lt;/P&gt;&lt;P&gt;    MOVE WA_T_YR-INCUR    TO WA_T_OUT-INCUR.&lt;/P&gt;&lt;P&gt;    APPEND WA_T_OUT TO T_OUT.&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;  LOOP AT T_YR_6 INTO WA_T_YR.&lt;/P&gt;&lt;P&gt;    MOVE WA_T_YR-VTGTYPNR TO WA_T_OUT-VTGTYPNR.&lt;/P&gt;&lt;P&gt;    MOVE '1'              TO WA_T_OUT-YEAR.&lt;/P&gt;&lt;P&gt;    MOVE WA_T_YR-BRCHNR   TO WA_T_OUT-BRCHNR.&lt;/P&gt;&lt;P&gt;    MOVE WA_T_YR-QTR      TO WA_T_OUT-QTR.&lt;/P&gt;&lt;P&gt;    MOVE WA_T_YR-EARNPREM TO WA_T_OUT-EARNPREM.&lt;/P&gt;&lt;P&gt;    MOVE WA_T_YR-PAIDLOSS TO WA_T_OUT-PAIDLOSS.&lt;/P&gt;&lt;P&gt;    MOVE WA_T_YR-OSLR     TO WA_T_OUT-OSLR.&lt;/P&gt;&lt;P&gt;    MOVE WA_T_YR-INCUR    TO WA_T_OUT-INCUR.&lt;/P&gt;&lt;P&gt;    APPEND WA_T_OUT TO T_OUT.&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Jun 2008 20:18:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-function-module-for-bw/m-p/4003216#M956416</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-18T20:18:15Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Function Module for BW</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-function-module-for-bw/m-p/4003217#M956417</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You cannot use open cursor with internal tables, it works with database tables only. Open cursor , fetch, close cursor statements are used to fetch data from database but in ur case if i am not mistaking, u r creating a final table form 6 diff. tables.So you cannot use Open cursor concept here.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN CURSOR [WITH HOLD] dbcur FOR &lt;/P&gt;&lt;P&gt;  SELECT result &lt;/P&gt;&lt;P&gt;         FROM source &lt;/P&gt;&lt;P&gt;         [[FOR ALL ENTRIES IN itab] WHERE sql_cond] &lt;/P&gt;&lt;P&gt;         [GROUP BY group] [HAVING group_cond] &lt;/P&gt;&lt;P&gt;         [ORDER BY sort_key]. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Addition: &lt;/P&gt;&lt;P&gt;... WITH HOLD &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Effect: &lt;/P&gt;&lt;P&gt;This statement opens a database cursor for the selection defined after FOR, and links a cursor variable dbcur with this database cursor. For dbcur, a declared variable with the specific predefined data type cursor must be entered. A database cursor dbcur that has already been opened cannot be opened again. A line of the resulting set is always assigned to an opened database cursor as a cursor position. After the OPEN CURSOR statement, the database cursor is positioned in front of the first line of the resulting set. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After FOR, the syntax of a SELECT statement can be entered, which contains all the additions of the normal SELECT statement, except for INTO and APPENDING. In the addition result, the addition SINGLE can also not be used after SELECT. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Only a limited number of database cursors can be open at the same time. An open database cursor can be closed using the statement CLOSE CURSOR . In addition, an open database cursor is closed for a database commit or a database rollback. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If a cursor variable dbcur of an open database cursor is assigned to another cursor variable, the latter is linked to the same database cursor at the same position. A cursor variable of an open database cursor can also be transferred to procedures that have been called externally, to enable the database cursor to be accessed from there. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note &lt;/P&gt;&lt;P&gt;It is not recommended to assign cursor variables to each other, but rather to set them exclusively using the statements OPEN CURSOR and CLOSE CURSOR. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Joy.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Jun 2008 20:57:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-function-module-for-bw/m-p/4003217#M956417</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-18T20:57:09Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Function Module for BW</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-function-module-for-bw/m-p/4003218#M956418</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Geroge,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i am facing the same problem, can you please share your solution how you have used open cursor to loop through internal table to get the data in bw. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;please help me on the same.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Nov 2010 14:52:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-function-module-for-bw/m-p/4003218#M956418</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-11-22T14:52:32Z</dc:date>
    </item>
  </channel>
</rss>

