‎2008 Sep 04 5:56 AM
Hi,
I need to do quotation approval based on some conditions, where i can write the code for quotation approval.
if possible tell me the code.
Thanks
‎2008 Sep 04 6:17 AM
If you looking for VA21
check this include MV45AFZZ.
write in below routine
USEREXIT_SAVE_DOCUMENT
to read the status of APPROVALS
CALL FUNCTION 'STATUS_READ'
EXPORTING
CLIENT = SY-MANDT
objnr = V_OBJNR
ONLY_ACTIVE = ' '
IMPORTING
OBTYP =
STSMA =
STONR = V_STONR
TABLES
STATUS =
EXCEPTIONS
OBJECT_NOT_FOUND = 1
OTHERS = 2.
change the status.
CALL FUNCTION 'STATUS_CHANGE_EXTERN'
EXPORTING
client = sy-mandt
objnr = V_OBJNR
user_status = 'E0001'
SET_CHGKZ = 'X'
EXCEPTIONS
OBJECT_NOT_FOUND = 1
STATUS_INCONSISTENT = 2
STATUS_NOT_ALLOWED = 3
OTHERS = 4.
IF SY-SUBRC = 0.
COMMIT WORK.
ENDIF.
I hope these two function module will work for your case
‎2008 Sep 04 6:17 AM
If you looking for VA21
check this include MV45AFZZ.
write in below routine
USEREXIT_SAVE_DOCUMENT
to read the status of APPROVALS
CALL FUNCTION 'STATUS_READ'
EXPORTING
CLIENT = SY-MANDT
objnr = V_OBJNR
ONLY_ACTIVE = ' '
IMPORTING
OBTYP =
STSMA =
STONR = V_STONR
TABLES
STATUS =
EXCEPTIONS
OBJECT_NOT_FOUND = 1
OTHERS = 2.
change the status.
CALL FUNCTION 'STATUS_CHANGE_EXTERN'
EXPORTING
client = sy-mandt
objnr = V_OBJNR
user_status = 'E0001'
SET_CHGKZ = 'X'
EXCEPTIONS
OBJECT_NOT_FOUND = 1
STATUS_INCONSISTENT = 2
STATUS_NOT_ALLOWED = 3
OTHERS = 4.
IF SY-SUBRC = 0.
COMMIT WORK.
ENDIF.
I hope these two function module will work for your case
‎2008 Sep 04 7:00 AM
Hi,
This was very helpful.
I will modify it according to my requirement.
Thanks