Application Development 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: 

How to add a condition type, when delivery create in vl10d.

shiz0frenik
Participant
0 Kudos
460

Hi, experts, how can i add an 'condition type' when delivery creates.
delivery creates with vl10d t-code, using BDC:

      DATA: bdcdata TYPE TABLE OF bdcdata.
      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.

shiz0frenik_0-1723457305744.png

Is it possible to add a condition inside bdc,  or to use some bapi after creation, to add 'ZF00' automatically?




2 REPLIES 2

Jelena_Perfiljeva
Active Contributor
0 Kudos
367

This pricing condition is a surcharge. Are you sure it needs to be added specifically in the outbound delivery? Why? It's rather unusual. Normally all the pricing is maintained in the sales order and then you can just create deliveries via standard transactions / background jobs. Pricing in this case would just flow organically to billing document.

Adding BDC to this doesn't do anyone favors.

0 Kudos
361

I'm sure.

I've have a transaction, where user firstly creates an purchase document number(me21n) and then creates a delivery(vl10d), but every time the reciever lgort has specific value ( eq t500 ), user need to go to vl02n and add this surcharge ( sometimes 2.5%, sometimes 2.25 ). And i want to add this surcharge using abap. It can be adding at moment of creation, or after creation(add a button, which will add this surcharge to delivry) after clicking.

Is it possible to do?