<?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 Offset getting skipped in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/offset-getting-skipped/m-p/12440301#M1998625</link>
    <description>&lt;P&gt;Experts,&lt;/P&gt;
  &lt;P&gt;In my report, after loop at, it goes directly to the move statement and skips the if...endif. How do I resolve that?&lt;/P&gt;
  &lt;P&gt;Thanks in Advance&lt;/P&gt;
  &lt;P&gt;DATA: lt_zfi_pr_details TYPE TABLE OF zfi_pr_details,&lt;/P&gt;
  &lt;P&gt; lw_zfi_pr_details TYPE zfi_pr_details,&lt;BR /&gt; lt_input TYPE zmt_hierarchy_profit_center.&lt;BR /&gt;&lt;BR /&gt; DATA: lv_prctr TYPE string,&lt;BR /&gt; lv_name TYPE prctr,&lt;BR /&gt; lv_zpprctr TYPE string,&lt;BR /&gt; lv_pnode TYPE zfi_pprctr.&lt;BR /&gt;&lt;BR /&gt; CLEAR lt_input.&lt;BR /&gt; lt_input = input.&lt;BR /&gt;&lt;BR /&gt; LOOP AT lt_input-mt_hierarchy_profit_center-row INTO DATA(lw_input).&lt;BR /&gt; IF lv_name IS NOT INITIAL AND lv_pnode IS NOT INITIAL.&lt;BR /&gt; lv_name = lv_prctr+3(10).&lt;BR /&gt; lv_pnode = lv_zpprctr+3(10).&lt;BR /&gt; endif.&lt;BR /&gt; MOVE: lw_input-name TO lw_zfi_pr_details-prctr,&lt;BR /&gt; lw_input-parent_node TO lw_zfi_pr_details-zpprctr,&lt;BR /&gt; lw_input-description TO lw_zfi_pr_details-zpdesc.&lt;BR /&gt; APPEND: lw_zfi_pr_details TO lt_zfi_pr_details.&lt;BR /&gt; CLEAR: lw_input, lw_zfi_pr_details.&lt;BR /&gt; ENDLOOP.&lt;/P&gt;</description>
    <pubDate>Wed, 09 Jun 2021 16:38:32 GMT</pubDate>
    <dc:creator>simantini_sh</dc:creator>
    <dc:date>2021-06-09T16:38:32Z</dc:date>
    <item>
      <title>Offset getting skipped</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/offset-getting-skipped/m-p/12440301#M1998625</link>
      <description>&lt;P&gt;Experts,&lt;/P&gt;
  &lt;P&gt;In my report, after loop at, it goes directly to the move statement and skips the if...endif. How do I resolve that?&lt;/P&gt;
  &lt;P&gt;Thanks in Advance&lt;/P&gt;
  &lt;P&gt;DATA: lt_zfi_pr_details TYPE TABLE OF zfi_pr_details,&lt;/P&gt;
  &lt;P&gt; lw_zfi_pr_details TYPE zfi_pr_details,&lt;BR /&gt; lt_input TYPE zmt_hierarchy_profit_center.&lt;BR /&gt;&lt;BR /&gt; DATA: lv_prctr TYPE string,&lt;BR /&gt; lv_name TYPE prctr,&lt;BR /&gt; lv_zpprctr TYPE string,&lt;BR /&gt; lv_pnode TYPE zfi_pprctr.&lt;BR /&gt;&lt;BR /&gt; CLEAR lt_input.&lt;BR /&gt; lt_input = input.&lt;BR /&gt;&lt;BR /&gt; LOOP AT lt_input-mt_hierarchy_profit_center-row INTO DATA(lw_input).&lt;BR /&gt; IF lv_name IS NOT INITIAL AND lv_pnode IS NOT INITIAL.&lt;BR /&gt; lv_name = lv_prctr+3(10).&lt;BR /&gt; lv_pnode = lv_zpprctr+3(10).&lt;BR /&gt; endif.&lt;BR /&gt; MOVE: lw_input-name TO lw_zfi_pr_details-prctr,&lt;BR /&gt; lw_input-parent_node TO lw_zfi_pr_details-zpprctr,&lt;BR /&gt; lw_input-description TO lw_zfi_pr_details-zpdesc.&lt;BR /&gt; APPEND: lw_zfi_pr_details TO lt_zfi_pr_details.&lt;BR /&gt; CLEAR: lw_input, lw_zfi_pr_details.&lt;BR /&gt; ENDLOOP.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Jun 2021 16:38:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/offset-getting-skipped/m-p/12440301#M1998625</guid>
      <dc:creator>simantini_sh</dc:creator>
      <dc:date>2021-06-09T16:38:32Z</dc:date>
    </item>
    <item>
      <title>Re: Offset getting skipped</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/offset-getting-skipped/m-p/12440302#M1998626</link>
      <description>&lt;P&gt;Thank you for
visiting SAP Community to get answers to your questions. Since this is your
first question, I recommend that you familiarize yourself with our Q&amp;amp;A
Tutorial: &lt;A href="https://developers.sap.com/tutorials/community-qa.html"&gt;https://developers.sap.com/tutorials/community-qa.html&lt;/A&gt;,
as it provides tips for preparing questions that draw responses from our
members. Should you wish, you can revise your question by selecting Actions,
then Edit.&lt;/P&gt;&lt;P&gt;By adding a picture
to your profile you encourage readers to respond: &lt;A href="https://www.youtube.com/watch?v=46bt1juWUUM"&gt;https://www.youtube.com/watch?v=46bt1juWUUM&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Many thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 09 Jun 2021 16:38:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/offset-getting-skipped/m-p/12440302#M1998626</guid>
      <dc:creator>former_member34</dc:creator>
      <dc:date>2021-06-09T16:38:45Z</dc:date>
    </item>
    <item>
      <title>Re: Offset getting skipped</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/offset-getting-skipped/m-p/12440303#M1998627</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;Pleas use the CODE-button to format your code, it's much easier to read it like this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: lt_zfi_pr_details TYPE TABLE OF zfi_pr_details,
      lw_zfi_pr_details TYPE zfi_pr_details,
      lt_input TYPE zmt_hierarchy_profit_center.

DATA: lv_prctr TYPE string,
      lv_name TYPE prctr,
      lv_zpprctr TYPE string,
      lv_pnode TYPE zfi_pprctr.

CLEAR lt_input.
lt_input = input.

LOOP AT lt_input-mt_hierarchy_profit_center-row INTO DATA(lw_input).
  IF lv_name IS NOT INITIAL AND lv_pnode IS NOT INITIAL.
    lv_name = lv_prctr+3(10).
    lv_pnode = lv_zpprctr+3(10).
  endif.
  MOVE: lw_input-name TO lw_zfi_pr_details-prctr,
        lw_input-parent_node TO lw_zfi_pr_details-zpprctr,
        lw_input-description TO lw_zfi_pr_details-zpdesc.
  APPEND: lw_zfi_pr_details TO lt_zfi_pr_details.
  CLEAR: lw_input, lw_zfi_pr_details.
ENDLOOP.&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Anyway, if this is your entire code, it looks like your are just declaring the lv_name and lv_pnode a few lines before the LOOP, and never assign them values. So they will be INITIAL in the loop, and then the&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;IF lv_name IS NOT INITIAL AND lv_pnode IS NOT INITIAL.&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;will of course not be fulfilled, and the code will continue at MOVE...&lt;/P&gt;</description>
      <pubDate>Wed, 09 Jun 2021 16:54:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/offset-getting-skipped/m-p/12440303#M1998627</guid>
      <dc:creator>joltdx</dc:creator>
      <dc:date>2021-06-09T16:54:33Z</dc:date>
    </item>
    <item>
      <title>Re: Offset getting skipped</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/offset-getting-skipped/m-p/12440304#M1998628</link>
      <description>&lt;P&gt;Next time use the code button in the sap.com editor. Makes things easier to read.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: lt_zfi_pr_details TYPE TABLE OF zfi_pr_details,
lw_zfi_pr_details TYPE zfi_pr_details,
lt_input TYPE zmt_hierarchy_profit_center.

DATA: lv_prctr TYPE string,
lv_name TYPE prctr,
lv_zpprctr TYPE string,
lv_pnode TYPE zfi_pprctr.

CLEAR lt_input.
lt_input = input.

LOOP AT lt_input-mt_hierarchy_profit_center-row INTO DATA(lw_input).
  IF lv_name IS NOT INITIAL AND lv_pnode IS NOT INITIAL.
    lv_name = lv_prctr+3(10).
    lv_pnode = lv_zpprctr+3(10).
   endif.
   MOVE: lw_input-name TO lw_zfi_pr_details-prctr,
   lw_input-parent_node TO lw_zfi_pr_details-zpprctr,
   lw_input-description TO lw_zfi_pr_details-zpdesc.
   APPEND: lw_zfi_pr_details TO lt_zfi_pr_details.
  CLEAR: lw_input, lw_zfi_pr_details.
ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;If you debug it, you'll easily see what's wrong. The basic reason behind why it jumps over your IF clause is that the condition isn't satisfied.&lt;/P&gt;&lt;P&gt;Either lv_name is initial, or lv_pnode is not initial. Quite simple really. It does exactly what you've written. And has Jörgen pointed out, whose answer I just read - lv_pnode and lv_name aren't assigned a value when the IF clause is reached.&lt;BR /&gt;&lt;BR /&gt;Again &lt;STRONG&gt;DEBUG&lt;/STRONG&gt; and it is obvious.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Jun 2021 20:38:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/offset-getting-skipped/m-p/12440304#M1998628</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2021-06-09T20:38:57Z</dc:date>
    </item>
    <item>
      <title>Re: Offset getting skipped</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/offset-getting-skipped/m-p/12440305#M1998629</link>
      <description>&lt;P&gt;What do you intend to do later with those 2 variables (lv_name and lv_pnode) keep in memory the first or last non initial values or something I didn't think of?&lt;/P&gt;</description>
      <pubDate>Thu, 10 Jun 2021 11:07:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/offset-getting-skipped/m-p/12440305#M1998629</guid>
      <dc:creator>RaymondGiuseppi</dc:creator>
      <dc:date>2021-06-10T11:07:53Z</dc:date>
    </item>
  </channel>
</rss>

