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

BAPI_SCHEDULE_MAINTAIN

former_member599326
Participant
0 Likes
1,246

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

1 REPLY 1
Read only

Former Member
0 Likes
823

Hi

Bapi wont interact with standard screen so the enhancement also wont trigger.

So try to do the validation in program only.

regards

laxman