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 Read data from a TABLE

Former Member
0 Likes
3,379

Hi,

I am implementing a BADI, the interface has a TABLE type parameters (changing). i checked the data in debug mode in this TABLE. how do i read this contents in my BADI code.

Thanks

Akila. R

Hi,

I am implementing a BADI, the interface has a TABLE type parameters (changing). i checked the data in debug mode in this TABLE. how do i read this contents in my BADI code.

Thanks

Akila. R

8 REPLIES 8
Read only

Former Member
0 Likes
2,131

Use READ TABLE statement.

Read only

Former Member
0 Likes
2,131

hi,

Assume internally if the table name is t_vbak....do this way ...


Changing 
t_vbak type vbak


loop at itab.
read table t_vbak with key vbeln = itab-vbeln.
if sy-subrc = 0.

endif.
endloop.

Read only

Former Member
0 Likes
2,131

Use the SELECT statement to read the data into an internal table and then pass that internal table as a parameter.

Read only

GauthamV
Active Contributor
0 Likes
2,131

hi,

define a table type and use it.

check this sample code.

here cjbai_wbselement_table is structure in badi WORKBREAKDOWN_UPDATE.

data: wa_prps type line of cjbai_wbselement_table,

wa_prhi type line of cjbai_wbshierarchy_table.

read table it_wbs_element into wa_prps index 1.

if wa_prps-stufe = 1 or wa_prps-stufe = 2 .

message '1Your not able to create WBS element

upto 3rd level' type 'E'.

endif

Read only

Former Member
0 Likes
2,131

Hi ,

u need to read data into work area.

sample code .

changing table is CT_MARA.

data: lt_mara like line of ct_mara.

loop at ct_mara into lt_mara.

do nothing.

endloop.

regards

Prabhu

Read only

Former Member
0 Likes
2,131

I think the TABLE parameter is unknown, the table name will be known only at run time, so when i use READ TABLE <table parameter>.... WITH KEY GUID = '', it gives error that GUID is unknown.

Thanks

Akila. R

Read only

0 Likes
2,131

hi,

Dont directly us the key name , as the table is dynamic , u shud use the key name also as dynamic.

data: fld(4) type c value 'GUID'.

READ TABLE <table parameter>.... WITH KEY fld = ''.

this will read the Key only at runtime and ur error will be removed.

revrt back if any issues.

regards,

Naveen

Read only

Former Member
0 Likes
2,131

Hi

we can do it in two ways:

1. By using read statement.

2. By using internal tables: In this we can first select the data from database table to internal table using select statement, and then process the data.

thanks & regards,

Rajesh Kumar