‎2007 Sep 04 3:57 PM
Dear friends,
the following is the code i wrote, it is crossing the select statement, and giving sy-subrc = 0 , but it is getting struck at the update and never coming out , i dont know what is wrong in the stmt, can some one help.
select single * from vbuk into in_vbuk where VBELN = '0088011467'.
if sy-subrc = 0.
UPDATE VBUK SET: WBSTK = 'C',
GBSTK = 'C'
WHERE VBELN = '0088011467'.
else.
write:/ ' error: the doc number for vbuk doesnot exist '.
endif.
thank you.
sanjana
‎2007 Sep 04 3:59 PM
Hi,
select single * from vbuk into table in_vbuk where VBELN = '0088011467'.
if sy-subrc = 0.
UPDATE VBUK SET: WBSTK = 'C',
GBSTK = 'C'
WHERE VBELN = '0088011467'.
else.
write:/ ' error: the doc number for vbuk doesnot exist '.
endif.
This will work now
Regards
Sudheer
‎2007 Sep 04 4:04 PM
thank you for the reply sudhir,
i wanted to make sure that was the error, because, it is crossing over select stmt and also has sy-subrc = 0,
one more point is that, the above code which i wrote perfectly updated in development, but is giving the above error only in production.
thanks once again for the reply.
‎2007 Sep 04 4:08 PM
HI Sanjana,
There is no error in the code and it should update the Document number '0088011467'. even you can check the UPDATE statment with the SY-SUBRC
Regards
Sudheer
‎2007 Sep 04 4:11 PM
Hi,
but never change SAP-Data in this way in product-system?!?!
Regards, Dieter
‎2007 Sep 04 4:12 PM
hi sanjana
what sudhir sid is correct as : if select fails u don't need to use the update and just display the no record info or err message
well please awards points(atlest to sudhir ) (-: if the answer is helpful .
‎2007 Sep 04 4:21 PM
thank you friends for so many replies.
firstly sudhir, to check for sy-subrc at update command, it should first cross over that update command, but it is not,
it is just getting struck not moving from there infinitely, so we cant check the sy-subrc,
secondly, grohn, yes you are right, we should never do this way in production, but
we had multiple trials done through various ways, and finally, a conference agreed this way,
thanks again for the replies.
‎2007 Sep 04 4:23 PM
hi grohn,
by meaning that multiple trials, we tried table maint , etc..
but every time we got the same problem, access denied,
might be that this time too, it is giving the same error, thats why it is getting struck at production only.
‎2007 Sep 04 4:32 PM
I hope SAP was included in that conference.
The problem is that your code is trying to set WBSTK = 'C' for <b>every order in your system</b>. Is that your intention?
Rob
‎2007 Sep 04 5:23 PM
hi rob,
thanks for the reply,
actually my intention was to update only that perticular record with the given vbeln,
by changing the WBSTK to 'C'.
thank you
‎2007 Sep 04 5:31 PM
Of course, but since it is trying to update all records, that's why it is taking so long.
Are you saying that you are running this in your production system without testing in QA or development?
Did you check with SAP before setting out on this?
Rob
‎2007 Sep 04 6:21 PM
See the oss notes and we had same type of requirement :
Symptom
The goods issue for a delivery was posted and a material document created. However, the billing document for the delivery cannot be created because the system generates a message that the delivery is not yet posted for the goods issue.
However, the material document is contained in the document flow of the delivery.
Additional key words
Goods issue, GI, VL01, VL02, goods movement status, post GI, delivery, delivery note, VBUK-WBSTK, VBUP-WBSTA.
Cause and prerequisites
The goods movement status on header level (VBUK-WBSTK) and on item level (VBUP-WBSTA) was not set to 'C', but to 'A'.
Solution
With the ABAP/4 report specified below you can convert the goods movement status to 'C'. You can then bill the delivery with transaction VF01.
Preconditions:
1. The goods issue actually must have been carried out.
2. After executing the report, you should check the required conversion only with transaction SE16.
Source code corrections
REPORT ZZBRE003.
************************************************************************
*
This report changes the goods movement status for delivery. *
You can change the status from A to C or vice versa. (VBUP + VBUK) *
*
Notice: All positions and header will get the same status ! *
=========================================================== *
*
************************************************************************
*
After changing the status with this report do not use VL02 / VL03 *
to watch the effect. This would change the goods movement status *
again!!!!! *
Please use transaction SE16! *
*
************************************************************************
*
Invoice for this delivery should be done with VF01! *
*
************************************************************************
*
Please check this report with an example in your development system*
before using it in productive system! *
*
************************************************************************
TABLES: VBUP,
VBUK,
LIPS,
VBFA.
input parameters filled by user
PARAMETERS: BELNR LIKE LIKP-VBELN, "BELNR = delivery number
WBSTS LIKE VBUP-WBSTA. "WBSTS = goods movement status
DATA: COUNTER1 TYPE I,
COUNTER2 TYPE I.
CLEAR: COUNTER1, COUNTER2.
TRANSLATE WBSTS TO UPPER CASE.
has user filled the field for delivery note?
IF BELNR IS INITIAL.
FORMAT COLOR 6.
FORMAT INVERSE ON.
SKIP.
WRITE: 'Please insert number of delivery note'.
EXIT.
ENDIF.
change goods movement type in vbuk
SELECT SINGLE * FROM VBUK WHERE VBELN EQ BELNR.
IF SY-SUBRC = 0.
VBUK-WBSTK = WBSTS.
UPDATE VBUK.
ENDIF.
change goods movement type in vbup
SELECT * FROM VBUP WHERE VBELN EQ BELNR.
IF SY-SUBRC = 0.
VBUP-WBSTA = WBSTS.
COUNTER1 = COUNTER1 + 1.
UPDATE VBUP.
ENDIF.
ENDSELECT.
show the result to user
FORMAT COLOR 1.
WRITE: 'Delivery: ', BELNR.
SKIP.
FORMAT COLOR 3.
WRITE: / 'Number of postions:', (3) COUNTER1.
WRITE: 'changed to goods movement status', WBSTS.
************************************************************************
Thanks
Seshu
‎2007 Sep 04 6:53 PM
hi rob and seshu,
thanks for replies,
but rob,
as you were saying its updating all the records, but when i checked there were just one record to be updated with this vbeln value. and also i successfully updated the development system, with in a fraction of second.
and seshu
regarding your program which u gave ,
actually, i was approached by functional people and just asked me the above requirement, gave me no more details , and so might be i cannot use your program, thak you very much for your precious reply,
‎2007 Sep 04 7:16 PM
Sanjana - because of the colon and comma, the statement:
UPDATE VBUK SET: WBSTK = 'C',
GBSTK = 'C'
WHERE VBELN = '0088011467'.
is interpreted as the following two statements:
UPDATE VBUK SET WBSTK = 'C'.
UPDATE VBUK SET GBSTK = 'C'
WHERE VBELN = '0088011467'.
the WHERE is only on the second statement.
I see from an earlier response that you did test in your development system. Please check your results there.
Rob
‎2007 Sep 04 8:27 PM
Sanjana - don't be so quick to dismiss the program shown by Seshu. It has one important point. It is updating two tables. You are only updating one. It is very important to keep SAP tables in synch with each other.
Just because functinal people gave you the specs doesn't mean they have thought the situation through.
If I were you, I'd close this thread and open an OSS message with your problem.
Rob
PS - Seshu - notes are SAP copyright and I don't think were supposed to post them.
‎2007 Sep 04 10:35 PM
hi rob,
you are right,
i changed it to
select single * from vbuk where VBELN = '0088011467'.
if sy-subrc = 0.
UPDATE VBUK SET WBSTK = 'C'
GBSTK = 'C'
WHERE VBELN = '0088011467'.
else.
write:/ ' error: the doc number for vbuk doesnot exist '.
endif.
i removed the colon and comma,
it should work correctly right,
i only need to change the data of that specific vbeln,
remaining untouched.
thanks again
‎2007 Sep 04 10:40 PM
‎2007 Sep 04 11:36 PM
hi rob,
thanks for the reply,
i made similar changes to VBUP ,
the syntax and remaining are all correct right?
‎2007 Sep 04 11:46 PM
Sanjana,
Just remove hardcode values like vbeln = 'value',instead of passing hardcode values,just use selection-screen.
I saw your code and looks good.
Rob,
I noted ,hereafter i will not paste oss message,Thank you
Seshu
‎2007 Sep 05 4:43 AM
hi seshu
i was specifically asked to put the value , so that no other record is touched even by chance.
thank you