<?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: BAPI fails for 2nd time ? in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-fails-for-2nd-time/m-p/1877488#M368862</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Ravi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          When I remove the destinatione 'NONE' statement I get a return value as follows :-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
gs_bapiret2-type : 'E'.
MESSAGE        : 'BOM not found for this material/plant/usage'
MESSAGE_V1  : 'Program not started via RFC. No return possible.'
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the return when I execute my application for the 1rst time.&lt;/P&gt;&lt;P&gt;But when I give the tag destination 'NONE' the same BAPI is giving me the output with no return messages.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So what should I do now ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Deepu.K&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;null&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 23 Jan 2007 13:37:45 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-01-23T13:37:45Z</dc:date>
    <item>
      <title>BAPI fails for 2nd time ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-fails-for-2nd-time/m-p/1877480#M368854</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm using the BAPI " BAPI_DOCUMENT_CHECKOUTVIEW2 " to get the details of the CV04N document.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My code is as follows :- &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
              CALL FUNCTION 'BAPI_DOCUMENT_CHECKOUTVIEW2' 
                                                         DESTINATION 'NONE'
                EXPORTING
                  documenttype         = wa_final-doc_type
                  documentnumber     = wa_final-doc_nr
                  documentpart          = wa_final-doc_part
                  documentversion     = wa_final-doc_version
                  documentfile           = gs_bapi_doc_files2
                IMPORTING
                  return                     = gs_bapiret2
                TABLES
                  documentstructure  = gt_bapi_doc_structure
                  documentfiles         = gt_bapi_doc_files2
                  components           = gt_bapi_doc_comp.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm getting the Table entries for the selection data for the first time.&lt;/P&gt;&lt;P&gt;But when I give the same selection for the 2nd time the BAPI is not even getting called.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone tell me what's the reason ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I even tried calling it in a subroutine ..............&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
PERFORM get_file_path_2 IN PROGRAM (gv_program)
USING wa_final
CHANGING gt_bapi_doc_structure
gt_bapi_doc_files2
gt_bapi_doc_comp
gs_bapiret2
IF FOUND.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;But it's still the same case again.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm not able to debug for the 2nd time. It's not even going in t othe Call Function Statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone tell me what could be the reason ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Deepu.K&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I even passed the destination thru a variable. Then also it works for 1 time only but the next time it fails.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        deepu k&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Jan 2007 12:30:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-fails-for-2nd-time/m-p/1877480#M368854</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-23T12:30:42Z</dc:date>
    </item>
    <item>
      <title>Re: BAPI fails for 2nd time ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-fails-for-2nd-time/m-p/1877481#M368855</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Deepu,&lt;/P&gt;&lt;P&gt;    include a commit statement if the call is successful after the bapi.&lt;/P&gt;&lt;P&gt;Probably, you are locking the document and hence its failing for the second time.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ravi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Jan 2007 12:46:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-fails-for-2nd-time/m-p/1877481#M368855</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-23T12:46:13Z</dc:date>
    </item>
    <item>
      <title>Re: BAPI fails for 2nd time ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-fails-for-2nd-time/m-p/1877482#M368856</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;put do 2 times.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;call bapi.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;enddo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then check is it coming for two times or not.&lt;/P&gt;&lt;P&gt;and also check the values of tables and structure you are passing 2nd time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Aman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Jan 2007 12:48:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-fails-for-2nd-time/m-p/1877482#M368856</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-23T12:48:08Z</dc:date>
    </item>
    <item>
      <title>Re: BAPI fails for 2nd time ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-fails-for-2nd-time/m-p/1877483#M368857</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Ravi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        I used a commit work statement.&lt;/P&gt;&lt;P&gt;But even then it's failing for the 2nd time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Deepu.K&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Jan 2007 12:49:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-fails-for-2nd-time/m-p/1877483#M368857</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-23T12:49:20Z</dc:date>
    </item>
    <item>
      <title>Re: BAPI fails for 2nd time ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-fails-for-2nd-time/m-p/1877484#M368858</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Aman,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;           I implemented what u told.&lt;/P&gt;&lt;P&gt;The first 2 times it is going and working fine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But for the 2nd 2 times it's not going into the CALL FUNCTION STATEMENT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Deepu.K&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Jan 2007 12:53:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-fails-for-2nd-time/m-p/1877484#M368858</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-23T12:53:03Z</dc:date>
    </item>
    <item>
      <title>Re: BAPI fails for 2nd time ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-fails-for-2nd-time/m-p/1877485#M368859</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;you have to use Bapi_transaction_commit function module for commit. Don't use commit statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DO 2 TIMES.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'BAPI_DOCUMENT_CHECKOUTVIEW2' &lt;/P&gt;&lt;P&gt;                                                         DESTINATION 'NONE'&lt;/P&gt;&lt;P&gt;                EXPORTING&lt;/P&gt;&lt;P&gt;                  documenttype         = wa_final-doc_type&lt;/P&gt;&lt;P&gt;                  documentnumber     = wa_final-doc_nr&lt;/P&gt;&lt;P&gt;                  documentpart          = wa_final-doc_part&lt;/P&gt;&lt;P&gt;                  documentversion     = wa_final-doc_version&lt;/P&gt;&lt;P&gt;                  documentfile           = gs_bapi_doc_files2&lt;/P&gt;&lt;P&gt;                IMPORTING&lt;/P&gt;&lt;P&gt;                  return                     = gs_bapiret2&lt;/P&gt;&lt;P&gt;                TABLES&lt;/P&gt;&lt;P&gt;                  documentstructure  = gt_bapi_doc_structure&lt;/P&gt;&lt;P&gt;                  documentfiles         = gt_bapi_doc_files2&lt;/P&gt;&lt;P&gt;                  components           = gt_bapi_doc_comp.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;call function 'BAPI_TRANSACTION_COMMIT'&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;     WAIT = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDDO.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If this doesn't work then please send the code to aman.sharma81@gmail.com&lt;/P&gt;&lt;P&gt;i will see to it and will tell you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Aman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Jan 2007 13:06:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-fails-for-2nd-time/m-p/1877485#M368859</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-23T13:06:45Z</dc:date>
    </item>
    <item>
      <title>Re: BAPI fails for 2nd time ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-fails-for-2nd-time/m-p/1877486#M368860</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Aman ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;       Thanks for ur reply. But this problem is stll not leaving me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;THis is my code :-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
*********************************************************************************
* Display_Doc FUNCTIONALITY
*********************************************************************************
      WHEN 'DISPLAY_DOC'.

        DATA: wa_bapi_doc_files2 TYPE LINE OF lt_bapi_doc_files2,
              wa_file_path       TYPE LINE OF lt_file_path.

        CLEAR  : gv_data,gv_tv_data.
        FREE   : gv_data,gv_tv_data.

        gv_data ?= cl_htmlb_manager=&amp;gt;get_data( request = runtime-&amp;gt;server-&amp;gt;request
                                               name    = 'tableview'
                                               id      =  gv_tv_id  ).
        gv_tv_data = gv_data-&amp;gt;data.

        IF gv_tv_data-&amp;gt;selectedrowindex IS NOT INITIAL.

          CLEAR wa_final.

          READ TABLE gt_final INTO wa_final INDEX gv_tv_data-&amp;gt;selectedrowindex .
          IF sy-subrc = 0.

* Call the BAPI FM to get the Filename of the Document

            REFRESH : gt_bapi_doc_structure,gt_bapi_doc_files2,gt_bapi_doc_comp.
            CLEAR   : gs_bapi_doc_files2.

***            PERFORM get_file_path_2 IN PROGRAM (gv_program)
***                                    USING wa_final
***                                    CHANGING gt_bapi_doc_structure
***                                             gt_bapi_doc_files2
***                                             gt_bapi_doc_comp
***                                             gs_bapiret2
***                                    IF FOUND.
*            runtime-&amp;gt;keep_context = 0.

          ENDIF.
        ENDIF.

        DO 2 TIMES.

          CALL FUNCTION 'BAPI_DOCUMENT_CHECKOUTVIEW2' DESTINATION gv_rfc_destination
            EXPORTING
              documenttype      = wa_final-doc_type
              documentnumber    = wa_final-doc_nr
              documentpart      = wa_final-doc_part
              documentversion   = wa_final-doc_version
              documentfile      = gs_bapi_doc_files2
            IMPORTING
              return            = gs_bapiret2
            TABLES
              documentstructure = gt_bapi_doc_structure
              documentfiles     = gt_bapi_doc_files2
              components        = gt_bapi_doc_comp.

          CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
            EXPORTING
              wait = 'X'.

        ENDDO.

*        runtime-&amp;gt;keep_context = 1.

* Populate the table gt_file_path with the File Path's
        REFRESH gt_file_path.

        IF gt_bapi_doc_files2[] IS NOT INITIAL.
          CLEAR wa_bapi_doc_files2.
          LOOP AT gt_bapi_doc_files2 INTO wa_bapi_doc_files2.
            CLEAR wa_file_path.
            IF sy-langu = 'D'.
              MOVE: 'Dateipfad'                 TO wa_file_path-file,
                     wa_bapi_doc_files2-docfile TO wa_file_path-path.
            ELSE.
              MOVE: 'File Path'                 TO wa_file_path-file,
                     wa_bapi_doc_files2-docfile TO wa_file_path-path.
            ENDIF.

            APPEND wa_file_path TO gt_file_path.
            CLEAR wa_file_path.
          ENDLOOP.
        ENDIF.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PS: I'm using this FM in BSP so I think u maynot check my code.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Deepu.K&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Jan 2007 13:17:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-fails-for-2nd-time/m-p/1877486#M368860</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-23T13:17:11Z</dc:date>
    </item>
    <item>
      <title>Re: BAPI fails for 2nd time ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-fails-for-2nd-time/m-p/1877487#M368861</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Deepu, &lt;/P&gt;&lt;P&gt;  Just check what does the return table contain immediately after the call and look for any meaningful messages that would tell what has gone wrong.&lt;/P&gt;&lt;P&gt;if it doesn't even go into the call, just remove the destination addition and see(Anyway you are passing none to the destination).&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ravi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Jan 2007 13:23:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-fails-for-2nd-time/m-p/1877487#M368861</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-23T13:23:47Z</dc:date>
    </item>
    <item>
      <title>Re: BAPI fails for 2nd time ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-fails-for-2nd-time/m-p/1877488#M368862</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Ravi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          When I remove the destinatione 'NONE' statement I get a return value as follows :-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
gs_bapiret2-type : 'E'.
MESSAGE        : 'BOM not found for this material/plant/usage'
MESSAGE_V1  : 'Program not started via RFC. No return possible.'
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the return when I execute my application for the 1rst time.&lt;/P&gt;&lt;P&gt;But when I give the tag destination 'NONE' the same BAPI is giving me the output with no return messages.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So what should I do now ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Deepu.K&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;null&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Jan 2007 13:37:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-fails-for-2nd-time/m-p/1877488#M368862</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-23T13:37:45Z</dc:date>
    </item>
    <item>
      <title>Re: BAPI fails for 2nd time ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-fails-for-2nd-time/m-p/1877489#M368863</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When I used the LE_DSP_REMOTE function for splitting the deliveries I faced with the same problem. In my program I was calling&lt;/P&gt;&lt;P&gt;the program many times but it was failing except the first call. If you use the function in this way it can be called many times:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: taskname type string. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        CALL FUNCTION 'LE_DSP_REMOTE' &lt;/P&gt;&lt;P&gt;                 &lt;U&gt;STARTING NEW TASK taskname&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                  EXPORTING&lt;/P&gt;&lt;P&gt;                    IF_SIMULATE                 = IF_SIMULATE1&lt;/P&gt;&lt;P&gt;                    IF_CONFIRM_DECENTRAL        = IF_CONFIRM_DECENTRAL1&lt;/P&gt;&lt;P&gt;                    IF_PMODE                    = IF_PMODE1&lt;/P&gt;&lt;P&gt;                  TABLES&lt;/P&gt;&lt;P&gt;                    IT_RES                      = IT_RES2&lt;/P&gt;&lt;P&gt;                    ET_DETAIL                   = ET_DETAIL1&lt;/P&gt;&lt;P&gt;                    ET_SUMM                     = ET_SUMM1&lt;/P&gt;&lt;P&gt;                    ET_SUMM_23                  = ET_SUMM_231&lt;/P&gt;&lt;P&gt;                 EXCEPTIONS&lt;/P&gt;&lt;P&gt;                   ERROR_IN_SUBFUNCTIONS       = 1&lt;/P&gt;&lt;P&gt;                   OTHERS                      = 2&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Aug 2009 07:50:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-fails-for-2nd-time/m-p/1877489#M368863</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-06T07:50:37Z</dc:date>
    </item>
  </channel>
</rss>

