Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Requested delivery date

Former Member
0 Kudos
1,359

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.

7 REPLIES 7
Read only

Former Member
0 Kudos
502

Did you check if internal table XVBEP has any values?

Read only

0 Kudos
502

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.

Read only

0 Kudos
502

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

Read only

0 Kudos
502

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.

Read only

0 Kudos
502

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

Read only

0 Kudos
502

@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.

Read only

0 Kudos
502

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