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

Create a routine for new condition type using VOFM

Former Member
0 Likes
6,414

Hi Experts,

Please let me know how to create a new routine for the new conditon type which has been created in the system.

Functional is suggesting me the routine number 362 and 363. My requirement is:

If the pricing condition type value is less than 299 than it should be set to 299.

( if XKWERT value is less than 299, then assign XKWERT=299).

Please let me know in clear steps coz I am very new to it.

and priority of it is very high.

Waiting for early responses.

Hi Experts,

Please let me know how to create a new routine for the new conditon type which has been created in the system.

Functional is suggesting me the routine number 362 and 363. My requirement is:

If the pricing condition type value is less than 299 than it should be set to 299.

( if XKWERT value is less than 299, then assign XKWERT=299).

Please let me know in clear steps coz I am very new to it.

and priority of it is very high.

Waiting for early responses.

8 REPLIES 8
Read only

Former Member
0 Likes
4,625

Go to Transaction code VOFM -> Menu option (Formulas) ->Condition Value -> select the routine -> Click f5 to go to source text.

See the Sample code

read table xkomv with key kschl = <condition type>.
if xkomv-kwert LT 299.
 move 299 to xkomv-kwert.
 modify xkomv transporting kwert where kschl = <condition type>.
endif.

Regards

Vinod

Read only

0 Likes
4,625

Hi Vinod. Thanks for the reply. You said to click on the routine number (363/363) but requirement is to create a new routine. Please guide me on it how to achieve it. I suspect to get issues if I write something without knowing. Even more If I click on the change mode than it asks for the access key. I write the routine number 362 for you reference. Please tell where to write and using which step.

Again thanks.

Include FV64A362
* APPL COUNTRY SPECIFIC

FORM FRM_KONDI_WERT_362.
  SELECT SINGLE * FROM T001 INTO T001 WHERE BUKRS = KOMK-BUKRS.
  CASE T001-LAND1.
*Thailand
    WHEN 'TH'.

      IF XKOMV-KOAID = 'A'.
        KOMK-FKWRT = KOMK-FKWRT + KOMP-MWSBP.
      ENDIF.
*India
    WHEN 'IN'.

      DATA: TOTAL_RATE    LIKE KOMV-KBETR,
            NORMAL_RATE   LIKE KOMV-KBETR,
            XXKOMV LIKE XKOMV.
      DATA L_DED_RATE LIKE KONP-KBETR.

      CHECK KOMK-TRTYP NE 'A'.
      SELECT SINGLE * FROM J_1IWRKCUS WHERE J_1IWERKS = KOMP-WERKS.
      SELECT SINGLE * FROM J_1IREGSET WHERE J_1IREGID =
                                            J_1IWRKCUS-J_1IREGID.
      IF J_1IREGSET-J_1IPARTL = 'X'.
        XXKOMV = XKOMV.
        CLEAR TOTAL_RATE.
        NORMAL_RATE = 100000.
        LOOP AT XKOMV WHERE KSCHL = 'JMO1'.
        ENDLOOP.
        IF SY-SUBRC EQ 0.
          SELECT SINGLE * FROM KONP WHERE KNUMH = XKOMV-KNUMH.
          TOTAL_RATE = KONP-KBETR.
          L_DED_RATE = KONP-KBETR.
          SELECT SINGLE * FROM KONP WHERE KNUMH = XXKOMV-KNUMH.
          TOTAL_RATE = TOTAL_RATE + KONP-KBETR.
          IF TOTAL_RATE < NORMAL_RATE AND TOTAL_RATE <> 0.
            MESSAGE W452(8I).
          ELSEIF TOTAL_RATE > NORMAL_RATE.
            MESSAGE E453(8I).
          ENDIF.
        ENDIF.
        XKOMV = XXKOMV.
      ENDIF.
* take over rates and values from internal fields
      IF XKOMV-KBETR NE 0.
        XKOMV-KWERT = J_1ITAXVAR-J_1ITAXAM2.
        XKWERT      = J_1ITAXVAR-J_1ITAXAM2.
        IF J_1IREGSET-J_1IPARTL = 'X'.
          IF J_1ITAXVAR-J_1ITAXAM2 EQ 0.
            XKOMV-KWERT = J_1ITAXVAR-J_1ITAXAM1 *
                        XKOMV-KBETR / 100000.
            XKWERT      = XKOMV-KWERT.

            IF XKOMV-KBETR EQ J_1ITAXVAR-J_1ITAXPC1.
              XKWERT = J_1ITAXVAR-J_1ITAXAM1 *
                       KONP-KBETR / 100000.
            ENDIF.


            IF XKOMV-KAWRT NE 0.
              XKOMV-KBETR = J_1ITAXVAR-J_1ITAXPC1.
            ENDIF.
          ENDIF.
        ELSE.
          IF XKOMV-KAWRT NE 0.
            XKOMV-KBETR = J_1ITAXVAR-J_1ITAXPC2.
          ENDIF.
        ENDIF.
      ELSE.
* reset fields for zero percent tax codes
        XKOMV-KBETR = 0.
        IF NOT KOMP-MATNR IS INITIAL.
          XKWERT = 0.
        ENDIF.
**  xkwert      = 0.
      ENDIF.
      IF L_DED_RATE NE 0.
      CALL FUNCTION 'J_1I4_DED_EXC_INV_FOR_OCTROI'
        EXPORTING
          BASEVAL = XKWERT
          YKOMP   = KOMP
          POSNR   = KOMP-KPOSN
        EXCEPTIONS
          OTHERS  = 1.
      ENDIF.
*If it is invoice verification then no 95% has to pick up the value as
*per excise invoice if it exists. Change on 14.9.98
      DATA: BED_INVENTORY LIKE TAXCOM-NEBTR.
      IF SY-CPROG = 'SAPMM08R' OR  SY-CPROG = 'RMMR01RS'.
        BED_INVENTORY = XKWERT.
        CALL FUNCTION 'J_1I4_GET_ACTUAL_DUTY_IN_IV'
          EXPORTING
            Y_KOMK          = KOMK
            Y_KOMP          = KOMP
            E_BED_INVENTORY = BED_INVENTORY
          IMPORTING
            X_BED_INVENTORY = BED_INVENTORY
          EXCEPTIONS
            NOT_FOUND       = 1
            OTHERS          = 2.
        IF SY-SUBRC EQ 0.
          XKOMV-KWERT = BED_INVENTORY.
          XKWERT       = BED_INVENTORY.
        ENDIF.
      ENDIF.
      IF SY-CPROG = 'SAPLMR1M'
         OR SY-CPROG = 'RMMR1MRS'
         OR SY-CPROG = 'SAPMM08N'
         OR SY-CPROG = 'SAPMSSY1'.

        BED_INVENTORY = XKWERT.
        CALL FUNCTION 'J_1I4_GET_ACTUAL_DUTY_IN_LIV'
          EXPORTING
            Y_KOMK          = KOMK
            Y_KOMP          = KOMP
            E_BED_INVENTORY = BED_INVENTORY
          IMPORTING
            X_BED_INVENTORY = BED_INVENTORY
          EXCEPTIONS
            NOT_FOUND       = 1
            OTHERS          = 2.
        IF SY-SUBRC EQ 0.
          XKOMV-KWERT = BED_INVENTORY.
          XKWERT       = BED_INVENTORY.
        ENDIF.
      ENDIF.


      TAXBAS2     = XKOMV-KAWRT.


  ENDCASE.


ENDFORM.                    "frm_kondi_wert_362 }

Edited by: Soni on Apr 22, 2010 2:16 AM

Edited by: Soni on Apr 22, 2010 2:18 AM

Read only

0 Likes
4,625

To create the new routine, you require the access key. Once you create the new routine, use the code mentioned in my earlier post. Once the new routine is created, it should be assigned to the pricing procedure (done by functional consultant)

Regards

Vinod

Read only

0 Likes
4,625

Once I take the access key what steps should I follow to copy it ? And please let me the where to insert your code block in the include I mentioned in my last post. I tried to send it in CODE form but could do it. It came in line format. Please tell me this also how to set a piece of code in code format as you did for your READ TABLE code block.

Thanks for quick reaponses.

Read only

0 Likes
4,625

Are you creating a new routine or doing changes in 362? If you are creating a new routine, once you create the routine, new program like FV64A362 will be created(FV64A<newroutine no). You have to write the code inside this program. Once you create the routine, ask the Functional consultant to attach the same in the pricing procedure.

Regards

Vinod

Read only

0 Likes
4,625

I am confused with this again. Actually I know only one thing that new conditon type has been created. Now what to do or not, is not cleared to me i.e wether to crate a new routine or to use the existing routine. If I need to create a new routine than how it can be achieved ?

Read only

0 Likes
4,625

See, these things are to be decided by the functional consultant. I have mentioned the steps required for creating the new routine and the sample code for that.

Regards

Vinod

Read only

Former Member
0 Likes
4,625

g