<?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: Error in BAPI Coding in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-in-bapi-coding/m-p/7581997#M1566475</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Praveen,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks  for you reply, in the thread by mistake it was commented,&lt;/P&gt;&lt;P&gt;and i run the program in uncomment mode only, and error is displaying like  "error occured" &lt;/P&gt;&lt;P&gt;(it displaying the write statement in 'IF 'block).&lt;/P&gt;&lt;P&gt;i did debug also, but i am not able to reslove the error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;removed by moderator&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;gsreddy.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Thomas Zloch on Jan 7, 2011 1:52 PM - &lt;STRONG&gt;please no "needful" in these forums&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 07 Jan 2011 12:35:37 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2011-01-07T12:35:37Z</dc:date>
    <item>
      <title>Error in BAPI Coding</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-in-bapi-coding/m-p/7581995#M1566473</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am new to interfaces like bapi, I tried a program for BAPI_ACC_DOCUMENT_POST to update AR, when i trying to execute it is displayng as "PROBLEM OCCURED".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here i am giving program code, so please see the program and reslove my eror.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;removed by moderator&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: obj_type LIKE bapiache09-obj_type,
      obj_key LIKE bapiache09-obj_key,
      obj_sys LIKE bapiache09-obj_sys,
      documentheader LIKE bapiache09,
      accountgl LIKE bapiacgl09 OCCURS 0 WITH HEADER LINE,
      accountpayable LIKE bapiacar09 OCCURS 0 WITH HEADER LINE,
      accountreceivable LIKE bapiacar09 OCCURS 0 WITH HEADER LINE,
      currencyamount LIKE bapiaccr09 OCCURS 0 WITH HEADER LINE,
      return LIKE bapiret2 OCCURS 0 WITH HEADER LINE,
      extension1 LIKE bapiextc OCCURS 0 WITH HEADER LINE,
      t_edidd LIKE edidd OCCURS 0 WITH HEADER LINE,
      bapi_retn_info LIKE bapiret2 OCCURS 0 WITH HEADER LINE.

DATA: error_flag.
documentheader-username = sy-uname.
documentheader-header_txt = 'Test BAPI'.
documentheader-comp_code = 'SERC'.
documentheader-doc_date = sy-datum.
documentheader-pstng_date = '10.09.2010'.
documentheader-doc_type = 'DR'.

CLEAR accountgl.
accountgl-itemno_acc = '1'.
accountgl-gl_account = '100100'.
accountgl-ref_key_1  = 'TEST'.
accountgl-comp_code = 'S150'.
accountgl-pstng_date = sy-datum.
accountgl-doc_type = 'DR'.
accountgl-customer = '2001'.
APPEND accountgl.
CLEAR accountgl.

CLEAR  accountreceivable.
accountreceivable-itemno_acc = '1'.
accountreceivable-customer = '2001'.
accountreceivable-gl_account = '100100'.
accountreceivable-comp_code = 'S150'.
APPEND accountreceivable.
CLEAR  accountreceivable.


APPEND currencyamount.
currencyamount-itemno_acc = '1'.
currencyamount-currency = 'INR'.
currencyamount-amt_doccur = '1000'.
APPEND currencyamount.


CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
  EXPORTING
    documentheader          = documentheader
*   CUSTOMERCPD             =
*   CONTRACTHEADER          =
 IMPORTING
   OBJ_TYPE                = obj_type
   OBJ_KEY                 = obj_key
   OBJ_SYS                 = obj_sys
  TABLES
   accountgl               = accountgl
   accountreceivable       = accountreceivable
*   ACCOUNTPAYABLE          =
*   ACCOUNTTAX              =
    currencyamount          = currencyamount
*   CRITERIA                =
*   VALUEFIELD              =
*   EXTENSION1              =
    return                  = return
*   PAYMENTCARD             =
*   CONTRACTITEM            =
*   EXTENSION2              =
*   REALESTATE              =
*   ACCOUNTWT               =
          .

IF sy-subrc &amp;lt;&amp;gt; 0.
  WRITE 'Problem occured'.
ELSE.
  *LOOP AT return.*
    *IF NOT return IS INITIAL.*
      *CLEAR bapi_retn_info.*
      *MOVE-CORRESPONDING return TO bapi_retn_info.*
      *IF return-type = 'A' OR return-type = 'E'.*
        *error_flag = 'X'.*
      *ENDIF.*
      *APPEND bapi_retn_info.*
    *ENDIF.*
  *ENDLOOP.*   (in this block i find error)
IF error_flag = 'X'.
    WRITE 'Problem occured'.
    ROLLBACK WORK.
  ELSE.
   CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
* EXPORTING
*   WAIT          =
* IMPORTING
*   RETURN        =
          .
  ENDIF.

ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thanks in Advance,&lt;/P&gt;&lt;P&gt;gsreddy.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Thomas Zloch on Jan 7, 2011 11:01 AM - &lt;STRONG&gt;please use code tags&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Jan 2011 09:51:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-in-bapi-coding/m-p/7581995#M1566473</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-01-07T09:51:08Z</dc:date>
    </item>
    <item>
      <title>Re: Error in BAPI Coding</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-in-bapi-coding/m-p/7581996#M1566474</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;
  *LOOP AT return.*
    *IF NOT return IS INITIAL.*
      *CLEAR bapi_retn_info.*
      *MOVE-CORRESPONDING return TO bapi_retn_info.*
      *IF return-type = 'A' OR return-type = 'E'.*
        *error_flag = 'X'.*
      *ENDIF.*
      *APPEND bapi_retn_info.*
    *ENDIF.*
  *ENDLOOP.*   (in this block i find error)
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Uncomment the above code and check the errors in itab 'return' in debugging mode.&lt;/P&gt;&lt;P&gt;If are not able to resolve the error let us know what errors you are getting&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Praveen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Jan 2011 11:48:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-in-bapi-coding/m-p/7581996#M1566474</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-01-07T11:48:20Z</dc:date>
    </item>
    <item>
      <title>Re: Error in BAPI Coding</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-in-bapi-coding/m-p/7581997#M1566475</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Praveen,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks  for you reply, in the thread by mistake it was commented,&lt;/P&gt;&lt;P&gt;and i run the program in uncomment mode only, and error is displaying like  "error occured" &lt;/P&gt;&lt;P&gt;(it displaying the write statement in 'IF 'block).&lt;/P&gt;&lt;P&gt;i did debug also, but i am not able to reslove the error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;removed by moderator&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;gsreddy.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Thomas Zloch on Jan 7, 2011 1:52 PM - &lt;STRONG&gt;please no "needful" in these forums&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Jan 2011 12:35:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-in-bapi-coding/m-p/7581997#M1566475</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-01-07T12:35:37Z</dc:date>
    </item>
    <item>
      <title>Re: Error in BAPI Coding</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-in-bapi-coding/m-p/7581998#M1566476</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;
CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
  EXPORTING
    documentheader          = documentheader
*   CUSTOMERCPD             =
*   CONTRACTHEADER          =
 IMPORTING
   OBJ_TYPE                = obj_type
   OBJ_KEY                 = obj_key
   OBJ_SYS                 = obj_sys
  TABLES
   accountgl               = accountgl
   accountreceivable       = accountreceivable
*   ACCOUNTPAYABLE          =
*   ACCOUNTTAX              =
    currencyamount          = currencyamount
*   CRITERIA                =
*   VALUEFIELD              =
*   EXTENSION1              =
    return                  = return
*   PAYMENTCARD             =
*   CONTRACTITEM            =
*   EXTENSION2              =
*   REALESTATE              =
*   ACCOUNTWT               =
          .
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the BAPI tables parameter "return" what are the messages you are seeing in debugging mode???&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Jan 2011 13:50:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-in-bapi-coding/m-p/7581998#M1566476</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-01-07T13:50:05Z</dc:date>
    </item>
    <item>
      <title>Re: Error in BAPI Coding</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-in-bapi-coding/m-p/7581999#M1566477</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;SY-SUBRC is not relevant.  Why do you check that and what is the condition?  The 'NE' or 'EQ' is missing in your post.  You've also hard-coded a customer account w/o leading zeros and hardcoded a date in the incorrect format - that's not correct.  Otherwise, review some of that many examples in the forum or check the error messages as has already been suggested twice.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Jan 2011 15:52:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-in-bapi-coding/m-p/7581999#M1566477</guid>
      <dc:creator>brad_bohn</dc:creator>
      <dc:date>2011-01-07T15:52:26Z</dc:date>
    </item>
  </channel>
</rss>

