Application Development 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: 

Header line problem inside BADI method

Former Member
0 Kudos

Hi all,

I have to use a function CLAF_CLASSIFICTION_OF_OBJECTS'

inside a BADI called BATCH_Master.

Now the thing is that the data which I have to read gets fetched in one of the tables of function module.

Following CODE works fine if <b>I am not using BADI.</b>

Data: P_CLASS like SCLASS occurs 0 with header line,

P_OBJECTDATA like CLOBJDAT occurs 0 with header line.

*

*

Call Function 'CLaff_Classification_OF OBjects'

*

*

TABLES

T_CLASS = P_Class

T_OBJECTDATA = P_OBJECTDATA.

*

*

LOOP AT P_OBJECTDATA.

WRITE: / P_OBJECTDATA-AUSP1.

ENDLOOP.

<b>But if I am use BADI then I can't use header line.</b>

Data:

P_Class TYPE STANDARD TABLE OF SCLASS initial size 0,

P_Objectdata TYPE STANDARD TABLE OF CLOBJDAT initial size 0.

Now I can't print the values of P_Objectdata because I am not using header line since I am using BADI.

How can I print P_Objectdata because I can't use header line in BADI while declaring any table (Due to OO Concept) ?

3 REPLIES 3

Former Member
0 Kudos

Don't declare itabs with header line that will not work in OO context.

You should rather declare a work area and then loop into a work area ..

see the code below.


DATA : P_Class TYPE STANDARD TABLE OF SCLASS , 
P_Objectdata TYPE STANDARD TABLE OF CLOBJDAT .

DATA : wa_objdata type CLOBJDAT.

*
*
Call Function 'CLaff_Classification_OF OBjects'
*
*
TABLES
T_CLASS = P_Class
T_OBJECTDATA = P_OBJECTDATA.
*
*

LOOP AT P_OBJECTDATA into wa_objdata.
WRITE: / wa_objdata-AUSP1.
ENDLOOP.

ChristianFi
Active Participant
0 Kudos

> Hi all,

> I have to use a function

> CLAF_CLASSIFICTION_OF_OBJECTS'

> inside a BADI called BATCH_Master.

> Now the thing is that the data which I have to read

> gets fetched in one of the tables of function

> module.

>

> Following CODE works fine if <b>I am not using

> BADI.</b>

>

> Data: P_CLASS like SCLASS occurs 0 with header line,

> P_OBJECTDATA like CLOBJDAT occurs 0 with header

> line.

>

> *

> *

> Call Function 'CLaff_Classification_OF OBjects'

> *

> *

> TABLES

> T_CLASS = P_Class

> T_OBJECTDATA = P_OBJECTDATA.

> *

> *

>

> LOOP AT P_OBJECTDATA.

> WRITE: / P_OBJECTDATA-AUSP1.

> ENDLOOP.

>

> <b>But if I am use BADI then I can't use header

> line.</b>

> Data:

> P_Class TYPE STANDARD TABLE OF SCLASS initial size 0,

>

> P_Objectdata TYPE STANDARD TABLE OF CLOBJDAT initial

> size 0.

>

> Now I can't print the values of P_Objectdata because

> I am not using header line since I am using BADI.

>

> How can I print P_Objectdata because I can't use

> header line in BADI while declaring any table (Due to

> OO Concept) ?

If you declare your table without header line, make sure that the internal table is passed to a function call with the brackets


Call Function 'CLaff_Classification_OF OBjects'
 TABLES
 T_OBJECTDATA = itab[].
 *
> 

Also you need a workarea for your loop.

loop at itab into wa.

endloop.

Hope this helps

Christian

0 Kudos

I don't think this is required?

since itab is defined without header line , any reference to internal table as itab means the body of table only and not the header.

Call Function 'CLaff_Classification_OF OBjects'

TABLES

T_OBJECTDATA = itab[].

Cheers,

Ram