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

Internal Table Declartions with Include structure

Former Member
0 Likes
5,995

Hi ,

I need to declare a internal table with the combination of two tables(BKPF and BSEG).But the declaration like below has syntax error since

there are some common fields in both the tables .

data:begin of t_bkbs occurs 0.

include structure bkpf.

include structure bseg.

data:end of t_bkbs.

Is there any other way to solve this problem.

Thanks in advance .

Regards,

Raj

8 REPLIES 8
Read only

jayanthi_jayaraman
Active Contributor
2,363

Hi,

declare as follows.

data : begin of t_bkbs occurs 0.

include struture bkpf.

data : buzei type bseg-buzei,

...

...like that declare fields in bseg which is not in bkpf

end of t_bkbs.

Read only

Former Member
0 Likes
2,363

Hi,

Declare the internal table with common fields from both the tables, for ex,

tab1 & tab2 are 2 dbtables

types: begin of wa_tab,

fld1 like tab1-fld1, " from tab1

fld2 like tab1-fld2,

fld3 like tab2-fld1, " from tab2

end of it_tab.

declare an internal table from the work area defined earlier. Hope this helps,

Rgds,

Read only

Former Member
0 Likes
2,363

Hi,

TYPES : BEGIN OF pfra0_pcale,

annee(4) TYPE c.

INCLUDE STRUCTURE pcint.

TYPES : END OF pfra0_pcale.

Try like this.

Read only

andreas_mann3
Active Contributor
0 Likes
2,363

Hi,

look, if you can use one of the following structures :

BSIK,BSID,BSIS,ACCIT which include the important fields of bkpf and bseg.

regards Andreas

Read only

ssimsekler
Product and Topic Expert
Product and Topic Expert
0 Likes
2,363

Hi

Try this

DATA: BEGIN OF t_bkbs OCCURS 0.
INCLUDE STRUCTURE bkpf AS k .
INCLUDE STRUCTURE bseg AS s .
DATA: END OF t_bkbs.

*--Serdar <a href="https://www.sdn.sap.com:443http://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.sdn.businesscard.sdnbusinesscard?u=qbk%2bsag%2bjiw%3d">[ BC ]</a>

Read only

0 Likes
2,363

Hi ,

I need all the fields of BKPF and BSEG .

I am looking for the simplest way of declaring internal table .Declaring one table as structure and other as individual fields will be a lengthy declaration(BSEG has 350 fields)

.Is there any other simplest way of declaring this internal table .

Thanks all for your views.

Regards,

Raj

Read only

0 Likes
2,363

Hi,

Declare a type which is similar to table type, for ex,

types: t_bseg type bseg.

use the type as one of the line types to declare the internal table, for ex,

DATA itab_bseg TYPE STANDARD TABLE OF t_bseg

initial size 0 with header line.

Hope this helps.

Rgds,

Read only

ssimsekler
Product and Topic Expert
Product and Topic Expert
0 Likes
2,363

Hi Raja

Did you try :

DATA: BEGIN OF t_bkbs OCCURS 0.
INCLUDE STRUCTURE bkpf AS k .
INCLUDE STRUCTURE bseg AS s .
DATA: END OF t_bkbs.

This way you can reach a field via, e.g. <b>'t_bkbs-k<i>-<fieldname></i>'</b>.

<u>Alternatively;</u>

DATA: BEGIN OF t_bkbs OCCURS 0.
bkpf_str LIKE bkpf .
bseg_str LIKE bseg .
DATA: END OF t_bkbs.

This way you can reach a field via e.g. <b>'t_bkbs-bkpf_str<i>-<fieldname></i>'</b>.

<u>Alternatively;</u>

Create a new structure, e.g. ZBKBS, in DDIC and include bseg and bkpf there. Then, in your program refer to this DDUC structure.

*--Serdar <a href="https://www.sdn.sap.com:443http://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.sdn.businesscard.sdnbusinesscard?u=qbk%2bsag%2bjiw%3d">[ BC ]</a>