2008 Jun 10 6:56 PM
Hi,
I am working on a print program for SAP Script for order confirmations. I have to find a way to determine if there are different plant between the positions before printout, as it should trigger an additional text at the end of each line.
example: itab = TVBDPA (order lines)
Pos. Plant
10 A
20 C
30 A
40 D
As you can see the item lines have different plants. How can I determine this in my program, so I can set a flag for different plants
for instance G_PLANT ?
In short: how to run though the positions and check if plants are different ?
2008 Jun 10 8:57 PM
May be this way
sort TVBDPA by plants.
delete adjacent duplicates from TVBDPA comparing PLANTS.
describe table TVBDPA lines v_lin.
if v_lin > 1.
" Different plant.
else.
" Single plant
endif.
a®
Hi,
I am working on a print program for SAP Script for order confirmations. I have to find a way to determine if there are different plant between the positions before printout, as it should trigger an additional text at the end of each line.
example: itab = TVBDPA (order lines)
Pos. Plant
10 A
20 C
30 A
40 D
As you can see the item lines have different plants. How can I determine this in my program, so I can set a flag for different plants
for instance G_PLANT ?
In short: how to run though the positions and check if plants are different ?
2008 Jun 10 8:35 PM
No way but to loop through table TVBDPA. If your intention is find the existence of more than on plant among the lines, without worrying about what the plants are, here is short pseudo-code snippet:
READ TABLE TVBDPA INDEX 1 INTO FIRST_PLANT.
LOOP AT TVBDPA FROM INDEX 2.
IF TVBDPA-PLANT NOT EQUAL TO FIRST_PLANT.
FLAG_DIFFERENT_PLANTS = TRUE
EXIT. "THE LOOP
ENDIF.
ENDLOOP.
2008 Jun 10 8:57 PM
May be this way
sort TVBDPA by plants.
delete adjacent duplicates from TVBDPA comparing PLANTS.
describe table TVBDPA lines v_lin.
if v_lin > 1.
" Different plant.
else.
" Single plant
endif.
a®
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |