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

how to retrieve data from database to the structure(complicated)

Former Member
0 Likes
838

Hello everyone:

I want to retrieve data from database to the structure. but the structure defined like this below:

TOLERANZOB LIKE QAMV-TOLERANZOB

TOLERANZOB1 LIKE QAMV-TOLERANZOB

so how can I retrieve the data from the database ? make sure that the two fields contain data both.

Thanks in advance .

Regards

Nick

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
807

Hi,

Use select single

Select single TOLERANZOB into TOLERANZOB from QAMV where ......

If sys-subrc = 0.

TOLERANZOB1 = TOLERANZOB.

endif.

<b>Reward if helpful.</b>

Hello everyone:

I want to retrieve data from database to the structure. but the structure defined like this below:

TOLERANZOB LIKE QAMV-TOLERANZOB

TOLERANZOB1 LIKE QAMV-TOLERANZOB

so how can I retrieve the data from the database ? make sure that the two fields contain data both.

Thanks in advance .

Regards

Nick

5 REPLIES 5
Read only

Former Member
0 Likes
808

Hi,

Use select single

Select single TOLERANZOB into TOLERANZOB from QAMV where ......

If sys-subrc = 0.

TOLERANZOB1 = TOLERANZOB.

endif.

<b>Reward if helpful.</b>

Read only

Former Member
0 Likes
807

Hi Nick,

To retreive data for TOLERANZOB from QAMV,

If you know the key fields then use

SELECT SINGLE TOLERANZOB FROM QAMV INTO TOLERANZOB WHERE keyfields.

else, you can use

SELECT TOLERANZOB FROM QAMV UPTO ONE ROWS INTO TOLERANZOB WHERE....

Once you retreive the data using the select query, you can check if it is initial and if not move the data from TOLERANZOB to TOLERANZOB1.

<b>Reward points for helpful answers.</b>

Best Regards,

Ram.

Read only

Former Member
0 Likes
807

Hi

no , the two fields don't contain the same data .

such as , TOLERANZOB contains the first data , and TOLERANZOB1 contains the second data .

thanks

nick.

Read only

Former Member
0 Likes
807

Hi Nick,

Let's consider WA is the name of the strcuture, then you will write the query as below:

Select single TOLERANZOB from QAMV into WA-TOLERANZOB where .......

if sy-subrc = 0.

WA-TOLERANZOB1 = WA-TOLERANZOB.

endif.

Read only

Former Member
0 Likes
807

you define an internal table from structure and then fill this itab with data.

For example:

data: itab type standard table of QAMV (or whatever the structure name is).

Then you can fill this itab via:

Select * from QAMV into table itab [where if required, write any field of need].

Thanks.