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: 

hi structure

Former Member
0 Kudos
91

hi

i want data from structure. data in the structure comes run time.

how can i take data from structure using table and variable???

pl give one example each for both.

thanx

rocky

1 ACCEPTED SOLUTION

Former Member
0 Kudos
54

Hi Rocky,

Internal table & structure both can hold values only at runtime,

but in case of structure it can hold only one record at a time, internal tables holds multiple records.

u can access the data same as u do it in case of an internal table..

variable_name = structure_name-field_name...

Hope this is simple and clear.

<b>Reward Points If Useful</b>

6 REPLIES 6

Former Member
0 Kudos
54

Hi,

Structure doesnot hold any data in database. They exist as a single empty line structure in database. What ever you see data in structure at run time is because somewhere inside the program some data has been move to that structure.

To find out how data is populating the structure, debug the program set a watchpoint on one of the field of the structure. Hope this way you will find out how data has been moved to the structure at run time inside a program.

Regards,

A.Singh

Former Member
0 Kudos
54

structure at a time only one record maintain.

internal table main no of records.

Former Member
0 Kudos
54

DATA: BEGIN OF fs_spfli,

carrid TYPE spfli-carrid,

connid TYPE spfli-connid,

countryfr TYPE spfli-countryfr,

END OF fs_spfli.

DATA: BEGIN OF fs_sflight,

carrid TYPE sflight-carrid,

connid TYPE sflight-connid,

fldate TYPE sflight-fldate,

price TYPE sflight-price,

END OF fs_sflight.

DATA: t_spfli LIKE STANDARD TABLE OF fs_spfli,

t_sflight LIKE STANDARD TABLE OF fs_sflight.

START-OF-SELECTION.

SELECT * FROM spfli INTO CORRESPONDING FIELDS OF TABLE t_spfli.

SELECT * FROM sflight INTO CORRESPONDING FIELDS OF TABLE t_sflight.

In the above sample code,

fs_spfli, fs_sflight are structures while t_spfli, t_sflight are internal tables.

Regards,

Pavan

Former Member
0 Kudos
54

Structure doesn't contain any data..

they can be used at runtime to hold a single record at a time.

But u can declare internal table if want to process more than one record at at time.

To use structure at runtime use following methods..

1. If u want to use structure name as it is..

TABLES: structure_name. " Structure should be in data dictionary

2. To give different name :

DATA: wa_str type structure_name.

3. To declare internal table type of structure or database table

DATA: itab TYPE STANDARD TABLE OF structure_name INITIAL SIZE 0.

DATA: itab TYPE STANDARD TABLE OF dbtable_name INITIAL SIZE 0.

Regards

Prax

Former Member
0 Kudos
55

Hi Rocky,

Internal table & structure both can hold values only at runtime,

but in case of structure it can hold only one record at a time, internal tables holds multiple records.

u can access the data same as u do it in case of an internal table..

variable_name = structure_name-field_name...

Hope this is simple and clear.

<b>Reward Points If Useful</b>

Former Member
0 Kudos
54

hi

i would like to know how to trap errors in session method??

do we have to code seperately or what??

pl explain nicely???

thanx

rocky.