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

Help reqd - Data declaration

Former Member
0 Likes
1,950

Hi,

I have a problem here. I am analyzing an existing program. This is an active prg in Production.

In that I see usage of an internal table called 'itab1'. On double clicking on it (to find it's data declaration) it takes no-where. It asks if I would like to create it.

In an include program (which in embedded in this main program), I find some declaration as follows:

data: itab&1 like &2 occurs 0 with header line.

Can you help me understand this? I need to change the data declaration for this 'itab1' for an upgrade.

Regards,

Sanju.

20 REPLIES 20
Read only

Former Member
0 Likes
1,913

Sanju,

Welcome to SDN

Is that statement is commented? if it is commented i think it will not takes no where.

Uncomment it once, double click on it and see.......

Read only

0 Likes
1,913

No Naveen.. It's very much uncommented and in use.

Read only

Sm1tje
Active Contributor
0 Likes
1,913

You can change the data declaration and it should not give you any problems.

In stead of declaring the data in the report itself, an include is used to do (all) data declaration. The fact that you don't jump to the data declaration upon double clicking can be caused by the fact that the navigation index is not up to date.

You can do this in the menu (utilities I believe) and choose 'update navigation index'. Try this and then again try to double click on itab1. Check if it works now.

Read only

Former Member
0 Likes
1,913

hi ,

if u double clicking the itab it is not taking any more means it is not used or it is called dynamically...

data: itab&1 like &2 occurs 0 with header line.

i think this is done in the oops abap ....

regards,

venkat.

Read only

Former Member
0 Likes
1,913

Hi

I dont think that its a commented statement.

May be Internal table is declared at runtime.

so, put a break point and execute the program and see what happens...

cheers!!!

Read only

Former Member
0 Likes
1,913

Not sure, but this can be a dinamic declaration for this internal table's name using two macro parameters.

This probably is part of a macro which has the parameters &1 and &2.

Read only

0 Likes
1,913

Yes Rodrigo.. You are correct.. the 'itab&1' is inside a macro.

So, what's the connection between 'itab1' and 'itab&1'? All I need to do is change the declaration of 'itab1'..

Please help.

I can try executing this program but it needs an input file which I dont have a this moment..

Edited by: Sanju S on Mar 27, 2008 6:47 PM

Read only

0 Likes
1,913

Macros are defined using the following statement:


DEFINE conversion.

  if &1 is not initial.
    &2 = c_X.
  else.
    &2 = space.
  endif.
 

END-OF-DEFINITION.

You apply it like described bellow:


  conversion var_1 var_return.

My guess is that this internal table is being declared using the macro parameter. so, if &1 is valued with "10", that internal table will be named itab10.

Not quite sure about that, but maybe that's what is happening. Try to find the place where the macro is being called and see if &1 value is '1'.

Read only

Former Member
0 Likes
1,913

Hi

I believe the definition is made by a macro, something like this:

DEFINE INT_TABLE.
  DATA: ITAB&1 LIKE &2 OCCURS 0 WITH HEADER LINE.
END-OF-DEFINITION.

INT_TABLE 1 BKPF.
INT_TABLE 2 BSEG.


START-OF-SELECTION.

  LOOP AT ITAB1.
    LOOP AT ITAB2 WHERE BUKRS = ITAB1-BUKRS
                    AND BELNR = ITAB1-BELNR
                    AND GJAHR = ITAB1-GJAHR.
    ENDLOOP.
  ENDLOOP.

In this way I define 2 internal table ITAB1 like BKPF and ITAB2 like BSEG.

So u need to find out when that macro is called in order to define ITAB1.

Max

Read only

0 Likes
1,913

Yes Max.. Inside the macro I see this kind of thing

DEFINE INT_TABLE.

DATA: ITAB&1 LIKE &2 OCCURS 0 WITH HEADER LINE.

END-OF-DEFINITION.

But I don't see anything as below in the include program that has the macro definition.

INT_TABLE 1 BKPF.

INT_TABLE 2 BSEG.

Read only

0 Likes
1,913

Perhaps it's passing any variable instead of 1...

Read only

0 Likes
1,913

Hi

Yes I know, your macro should have a different name: in my sample I call the macro INT_TABLE, but I suppose it'll be different in your code.

So go to the macro defination:

DEFINE <MACRO NAME>.

DATA: ITAB&1 LIKE &2 OCCURS 0 WITH HEADER LINE.

END-OF-DEFINITION.

Find out the name of the macro and check where it's used.

If you have a table ITAB1 you should find a line similar to this:

<MACRO NAME> 1 <STRUCTURE NAME FOR INTERNAL TABLE>

Max

Read only

0 Likes
1,913

Yes Max.. I understood your point before itself.. My macro is called 'file_select'

DEFINE file_select.

*--- Internal table for file contents

data: itab&1 like &2 occurs 0 with header line.

-


more data declarations

-


selection screen definition

END-OF-DEFINITION.

Then I do CNTL F for 'file_select' and don't see in anywhere in that include. Thus I am not able to see what &2 or &1 means.

Edited by: Sanju S on Mar 27, 2008 7:07 PM

Edited by: Sanju S on Mar 27, 2008 7:08 PM

Read only

0 Likes
1,913

Sorry Venkat that wouldn't help.. Later on internal table itab1 aquires value from itab2

itab1[] = itab2[]. So, I need to change the type of itab1 to suit to that of itab2.

Read only

0 Likes
1,913

You searched only in the include or also in the main program?

Read only

0 Likes
1,913

Both..

Read only

0 Likes
1,913

Is the code too long?

Could you post it?

Read only

0 Likes
1,913

Sorry

Can u post all codes in your macro definition

Max

Read only

0 Likes
1,913

Against security policy of client, so sorry I cannot.. thanks for all the comments but still it's open will have a look tomorrow.. it's 6:20pm I gotta go home.. bye..

Edited by: Sanju S on Mar 27, 2008 7:23 PM

Read only

Former Member
0 Likes
1,913

hi use this ...

data: test LIKE CAWN-ATWRT value '20080327',

out like CAWN-ATFLV .

CALL FUNCTION 'CTCV_CONVERT_DATE_TO_FLOAT'

EXPORTING

DATE = test

IMPORTING

FLOAT = out.

write:/ out.

.

regards,

venkat.