<?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: looing the header data and item data based on posting  key in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/looing-the-header-data-and-item-data-based-on-posting-key/m-p/12146047#M1976511</link>
    <description>&lt;P&gt;Hi &lt;SPAN class="mention-scrubbed"&gt;bhavani123&lt;/SPAN&gt;,&lt;/P&gt;&lt;P&gt;Add one more column in excel and mention H and L as a indicator, load to respective Internal Table and proceed. &lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Abinath. S&lt;/P&gt;</description>
    <pubDate>Tue, 24 Mar 2020 13:47:09 GMT</pubDate>
    <dc:creator>Abinathsiva</dc:creator>
    <dc:date>2020-03-24T13:47:09Z</dc:date>
    <item>
      <title>looing the header data and item data based on posting  key</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/looing-the-header-data-and-item-data-based-on-posting-key/m-p/12146045#M1976509</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
  &lt;P&gt;how to do looping for header data and item data for bdc&lt;/P&gt;
  &lt;P&gt;i attached my excel file for that file i want to upload into sap system through bdc .&lt;/P&gt;
  &lt;P&gt;But can you please help me to find out what are header data and item data in that excel file and how to loop the header data as well as item data based on posting key&lt;/P&gt;</description>
      <pubDate>Tue, 24 Mar 2020 07:30:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/looing-the-header-data-and-item-data-based-on-posting-key/m-p/12146045#M1976509</guid>
      <dc:creator>former_member612655</dc:creator>
      <dc:date>2020-03-24T07:30:19Z</dc:date>
    </item>
    <item>
      <title>Re: looing the header data and item data based on posting  key</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/looing-the-header-data-and-item-data-based-on-posting-key/m-p/12146046#M1976510</link>
      <description>&lt;P&gt;Hi Bhavani,&lt;/P&gt;&lt;P&gt;I remember you had similar BDC issues you raised couple of weeks before. Is this the same issue or different. &lt;/P&gt;&lt;P&gt;I would suggest BAPI instead of BDC - which will be convenient to handle. &lt;/P&gt;&lt;P&gt;Please update &lt;/P&gt;&lt;P&gt;Let me know if you need any help on BAPI - I can provide you with model template&lt;/P&gt;</description>
      <pubDate>Tue, 24 Mar 2020 07:41:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/looing-the-header-data-and-item-data-based-on-posting-key/m-p/12146046#M1976510</guid>
      <dc:creator>venkateswaran_k</dc:creator>
      <dc:date>2020-03-24T07:41:27Z</dc:date>
    </item>
    <item>
      <title>Re: looing the header data and item data based on posting  key</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/looing-the-header-data-and-item-data-based-on-posting-key/m-p/12146047#M1976511</link>
      <description>&lt;P&gt;Hi &lt;SPAN class="mention-scrubbed"&gt;bhavani123&lt;/SPAN&gt;,&lt;/P&gt;&lt;P&gt;Add one more column in excel and mention H and L as a indicator, load to respective Internal Table and proceed. &lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Abinath. S&lt;/P&gt;</description>
      <pubDate>Tue, 24 Mar 2020 13:47:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/looing-the-header-data-and-item-data-based-on-posting-key/m-p/12146047#M1976511</guid>
      <dc:creator>Abinathsiva</dc:creator>
      <dc:date>2020-03-24T13:47:09Z</dc:date>
    </item>
    <item>
      <title>Re: looing the header data and item data based on posting  key</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/looing-the-header-data-and-item-data-based-on-posting-key/m-p/12146048#M1976512</link>
      <description>&lt;P&gt;I can't understand your question at all. You don't even tell what transaction you call.&lt;/P&gt;&lt;P&gt;If you want people to create the program for you (for free), please provide the specification. Crystal balls don't work with programming.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Mar 2020 13:54:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/looing-the-header-data-and-item-data-based-on-posting-key/m-p/12146048#M1976512</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2020-03-24T13:54:54Z</dc:date>
    </item>
    <item>
      <title>Re: looing the header data and item data based on posting  key</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/looing-the-header-data-and-item-data-based-on-posting-key/m-p/12146049#M1976513</link>
      <description>&lt;P&gt;Hi Krishnamurty Sir,&lt;/P&gt;&lt;P&gt;As you said that can you please provide model template for bapi&lt;/P&gt;</description>
      <pubDate>Sat, 28 Mar 2020 04:57:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/looing-the-header-data-and-item-data-based-on-posting-key/m-p/12146049#M1976513</guid>
      <dc:creator>former_member612655</dc:creator>
      <dc:date>2020-03-28T04:57:39Z</dc:date>
    </item>
    <item>
      <title>Re: looing the header data and item data based on posting  key</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/looing-the-header-data-and-item-data-based-on-posting-key/m-p/12146050#M1976514</link>
      <description>&lt;P&gt;Dear Bhavani,&lt;/P&gt;&lt;P&gt;I would suggest you to go for the BAPI. Use the following steps and code - which is working code for me. You adjust it according to your dataset.&lt;/P&gt;&lt;P&gt;Step 1 : Declare Data &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA : header         TYPE bapiache09,
       customer       TYPE bapiacpa09,
       docno          TYPE bapiache09-obj_key,
       accountgl      TYPE STANDARD TABLE OF bapiacgl09 WITH HEADER LINE,
       accountar      TYPE STANDARD TABLE OF bapiacar09 WITH HEADER LINE,
       currencyamount TYPE STANDARD TABLE OF bapiaccr09 WITH HEADER LINE,
       taxline        TYPE STANDARD TABLE OF BAPIACTX09 WITH HEADER LINE,
       return         TYPE STANDARD TABLE OF bapiret2   WITH HEADER LINE,
       creditcard     TYPE STANDARD TABLE OF bapiacpc09 WITH HEADER LINE,
       msg            TYPE c LENGTH 50.

You may arrange and  call like this....
PERFORM debit_entry_cc.
PERFORM credit_entry_cc.
PERFORM bapi_gl_posting_cc.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Step 2 : Populate Debit Items&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;FORM debit_entry_cc .
  DATA lin TYPE int4.
  DATA saknr TYPE ska1-saknr.
  dr = 0.
  LOOP AT it_finalposting_cc INTO wa_finalposting_cc.
    IF wa_finalposting_cc-bschl = '40'.
      lin = lin + 1.
      accountgl-itemno_acc = &amp;lt;item number&amp;gt; "here it goes like 10,20,30 etc
      saknr = wa_finalposting_cc-hkont.
      CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
        EXPORTING
          input  = saknr
        IMPORTING
          output = saknr.
      accountgl-gl_account =  saknr.
      accountgl-comp_code = '1000'.
      accountgl-pstng_date = sy-datum.
      accountgl-doc_type = &amp;lt;your documen ttype&amp;gt;
      accountgl-item_text =  &amp;lt;your text&amp;gt;
      accountgl-alloc_nmbr = wa_finalposting_cc-zuonr .
      CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
        EXPORTING
          input  = wa_finalposting_cc-kostl
        IMPORTING
          output = wa_finalposting_cc-kostl.
      accountgl-costcenter = wa_finalposting_cc-kostl.
      APPEND accountgl.
    currencyamount-itemno_acc = &amp;lt;item number&amp;gt; " same item number you mentioned above
      currencyamount-currency = 'SAR'.
      currencyamount-amt_doccur = wa_finalposting_cc-debit.
      APPEND currencyamount.
      dr = dr + wa_finalposting_cc-debit.
      CLEAR : currencyamount, accountgl.
    ENDIF.
    CLEAR : currencyamount, accountgl, wa_finalposting_cc.
  ENDLOOP.
ENDFORM.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Step 3 : Populate Credit items&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;FORM credit_entry_cc .
  DATA lin TYPE int4.
  DATA saknr TYPE ska1-saknr.
  cr = 0.


  LOOP AT it_finalposting_cc INTO wa_finalposting_cc.
    IF wa_finalposting_cc-bschl = '50'.
      accountgl-itemno_acc = &amp;lt;item number&amp;gt;  "importnt cr
      saknr = wa_finalposting_cc-hkont.
      CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
        EXPORTING
          input  = saknr
        IMPORTING
          output = saknr.
      accountgl-gl_account =  saknr.
      accountgl-comp_code = '1000'.
      accountgl-pstng_date = sy-datum.
      accountgl-doc_type = &amp;lt;your documen ttype &amp;gt;.
      accountgl-item_text = wa_finalposting_cc-sgtxt .   
      CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
        EXPORTING
          input  = wa_finalposting_cc-kostl
        IMPORTING
          output = wa_finalposting_cc-kostl.
      accountgl-costcenter = wa_finalposting_cc-kostl.
      accountgl-alloc_nmbr = wa_finalposting_cc-zuonr .
      APPEND accountgl.
      currencyamount-itemno_acc = &amp;lt;item number&amp;gt; " same item mentioned above importatnt cr
      currencyamount-currency = 'SAR'.
      "since credit items - multiply by -1
      currencyamount-amt_doccur = wa_finalposting_cc-credit * -1.
      APPEND currencyamount.
      cr = cr + wa_finalposting_cc-credit.
      CLEAR : currencyamount, accountgl.
    ENDIF.
    CLEAR : currencyamount, accountgl, wa_finalposting_cc.
  ENDLOOP.
ENDFORM.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Step 4 : Call BAPI&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;FORM bapi_gl_posting_cc .
  header-username = sy-uname.
  header-header_txt = 'Payroll Posting'.
  header-comp_code = '1000'.
  header-doc_date = sy-datum
  header-pstng_date = sy-datum
  header-doc_type = &amp;lt;your document type goes here&amp;gt;.
  header-ref_doc_no = '1'.                  
                " 
  CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
    EXPORTING
      documentheader = header
    IMPORTING
*     OBJ_TYPE       =
      obj_key        = docno
*     OBJ_SYS        =
    TABLES
      accountgl      = accountgl
*     ACCOUNTTAX     = taxline
      currencyamount = currencyamount
*     CRITERIA       =
*     VALUEFIELD     =
*     EXTENSION1     =
      return         = return.

  IF docno IS NOT INITIAL AND docno NE '$'.
    CONCATENATE 'Document ' docno+0(10) 'Created' INTO msg SEPARATED BY space.
    MESSAGE msg TYPE 'S' DISPLAY LIKE 'I'.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
      EXPORTING
        wait = 'X'.
  ELSE.
    MESSAGE 'Please Refer to Final Posting Tab..!' TYPE 'S' DISPLAY LIKE 'S'.
  ENDIF.
ENDFORM.
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 28 Mar 2020 06:03:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/looing-the-header-data-and-item-data-based-on-posting-key/m-p/12146050#M1976514</guid>
      <dc:creator>venkateswaran_k</dc:creator>
      <dc:date>2020-03-28T06:03:24Z</dc:date>
    </item>
    <item>
      <title>Re: looing the header data and item data based on posting  key</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/looing-the-header-data-and-item-data-based-on-posting-key/m-p/12146051#M1976515</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;Is your problem resolved? Did you try using the BAPI ?&lt;/P&gt;</description>
      <pubDate>Thu, 09 Apr 2020 05:08:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/looing-the-header-data-and-item-data-based-on-posting-key/m-p/12146051#M1976515</guid>
      <dc:creator>venkateswaran_k</dc:creator>
      <dc:date>2020-04-09T05:08:29Z</dc:date>
    </item>
  </channel>
</rss>

