<?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: Program Help in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/program-help/m-p/6182863#M1373520</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Build a final internal table with all the fields you require.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
SELECT aa~matnr bb~matnr aa~lifnr aa~infnr
aa~erdat aa~ernam cc~erdat cc~ernam
cc~vdatu cc~bdatu
FROM eina AS aa INNER JOIN makt AS bb ON aa~matnr = bb~matnr
INNER JOIN eord AS cc ON aa~matnr = cc~matnr AND aa~lifnr = cc~lifnr

INTO CORRESPONDING FIELDS OF TABLE it_ir_v_sl
WHERE aa~matnr IN s_matnr AND
cc~flifn EQ 'X'.

if it_ir_v_sl[] is not initial.

SELECT * FROM a017 INTO table it_a017 FOR ALL ENTRIES IN it_ir_v_sl
WHERE matnr = it_ir_v_sl-matnr AND
lifnr = it_ir_v_sl-lifnr.
 endif.

loop at it_ir_v_sl into wa1. 
" if only 1 record exists in it_a017 for a record in           
 " it_ir_v_sl  then avoid second loop and use read statement 
   loop at it_a017  into wa2 where matnr = wa1-matnr and lifnr = wa1-lifnr. 
      move-corresponding wa1 to wa_final.
      move-corresponding wa2 to wa_final.
      append wa_final to it_final.
       clear: wa2,wa_final.
endloop.
if sy-subrc ne 0. " if required
 move-corresponding wa1 to wa_final.
append wa_final to it_final. 
clear wa_final.
endif.
endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 07 Oct 2009 14:24:27 GMT</pubDate>
    <dc:creator>kesavadas_thekkillath</dc:creator>
    <dc:date>2009-10-07T14:24:27Z</dc:date>
    <item>
      <title>Program Help</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/program-help/m-p/6182861#M1373518</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm just wondering if anyone can help. I'm very new to the programming lark. I've got the below program&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT aa&lt;SUB&gt;matnr bb&lt;/SUB&gt;matnr aa&lt;SUB&gt;lifnr aa&lt;/SUB&gt;infnr&lt;/P&gt;&lt;P&gt;aa&lt;SUB&gt;erdat aa&lt;/SUB&gt;ernam cc&lt;SUB&gt;erdat cc&lt;/SUB&gt;ernam&lt;/P&gt;&lt;P&gt;cc&lt;SUB&gt;vdatu cc&lt;/SUB&gt;bdatu&lt;/P&gt;&lt;P&gt;FROM eina AS aa INNER JOIN makt AS bb ON aa&lt;SUB&gt;matnr = bb&lt;/SUB&gt;matnr&lt;/P&gt;&lt;P&gt;INNER JOIN eord AS cc ON aa&lt;SUB&gt;matnr = cc&lt;/SUB&gt;matnr AND aa&lt;SUB&gt;lifnr = cc&lt;/SUB&gt;lifnr&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;INTO CORRESPONDING FIELDS OF TABLE it_ir_v_sl&lt;/P&gt;&lt;P&gt;WHERE aa~matnr IN s_matnr AND&lt;/P&gt;&lt;P&gt;cc~flifn EQ 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * FROM a017 INTO wa_a017&lt;/P&gt;&lt;P&gt;FOR ALL ENTRIES IN it_ir_v_sl&lt;/P&gt;&lt;P&gt;WHERE matnr = it_ir_v_sl-matnr AND&lt;/P&gt;&lt;P&gt;lifnr = it_ir_v_sl-lifnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDSELECT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="-------------------------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to write fields&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;matnr, &lt;/P&gt;&lt;P&gt;maktx,&lt;/P&gt;&lt;P&gt;infnr,&lt;/P&gt;&lt;P&gt;lifnr,&lt;/P&gt;&lt;P&gt;erdat,&lt;/P&gt;&lt;P&gt;ernam,&lt;/P&gt;&lt;P&gt;datab, - from table a017&lt;/P&gt;&lt;P&gt;datbi, - from table a017&lt;/P&gt;&lt;P&gt;erdat,&lt;/P&gt;&lt;P&gt;ernam,&lt;/P&gt;&lt;P&gt;vdatu,&lt;/P&gt;&lt;P&gt;bdatu.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But i'm not sure how to get the two internal table that i've pulled the info into to fit together so i can write this out.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If anyone can help on this, it would be a great help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Oct 2009 14:15:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/program-help/m-p/6182861#M1373518</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-10-07T14:15:26Z</dc:date>
    </item>
    <item>
      <title>Re: Program Help</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/program-help/m-p/6182862#M1373519</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;Take one Internal table with all fields as t_final.&lt;/P&gt;&lt;P&gt;format the data to final inter table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at it_ir_v_sl.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;move-corresponding fields to t_final.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * FROM a017 INTO wa_a017&lt;/P&gt;&lt;P&gt;FOR ALL ENTRIES IN it_ir_v_sl&lt;/P&gt;&lt;P&gt;WHERE matnr = it_ir_v_sl-matnr AND&lt;/P&gt;&lt;P&gt;lifnr = it_ir_v_sl-lifnr.&lt;/P&gt;&lt;P&gt;if sy-subrc = 0. &lt;/P&gt;&lt;P&gt;  move the date fields to t_final table.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;append t_final.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Oct 2009 14:19:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/program-help/m-p/6182862#M1373519</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-10-07T14:19:44Z</dc:date>
    </item>
    <item>
      <title>Re: Program Help</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/program-help/m-p/6182863#M1373520</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Build a final internal table with all the fields you require.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
SELECT aa~matnr bb~matnr aa~lifnr aa~infnr
aa~erdat aa~ernam cc~erdat cc~ernam
cc~vdatu cc~bdatu
FROM eina AS aa INNER JOIN makt AS bb ON aa~matnr = bb~matnr
INNER JOIN eord AS cc ON aa~matnr = cc~matnr AND aa~lifnr = cc~lifnr

INTO CORRESPONDING FIELDS OF TABLE it_ir_v_sl
WHERE aa~matnr IN s_matnr AND
cc~flifn EQ 'X'.

if it_ir_v_sl[] is not initial.

SELECT * FROM a017 INTO table it_a017 FOR ALL ENTRIES IN it_ir_v_sl
WHERE matnr = it_ir_v_sl-matnr AND
lifnr = it_ir_v_sl-lifnr.
 endif.

loop at it_ir_v_sl into wa1. 
" if only 1 record exists in it_a017 for a record in           
 " it_ir_v_sl  then avoid second loop and use read statement 
   loop at it_a017  into wa2 where matnr = wa1-matnr and lifnr = wa1-lifnr. 
      move-corresponding wa1 to wa_final.
      move-corresponding wa2 to wa_final.
      append wa_final to it_final.
       clear: wa2,wa_final.
endloop.
if sy-subrc ne 0. " if required
 move-corresponding wa1 to wa_final.
append wa_final to it_final. 
clear wa_final.
endif.
endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Oct 2009 14:24:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/program-help/m-p/6182863#M1373520</guid>
      <dc:creator>kesavadas_thekkillath</dc:creator>
      <dc:date>2009-10-07T14:24:27Z</dc:date>
    </item>
  </channel>
</rss>

