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

changing internal table

Former Member
0 Likes
596

Hi,

I need to create internal table depended on checkbox.

That means that if checkbox is checked the itab will have one column more.

could i do smt like this:

begin of itab.

.

.

if checkbox = 'X'.

pole type d,

endif.

end of itab.

Regards,

Joanna

5 REPLIES 5
Read only

Former Member
0 Likes
567

Joanna,

There is no such feature in ABAP exactly the way you are looking for, but there are many alternatives. Depending on your need (why you want such a feature), one or other may be used.

1) Go ahead and add the column, but don't use it if check box is unchecked.

2) Define two internal tables (one of them with additional column) and use the appropriate itab when checkbox is checked.

3) Create a dynamic internal table - a very hard solution to implement and much harder to maintain.

Read only

0 Likes
567

Hi sudhi,

Can u show me some code which illustrates the implementation if dynamic internal table.

Thanks & Regards,

Sai

Read only

0 Likes
567

Sai,

Please create a separate question in the forum when you want to start a topic that is different from the original post. (Side tracking a thread is called 'hijacking' the thread.) Also, you might get more (and better) responses from others when the subject title is more appropriate for the question.

For dynamic internal table creation, please look up help on ABAP statement CREATE DATA. I recall the help page having an example. Also, you might find examples in this forum if you search with those keywords.

Read only

Former Member
0 Likes
567

Hi

sorry joanna lazarz

there is no such facility in SAP to change the internal table like that

if you want you can create 2 internal tables where one contains one field extra and at that time if check box is checked then call that internal table other wise normal internal table

<b>Reward if usefull</b>

Read only

0 Likes
567

Hi,

but if i create two tables i need to make saome select twice i in code I am collecting a lot of data so it will be double long