Skip to Content
0
Former Member
Dec 04, 2006 at 12:52 PM

problem with select.....endselect

74 Views

Hi All,

When i'm trying to create new condition records in txn :

VK11

, 'm facing a problem in the subroutine vtweg_pruefen of the include program MV13AF0V which is included in the main pgm SAPMV13A .
The problem is that, even though i've only 1 record in the dbtable

TVKOV

for the combination vp_vkorg and vp_vtweg, the select statement is fetching 2 values. Is this a problem with buffering?

FORM vtweg_pruefen USING vp_vkorg vp_vtweg vp_error.

DATA: vtwku_tmp LIKE tvkov-vtwku.

  • Satz bereits gelesen

IF tvkov-vkorg <> vp_vkorg OR

tvkov-vtwko <> vp_vtweg.

  • Prüftabelle lesen

SELECT * FROM tvkov WHERE vkorg = vp_vkorg

AND vtwko = vp_vtweg.

  • Die erste Kundensparte setzen

IF vtwku_tmp IS INITIAL.

vtwku_tmp = tvkov-vtwku.

ENDIF.

  • Nicht eindeutig ?

IF vtwku_tmp NE tvkov-vtwku.

CLEAR tvkov-vtwku.

IF NOT call_modus IS INITIAL AND

NOT maapv-vtweg IS INITIAL.

tvkov-vtwku = maapv-vtweg.

ENDIF.

EXIT.

ENDIF.

ENDSELECT.

  • Workarea initial stzen

IF sy-subrc <> 0 AND NOT vp_error IS INITIAL.

CLEAR tvkov.

  • Anlegen von Kondition in dieser Verkaufsorganisation nicht erlaubt

MESSAGE e076 WITH vp_vtweg vp_vkorg.

ENDIF.

ENDIF.

ENDFORM.