2015 Jan 20 9:39 AM
Hi,
How to get error "Scheduled quantity greater than target quantity" error through BAPI "BAPI_SCEHDULE_MAINTAIN?
When i execute tcode ME38, there is a check to compare scheduled quantity with target quantity. But through BAPI this check is not working.
Though Scheduled quantity is greater than target quantity, BAPI executes successfully.
Please let me know is there any additional parameter required to pass to BAPI for getting this check working.
my source code :-
CLEAR wa_schedule.
REFRESH gt_schedule.
wa_schedule-item_no = <fs_zmekkoekpo>-ebelp.
CLEAR gv_dats.
CONCATENATE sy-datum+6(2) '.'
sy-datum+4(2) '.'
sy-datum+0(4)
INTO gv_dats.
CONDENSE gv_dats.
wa_schedule-delivery_date = gv_dats.
wa_schedule-quantity = <fs_inp_data>-menge.
APPEND wa_schedule TO gt_schedule.
CLEAR wa_schedulex.
REFRESH gt_schedulex.
wa_schedulex-item_no = <fs_zmekkoekpo>-ebelp.
wa_schedulex-delivery_date = 'X'.
wa_schedulex-quantity = 'X'.
wa_schedulex-sched_linex = 'X'.
APPEND wa_schedulex TO gt_schedulex.
REFRESH gt_return.
CALL FUNCTION 'BAPI_SCHEDULE_MAINTAIN'
EXPORTING
purchasingdocument = <fs_zmekkoekpo>-ebeln
TABLES
schedule = gt_schedule
schedulex = gt_schedulex
return = gt_return.
READ TABLE gt_return ASSIGNING <fs_return> WITH KEY type = 'S'.
IF sy-subrc = 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
2015 Jan 20 9:44 AM
Hi
Bapi wont interact with standard screen so the enhancement also wont trigger.
So try to do the validation in program only.
regards
laxman