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

structures-- to populate the field

Former Member
0 Likes
2,329

how to populate the fields in the internal table , in which the fields are in structure.

1 ACCEPTED SOLUTION
Read only

jyotheswar_p2
Active Participant
0 Likes
1,841

hi ,

u have find out in which table the field is actually in.For this u go to transaction SE84.there you give ur field name and then it will give it is from which table.according to that u have fetch the data from that table and populate it..

hope this will clear ur problem.

if u have any queries get back.

regards

jyo

8 REPLIES 8
Read only

jyotheswar_p2
Active Participant
0 Likes
1,842

hi ,

u have find out in which table the field is actually in.For this u go to transaction SE84.there you give ur field name and then it will give it is from which table.according to that u have fetch the data from that table and populate it..

hope this will clear ur problem.

if u have any queries get back.

regards

jyo

Read only

Former Member
0 Likes
1,841

Use select query to populate the fields in the internal table.

e.g. -

----


  • Types (ty_)

----


TYPES:

BEGIN OF ty_alv_output,

vbeln TYPE vbeln,

vbtyp TYPE vbtyp,

auart TYPE auart,

NETWR TYPE NETWR_ak,

WAERK TYPE waerk,

VKORG TYPE VKORG,

VTWEG TYPE VTWEG,

SPART TYPE SPART,

VKGRP TYPE VKGRP,

VKBUR TYPE VKBUR,

GSBER TYPE GSBER,

matnr TYPE matnr,

END OF ty_alv_output,

ty_table_alv_output TYPE STANDARD TABLE OF ty_alv_output.

----


  • Internal tables(gt_)

----


DATA :

gt_alv_output TYPE STANDARD TABLE OF ty_alv_output.

----


  • Work area

----


DATA :gs_alv_output TYPE ty_alv_output.

----


  • Selection screen data

  • select-options (s_)

  • parameters (p_)

  • radio buttons (r_)

  • checkboxes (x_)

  • pushbuttons (b_)

----


SELECTION-SCREEN BEGIN OF BLOCK block1 WITH FRAME TITLE text-f01.

SELECT-OPTIONS:

s_vbeln FOR vbak-vbeln, "Sales Document

s_vbtyp FOR vbak-vbtyp, "SD document category

s_auart FOR vbak-auart. "Sales Document Type

SELECTION-SCREEN END OF BLOCK block1.

START-OF-SELECTION.

SELECT vbeln

vbtyp

auart

netwr

waerk

vkorg

vtweg

spart

vkgrp

vkbur

gsber

matnr

INTO CORRESPONDING FIELDS OF TABLE gt_alv_output

FROM vbak

WHERE vbeln IN s_vbeln

AND auart IN s_auart

AND vbtyp IN s_vbtyp.

This selct query will fill the data in internal table.

Plz reward if found helpful

Thanks

Read only

Former Member
0 Likes
1,841

hi keerthi,

first u can define <itab> for your required fields,

i.e.

data: begin of <itab> occurs 0,

kunnr type kunnr,

name1 type name1_gd,

land1 type land1_gd.

data: end of <itab>.

then u can select these filed from data base table and insert into this <itab>.

these records u can use.

regards,

seshu.

Read only

dev_parbutteea
Active Contributor
0 Likes
1,841

Hi Keerthi,

You can access fields in structures as follows:

DATA: begin of tt_type2,

kunnr type bkpf-mandt,

end of tt_type2.

DATA: begin of tt_type1,

kunnr2 type bkpf-mandt,

end of tt_type1.

data: begin of t_type.

include structure tt_type1.

INCLUDE STRUCTURE tt_type2.

DATA: END OF t_type.

DATa:i_table LIKE TABLE OF t_type,

wa_table like t_type.

wa_table-kunnr = '01'.

wa_table-kunnr2 = '01'.

APPEND wa_table to i_table.

Hope that this helps you,

Regards,

Sooness.

Read only

Former Member
0 Likes
1,841

Basically the fields in the structre are depend on the some table data .... or else some of data are dynamically filled to structure through the program ...

so for dymanic there willl be Function Module's for reading and wirting ...like Importing & exporting ....

otherwise as the ohter friend told .... the structure fields where user list or the check table or view fields list ... so that will get the tranparent table where in you can select the data...

Girish

Read only

Former Member
0 Likes
1,841

if you have the values in a structure wa, and want to insert this into an internal table itab, you can use <b>append wa to itab</b> or

<b>insert wa into table itab</b>

reward if helpful

Read only

Former Member
0 Likes
1,841

hi keerthi

If u want to populate fields which is in structure then try this,

loop at itab.

move corresponding struct to itab.

endloop.

REWARD IF USEFUL...!!

Read only

Former Member
0 Likes
1,841

Hi keerthi,

to populate fields in an internal table you will have to use SELECT Query for that...

consider following program,

****************TYPE declaration**************************

TYPES : begin of ty_mara,

matnr TYPE mara-matnr,

ernam TYPE mara-ernam,

End of ty_mara.

***************DATA declaration**************************

DATA : gt_mara TYPE TABLE OF ty_mara,

gs_mara TYPE ty_mara.

*******************Selection screen*************************

select-options : s_matnr like mara-matnr.

*****************at selection screen************************

at selection-screen.

if s_matnr is intial.

message 'Enter material number' TYPE 'E'.

endif.

*******************start of slection***************************

start-of-selection

**fetching data from table

select matnr

ernam

FROM mara

INTO TABLE gt_mara

WHERE matnr in s_matnr.

***after this query the internal table will be having data for the selected material numbers...display the output.

Loop at gt_mara into gs_mara.

Write 😕 gs_mara-matnr,

gs_mara-ernam.

Endloop.

hope this will solve ur problem...

please reward points incase useful..

Regards,

Prashant