<?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 Compare sales order items (specific fields) in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/compare-sales-order-items-specific-fields/m-p/6321071#M1394496</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi guys,&lt;/P&gt;&lt;P&gt;I need to compare some fields from vbap and vbkd and to add values from sales order items, before I print then on screen.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to compare if vbkd-ihrez_e and vbkd-bstkd and vbap-matnr are the same for two records from sales order (10 and 20), If they are the same then add vbkd-ihrez values (for items 10 and 20), also add vbap-kwmeng, and write that sum on screen.&lt;/P&gt;&lt;P&gt;Compare item with previous one. if doing for 20 compare with 10, for item 30 compare with 20 etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I start like this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select aubel posnr into (wa_tab-vbeln, wa_tab-posnr)&lt;/P&gt;&lt;P&gt;         from vbrp&lt;/P&gt;&lt;P&gt;         where vbeln = p_vbeln.&lt;/P&gt;&lt;P&gt;    append wa_tab to it_tab.&lt;/P&gt;&lt;P&gt;  endselect.&lt;/P&gt;&lt;P&gt;loop at it_tab into wa_tab.                   &amp;lt;&amp;lt; I need somewhere to compare fields if they are the same before I print them.&lt;/P&gt;&lt;P&gt;      select single fbuda bstkd_e ihrez_e ihrez bstkd&lt;/P&gt;&lt;P&gt;                      into&lt;/P&gt;&lt;P&gt;                      (wa_tab-fbuda,&lt;/P&gt;&lt;P&gt;                      wa_tab-bstkd_e,&lt;/P&gt;&lt;P&gt;                      wa_tab-ihrez_e,&lt;/P&gt;&lt;P&gt;                      wa_tab-ihrez,&lt;/P&gt;&lt;P&gt;                      wa_tab-bstkd)&lt;/P&gt;&lt;P&gt;                      from vbkd&lt;/P&gt;&lt;P&gt;                      where vbeln = wa_tab-vbeln and&lt;/P&gt;&lt;P&gt;                            posnr = wa_tab-posnr.&lt;/P&gt;&lt;P&gt;select single kbmeng waerk netwr arktx kwmeng&lt;/P&gt;&lt;P&gt;                      into&lt;/P&gt;&lt;P&gt;                      (wa_tab-kbmeng,&lt;/P&gt;&lt;P&gt;                      wa_tab-waerk,&lt;/P&gt;&lt;P&gt;                      wa_tab-netwr,&lt;/P&gt;&lt;P&gt;                      wa_tab-arktx,&lt;/P&gt;&lt;P&gt;                      wa_tab-kwmeng)&lt;/P&gt;&lt;P&gt;                      from vbap&lt;/P&gt;&lt;P&gt;                      where vbeln = wa_tab-vbeln and&lt;/P&gt;&lt;P&gt;                            posnr = wa_tab-posnr.&lt;/P&gt;&lt;P&gt;modify it_tab from wa_tab.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;How can I modify code to get this process? Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: nihad omerbegovic on Nov 2, 2009 9:45 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 02 Nov 2009 08:38:13 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-11-02T08:38:13Z</dc:date>
    <item>
      <title>Compare sales order items (specific fields)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/compare-sales-order-items-specific-fields/m-p/6321071#M1394496</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi guys,&lt;/P&gt;&lt;P&gt;I need to compare some fields from vbap and vbkd and to add values from sales order items, before I print then on screen.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to compare if vbkd-ihrez_e and vbkd-bstkd and vbap-matnr are the same for two records from sales order (10 and 20), If they are the same then add vbkd-ihrez values (for items 10 and 20), also add vbap-kwmeng, and write that sum on screen.&lt;/P&gt;&lt;P&gt;Compare item with previous one. if doing for 20 compare with 10, for item 30 compare with 20 etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I start like this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select aubel posnr into (wa_tab-vbeln, wa_tab-posnr)&lt;/P&gt;&lt;P&gt;         from vbrp&lt;/P&gt;&lt;P&gt;         where vbeln = p_vbeln.&lt;/P&gt;&lt;P&gt;    append wa_tab to it_tab.&lt;/P&gt;&lt;P&gt;  endselect.&lt;/P&gt;&lt;P&gt;loop at it_tab into wa_tab.                   &amp;lt;&amp;lt; I need somewhere to compare fields if they are the same before I print them.&lt;/P&gt;&lt;P&gt;      select single fbuda bstkd_e ihrez_e ihrez bstkd&lt;/P&gt;&lt;P&gt;                      into&lt;/P&gt;&lt;P&gt;                      (wa_tab-fbuda,&lt;/P&gt;&lt;P&gt;                      wa_tab-bstkd_e,&lt;/P&gt;&lt;P&gt;                      wa_tab-ihrez_e,&lt;/P&gt;&lt;P&gt;                      wa_tab-ihrez,&lt;/P&gt;&lt;P&gt;                      wa_tab-bstkd)&lt;/P&gt;&lt;P&gt;                      from vbkd&lt;/P&gt;&lt;P&gt;                      where vbeln = wa_tab-vbeln and&lt;/P&gt;&lt;P&gt;                            posnr = wa_tab-posnr.&lt;/P&gt;&lt;P&gt;select single kbmeng waerk netwr arktx kwmeng&lt;/P&gt;&lt;P&gt;                      into&lt;/P&gt;&lt;P&gt;                      (wa_tab-kbmeng,&lt;/P&gt;&lt;P&gt;                      wa_tab-waerk,&lt;/P&gt;&lt;P&gt;                      wa_tab-netwr,&lt;/P&gt;&lt;P&gt;                      wa_tab-arktx,&lt;/P&gt;&lt;P&gt;                      wa_tab-kwmeng)&lt;/P&gt;&lt;P&gt;                      from vbap&lt;/P&gt;&lt;P&gt;                      where vbeln = wa_tab-vbeln and&lt;/P&gt;&lt;P&gt;                            posnr = wa_tab-posnr.&lt;/P&gt;&lt;P&gt;modify it_tab from wa_tab.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;How can I modify code to get this process? Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: nihad omerbegovic on Nov 2, 2009 9:45 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Nov 2009 08:38:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/compare-sales-order-items-specific-fields/m-p/6321071#M1394496</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-11-02T08:38:13Z</dc:date>
    </item>
    <item>
      <title>Re: Compare sales order items (specific fields)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/compare-sales-order-items-specific-fields/m-p/6321072#M1394497</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Nihad&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

select aubel posnr into CORRESPONDING FIELDS OF TABLE it_tab
from vbrp
where vbeln EQ p_vbeln.

select a~vbeln a~posnr a~fbuda a~bstkd_e a~ihrez_e a~ihrez a~bstkd
b~kbmeng b~waerk b~netwr b~arktx b~kwmeng
into CORRESPONDING FIELDS OF TABLE it_vb
from vbkd as a INNER JOIN vbap as b ON a~vbeln EQ b~vbeln AND a~posnr EQ b~posnr
FOR ALL ENTRIES IN it_tab
where vbeln EQ it_tan-vbeln and
posnr EQ it_tab-posnr.

SORT it_tab BY vbeln posnr.

LOOP AT it_tab INTO wa_tab.

IF lv_vbeln EQ wa_tab-vbeln. "means it's the same order but a different item
IF ( lv_ihrez_e = wa_tab-ihrez_e ) AND ( lv_bstkd = wa_tab-bstkd ) AND ( lv_matnr = wa_tab-matnr ).
ADD wa_tab-kwmeng TO lv_kwmeng.
WRITE lv_kwmeng.
ENDIF.

CLEAR lv_kwmeng.

lv_ihrez_e = wa_tab-ihrez_e.
lv_bstkd = wa_tab-bstkd.
lv_matnr = wa_tab-matnr.
lv_vbeln = wa_tab-vbeln.
lv_kwmeng = wa_tab-kwmeng.

endloop.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Pushpraj&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Nov 2009 09:32:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/compare-sales-order-items-specific-fields/m-p/6321072#M1394497</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-11-02T09:32:48Z</dc:date>
    </item>
    <item>
      <title>Re: Compare sales order items (specific fields)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/compare-sales-order-items-specific-fields/m-p/6321073#M1394498</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think u need to store the data in a new internal table where the keys are the fields u need to compair and collect the data there.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Max&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Nov 2009 10:26:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/compare-sales-order-items-specific-fields/m-p/6321073#M1394498</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-11-02T10:26:45Z</dc:date>
    </item>
  </channel>
</rss>

