Hi, experts, how can i add an ‘condition type’ when delivery creates.
delivery creates with vl10d t-code, using BDC:
DATA: ls_opt TYPE ctu_params,
lt_messtab TYPE TABLE OF bdcmsgcoll, “#EC NEEDED
str_param TYPE bdc_fval,
cl_pp TYPE REF TO zhm_cl_pp,
pv_matnr_ext TYPE matnr_ext.
FIELD-SYMBOLS: <fs_matnr> LIKE LINE OF lt_matnr.
CREATE OBJECT cl_pp.
cl_pp->bdc_dynpro( exporting program = ‘RVV50R10C’
dynpro = ‘1000’
changing bdcdata = bdcdata ).
cl_pp->bdc_fields( exporting fnam = ‘BDC_OKCODE’
fval = ‘=S0S_TAB5’
changing bdcdata = bdcdata ).
cl_pp->bdc_fields( exporting fnam = ‘ST_LEDAT-LOW’
fval = ”
changing bdcdata = bdcdata ).
cl_pp->bdc_fields( exporting fnam = ‘ST_LEDAT-HIGH’
fval = ”
changing bdcdata = bdcdata ).
if lt_ebeln is not initial.
cl_pp->bdc_dynpro( exporting program = ‘RVV50R10C’
dynpro = ‘1000’
changing bdcdata = bdcdata ).
cl_pp->bdc_fields( exporting fnam = ‘BDC_OKCODE’
fval = ‘=%00210300000713501’
changing bdcdata = bdcdata ).
loop at lt_ebeln assigning <fs_ebeln> to 1.
str_param = <fs_ebeln>.
cl_pp->bdc_dynpro( exporting program = ‘SAPLALDB’
dynpro = ‘3000’
changing bdcdata = bdcdata ).
cl_pp->bdc_fields( exporting fnam = ‘BDC_OKCODE’
fval = ‘=P+’
changing bdcdata = bdcdata ).
cl_pp->bdc_fields( exporting fnam = ‘RSCSEL-SLOW_I(01)’
fval = str_param
changing bdcdata = bdcdata ).
endloop.
loop at lt_ebeln assigning <fs_ebeln> from 2.
str_param = <fs_ebeln>.
cl_pp->bdc_dynpro( exporting program = ‘SAPLALDB’
dynpro = ‘3000’
changing bdcdata = bdcdata ).
cl_pp->bdc_fields( exporting fnam = ‘BDC_OKCODE’
fval = ‘=P+’
changing bdcdata = bdcdata ).
cl_pp->bdc_fields( exporting fnam = ‘RSCSEL-SLOW_I(02)’
fval = str_param
changing bdcdata = bdcdata ).
endloop.
cl_pp->bdc_dynpro( exporting program = ‘SAPLALDB’
dynpro = ‘3000’
changing bdcdata = bdcdata ).
cl_pp->bdc_fields( exporting fnam = ‘BDC_OKCODE’
fval = ‘=ACPT’
changing bdcdata = bdcdata ).
endif.
cl_pp->bdc_dynpro( exporting program = ‘RVV50R10C’
dynpro = ‘1000’
changing bdcdata = bdcdata ).
cl_pp->bdc_fields( exporting fnam = ‘BDC_OKCODE’
fval = ‘=S0S_TAB3’
changing bdcdata = bdcdata ).
if lt_matnr is not initial.
cl_pp->bdc_dynpro( exporting program = ‘RVV50R10C’
dynpro = ‘1000’
changing bdcdata = bdcdata ).
cl_pp->bdc_fields( exporting fnam = ‘BDC_OKCODE’
fval = ‘=%00210400000713501’
changing bdcdata = bdcdata ).
loop at lt_matnr assigning <fs_matnr> to 1.
select single matnr_ext
from materialid
into pv_matnr_ext
where matnr_int = <fs_matnr>.
if sy-subrc <> 0.
pv_matnr_ext = <fs_matnr>.
endif.
cl_pp->bdc_dynpro( exporting program = ‘SAPLALDB’
dynpro = ‘3000’
changing bdcdata = bdcdata ).
cl_pp->bdc_fields( exporting fnam = ‘BDC_OKCODE’
fval = ‘=P+’
changing bdcdata = bdcdata ).
str_param = pv_matnr_ext.
cl_pp->bdc_fields( exporting fnam = ‘RSCSEL-SLOW_I(01)’
fval = str_param
changing bdcdata = bdcdata ).
endloop.
loop at lt_matnr assigning <fs_matnr> from 2.
select single matnr_ext
from materialid
into pv_matnr_ext
where matnr_int = <fs_matnr>.
if sy-subrc <> 0.
pv_matnr_ext = <fs_matnr>.
endif.
cl_pp->bdc_dynpro( exporting program = ‘SAPLALDB’
dynpro = ‘3000’
changing bdcdata = bdcdata ).
cl_pp->bdc_fields( exporting fnam = ‘BDC_OKCODE’
fval = ‘=P+’
changing bdcdata = bdcdata ).
str_param = pv_matnr_ext.
cl_pp->bdc_fields( exporting fnam = ‘RSCSEL-SLOW_I(02)’
fval = str_param
changing bdcdata = bdcdata ).
endloop.
cl_pp->bdc_dynpro( exporting program = ‘SAPLALDB’
dynpro = ‘3000’
changing bdcdata = bdcdata ).
cl_pp->bdc_fields( exporting fnam = ‘BDC_OKCODE’
fval = ‘=ACPT’
changing bdcdata = bdcdata ).
endif.
cl_pp->bdc_dynpro( exporting program = ‘RVV50R10C’
dynpro = ‘1000’
changing bdcdata = bdcdata ).
cl_pp->bdc_fields( exporting fnam = ‘BDC_OKCODE’
fval = ‘=ONLI’
changing bdcdata = bdcdata ).
cl_pp->bdc_dynpro( exporting program = ‘SAPMSSY0’
dynpro = ‘0120’
changing bdcdata = bdcdata ).
cl_pp->bdc_fields( exporting fnam = ‘BDC_CURSOR’
fval = ’06/03′
changing bdcdata = bdcdata ).
cl_pp->bdc_fields( exporting fnam = ‘BDC_OKCODE’
fval = ‘=&ALL’
changing bdcdata = bdcdata ).
cl_pp->bdc_dynpro( exporting program = ‘SAPMSSY0’
dynpro = ‘0120’
changing bdcdata = bdcdata ).
cl_pp->bdc_fields( exporting fnam = ‘BDC_CURSOR’
fval = ’06/03′
changing bdcdata = bdcdata ).
cl_pp->bdc_fields( exporting fnam = ‘BDC_OKCODE’
fval = ‘=SAMD’
changing bdcdata = bdcdata ).
cl_pp->bdc_dynpro( exporting program = ‘SAPMSSY0’
dynpro = ‘0120’
changing bdcdata = bdcdata ).
cl_pp->bdc_fields( exporting fnam = ‘BDC_CURSOR’
fval = ’06/03′
changing bdcdata = bdcdata ).
cl_pp->bdc_fields( exporting fnam = ‘BDC_OKCODE’
fval = ‘=&F03’
changing bdcdata = bdcdata ).
cl_pp->bdc_dynpro( exporting program = ‘RVV50R10C’
dynpro = ‘1000’
changing bdcdata = bdcdata ).
cl_pp->bdc_fields( exporting fnam = ‘BDC_CURSOR’
fval = ‘ST_VSTEL-LOW’
changing bdcdata = bdcdata ).
cl_pp->bdc_fields( exporting fnam = ‘BDC_OKCODE’
fval = ‘/EE’
changing bdcdata = bdcdata ).
ls_opt-updmode = ‘S’.
ls_opt-dismode = ‘E’.
REFRESH lt_messtab.
CALL TRANSACTION ‘VL10D’ USING bdcdata
OPTIONS FROM ls_opt
MESSAGES INTO lt_messtab.
Then customer comes to vl02n->conditions and add a condition ‘ZF00’ manually and after activates it recalculates price.
Is it possible to add a condition inside bdc, or to use some bapi after creation, to add ‘ZF00’ automatically?