Application Development 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: 

How to read sets and store the values in table?

Former Member
0 Kudos

Hey gurus,

I have to write a program to read data from sets and modify the custom table..with the data read...I got a function module that reads data from the set...G_SET_GET_ALL_VALUES...

How shud i update the table with the read values...

Please guide me in this...

Thanks

Sam

1 ACCEPTED SOLUTION

naimesh_patel
Active Contributor
0 Kudos

you need to make a loop through the result table to get all the object related to that like:

For this example I am checkint the cost centers.

  CALL FUNCTION 'G_SET_GET_ALL_VALUES'
       EXPORTING
            SETNR                 = SET_ID                "RDI_SETS_4.0
       TABLES
            SET_VALUES            = KO_VAL
       EXCEPTIONS
            SET_NOT_FOUND         = 1
            OTHERS                = 2.

ranges: r_kostl for CSKS-KOSTL.

  LOOP AT KO_VAL.
    r_kostl-sign = 'I'.
    r_kostl-options = 'BT'.
    r_kostl-low = ko_val-from.
    r_kostl-high = ko_val-to.
    append r_kostl.
  ENDLOOP.

  select kostl from csks
into it_csks
where kostl in r_kostl.

loop at it_csks.
* insert data into your z table
endloop.


Regards,

Naimesh Patel

3 REPLIES 3

naimesh_patel
Active Contributor
0 Kudos

you need to make a loop through the result table to get all the object related to that like:

For this example I am checkint the cost centers.

  CALL FUNCTION 'G_SET_GET_ALL_VALUES'
       EXPORTING
            SETNR                 = SET_ID                "RDI_SETS_4.0
       TABLES
            SET_VALUES            = KO_VAL
       EXCEPTIONS
            SET_NOT_FOUND         = 1
            OTHERS                = 2.

ranges: r_kostl for CSKS-KOSTL.

  LOOP AT KO_VAL.
    r_kostl-sign = 'I'.
    r_kostl-options = 'BT'.
    r_kostl-low = ko_val-from.
    r_kostl-high = ko_val-to.
    append r_kostl.
  ENDLOOP.

  select kostl from csks
into it_csks
where kostl in r_kostl.

loop at it_csks.
* insert data into your z table
endloop.


Regards,

Naimesh Patel

0 Kudos

Thanks for the reply Naimesh...

How shud i update the database table with the records in the internal table....

Please suggest..

Thanks

Sam

0 Kudos

YOu can use the MODIFY option

Like:

MODIFY ZTAB from table ITAB.

Regards,

Naimesh Patel