<?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 Dynamic Excel Template mapping to internal table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-excel-template-mapping-to-internal-table/m-p/12783051#M2023855</link>
    <description>&lt;P&gt;I have an requirement to upload excel with dynamic template from abap program i.e..the excel template won't be a constant, it might change.&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/2228828-image.png" /&gt;&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/2228827-image.png" /&gt;&lt;/P&gt;
  &lt;P&gt;move gt_intern[] TO gt_intern2[].&lt;BR /&gt;DELETE gt_intern2 WHERE row NE 1.&lt;BR /&gt;&lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/2228829-image.png" /&gt;&lt;/P&gt;
  &lt;P&gt;I need to get the get the fieldnames "LOC" and fields starts with "Charge for"&lt;/P&gt;
  &lt;P&gt;I need the fields that starts with "Charge for" for calculation&lt;/P&gt;
  &lt;P&gt;so i use this logic &lt;/P&gt;
  &lt;P&gt;IF gwa_intern2-value+(10) EQ 'Charge for' OR gwa_intern-Value EQ 'Loc'.&lt;/P&gt;
  &lt;P&gt;MOVE : gwa_intern2-col to gwa_intern3-col,&lt;BR /&gt; gwa_intern2-Value to gwa_intern3-value.&lt;BR /&gt; APPEND gwa_intern3 TO gt_intern3.&lt;BR /&gt;&lt;/P&gt;
  &lt;P&gt;then&lt;/P&gt;
  &lt;P&gt;loop at gt_intern into gwa_intern.&lt;BR /&gt;read table gt_intern3 ASSIGNING FIELD-SYMBOL(&amp;lt;FS_MA&amp;gt;) with key col = gwa_intern-col.&lt;BR /&gt;if sy-subrc = 0.&lt;BR /&gt;&lt;/P&gt;
  &lt;P&gt; append to GT_BODY.&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/2228826-image.png" /&gt;&lt;/P&gt;
  &lt;P&gt;After uploading the invoice and select necessary information from (Loc, Charge for: etc...) The question is how can I map the fields and their respective values from excel to another internal table. &lt;/P&gt;
  &lt;P&gt;I tried this logic&lt;/P&gt;
  &lt;P&gt;If Field01 = 'Charge for: Con'&lt;/P&gt;
  &lt;P&gt; MOVE: &amp;lt;FS_INPTFL&amp;gt;-FIELD01 TO E_invoice-BASE.&lt;/P&gt;
  &lt;P&gt;else if Field01 = 'Charge for Dg'&lt;/P&gt;
  &lt;P&gt;MOVE: &amp;lt;FS_INPTFL&amp;gt;-FIELD01 TO E_invoice-BASE.&lt;/P&gt;
  &lt;P&gt;else if field01 ='Charge for FRT'&lt;/P&gt;
  &lt;P&gt;MOVE: &amp;lt;FS_INPTFL&amp;gt;-FIELD01 TO E_invoice-BASE.&lt;/P&gt;
  &lt;P&gt;endif.&lt;/P&gt;
  &lt;P&gt;If Field02 = 'Charge for: Con'&lt;/P&gt;
  &lt;P&gt; MOVE: &amp;lt;FS_INPTFL&amp;gt;-FIELD01 TO E_invoice-BASE.&lt;/P&gt;
  &lt;P&gt;else if Field02 = 'Charge for Dg'&lt;/P&gt;
  &lt;P&gt;MOVE: &amp;lt;FS_INPTFL&amp;gt;-FIELD01 TO E_invoice-BASE.&lt;/P&gt;
  &lt;P&gt;else if field02 ='Charge for FRT'&lt;/P&gt;
  &lt;P&gt;MOVE: &amp;lt;FS_INPTFL&amp;gt;-FIELD01 TO E_invoice-BASE.&lt;/P&gt;
  &lt;P&gt;endif.&lt;/P&gt;
  &lt;P&gt;If Field03 = 'Charge for: Con'&lt;/P&gt;
  &lt;P&gt; MOVE: &amp;lt;FS_INPTFL&amp;gt;-FIELD01 TO E_invoice-BASE.&lt;/P&gt;
  &lt;P&gt;else if Field03 = 'Charge for Dg'&lt;/P&gt;
  &lt;P&gt;MOVE: &amp;lt;FS_INPTFL&amp;gt;-FIELD01 TO E_invoice-BASE.&lt;/P&gt;
  &lt;P&gt;else if field03='Charge for FRT'&lt;/P&gt;
  &lt;P&gt;MOVE: &amp;lt;FS_INPTFL&amp;gt;-FIELD01 TO E_invoice-BASE.&lt;/P&gt;
  &lt;P&gt;endif.&lt;/P&gt;
  &lt;P&gt;The things is I have 24 fields so I need to do this 24 times. &lt;/P&gt;
  &lt;P&gt;is there another way to identify specific charges?&lt;/P&gt;</description>
    <pubDate>Fri, 17 Nov 2023 13:37:42 GMT</pubDate>
    <dc:creator>calvinkarlo</dc:creator>
    <dc:date>2023-11-17T13:37:42Z</dc:date>
    <item>
      <title>Dynamic Excel Template mapping to internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-excel-template-mapping-to-internal-table/m-p/12783051#M2023855</link>
      <description>&lt;P&gt;I have an requirement to upload excel with dynamic template from abap program i.e..the excel template won't be a constant, it might change.&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/2228828-image.png" /&gt;&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/2228827-image.png" /&gt;&lt;/P&gt;
  &lt;P&gt;move gt_intern[] TO gt_intern2[].&lt;BR /&gt;DELETE gt_intern2 WHERE row NE 1.&lt;BR /&gt;&lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/2228829-image.png" /&gt;&lt;/P&gt;
  &lt;P&gt;I need to get the get the fieldnames "LOC" and fields starts with "Charge for"&lt;/P&gt;
  &lt;P&gt;I need the fields that starts with "Charge for" for calculation&lt;/P&gt;
  &lt;P&gt;so i use this logic &lt;/P&gt;
  &lt;P&gt;IF gwa_intern2-value+(10) EQ 'Charge for' OR gwa_intern-Value EQ 'Loc'.&lt;/P&gt;
  &lt;P&gt;MOVE : gwa_intern2-col to gwa_intern3-col,&lt;BR /&gt; gwa_intern2-Value to gwa_intern3-value.&lt;BR /&gt; APPEND gwa_intern3 TO gt_intern3.&lt;BR /&gt;&lt;/P&gt;
  &lt;P&gt;then&lt;/P&gt;
  &lt;P&gt;loop at gt_intern into gwa_intern.&lt;BR /&gt;read table gt_intern3 ASSIGNING FIELD-SYMBOL(&amp;lt;FS_MA&amp;gt;) with key col = gwa_intern-col.&lt;BR /&gt;if sy-subrc = 0.&lt;BR /&gt;&lt;/P&gt;
  &lt;P&gt; append to GT_BODY.&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/2228826-image.png" /&gt;&lt;/P&gt;
  &lt;P&gt;After uploading the invoice and select necessary information from (Loc, Charge for: etc...) The question is how can I map the fields and their respective values from excel to another internal table. &lt;/P&gt;
  &lt;P&gt;I tried this logic&lt;/P&gt;
  &lt;P&gt;If Field01 = 'Charge for: Con'&lt;/P&gt;
  &lt;P&gt; MOVE: &amp;lt;FS_INPTFL&amp;gt;-FIELD01 TO E_invoice-BASE.&lt;/P&gt;
  &lt;P&gt;else if Field01 = 'Charge for Dg'&lt;/P&gt;
  &lt;P&gt;MOVE: &amp;lt;FS_INPTFL&amp;gt;-FIELD01 TO E_invoice-BASE.&lt;/P&gt;
  &lt;P&gt;else if field01 ='Charge for FRT'&lt;/P&gt;
  &lt;P&gt;MOVE: &amp;lt;FS_INPTFL&amp;gt;-FIELD01 TO E_invoice-BASE.&lt;/P&gt;
  &lt;P&gt;endif.&lt;/P&gt;
  &lt;P&gt;If Field02 = 'Charge for: Con'&lt;/P&gt;
  &lt;P&gt; MOVE: &amp;lt;FS_INPTFL&amp;gt;-FIELD01 TO E_invoice-BASE.&lt;/P&gt;
  &lt;P&gt;else if Field02 = 'Charge for Dg'&lt;/P&gt;
  &lt;P&gt;MOVE: &amp;lt;FS_INPTFL&amp;gt;-FIELD01 TO E_invoice-BASE.&lt;/P&gt;
  &lt;P&gt;else if field02 ='Charge for FRT'&lt;/P&gt;
  &lt;P&gt;MOVE: &amp;lt;FS_INPTFL&amp;gt;-FIELD01 TO E_invoice-BASE.&lt;/P&gt;
  &lt;P&gt;endif.&lt;/P&gt;
  &lt;P&gt;If Field03 = 'Charge for: Con'&lt;/P&gt;
  &lt;P&gt; MOVE: &amp;lt;FS_INPTFL&amp;gt;-FIELD01 TO E_invoice-BASE.&lt;/P&gt;
  &lt;P&gt;else if Field03 = 'Charge for Dg'&lt;/P&gt;
  &lt;P&gt;MOVE: &amp;lt;FS_INPTFL&amp;gt;-FIELD01 TO E_invoice-BASE.&lt;/P&gt;
  &lt;P&gt;else if field03='Charge for FRT'&lt;/P&gt;
  &lt;P&gt;MOVE: &amp;lt;FS_INPTFL&amp;gt;-FIELD01 TO E_invoice-BASE.&lt;/P&gt;
  &lt;P&gt;endif.&lt;/P&gt;
  &lt;P&gt;The things is I have 24 fields so I need to do this 24 times. &lt;/P&gt;
  &lt;P&gt;is there another way to identify specific charges?&lt;/P&gt;</description>
      <pubDate>Fri, 17 Nov 2023 13:37:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-excel-template-mapping-to-internal-table/m-p/12783051#M2023855</guid>
      <dc:creator>calvinkarlo</dc:creator>
      <dc:date>2023-11-17T13:37:42Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Excel Template mapping to internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-excel-template-mapping-to-internal-table/m-p/12783052#M2023856</link>
      <description>&lt;P&gt;Check out the many blogposts and questions related to #abap2xlsx&lt;/P&gt;</description>
      <pubDate>Fri, 17 Nov 2023 13:49:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-excel-template-mapping-to-internal-table/m-p/12783052#M2023856</guid>
      <dc:creator>abo</dc:creator>
      <dc:date>2023-11-17T13:49:54Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Excel Template mapping to internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-excel-template-mapping-to-internal-table/m-p/12783053#M2023857</link>
      <description>&lt;P&gt;I don't get why GT_BODY contains these non-functional names FIELD01, etc.&lt;/P&gt;&lt;P&gt;Why don't you just indicate the component names you want, e.g. LOC, CHARGE_FOR_CON, etc.&lt;/P&gt;&lt;P&gt;I don't know your ABAP version, let's admit it's an old one (&amp;lt; 7.40):&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;read table GT_INTERN INTO LS_INTERN_LOC with key value = 'Loc'.&lt;BR /&gt;read table GT_INTERN INTO LS_INTERN_CON with key value = 'Charge for: CON'.&lt;BR /&gt;read table GT_INTERN INTO LS_INTERN_DG with key value = 'Charge for: DG'.&lt;BR /&gt;read table GT_INTERN INTO LS_INTERN_FRT with key value = 'Charge for: FRT'.

LOOP AT gt_intern INTO ls_intern WHERE row &amp;gt;= 2.&lt;BR /&gt;  CASE ls_intern-col.&lt;BR /&gt;    WHEN ls_intern_loc-col.
      E_invoice-LOC = ls_intern-value.
    WHEN ls_intern_loc-con.
      E_invoice-charge_for_con = ls_intern-value.
    WHEN ls_intern_loc-dg.
      E_invoice-charge_for_dg = ls_intern-value.
    WHEN ls_intern_loc-frt.
      E_invoice-charge_for_frt = ls_intern-value.
  ENDCASE.
...
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Remarks:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Your variable names are awful, they should express the functional meaning.&lt;/LI&gt;&lt;LI&gt;MOVE has been obsolete for 15 years.&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Fri, 17 Nov 2023 14:43:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-excel-template-mapping-to-internal-table/m-p/12783053#M2023857</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2023-11-17T14:43:09Z</dc:date>
    </item>
  </channel>
</rss>

