Hi,
You have declared this condition - ' ACGL_ITEM-SHKZG IS INITIAL ' same in if and else .
Check this part of your code - >
IF ACGL_ITEM-SHKZG IS INITIAL.
perform bdc_dynpro using 'SAPMF05A' '1100'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'ACWT_ITEM-WT_WITHCD(01)'.
perform bdc_dynpro using 'SAPMF05A' '1100'.
perform bdc_field using 'BDC_OKCODE'
'=BU'.
perform bdc_field using 'BDC_CURSOR'
'ACWT_ITEM-WT_WITHCD(01)'.
perform bdc_dynpro using 'SAPMF05A' '1100'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'ACGL_ITEM-SHKZG(01)'.
perform bdc_dynpro using 'SAPMF05A' '1100'.
perform bdc_field using 'BDC_OKCODE'
'=BU'.
perform bdc_field using 'BDC_CURSOR'
'ACGL_ITEM-HKONT(02)'.
ELSEIF ACGL_ITEM-SHKZG IS INITIAL.
wa_msg-msgtyp = 'E'.
wa_msg_error = 'Withholding window is not activated for this Vendor'.
ENDIF.