cancel
Showing results for 
Search instead for 
Did you mean: 

ITAB in BSP application

Former Member
0 Kudos

Hi,

Does BSP support ITAB (with header line)? If NO, then how can the data be appended to ITAB with LOOP AT in the event handler?

Is there any equivalent component for ITAB in BSP?

Thank you

arun

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

As far as possible avoid Internal table with Header lines. Since a lot of object oriented technology is used in BSP.

I suggest you use the following methodology:


TYPES: begin of ty_mytype
         myfirstfield type myfirstdatatype,
         mysecndfield type mysecnddatatype,
       end of ty_mytpe.

For workarea,


DATA: wa_myworkarea type ty_mytype.

For internal table,


DATA: lt_myinternaltable type table of ty_mytype.

Field-Symbols,


FIELD-SYMBOLS: <FS> TYPE ty_mytype.

In order to loop at internal table.


LOOP AT lt_myinternaltable to wa_myworkarea.
*** process with wa_myworkarea
ENDLOOP.

or


LOOP AT lt_myinternaltable ASSIGNING <FS>
*** process with <FS>
ENDLOOP.

Regards,

Subramanian V.

P.S. - Habits die hard. Bad Habits die harder.

athavanraja
Active Contributor
0 Kudos

<b>As far as possible avoid Internal table with Header lines. Since a lot of object oriented technology is used in BSP.</b>

There is no question of avoiding, you simply can't use it in BSPs.

In BSPs if you declare itab with header line

you will get the following syntax error.

<b><i>Tables with headers are no longer supported in the OO context. </i></b>

Regards

Raja

Former Member
0 Kudos

If you do a search in this forum for:

Guidance on Internal Tables in BSP's & ABAP Functions

you will see that in the last 7 days the subject of ITABs in BSP's was discussed thoroughly through to conclusion.

Milan.

Former Member
0 Kudos

The problem with the search is that it picks up everytime the word itab appears and sometimes you get a hit on a code sample.

But using the search is a great place to start!

Answers (2)

Answers (2)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

If you want to get really fancy you could use MVC and databind directly into the individual cells in your internal table. If you can get past the bad humor, the following weblog has an example of this:

/people/thomas.jung3/blog/2004/09/24/important-lessons-involving-bsp-model-view-binding-and-a-frozen-burrito

This can be a short cut when you are dealing with a large number of input fields or if the input fields are created dynamically.

Former Member
0 Kudos

Hi,

Now let me put my question in different way. I have 10 <htmlb:inputfield> in my page and in my Event handler i want to call a BAPI which will return values for those 10 Input fields. In this case it is an ITAB.

I need to assign First field of ITAB to First inputfield and 10 field of ITAB to 10 inputfield. How do i do that? I cannot assign directly <%= ITAB-field1%>

I tried to use 10 seperate page attribute fields and assign inputfields value as "<% = field1 %>" etc. But in my event handler when i assign ITABS first field to page attributes first field it says "ITAB has no header line"

What is the best way to handle this situation? Is there any better way to do this process.

Thank you

arun

Message was edited by: Arun Prasad

Former Member
0 Kudos

You can do a


<%
LOOP AT itab INTO witab
 field1 = witab-field1.
 field2 = witab-field2.
 field3 = witab-field3.
 field4 = witab-field4.
ENDLOOP.
%>

<htmlb:inputField id="field1" value="<%=field1%>">

Former Member
0 Kudos

Hai arun,

I am also new to BSP, But i have good friends like subramaniyan,creg..etc.

try this,

first capture values into internal table...

and now you have 10 input fields and each one has id.and only one record can place into input fields at a time.

now READ TABLE ITAB INDEX 1 (assume this)

and pass values to all input fields

input1 = <%=itab-val1%>

input2 = <%=itab-val2%>

---

-


-


like wise.

try this, it will work

Former Member
0 Kudos

Nice Leoiz,

That is also an option for working!!!