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

Error in my Function Module

Former Member
0 Likes
549

Dear Experts,

I have created a Function Module to call it from a Dependency .. the main object of this "Dependency & FM" is to calculate a Date in the characteristic of the batch ..

Note :

GRDate is the characteristic which hold the date i will work on "Import"

FRUD is the characteristic which will hold the manipulated date "Export"

Here is my Code :



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 AUSP-ATWRT,
        TEMPDATE      Type F.

REFRESH MATCH.

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

* Return
READ TABLE QUERY WITH KEY 'FRUD'.

MATCH = QUERY.
MATCH-ATFLV = TEMPDATE.

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

  APPEND MATCH.

ENDFUNCTION.

Please Advice

4 REPLIES 4
Read only

Former Member
0 Likes
474

Hello


* Read date
*READ TABLE QUERY WITH KEY 'GRDate'. " remove this
READ TABLE QUERY WITH KEY VARNAM = 'GRDate'. " add this
* Convert date
  CALL FUNCTION 'CTCV_CONVERT_FLOAT_TO_DATE'
       EXPORTING
            FLOAT = QUERY-ATFLV
       IMPORTING
            DATE  = HELPDATE.
*Compute
  TEMPDATE = HELPDATE + 1 .
  TEMPDATE = TEMPDATE * 86400.
 
* Return
*READ TABLE QUERY WITH KEY 'FRUD'. " remove this
READ TABLE QUERY WITH KEY VARNAM = 'FRUD'. " add this

Read only

0 Likes
474

Hi,

Just make sure the 'GRDate' is stored in the database table. It might also be stored as GRDATE.

Thanks,

Harini

Read only

0 Likes
474

Thanks alot Dzed for your quick response ..

I have edited the code as you requested to be like this :

but still an error while trying to change the batch "Error in Dependency processing, Function ZUPDATEDate"



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 AUSP-ATWRT,
        TEMPDATE      Type F.

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 + 1 .
  TEMPDATE = HELPDATE * 86400.

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

MATCH = QUERY.
MATCH-ATFLV = TEMPDATE.

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

  APPEND MATCH.

ENDFUNCTION.

Please Advice

Read only

Former Member
0 Likes
474

I have to not add any other parameters but GLOBAL