2014 Nov 19 4:55 PM
Hi friends,
I have my loop:
The content of variable 'GT_N1VP_CV' is for example:
Under the Loop node, I have 2 text elements. The second one will be printed always. But the first one, I want to print it only when there is a change of VDATE and VTIME (previous image). That is, this text node should be printed for rows 1 and 2, but not for row 3 because it has the same values for VDATE and VTIME than row 2.
How could I do that? Thank you very much!
Joan
2014 Nov 20 10:00 AM
Hi Joan,
1. Declare two variables GV_VDATE and GV_TIME in the global data of the smartform.
2. Now in your loop, for the 1st text element, in its conditions tab, put as below.
Fieldname Relation Comparison Value
GS_N1VP-VDATE NE GV_VDATE
GS_N1VP-VTIME NE GV_VTIME
3. After this text element, insert program lines as below.
GV_VDATE = GS_N1VP-VDATE.
GV_VTIME = GS_N1VP-VTIME.
So in every loop pass, we check the value of VDATE and VTIME values with the previous loop. If it is not equal to the current iteration, then only the text element gets printed.
After this check is done, we assign the value of VDATE and VTIME of the current iteration into GV_VDATE and GV_VTIME.
Hope it helps!
2014 Nov 19 7:00 PM
Hi
Its better to add program line and pass the values to another internal table based on your requirement.
In this case, new table should have only two rows.
Now you can print new internal table.
Thanks
Gowrishankar
2014 Nov 20 10:00 AM
Hi Joan,
1. Declare two variables GV_VDATE and GV_TIME in the global data of the smartform.
2. Now in your loop, for the 1st text element, in its conditions tab, put as below.
Fieldname Relation Comparison Value
GS_N1VP-VDATE NE GV_VDATE
GS_N1VP-VTIME NE GV_VTIME
3. After this text element, insert program lines as below.
GV_VDATE = GS_N1VP-VDATE.
GV_VTIME = GS_N1VP-VTIME.
So in every loop pass, we check the value of VDATE and VTIME values with the previous loop. If it is not equal to the current iteration, then only the text element gets printed.
After this check is done, we assign the value of VDATE and VTIME of the current iteration into GV_VDATE and GV_VTIME.
Hope it helps!