08-02-2014 7:48 AM
Hi,
i want to update multiple records from my internal table to standard database table,while updating it is not clear and
updating the first time given value to all places...
code is...
LOOP AT GT_OUTTAB WHERE FREI_DAT IN SO_DATE .
if GT_OUTTAB-edit is not initial.
UPDATE QINF SET FREI_DAT = GT_OUTTAB-EDIT
WHERE MATNR IN SO_MATNR AND
LIEFERANT IN SO_VEND AND
WERK IN SO_PLANT AND
FREI_DAT IN SO_DATE.
endif.
endloop.
it is updating like.....1.1.2014
1.1.2014
1.1.2014
same value is repeating.......How to update this???????
08-02-2014 8:24 AM
Hi Anitha,
Couldn't able to understand the issue. Can you please elaborate issue ?
Thanks & Regards,
Arun
08-02-2014 8:31 AM
Hi,
While updating multiple records same value is again and again updated...it is not cleared..
if i give 1.1.2000 as first line
1.2.2000 as second line maens
it updates 1.1.2000
1.1.2000 only....
same time UPDATE QINF SET FREI_DAT = GT_OUTTAB-EDIT
qinf and gt_outtab has different structure.
08-02-2014 8:34 AM
Hi Anitha,
After update Include
Commit Work
WAIT UP TO 1 SECONDS
and check.
Regards,
Venkat.
08-02-2014 8:39 AM
Thanx for your repli,
commit work also not workingg..... May i know why same values are updating again and again..
08-02-2014 9:03 AM
Hi Anitha,
Cross check the GT_OUTTAB at run time in debugger.
What happening is in each loop iteration you are updating same records ( where close is common ).
Ideally last record value FREI_DAT of GT_OUTTAB should have updated to all the records, as you told here first record FREI_DAT of GT_OUTTB updating. I think it's updating first time successfully, failing for rest of iterations . You need to check any update errors.
08-02-2014 9:08 AM
yeah correct this only happening here,
But i didn get any update errors...It simply updates the same value to the standard qinf table.
08-02-2014 9:16 AM
Hi Anitha,
Is this FREI_DAT IN SO_DATE condition failing for rest of loop iteration after first loop updation ?
Have you checked the sy-subrc ?
Thanks & Regards,
Arun
08-02-2014 9:26 AM
FREI_DAT IN SO_DATE condition is not failing,because it fetches within that value only..
LOOP AT GT_OUTTAB WHERE FREI_DAT IN SO_DATE .
if GT_OUTTAB-edit is not initial.
UPDATE QINF SET FREI_DAT = GT_OUTTAB-EDIT.
WHERE MATNR IN SO_MATNR AND
LIEFERANT IN SO_VEND AND
WERK IN SO_PLANT AND
FREI_DAT IN SO_DATE.
else.
UPDATE QINF SET FREI_DAT = GT_OUTTAB-FREI_DAT.
WHERE MATNR IN SO_MATNR AND
LIEFERANT IN SO_VEND AND
WERK IN SO_PLANT AND
FREI_DAT IN SO_DATE.
endif.
endloop.
08-02-2014 9:35 AM
GT_OUTTAB-EDIT will be with in SO_DATE ? Secondly please check last record of GT_OUTAB whats the value of EDIT and FREI_DATE
08-02-2014 9:42 AM
no GT_OUTTAB-EDIT it is users option ,,in editable alv user entered some date and save it...so some times it is not in FREI_DATE..
08-02-2014 10:14 AM
Hi Anitha,
Try this,
Include ZAEHL field in where condition and check (Key field)
FIELD-SYMBOLS: <wa> like line of gt_outtab.
LOOP AT GT_OUTTAB WHERE FREI_DAT IN SO_DATE
AND MATNR IN SO_MATNR AND
LIEFERANT IN SO_VEND AND
WERK IN SO_PLANT AND
FREI_DAT IN SO_DATE.
MOVE-CORRESPONDING gt_outtab to <wa>.
if <wa>-edit is not initial.
UPDATE QINF SET FREI_DAT = GT_OUTTAB-EDIT
WHERE MATNR EQ <wa>-matnr AND
ZAEHL EQ <wa>-zaehil AND
LIEFERANT EQ <wa>-LIEFERANT AND
WERK EQ <wa>-werk.
COMMIT WORK.
WAIT UP TO 1 SECONDS.
else.
UPDATE QINF SET FREI_DAT = <wa>-FREI_DAT
WHERE MATNR EQ <wa>-matnr AND
ZAEHL EQ <wa>-zaehil AND
LIEFERANT EQ <wa>-LIEFERANT AND
WERK EQ <wa>-werk.
COMMIT WORK.
WAIT UP TO 1 SECONDS.
endif.
endloop.
Regards,
Venkat.
08-02-2014 10:25 AM
Have you checked , first record of EDIT date in range of SO_DATE ? If it is not the range of SO_DATE than first time EDIT date updated to FREI_DATE in all the records, for rest of loop iterations FREI_DATE(since its updated with EDIT date) not in range of SO_DATE it will fail.
As per your code, once EDIT date falls into not in the range of SO_DATE than that will be final update, remaining will fail
08-02-2014 8:46 AM
Hi,
I'm not sure if what you are asking is strictly against the forum rules, but I don't believe it's a good idea to update that table directly, and if you must, sorry - you'd better know what you are doing and how to program updates.
sorry
Janis
08-02-2014 8:49 AM
Hi Anitha,
Try clearing the GT_OUTTAB inside the loop.Use Clear GT_OUTTAB.
By the way GT_OUTTAB is an internal table without headerline.?
Regards,
Kannan