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

ABAP CODE

Former Member
0 Likes
760

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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
678

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.

4 REPLIES 4
Read only

Former Member
0 Likes
678

post the code of the Z function otherwise we would all be guessing!

Cheers,

Syd.

Read only

former_member186741
Active Contributor
0 Likes
678

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.

Read only

Former Member
0 Likes
679

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.

Read only

former_member186741
Active Contributor
0 Likes
678

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.