SETS and usage in ABAP.

Using Sets ( Tcodes Gs01, Gs02, Gs03) we can avoid hard coding of values in Ranges in ABAP.

SETS allow us to store low and high values in System Table SETLEAF.

So Define Ranges as is in Program, but fill values from SETLEAF table, so that the values can be independently maintained .

CODE SNIPPET

TABLES: mara, setleaf.
* ———————————————————————
RANGES: mirango FOR mara-matnr.
* ———————————————————————
SELECT valsign valoption valfrom valto
INTO (mirango-sign, mirango-option,
mirango-low, mirango-high)
FROM setleaf
WHERE setname = ‘ZEXE001’.
APPEND mirango.
ENDSELECT.

 

SELECT * FROM mara
WHERE matnr IN mirango.
WRITE : / mara-matnr.
ENDSELECT.

 

 

 

 

 

http://translate.google.com/translate?hl=en&sl=es&u=http://sap4.com/wiki/index.php%3Ftitle%3DBreve_Tutorial_de_SETs&sa=X&oi=translate&resnum=4&ct=result&prev=/search%3Fq%3DSets%2BGs02%2B%2Babap%26hl%3Den%26rls%3Dcom.microsoft:en-us:IE-SearchBox%26rlz%3D1I7GZHZ