cancel
Showing results for 
Search instead for 
Did you mean: 

VC Function Module

nicky_hays
Participant
0 Kudos

Hi,

I have defined a function and the underlying Z table. I am using a Variant Configuration (VC)  procedure to call this function. When I run the error check on the VC procedure, I get the error that the "Formal parameter xyz not valid for: <name of function module>.

In the code for the function module, I have defined it as follows. Am I missing something?

CALL FUNCTION 'CUOV_GET_FUNCTION_ARGUMENT'

       EXPORTING

            ARGUMENT      =  'xyz'

      IMPORTING

*          VTYPE         =

*          sym_val       =

            NUM_VAL       = F_XYZ

*          IO_FLAG       =

       TABLES

            QUERY         =  QUERY

       EXCEPTIONS

            ARG_NOT_FOUND = 1

            OTHERS        = 2.

  IF SY-SUBRC NE 0.

    RAISE INTERNAL_ERROR.

  ENDIF.

Please help,

Nicky

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi

As per the sap help  user defined functions

From the variant configuration menu, choose Tools ® Function ® Create (cu65) provide xyz characteristic as input in characteristic tab.

for more details see the below link

http://help.sap.com/saphelp_470/helpdata/en/92/58c6aa417011d189ec0000e81ddfac/frameset.htm

Thanks.

Former Member
0 Kudos

Hi ,

There was a requirement to do some processing and then pass that processed value on to the VC screen. Given below is Function i used for the same. Hope it helps you.

FUNCTION ZFI_VC_VAS_SPCL_CODE .
*"--------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     VALUE(GLOBALS) LIKE  CUOV_00 STRUCTURE  CUOV_00
*"  TABLES
*"      QUERY STRUCTURE  CUOV_01
*"      MATCH STRUCTURE  CUOV_01
*"  EXCEPTIONS
*"      FAIL
*"      INTERNAL_ERROR
*"--------------------------------------------------------------------

*----------------------------------------------------------------------*
*         DATA DECLARATION                                             *
*----------------------------------------------------------------------*
* Variable Definitions
  DATA: lv_value LIKE cuov_01-atwrt,
        lv_char  LIKE cuov_01-atwrt.

* Constants Declaration
  CONSTANTS: lc_std_vas     TYPE cuov_01-varnam VALUE 'GD_STD_VAS',
             lc_spl_vas     TYPE cuov_01-varnam VALUE 'GD_SPECIAL_VAS',
             lc_vtype       TYPE cuov_01-atfor  VALUE 'CHAR'.


*----------------------------------------------------------------------*
*         DATA PROCESSING                                              *
*----------------------------------------------------------------------*

* Concatenate all the VAS CODES in a string lv_char seperated by comma


*----------------------------------------------------------------------
* Get the Standard VAS (This characteristic will be filled by default)
*----------------------------------------------------------------------
* Get value of input characteristic STANDARD VAS
  CALL FUNCTION 'CUOV_GET_FUNCTION_ARGUMENT'
    EXPORTING
      ARGUMENT      = lc_std_vas    "GD_STD_VAS
    IMPORTING
      SYM_VAL       = lv_value
    TABLES
      QUERY         = query
    EXCEPTIONS
      ARG_NOT_FOUND = 1.

  IF SY-SUBRC <> 0.
    RAISE internal_error.
  ENDIF.

  IF lv_value IS NOT INITIAL.
*----------------------------------------------------------------------
* Return VAS Code value to the VAS CODE Characteristics
*----------------------------------------------------------------------
* Add result to the table of output characteristics
    CALL FUNCTION 'CUOV_SET_FUNCTION_ARGUMENT'
      EXPORTING
        argument                = lc_spl_vas   "GD_SPECIAL_VAS
        vtype                   = lc_vtype     "CHAR
        sym_val                 = lv_char
      TABLES
        match                   = match
      EXCEPTIONS
        existing_value_replaced = 01.
    IF SY-SUBRC <> 0.
      RAISE internal_error.
    ENDIF.

  ENDIF.

ENDFUNCTION.

Former Member
0 Kudos

Hi,

I have checked the FM

the data element for 'xyz' is below.

you have to declare like below..

DATA : l_ARGUMENT LIKE  CUOV_01-VARNAM default 'xyz'.

CALL FUNCTION 'CUOV_GET_FUNCTION_ARGUMENT'

       EXPORTING

            ARGUMENT      = l_ARGUMENT

      IMPORTING

*          VTYPE         =

*          sym_val       =

            NUM_VAL       = F_XYZ

*          IO_FLAG       =

       TABLES

            QUERY         =  QUERY

       EXCEPTIONS

            ARG_NOT_FOUND = 1

            OTHERS        = 2.

  IF SY-SUBRC NE 0.

    RAISE INTERNAL_ERROR.

  ENDIF.

Regards

Tejas