Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

changing PSTYV in sales order with BAPI_SALESORDER_CREATEFROMDAT2

hi all,

I'm having this trouble...

we are creating a Sales Order from PI calling directly the BAPI_SALESORDER_CREATEFROMDAT2...

but, theres a field than I have to change... the PSTYV must be TANN when the VBAP-NETWR is 0.

I've used the MV45AFZZ program for the exit... but no in the move_field_to_vbap ('cause it doesn't work form me), I used this one:

FORM USEREXIT_SAVE_DOCUMENT_PREPARE.
data: l_tabix type i VALUE 0.

if xvbak-AUART = 'ZCO'.
  loop at xvbap.
    add 1 to l_tabix.
    if xvbap-netwr EQ 0.
      xvbap-PSTYV = 'TANN'.
      modify xvbap index l_tabix TRANSPORTING pstyv .
    endif.
  endloop.
endif.

ENDFORM.

and with this, when the sales order is created, my PSTYV field if NETWR = 0, now is TANN.... but this is NOT the solution 'cause I can't make an Invoice... I have an incompletion LOG....

but, if I change the field manually appears a message: New pricing carried out ( Message no. V1209 ).

and with this... I fix the problem.... but, you can see than I need it automatically....

so I think, than with my exit, I'm only changing the PSTYV value, but no all the changes than this need...

thanks in advance...

Regards..

Former Member
Former Member replied

Hi

U should run the exit USEREXIT_NEW_PRICING_VBAP (include MV45AFZB) in order to force a new pricing

Max

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question