<?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 code to modify in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-to-modify/m-p/5576269#M1271835</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i need to fetch the data from bseg table. i have written the following select query&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT BUKRS BELNR GJAHR BUZEI KUNNR LIFNR&lt;/P&gt;&lt;P&gt;  INTO CORRESPONDING FIELDS OF TABLE GT_BSEG1&lt;/P&gt;&lt;P&gt;  FROM BSEG&lt;/P&gt;&lt;P&gt;  FOR ALL ENTRIES IN GT_BKPF&lt;/P&gt;&lt;P&gt;  WHERE&lt;/P&gt;&lt;P&gt;      BUKRS = GT_BKPF-BUKRS  AND&lt;/P&gt;&lt;P&gt;      BELNR = GT_BKPF-BELNR  AND&lt;/P&gt;&lt;P&gt;      GJAHR = GT_BKPF-GJAHR  AND&lt;/P&gt;&lt;P&gt;      BUZEI = '1'.(i need to select first line item only)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for the belnrs i need to check it consists vendor(lifnr) and customer(kunnr) or not for any other line items for &lt;/P&gt;&lt;P&gt;that particular belnr.&lt;/P&gt;&lt;P&gt;so i have written the following select query.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT  BUKRS BELNR GJAHR BUZEI KUNNR LIFNR&lt;/P&gt;&lt;P&gt; INTO CORRESPONDING FIELDS OF TABLE GT_BSEG&lt;/P&gt;&lt;P&gt; FROM BSEG&lt;/P&gt;&lt;P&gt; FOR ALL ENTRIES IN GT_BSEG1&lt;/P&gt;&lt;P&gt; WHERE  BUKRS = GT_BSEG1-BUKRS  AND&lt;/P&gt;&lt;P&gt;        BELNR = GT_BSEG1-BELNR  AND&lt;/P&gt;&lt;P&gt;        GJAHR = GT_BSEG1-GJAHR  AND&lt;/P&gt;&lt;P&gt;        ( LIFNR NE ' ' OR KUNNR NE ' ' ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if LIFNR and KUNNR exists this internal table i need to take to loop, if it does not contains any data then &lt;/P&gt;&lt;P&gt;i need to modify gt_bseg table with gt_bseg1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;could you please help how to modify if gt_bseg is inital then gt_bseg1 values should come under gt_bseg table.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 07 May 2009 06:10:11 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-05-07T06:10:11Z</dc:date>
    <item>
      <title>code to modify</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-to-modify/m-p/5576269#M1271835</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i need to fetch the data from bseg table. i have written the following select query&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT BUKRS BELNR GJAHR BUZEI KUNNR LIFNR&lt;/P&gt;&lt;P&gt;  INTO CORRESPONDING FIELDS OF TABLE GT_BSEG1&lt;/P&gt;&lt;P&gt;  FROM BSEG&lt;/P&gt;&lt;P&gt;  FOR ALL ENTRIES IN GT_BKPF&lt;/P&gt;&lt;P&gt;  WHERE&lt;/P&gt;&lt;P&gt;      BUKRS = GT_BKPF-BUKRS  AND&lt;/P&gt;&lt;P&gt;      BELNR = GT_BKPF-BELNR  AND&lt;/P&gt;&lt;P&gt;      GJAHR = GT_BKPF-GJAHR  AND&lt;/P&gt;&lt;P&gt;      BUZEI = '1'.(i need to select first line item only)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for the belnrs i need to check it consists vendor(lifnr) and customer(kunnr) or not for any other line items for &lt;/P&gt;&lt;P&gt;that particular belnr.&lt;/P&gt;&lt;P&gt;so i have written the following select query.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT  BUKRS BELNR GJAHR BUZEI KUNNR LIFNR&lt;/P&gt;&lt;P&gt; INTO CORRESPONDING FIELDS OF TABLE GT_BSEG&lt;/P&gt;&lt;P&gt; FROM BSEG&lt;/P&gt;&lt;P&gt; FOR ALL ENTRIES IN GT_BSEG1&lt;/P&gt;&lt;P&gt; WHERE  BUKRS = GT_BSEG1-BUKRS  AND&lt;/P&gt;&lt;P&gt;        BELNR = GT_BSEG1-BELNR  AND&lt;/P&gt;&lt;P&gt;        GJAHR = GT_BSEG1-GJAHR  AND&lt;/P&gt;&lt;P&gt;        ( LIFNR NE ' ' OR KUNNR NE ' ' ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if LIFNR and KUNNR exists this internal table i need to take to loop, if it does not contains any data then &lt;/P&gt;&lt;P&gt;i need to modify gt_bseg table with gt_bseg1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;could you please help how to modify if gt_bseg is inital then gt_bseg1 values should come under gt_bseg table.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 May 2009 06:10:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-to-modify/m-p/5576269#M1271835</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-07T06:10:11Z</dc:date>
    </item>
    <item>
      <title>Re: code to modify</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-to-modify/m-p/5576270#M1271836</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi neethu,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   If GT_BSEG[] is initial.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      append lines of GT_BSEG1 to GT_BSEG . &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;         or the other stmt is&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;       GT_BSEG[ ] = GT_BSEG1[ ] .&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;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;ajit.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: AJIT THAKUR on May 7, 2009 8:22 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 May 2009 06:21:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-to-modify/m-p/5576270#M1271836</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-07T06:21:02Z</dc:date>
    </item>
    <item>
      <title>Re: code to modify</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-to-modify/m-p/5576271#M1271837</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 could write like this &lt;/P&gt;&lt;P&gt;If gt_bseg is initial.&lt;/P&gt;&lt;P&gt;loop at gt_bseg1 into fs_gt_bseg1 .&lt;/P&gt;&lt;P&gt;fs_gt_bseg = fs_gt_bseg1 &lt;/P&gt;&lt;P&gt;append fs_gt_bseg to gt_bseg.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Viquar Iqbal&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 May 2009 06:25:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-to-modify/m-p/5576271#M1271837</guid>
      <dc:creator>viquar_iqbal</dc:creator>
      <dc:date>2009-05-07T06:25:28Z</dc:date>
    </item>
    <item>
      <title>Re: code to modify</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-to-modify/m-p/5576272#M1271838</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;SELECT BUKRS BELNR GJAHR BUZEI KUNNR LIFNR&lt;/P&gt;&lt;P&gt;INTO CORRESPONDING FIELDS OF TABLE GT_BSEG1&lt;/P&gt;&lt;P&gt;FROM BSEG&lt;/P&gt;&lt;P&gt;FOR ALL ENTRIES IN GT_BKPF&lt;/P&gt;&lt;P&gt;WHERE&lt;/P&gt;&lt;P&gt;BUKRS = GT_BKPF-BUKRS AND&lt;/P&gt;&lt;P&gt;BELNR = GT_BKPF-BELNR AND&lt;/P&gt;&lt;P&gt;GJAHR = GT_BKPF-GJAHR AND&lt;/P&gt;&lt;P&gt;BUZEI = '1'.(i need to select first line item only)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT BUKRS BELNR GJAHR BUZEI KUNNR LIFNR&lt;/P&gt;&lt;P&gt;INTO CORRESPONDING FIELDS OF TABLE GT_BSEG&lt;/P&gt;&lt;P&gt;FROM BSEG&lt;/P&gt;&lt;P&gt;FOR ALL ENTRIES IN GT_BSEG1&lt;/P&gt;&lt;P&gt;WHERE BUKRS = GT_BSEG1-BUKRS AND&lt;/P&gt;&lt;P&gt;BELNR = GT_BSEG1-BELNR AND&lt;/P&gt;&lt;P&gt;GJAHR = GT_BSEG1-GJAHR . ..........................&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(REMOVE AND&lt;/P&gt;&lt;P&gt;( LIFNR NE ' ' OR KUNNR NE ' ' )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT GT_BSEG.&lt;/P&gt;&lt;P&gt;if  LIFNR EQ  ' ' OR KUNNR EQ  ' '.&lt;/P&gt;&lt;P&gt; GT_BSEG-FIELD1 =  GT_BSEG-FIELD1.&lt;/P&gt;&lt;P&gt;....&lt;/P&gt;&lt;P&gt;....&lt;/P&gt;&lt;P&gt;APPEND GT_BSEG.&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;..........&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;TRY THIS HOPE IT WILL SOLVE UR PROBLEM.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 May 2009 06:26:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-to-modify/m-p/5576272#M1271838</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-07T06:26:35Z</dc:date>
    </item>
    <item>
      <title>Re: code to modify</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-to-modify/m-p/5576273#M1271839</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As you written both the select statements for IT_BSEG1.&lt;/P&gt;&lt;P&gt;There are no entries in the IT_BSEG now.&lt;/P&gt;&lt;P&gt;So what do you mean by modifying the IT_BESG table here.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to fetch all the records for which KUNNR, LIFNR is initial and not initial.&lt;/P&gt;&lt;P&gt;Use one select query for the both. Later move the records into two separate internal tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your question should be more clear without error to got good answers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Naveen Inuganti.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 May 2009 06:29:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-to-modify/m-p/5576273#M1271839</guid>
      <dc:creator>naveen_inuganti2</dc:creator>
      <dc:date>2009-05-07T06:29:01Z</dc:date>
    </item>
    <item>
      <title>Re: code to modify</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-to-modify/m-p/5576274#M1271840</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi neethu,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;could you please help how to modify if gt_bseg is inital then gt_bseg1 values should come under gt_bseg table.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For this if both the internal table have same Structure then u can do this &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;GT_BSEG1 = GT_BSEG.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;else &lt;/P&gt;&lt;P&gt; u need to do this &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Loop at GT_BSEG1 &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;here transfer th valuse from Work Area of GT_BSEG1 to the Work Area of GT_BSEG &lt;/P&gt;&lt;P&gt;and noe &lt;/P&gt;&lt;P&gt;Append GT_BSEG.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endoop .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheersss....&lt;/P&gt;&lt;P&gt;Snehi Chouhan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 May 2009 06:36:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-to-modify/m-p/5576274#M1271840</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-07T06:36:24Z</dc:date>
    </item>
    <item>
      <title>Re: code to modify</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-to-modify/m-p/5576275#M1271841</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this after the select: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
SELECT BUKRS BELNR GJAHR BUZEI KUNNR LIFNR
INTO CORRESPONDING FIELDS OF TABLE GT_BSEG1
FROM BSEG
FOR ALL ENTRIES IN GT_BKPF
WHERE
BUKRS = GT_BKPF-BUKRS AND
BELNR = GT_BKPF-BELNR AND
GJAHR = GT_BKPF-GJAHR AND
BUZEI = '1'.(i need to select first line item only)
if sy-subrc = 0.
    delete gt_bseg1 where kunnr = space or 
                                               lifnr    = space. 
endif. 

if gt_bseg1 is initial.
     message 'No data found' type 'E'. 
endif. 
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope that Helps&lt;/P&gt;&lt;P&gt;Anirban M.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 May 2009 06:41:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-to-modify/m-p/5576275#M1271841</guid>
      <dc:creator>former_member480923</dc:creator>
      <dc:date>2009-05-07T06:41:17Z</dc:date>
    </item>
    <item>
      <title>Re: code to modify</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-to-modify/m-p/5576276#M1271842</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi neethu,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hitting the database twice for the same table and almost similar records will hit on the performance of your program.... you just copy and paste the code given below... this will resolve your issue....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data gs_bseg like line of gt_bseg.

SELECT BUKRS BELNR GJAHR BUZEI KUNNR LIFNR
INTO CORRESPONDING FIELDS OF TABLE GT_BSEG1
FROM BSEG
FOR ALL ENTRIES IN GT_BKPF
WHERE
BUKRS = GT_BKPF-BUKRS AND
BELNR = GT_BKPF-BELNR AND
GJAHR = GT_BKPF-GJAHR AND
BUZEI = '1'.

"  after this select query removing the other select query and putting a loop for it to update gt_bseg internal 
" table this will work even if none of the records of kunnr and lifnr is initial.....
if gt_bseg1 is not initial.
  loop at gt_bseg1 into fs_bseg where lifnr ne space or kunnr ne space.
    append fs_bseg to gt_bseg.
  endloop.
endif.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Siddarth&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 May 2009 06:48:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-to-modify/m-p/5576276#M1271842</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-07T06:48:54Z</dc:date>
    </item>
  </channel>
</rss>

