Skip to Content
0
Former Member
Aug 05, 2005 at 05:15 PM

VARIABLE - TYPE - EXIT - Error

95 Views

I have created a variable of type Exit for characateristic Product. I am just trying to fill the variable in the function module and its keep throwing an error "". Any input ?

FUNCTION Z_EXIT_VARIABLE_PRODUCT.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     REFERENCE(I_AREA) TYPE  UPC_Y_AREA
*"     REFERENCE(I_VARIABLE) TYPE  UPC_Y_VARIABLE
*"     REFERENCE(I_CHANM) TYPE  UPC_Y_CHANM OPTIONAL
*"     REFERENCE(ITO_CHANM) TYPE  UPC_YTO_CHA
*"  EXPORTING
*"     REFERENCE(ETO_CHARSEL) TYPE  UPC_YTO_CHARSEL
*"----------------------------------------------------------------------
  TABLES : /BI0/PBPS_PRODU.
* Change constant according to your needs
  CONSTANTS:
      L_SOURCE_VAR TYPE UPC_Y_VARIABLE VALUE 'VARPRD',
      L_SOURCE_AREA TYPE UPC_Y_AREA VALUE 'ZBA01',
      L_USE_RESTRICTED_VALUES TYPE BOOLE-BOOLE VALUE 'X',
      L_BUFFER_CALL TYPE BOOLE-BOOLE VALUE 'X'.
  DATA:
      L_SUBRC LIKE SY-SUBRC,
      LS_RETURN LIKE BAPIRET2,
      L_TYPE LIKE UPC_VAR-VARTYPE,
      LTO_VARSEL_ALL TYPE UPC_YTO_CHARSEL,
      LTO_VARSEL TYPE UPC_YTO_CHARSEL,
      LTO_VAR TYPE UPC_YTO_CHARSEL,
      LTO_CHANM TYPE UPC_YTO_CHA,
      LS_VARSEL TYPE UPC_YS_CHARSEL,
      L_ENTRIES TYPE I,
      LS_CHAVL TYPE UPC_YS_CHADEP.
  DATA : LT_CHAVL      TYPE STANDARD TABLE OF UPC_YS_CHADEP.

*** READ SOURCE VALUE
  CALL FUNCTION 'Z_VARIABLE_GET_DETAIL'
    EXPORTING
      I_AREA         = L_SOURCE_AREA
      I_VARIABLE     = L_SOURCE_VAR
      I_BUFFER       = L_BUFFER_CALL
    IMPORTING
      E_SUBRC        = L_SUBRC
      ES_RETURN      = LS_RETURN
      E_TYPE         = L_TYPE
*      ETO_VARSEL_ALL = LTO_VARSEL_ALL
*      ETO_VARSEL     = LTO_VARSEL
*      ETO_CHANM      = LTO_CHANM
.
  IF L_SUBRC <> 0.
    MESSAGE I136(UPC_FW) WITH L_SOURCE_VAR.
* Values of variable &1 cannot be determined
    EXIT.
  ENDIF.

  EXIT.

*  DETERMINE THE BPS_PRODU BELONGING TO THE BPS_PRODL
  SELECT * FROM /BI0/PBPS_PRODU INTO TABLE LT_CHAVL
    WHERE BPS_PRODL = '1'.
*  IF SY-SUBRC <> 0.
*    MESSAGE E026(UPC) WITH '0BPS_PRODL'.
*** attribute value not found
*    EXIT.
*  ENDIF.
  LS_VARSEL-SEQNO = '0000'.
  LS_VARSEL-CHANM = '0BPS_PRODU'.
  LS_VARSEL-LOW =  '1'.
  APPEND LS_VARSEL TO ETO_CHARSEL.

*  LOOP AT LT_CHAVL INTO LS_CHAVL.
*    LS_VARSEL-SEQNO = LS_VARSEL-SEQNO + 1.
*    LS_VARSEL-LOW =  1 ."LS_CHAVL-BPS_PRODU.
*    APPEND LS_VARSEL TO ETO_CHARSEL.
*  ENDLOOP.

ENDFUNCTION.