‎2006 Dec 04 12:52 PM
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 .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.
‎2006 Dec 04 2:38 PM
true with your table values it will surely give the duplicates as
SELECT * FROM tvkov WHERE vkorg = vp_vkorg
AND vtwko = vp_vtweg.
vtwko is being checked for the distribtion channel and not vtweg. Can the vtwko that is the reference values be changes or not.
‎2006 Dec 04 1:32 PM
Hi, just check if the other record is having a deletion flag set in.
Krishna
‎2006 Dec 04 1:39 PM
try using select single......
or else
use where deletion flag eq space in ur select statement....
‎2006 Dec 04 1:49 PM
Hi Krishna/Ramesh,
There is no deletion flag in the table. I am wondering as how I can change a standard program.
‎2006 Dec 04 1:56 PM
are you sure its looping through the 2nd time to get the values. i tried to debug and it gets only one value. There is no deletion flag as the table data is populated from the functional setting. Could you be more specific if its only during creation that you get 2 values or is it the same while changing and display.
‎2006 Dec 04 2:27 PM
MANDT VKORG VTWEG VTWKO VTWAU VTWKU VLGFI VLTYP VLKEB
100 0001 01 01 01
100 0001 03 01 03
Hi Kshamatha,
Make sure ur entries in the table <u>TVKOV</u> are same as above, i.e., the values in the field VTWKU must be different for the same sales organization only then u can replicate my problem. I didn't check during change but i'm facing the problem during creation(VK11). U can maintain the entries in the table with the txn <b>VOR1</b>
‎2006 Dec 04 2:29 PM
1st Rcrd: 100(MANDT ) 0001(VKORG) 01(VTWEG) 01(VTWKO) 01(VTWKU )
2nd Rcrd: 100(MANDT ) 0001(VKORG) 01(VTWEG) 01(VTWKO) 03( VTWKU)
‎2006 Dec 04 2:01 PM
Ratan,
I feel you have got it wrong ..table TVKOV cannot store 2 enteries for the same sales org and distibution channel as the particular fields are the primary key for the table.
It seems that you have missed something in debugging !!
Regards
Anurag
‎2006 Dec 04 2:17 PM
Hi Anurag,
Yes, it can't 've 2 values, but it is fetching the second record in the table with the same value of vkorg. One more interesting point that i've observed is
1. When i've placed a break-point at the SELECT statement, the control doesn't stop at the break-point for the second time.(which makes sense as there is only 1 record)
2. but when I've created a watch point with the condition
tvkov-vtwtu NE value fetched during first pass in the select....endselect statement, the control stops at the SELECT statement, by then the value of the field tvkov-vtwtu is already changed.
‎2006 Dec 04 2:38 PM
true with your table values it will surely give the duplicates as
SELECT * FROM tvkov WHERE vkorg = vp_vkorg
AND vtwko = vp_vtweg.
vtwko is being checked for the distribtion channel and not vtweg. Can the vtwko that is the reference values be changes or not.