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

regarding the table type to retrive data

Former Member
0 Likes
1,096

hi ,

i want to retrive data from a variable country , this is in the following heirarchy

I_tab-item-shipfrom_locationadress_data-country .

wher itab is a structure ,

item is a table type ,

shipfrom_location is structure ,

country is variable

i just want to retrive data from variable ,

if it is structure i can just give

I_tab-item-shipfrom_locationadress_data-country .

but as item is table type ,i dont no to retrive data , pls send some suggestion with example .

thanking you

ssridhar

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,073

You can declare a variable of the table type of the ITEM.

DATA : IT_ITEMTABLE type (Same as that of ITEM column in ITAB).

Then

IT_ITEMTABLE = I_TAB-ITAM.

LOOP AT IT_ITEMTABLE INTO WA_ITEMTABLE.

Process the data

ENDLOOP.

Regards,

Ravi

Note - Please mark all the helpful ansewrs

You can declare a variable of the table type of the ITEM.

DATA : IT_ITEMTABLE type (Same as that of ITEM column in ITAB).

Then

IT_ITEMTABLE = I_TAB-ITAM.

LOOP AT IT_ITEMTABLE INTO WA_ITEMTABLE.

Process the data

ENDLOOP.

Regards,

Ravi

Note - Please mark all the helpful ansewrs

10 REPLIES 10
Read only

Former Member
0 Likes
1,074

You can declare a variable of the table type of the ITEM.

DATA : IT_ITEMTABLE type (Same as that of ITEM column in ITAB).

Then

IT_ITEMTABLE = I_TAB-ITAM.

LOOP AT IT_ITEMTABLE INTO WA_ITEMTABLE.

Process the data

ENDLOOP.

Regards,

Ravi

Note - Please mark all the helpful ansewrs

Read only

0 Likes
1,073

it is showing a error , the type wa_item cannot be conveted into to the type I_TAB-ITEM

Read only

0 Likes
1,073

Why don't you give the code and declarations here?

Read only

Former Member
0 Likes
1,073

simple.

data : wa_item like i_tab-item.

Loop at I_TAB-ITEM INTO WA_ITEM.

write : WA_ITEM-shipfrom_locationadress_data-country.

endloop.

Read only

Former Member
0 Likes
1,073

hi,

i_tab-item is your table type.

you create an internal table wa_item using this code --

data wa_item like table of i_tab.

now try retrieving data from the internal table using loop statement.

loop at wa_itam into i_tab.

write: ....

endloop.

try this.

regards

pankaj

Read only

0 Likes
1,073

read table i_tab into itab_str index 1.

data wa_party like table of i_tab.

loop at wa_party into i_tab.

write:/ wa_party-ADDRESS_DATA-country .

endloop .

it is showing me a error that wa_party has no header line

pls i hope i making blender mistake .

thanking you

sridhar

Read only

0 Likes
1,073

Hi,

data wa_party like line of i_tab.

loop at i_tab into wa_party.

write:/ wa_party-ADDRESS_DATA-country .

endloop .

Message was edited by:

Jayanthi Jayaraman

Read only

Former Member
0 Likes
1,073

hi,

declare an internal table with header line and move th content into it in this way.

data: itab1 like item with header line.

itab1[] = I_tab-item[].

x_struct like shipfrom_locationadress_data.

loop at itab1.

x_struct = itab1-shipfrom_locationadress_data.

write:/ x_struct-country.

endloop.

Read only

0 Likes
1,073

data: ordid_str type /SCMB/DM_ORDID_str,

ordid_tab type /SCMB/DM_ORDID_TAB.

data: i_party type /SCMB/DM_PARTY_str.

CREATE OBJECT grid1 .

read table gt_po_detl index 1 .

move gt_po_detl-ordid to ordid_str-ordid.

append ordid_str to ordid_tab.

CALL METHOD grid1->READ_BY_IDS

EXPORTING

  • IS_CTRL =

IV_ORTYPE = gt_po_detl-ortype

  • IV_LOCKFLG = /SCMB/CL_C_ORDER=>GC_FALSE

  • IV_NOADDRESS = /SCMB/CL_C_ORDER=>GC_FALSE

  • IV_MAPID = /SCMB/CL_C_ORDER=>GC_FALSE

  • IV_DUEQUAN = /SCMB/CL_C_ORDER=>GC_FALSE

IT_ORDERID = ordid_tab

IMPORTING

ET_ORDERS = i_tab

  • ET_PROT =

.

read table i_tab into itab_str index 1.

data wa_party like table of itab_str.

loop at wa_party into itab_str .

  • write:/ wa_party-ADDRESS_DATA-country .

break-point .

endloop this is coding

Read only

Clemenss
Active Contributor
0 Likes
1,073

Hi,

go for speed:

field-symbols:

<f1> type any,

<f2> type any.

loop at I_tab-item assigning <f1>.

assign component 'COUNTRY' of structure <f1> to <f2>.

write: / 'Country for this item ''s shipfrom_locationadress:', <f2>.

endloop.

See also this valuable link:

<a href="http://help.sap.com/saphelp_47x200/helpdata/en/fc/eb3605358411d1829f0000e829fbfe/content.htm">Access Using Field Symbols</a>

Regards,

Clemens