cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Populating Contract Dates in Sales Orders using userexit

Former Member
0 Likes
1,453

Hi All,

We want to use a userexit to populate the conract start date and end date based on some rules during sales order processing. Contact data displayed in VA01/VA02 is stored in VEDA table. Is it possible to use MV45AZZ user exit for this purpose?

Thank You.

Regards,

Amit

Edited by: Amit Kokane on Feb 13, 2009 4:31 PM

Accepted Solutions (0)

Answers (2)

Answers (2)

Skirmantas
Explorer

I know it is very old question, but if you want to set initial values of the Contract Data tab (VEDA table) you can use this code in include MV45AFZZ, form USEREXIT_MOVE_FIELD_TO_VBAP:

  FIELD-SYMBOLS <xveda_tab> TYPE veda_t.

  CHECK vbap-matnr IS NOT INITIAL.

  ASSIGN ('(SAPLV45W)XVEDA[]') TO <xveda_tab>.
  CHECK         sy-subrc = 0
        AND NOT line_exists( <xveda_tab>[ vposn = vbap-posnr ] ).

  APPEND INITIAL LINE TO <xveda_tab> ASSIGNING FIELD-SYMBOL(<xveda_itm>).

  <xveda_itm>-mandt        = sy-mandt.
  <xveda_itm>-vposn        = vbap-posnr.
  <xveda_itm>-updkz        = 'I'.

  <xveda_itm>-vbegdat      = sy-datum.
  <xveda_itm>-vbegdat+6(2) = '01'.

  CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
    EXPORTING date      = <xveda_itm>-vbegdat
              days      = 0
              months    = 6
              years     = 0
    IMPORTING calc_date = <xveda_itm>-venddat.

It sets contract period start and end dates for 6 months from the current month.

VoJu
Participant
0 Likes
@Skirmantas Thanks a lot!
Jelena_Perfiljeva
Active Contributor
0 Likes

I don't see why it wouldn't be possible - use USEREXIT_MOVE_FIELD_TO_VBAK or USEREXIT_MOVE_FIELD_TO_VBAP, depending on whether this data is stored at header or line item level. You might need to use ASSIGN with '(SAPLV45W)VEDA' to get the data.

But if you create an order with reference to a contract, shouldn't those dates be copied from a contract "as is"? Just a thought...

Former Member
0 Likes

Hi Jelena,

Thanks for the response. We are not using the contracts at all. We are creating the sales order without any refrence. We want to use the revenue recognition for ceratin service items on sales orders for which we need contract start date and end date to be defaulted based on some rules. We had tried populating the VEDA, XVEDA tables in save prepare routine of MV45AFZZ for same but we observed that when system calls SD_VEDA_UPDATE FM during the saving, all the data in internal tables get refreshed and systen reads the data from screen.

Can you please explain the use of ASSIGN with '(SAPLV45W)VEDA' to update the data in VEDA table in USEREXIT_MOVE_FIELD_TO_VBAP?

Thanks again.

Regards,

Amit

former_member420878
Active Participant
0 Likes

Hi Amit,

I have same requirement as u had some time back. Please suggest me or share ur resolution for the same.

its urgent, please reply.

Regards,

Neha

Former Member
0 Likes

Folllowing links may help you to understand userexit_move_field_to_vbap

http://scn.sap.com/thread/1969799

http://scn.sap.com/message/3142122

Thanks

Rajesh

former_member420878
Active Participant
0 Likes

Hi Rajesh,

Thanks for the quick reply, but i dont want to change any thing in sales item.

i want to compare XVEDA and YVEDA (which contain date of contract), but not able to do that.

Please suggest any exit for this.

Regards

Neha