cancel
Showing results for 
Search instead for 
Did you mean: 

VARIABLE - TYPE - EXIT - Error

Former Member
0 Kudos

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.

Accepted Solutions (1)

Accepted Solutions (1)

former_member93896
Active Contributor
0 Kudos

Thiagu,

the SELECT statement is wrong. You are reading the table structure into an internal table that has a different structure.

Try the following change:

DATA : 
  LS_CHAVL TYPE /bi0/pbps_produ,
  LT_CHAVL TYPE STANDARD TABLE OF /bi0/pbps_produ.

Regards

Marc

SAP NetWeaver RIG

Former Member
0 Kudos

I had the basis guys extend the roll back segment and also changed the variable declaration.I still get the error message, any inputs please.

Answers (4)

Answers (4)

Former Member
0 Kudos

U cant set the variable value for user exit variable.

However, you need to set the variable value for the non exit variable from which u r deriving. Based on the fact that L_SOURCE_VAR is used in your function module, I am assuming VARPRD is the source variable.

Hope this helps

NS

Former Member
0 Kudos

Nimmi, Thanks a lot for your input. I have no need to use a source varible, but in my function module. I was making circular reference by having source and target variable the same and that was causing the problem.

Former Member
0 Kudos

Hello,

I am getting the exact same error message in the function module, Z_VARIABLE_GET_DETAIL. In BPS0, I have created a varibale on a characterstic and using this FM to populate it, But I am getting STACK_NO_ROLL_MEMORY. I know its not really memory problem. Is there anything I am missing out here? Thanks for your help !!!

Former Member
0 Kudos

Bala,

Does it still give u roll back segment error?

If it is not a roll back segment issue, then the FM should work. I have similar code, but instead of the Zvariable_get_detail, I used FM API_SEMBPS_VARIABLE_GETDETAIL.

Also, pl. check if you have set value for the variable VARPRD.

NS

Former Member
0 Kudos

Nimmi,

How can I set value for a variable of type USER EXIT in TCODE: BPS0 ?

I even moved this QBW and still have the same problem. Also tried with different characteristics and still the same.

I have copied the code from my Variable_Get_Detail FM. Any inputs appreciated.

FUNCTION Z_VARIABLE_GET_DETAIL.

*"----


""Local Interface:

*" IMPORTING

*" REFERENCE(I_AREA) TYPE UPC_VAR-AREA

*" REFERENCE(I_VARIABLE) TYPE UPC_VAR-VAR

*" REFERENCE(I_BUFFER) TYPE BOOLE-BOOLE OPTIONAL

*" EXPORTING

*" VALUE(E_SUBRC) TYPE SY-SUBRC

*" VALUE(ES_RETURN) TYPE BAPIRET2

*" VALUE(E_TYPE) TYPE UPC_VAR-VARTYPE

*" REFERENCE(ETO_VARSEL_ALL) TYPE UPC_YTO_CHARSEL

*" REFERENCE(ETO_VARSEL) TYPE UPC_YTO_CHARSEL

*" REFERENCE(ETO_CHANM) TYPE UPC_YTO_CHA

*"----


STATICS:

P_SUBRC LIKE SY-SUBRC,

PS_RETURN LIKE BAPIRET2,

P_TYPE LIKE UPC_VAR-VARTYPE,

PTO_VARSEL_ALL TYPE UPC_YTO_CHARSEL,

PTO_VARSEL TYPE UPC_YTO_CHARSEL,

PTO_CHANM TYPE UPC_YTO_CHA,

P_VARIABLE TYPE UPC_VAR-VAR,

P_AREA TYPE UPC_Y_AREA,

P_FIRST_READ LIKE BOOLE-BOOLE VALUE 'X'.

DATA:

LR_VARIABLE TYPE REF TO CL_SEM_VARIABLE.

  • We can't read the values from the buffer if ...

  • - it is the first read

  • - the buffer flag is initial

  • - the stored area or varname differ from imported values.

IF NOT I_BUFFER IS INITIAL

AND P_FIRST_READ IS INITIAL

AND P_AREA = I_AREA

AND P_VARIABLE = I_VARIABLE.

E_SUBRC = P_SUBRC.

ES_RETURN = PS_RETURN.

ETO_VARSEL_ALL = PTO_VARSEL_ALL.

ETO_VARSEL = PTO_VARSEL.

ETO_CHANM = PTO_CHANM.

ELSE.

  • clear all exporing tables of type reference

CLEAR: ETO_CHANM, ETO_VARSEL_ALL, ETO_VARSEL.

CALL METHOD CL_SEM_VARIABLE=>GET_INSTANCE

EXPORTING

I_AREA = I_AREA

I_VARIABLE = I_VARIABLE

RECEIVING

RR_VARIABLE = LR_VARIABLE

EXCEPTIONS

NOT_EXISTING = 1

OTHERS = 2.

IF SY-SUBRC <> 0.

E_SUBRC = 4.

CALL FUNCTION 'BALW_BAPIRETURN_GET2'

EXPORTING

TYPE = SY-MSGTY

CL = SY-MSGID

NUMBER = SY-MSGNO

PAR1 = SY-MSGV1

PAR2 = SY-MSGV2

PAR3 = SY-MSGV3

PAR4 = SY-MSGV4

IMPORTING

RETURN = ES_RETURN.

EXIT.

ENDIF.

  • read details of variable

CALL METHOD LR_VARIABLE->GET_ATTRIBUTES

IMPORTING

E_TYPE = E_TYPE

ETO_CHANM = ETO_CHANM.

  • read restricted values

CALL METHOD LR_VARIABLE->GET_VALUE

EXPORTING

I_USER = SY-UNAME

I_RESTRICT = 'X'

RECEIVING

RTO_VALUE = ETO_VARSEL

EXCEPTIONS

ERROR = 1

OTHERS = 2.

IF SY-SUBRC <> 0.

E_SUBRC = 4.

CALL FUNCTION 'BALW_BAPIRETURN_GET2'

EXPORTING

TYPE = SY-MSGTY

CL = SY-MSGID

NUMBER = SY-MSGNO

PAR1 = SY-MSGV1

PAR2 = SY-MSGV2

PAR3 = SY-MSGV3

PAR4 = SY-MSGV4

IMPORTING

RETURN = ES_RETURN.

EXIT.

ENDIF.

  • read all values

CALL METHOD LR_VARIABLE->GET_VALUE

EXPORTING

I_USER = SY-UNAME

I_RESTRICT = ' '

RECEIVING

RTO_VALUE = ETO_VARSEL_ALL

EXCEPTIONS

ERROR = 1

OTHERS = 2.

IF SY-SUBRC <> 0.

E_SUBRC = 4.

CALL FUNCTION 'BALW_BAPIRETURN_GET2'

EXPORTING

TYPE = SY-MSGTY

CL = SY-MSGID

NUMBER = SY-MSGNO

PAR1 = SY-MSGV1

PAR2 = SY-MSGV2

PAR3 = SY-MSGV3

PAR4 = SY-MSGV4

IMPORTING

RETURN = ES_RETURN.

EXIT.

ENDIF.

  • -- no error occured => store results to buffer

CLEAR P_FIRST_READ.

P_AREA = I_AREA.

P_VARIABLE = I_VARIABLE.

P_SUBRC = E_SUBRC.

PS_RETURN = ES_RETURN.

PTO_VARSEL_ALL = ETO_VARSEL_ALL.

PTO_VARSEL = ETO_VARSEL.

PTO_CHANM = ETO_CHANM.

ENDIF.

ENDFUNCTION.

Former Member
0 Kudos

Fill the sign and option parameter to EQ

LS_VARSEL-sign = 'I'.

LS_VARSEL-option = 'EQ'.

Hope this helps.

NS

Former Member
0 Kudos

Still having the same problem but thanks anyways.

Former Member
0 Kudos

Forgot to post the error message . When I run the manual planning, I am getting an short dump.

"STACK_NO_ROLL_MEMORY".

Former Member
0 Kudos

Hi,

Looks like memory for your rollback segment is low.

Talk to your basis guys to extend the segment.

Best regards,

Eugene