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

FM & Dependency not working well

Former Member
0 Likes
650

Dear Experts,

I have 3 Characteristics in "Batch" Class :

1. GRDate "Goods Receipt Date"

2. FRU "Gurantee Period in Years"

3. FRUD "Gurantee End Date"

For example : Goods was recipt in 12.12.2009 and the gutrantee period is 6 years .. so the gurantee end date is 12.12.2012

SO FRUD = GRDate + FRU

I have created a Dependency its type is ACTION to call a FM I have created .. Then I created a Function with the same name and put the characteristics as follows in it :

GRDate as Input Parameter

FRU as Input Parameter

FRUD "I didn't flag it as input"

Here is the code for the Dependency :



FUNCTION ZUPDATEDATE
  ( FRU = FRU,
GRDate      = GRDate,
   FRUD = $SELF.FRUD)

And here is the code for the FM :



FUNCTION ZUPDATEDATE.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     VALUE(GLOBALS) LIKE  CUOV_00 STRUCTURE  CUOV_00
*"  TABLES
*"      MATCH STRUCTURE  CUOV_01
*"      QUERY STRUCTURE  CUOV_01
*"  EXCEPTIONS
*"      FAIL
*"      INTERNAL_ERROR
*"----------------------------------------------------------------------
DATA:
        HELPDATE      LIKE CAWN-ATWRT,
        TEMPDATE      LIKE QUERY-ATFLV.

REFRESH MATCH.

* Read date
READ TABLE QUERY WITH KEY VARNAM = 'GRDate'.
* Convert date
  CALL FUNCTION 'CTCV_CONVERT_FLOAT_TO_DATE'
       EXPORTING
            FLOAT = QUERY-ATFLV
       IMPORTING
            DATE  = HELPDATE.
*Compute
*  HELPDATE = HELPDATE.

  CALL FUNCTION 'CTCV_CONVERT_DATE_TO_FLOAT'
    EXPORTING
      DATE          = HELPDATE
   IMPORTING
     FLOAT         = TEMPDATE.

* Return
READ TABLE QUERY WITH KEY VARNAM = 'FRUD'.

MATCH = QUERY.
MATCH-ATFOR = 'NUM'.
MATCH-ATFLV = TEMPDATE.
MATCH-VARNAM = 'FRUD'.

* Change dates in customer exit
  CALL CUSTOMER-FUNCTION '003'
       EXPORTING
            GLOBALS = GLOBALS
       TABLES
            QUERY   = QUERY
       CHANGING
            MATCH   = MATCH
       EXCEPTIONS
            OTHERS  = 1.

  APPEND MATCH.

ENDFUNCTION.

The problem is FRUD is filled with 00.00.0000 not with the date 12.12.2012

Please Advice

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
578

I believe that in VC (characteristics) date values are internally stored as a numeric value, in the system-date format. Check the internally stored value of date characteristic(s) in your scenario. That is probably what is causing your problem

Dear Experts,

I have 3 Characteristics in "Batch" Class :

1. GRDate "Goods Receipt Date"

2. FRU "Gurantee Period in Years"

3. FRUD "Gurantee End Date"

For example : Goods was recipt in 12.12.2009 and the gutrantee period is 6 years .. so the gurantee end date is 12.12.2012

SO FRUD = GRDate + FRU

I have created a Dependency its type is ACTION to call a FM I have created .. Then I created a Function with the same name and put the characteristics as follows in it :

GRDate as Input Parameter

FRU as Input Parameter

FRUD "I didn't flag it as input"

Here is the code for the Dependency :



FUNCTION ZUPDATEDATE
  ( FRU = FRU,
GRDate      = GRDate,
   FRUD = $SELF.FRUD)

And here is the code for the FM :



FUNCTION ZUPDATEDATE.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     VALUE(GLOBALS) LIKE  CUOV_00 STRUCTURE  CUOV_00
*"  TABLES
*"      MATCH STRUCTURE  CUOV_01
*"      QUERY STRUCTURE  CUOV_01
*"  EXCEPTIONS
*"      FAIL
*"      INTERNAL_ERROR
*"----------------------------------------------------------------------
DATA:
        HELPDATE      LIKE CAWN-ATWRT,
        TEMPDATE      LIKE QUERY-ATFLV.

REFRESH MATCH.

* Read date
READ TABLE QUERY WITH KEY VARNAM = 'GRDate'.
* Convert date
  CALL FUNCTION 'CTCV_CONVERT_FLOAT_TO_DATE'
       EXPORTING
            FLOAT = QUERY-ATFLV
       IMPORTING
            DATE  = HELPDATE.
*Compute
*  HELPDATE = HELPDATE.

  CALL FUNCTION 'CTCV_CONVERT_DATE_TO_FLOAT'
    EXPORTING
      DATE          = HELPDATE
   IMPORTING
     FLOAT         = TEMPDATE.

* Return
READ TABLE QUERY WITH KEY VARNAM = 'FRUD'.

MATCH = QUERY.
MATCH-ATFOR = 'NUM'.
MATCH-ATFLV = TEMPDATE.
MATCH-VARNAM = 'FRUD'.

* Change dates in customer exit
  CALL CUSTOMER-FUNCTION '003'
       EXPORTING
            GLOBALS = GLOBALS
       TABLES
            QUERY   = QUERY
       CHANGING
            MATCH   = MATCH
       EXCEPTIONS
            OTHERS  = 1.

  APPEND MATCH.

ENDFUNCTION.

The problem is FRUD is filled with 00.00.0000 not with the date 12.12.2012

Please Advice

2 REPLIES 2
Read only

Former Member
0 Likes
579

I believe that in VC (characteristics) date values are internally stored as a numeric value, in the system-date format. Check the internally stored value of date characteristic(s) in your scenario. That is probably what is causing your problem

Read only

Former Member
0 Likes
578

The problem was that I have to enter the Characteristics in CAPITAL Letters NOT in SMALL Litters