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 use table inside a BADI implementation

Former Member
0 Likes
658

Hi Friends,

I have to use one BADI (implementing it) in which I need to pull some data from different database tables but it is not allowing me write TABLES syntax.

So how do we extract data from database apart from using select single.

Thanks,

pradeep

Note : I will reward points to useful answers only.

1 ACCEPTED SOLUTION
Read only

uwe_schieferstein
Active Contributor
0 Likes
577

Hello Pradeep

You have to use (or define) table types,e.g.:

METHOD my_method.

DATA:
  ls_knb1     TYPE knb1,
  lt_knb1      TYPE STANDARD TABLE OF knb1.


  SELECT * FROM knb1 INTO TABLE lt_knb1.

  LOOP AT lt_knb1 INTO ls_knb1.
    " do processing of customer data
  ENDLOOP.

ENDMETHOD.

Note: the same is true for itab's as instance attributes.

Regards

Uwe

Hi Friends,

I have to use one BADI (implementing it) in which I need to pull some data from different database tables but it is not allowing me write TABLES syntax.

So how do we extract data from database apart from using select single.

Thanks,

pradeep

Note : I will reward points to useful answers only.

1 REPLY 1
Read only

uwe_schieferstein
Active Contributor
0 Likes
578

Hello Pradeep

You have to use (or define) table types,e.g.:

METHOD my_method.

DATA:
  ls_knb1     TYPE knb1,
  lt_knb1      TYPE STANDARD TABLE OF knb1.


  SELECT * FROM knb1 INTO TABLE lt_knb1.

  LOOP AT lt_knb1 INTO ls_knb1.
    " do processing of customer data
  ENDLOOP.

ENDMETHOD.

Note: the same is true for itab's as instance attributes.

Regards

Uwe