‎2006 Apr 04 3:54 AM
Hi,
I am trying to retrieve the field attribute SETNAME from the table SETLEAF based upon the parameters VALFROM and VALTO as i don't have a proper value for this to parameters i am not able to retrive the value properly.
Pl. suggest if there is any Function modlue which can be used to retrive the details of SETNAME from the SETLEAF table and if possible provide the coding details.
Thanks in Advance,
SOO1.
‎2006 Apr 04 4:01 AM
‎2006 Apr 04 4:08 AM
Hi,
try this.. but it would be better if u have the other key fields of SETLEAF in the where clause..
data: begin of itab occurs 0,
setname type SETNAMENEW,
end of itab.
SELECT setname into table setname
FROM SETLEAF
WHERE VALFROM = "your value
and valto = "your value.
ENDSELECT.
if sy-subrc eq 0.
* itab should hold setnames for the specified range
endif.
Regards,
Suresh Datti
‎2006 Apr 04 4:09 AM
Yes i have SETCLASS = '0111' and SUBCLASS = '1MAR' and a value which falls between VALFROM and VALTO values, for this combination i need SETNAME.
Thanks,
‎2006 Apr 04 4:11 AM
then use..
data: begin of itab occurs 0,
setname type SETNAMENEW,
end of itab.
SELECT setname into table setname
FROM SETLEAF
WHERE SETCLASS = '0111'
and SUBCLASS = '1MAR'
VALFROM le "your value
and valto ge "your value.
ENDSELECT.
if sy-subrc eq 0.
* itab should hold setnames for the specified range
endif.
Regards,
Suresh Datti
‎2006 Apr 04 4:15 AM
I have tried this option but as VALFROM and VALTO are CHAR fields this is not working.
‎2006 Apr 04 4:30 AM
then you cannot get it in one SELECT.. you will have to select all the setnames into an itab & then validate the valto & valfrom.. it will work only valto & valfrom are numbers..
data: begin of itab occurs 0,
setname type SETNAMENEW,
valfrom type SETVALMIN,
valto type SETVALMAX,
end of itab.
SELECT setname valfrom valto into table setname
FROM SETLEAF
WHERE SETCLASS = '0111'
and SUBCLASS = '1MAR'
VALFROM le "your value
and valto ge "your value.
ENDSELECT.
if sy-subrc eq 0.
sort itab.
loop at itab.
if w_value ge itab-valfrom
and w_value le itab-valto.
else.
delete itab index sy-tabix.
endif.
endloop.
endif.
* itab should hold setnames for the specified range
Regards,
Suresh Datti
‎2006 Apr 04 9:12 PM
This isn't very elegant, but it does what I think you are trying to do:
REPORT ztest LINE-SIZE 80 MESSAGE-ID 00.
TABLES: setleaf.
PARAMETERS: p_setcl LIKE setleaf-setclass OBLIGATORY,
p_subcl LIKE setleaf-subclass OBLIGATORY,
p_value LIKE setleaf-valfrom OBLIGATORY.
DATA: BEGIN OF setleaf_int OCCURS 0.
INCLUDE STRUCTURE setleaf.
DATA: END OF setleaf_int.
RANGES: r_value FOR setleaf-valfrom.
SELECT * FROM setleaf
INTO TABLE setleaf_int
WHERE setclass = p_setcl
AND subclass = p_subcl.
LOOP AT setleaf_int.
r_value-sign = setleaf_int-valsign.
r_value-option = setleaf_int-valoption.
r_value-low = setleaf_int-valfrom.
r_value-high = setleaf_int-valto.
APPEND r_value.
AT END OF setname.
IF p_value IN r_value.
WRITE: /001 p_value, 'is in set', setleaf_int-setname.
ENDIF.
REFRESH r_value.
ENDAT.
ENDLOOP.Rob