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

Using SETLEAF table to access setclass

Former Member
0 Likes
3,325

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.

7 REPLIES 7
Read only

Former Member
0 Likes
2,181

Do you have the SETCLASS, SUBCLASS and a value?

Rob

Read only

0 Likes
2,181

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

Read only

0 Likes
2,181

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,

Read only

0 Likes
2,181

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

Read only

0 Likes
2,181

I have tried this option but as VALFROM and VALTO are CHAR fields this is not working.

Read only

0 Likes
2,181

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

Read only

0 Likes
2,181

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