‎2006 May 18 2:57 AM
Hi ,
Can anyone please explain what the code below does. It is one that is used in infopackages for dynamic update of selection fields. i want to know the logic behind this code.Thanks in advance
Dave
data: l_idx like sy-tabix.
read table l_t_range with key
fieldname = 'OPTIONSETNAME'.
l_idx = sy-tabix.
RANGES:
gr_reso_optionset FOR l_t_range-low.
CALL FUNCTION 'Z_GET_TVARV_VARIABLE_VALUE'
EXPORTING
VARIABLE_NAME = 'Z_SCC_SPA_CDM'
IMPORTING
NUMBER_OF_VALUES =
TABLES
VARIABLE_RANGE = gr_reso_optionset
EXCEPTIONS
VARIABLE_NOT_FOUND = 1
INVALID_RANGE_TABLE = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
loop at gr_reso_optionset.
shift gr_reso_optionset by 3 places.
l_t_range-low = gr_reso_optionset.
l_t_range-high = gr_reso_optionset.
append l_t_range.
endloop.
p_subrc = 0.
‎2006 May 18 5:26 AM
Hi !
I think something like the following is goning on....
- The FM 'Z_GET_TVARV_VARIABLE_VALUE' is reading the
SAP parameter Table TVARV for the parametername
'Z_SCC_SPA_CDM'
- It gives the values (as used in a selection screen) back in the table variable gr_reso_optionset
- The loop shifts the parameters value by 3 places
(why ??) and puts the shiftet values to the
variables l_t_range-low and l_t_range-high of the
internal table l_t_range.
- The loop is obviously only used to do the shifting.
Regards
Rainer
Some points would be nice if that helped a bit.
‎2006 May 18 3:10 AM
post the code of the Z function otherwise we would all be guessing!
Cheers,
Syd.
‎2006 May 18 3:17 AM
i GUESS THAT IT IS SETTING UP THE RANGE variable from VALUES from the TVARV table based on the name 'Z_SCC_SPA_CDM'.
i.e. it gets all values from TVARV for this name and puts them in the range variable.
‎2006 May 18 5:26 AM
Hi !
I think something like the following is goning on....
- The FM 'Z_GET_TVARV_VARIABLE_VALUE' is reading the
SAP parameter Table TVARV for the parametername
'Z_SCC_SPA_CDM'
- It gives the values (as used in a selection screen) back in the table variable gr_reso_optionset
- The loop shifts the parameters value by 3 places
(why ??) and puts the shiftet values to the
variables l_t_range-low and l_t_range-high of the
internal table l_t_range.
- The loop is obviously only used to do the shifting.
Regards
Rainer
Some points would be nice if that helped a bit.
‎2006 May 18 5:46 AM
the shift left is being used to 'ignore' the sign and option components of the range. Why it just doesn't refer to the 'low' I don't understand but that's what it's doing.