2006 Jan 12 12:42 PM
Hi all,
I am using USEREXIT_SAVE_DOCUMENT in include MV45AFZZ to write some info of the Sales order to my own tables.
Now I would like to get the Requested delivery date for each position in the Sales Order.
There is this field with the "Requested delivery date of the document" in the document Header (vbak-vdatu),
but this can change for each position. They are displayed in Screen Field RV45A-ETDAT.
The dates are eventually written in table VBEP (VBEP-EDATU), but are not yet there in USEREXIT_SAVE_DOCUMENT.
How / where can I get the right date for each position?
Greetings Fred.
2006 Jan 12 12:55 PM
2006 Jan 12 2:07 PM
Hi Srinivas Adavi,
yes, XVBEP contains the right values, but when I run this code:
data: lf_vbap TYPE vbap,
ls_tmp like xvbep.
LOOP AT xvbap INTO lf_vbap.
ls_tmp-posnr = lf_vbap-posnr.
READ TABLE xvbep INTO ls_tmp
COMPARING posnr
TRANSPORTING edatu.
ENDLOOP.
Then I do not get the right values in ls_tmp-edatu.
But the value of the last position. The value of lf_vbap-posnr in the loop is correct.
Can someone tell me what is going wrong?
Greetings fred.
2006 Jan 12 2:49 PM
Hi Fred,
I am using USEREXIT_CHECK_VBEP in MV45AFZB for Checking the schedule lines for completeness. Because one line item may have 1 or more schedule lines.
This may help you.
Lanka
2006 Jan 12 3:12 PM
I don't know how the READ with the option COMPARING works(never used it!!!), but as Lanka pointed out, there is a possibility of having more than one schedule line for a given line item of the sales order. So instead of a READ, please use a loop as follows.
LOOP AT xvbap INTO lf_vbap.
ls_tmp-posnr = lf_vbap-posnr.
LOOP AT xvbep INTO ls_tmp WHERE vbeln = xvbap-vbeln
AND posnr = xvbap-posnr.
*-- do whatever you want to do here using EDATU
ENDLOOP.
ENDLOOP.
2006 Jan 12 3:14 PM
Hi,
Why cant you just take the EDATU from the any entry in schedule lines table for an item and exit? Some thing like the following..
data: lf_vbap TYPE vbap,
ls_tmp like xvbep.
LOOP AT xvbap INTO lf_vbap.
ls_tmp-posnr = lf_vbap-posnr.
LOOP AT xvbep INTO ls_tmp
WHERE vbeln EQ lf_vbap-vbeln
AND posnr EQ lf_vbap-posnr.
IF NOT ls_tmp-edatu IS INITIAL.
EXIT.
ENDIF.
ENDLOOP.
ENDLOOP.
Hope this helps..
Sri
2006 Jan 13 9:13 AM
@Srinivas Adavi:
Thanx for your answer. I must say, like in my first post that the VBELN is not yet available in the user-exit I am using. But without the "vbeln = xvbap-vbeln" it also works.
Actually xvbep was what I was looking for, was already looping xvbap, but not xvbep.
greetings Fred.
2006 Jan 13 1:19 PM
I would have imagined that the VBELN value would be assigned by this time, but apparently not. Anyway, glad to hear that the issue is resolved.
Srinivas