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 with internal table

Former Member
0 Likes
497

itab_bkpf and itab_awkey has the below structures:

DATA: BEGIN OF ITAB_AWKEY OCCURS 0,

VBELV TYPE VBFA-VBELN,

POSNV TYPE VBFA-POSNV,

AWKEY TYPE BKPF-AWKEY,

POSNN TYPE VBFA-POSNN,

END OF ITAB_AWKEY.

DATA: BEGIN OF ITAB_BKPF OCCURS 0,

VBELV TYPE VBFA-VBELN,

POSNV TYPE VBFA-POSNV,

AWKEY TYPE BKPF-AWKEY,

POSNN TYPE VBFA-POSNN,

BUKRS TYPE BKPF-BUKRS,

BELNR TYPE BKPF-BELNR,

GJAHR TYPE BKPF-GJAHR,

END OF ITAB_BKPF.

Now I am trying to access BKPF to get some records:

SELECT BUKRS BELNR GJAHR

FROM BKPF

INTO CORRESPONDING FIELDS OF TABLE ITAB_BKPF

FOR ALL ENTRIES IN ITAB_AWKEY

WHERE AWTYP = 'VBRK'

AND AWKEY = ITAB_AWKEY-AWKEY.

When I see the records in itab_bkpf, the other fields (vbelv, posnv, vbeln, posnn) are showing no values at all. What can I do to retrieve these values also in itab_bkpf while selecting with out affecing performance?

I appreciate your input.

Thanks in advance for your helpful answers and points guaranteed.

3 REPLIES 3
Read only

Former Member
0 Likes
471

One way is using JOINS, can you please let us know from which table you are selecting for populating the internal table ITAB_AWKEY.

Other way is:

loop at ITAB_AWKEY.

SELECT BUKRS

BELNR

GJAHR

FROM BKPF UP TO 1 rows

INTO CORRESPONDING FIELDS OF ITAB_BKPF

FOR ALL ENTRIES IN ITAB_AWKEY

WHERE AWTYP = 'VBRK'

AND AWKEY = ITAB_AWKEY-AWKEY.

itab_bkpf-vbeln = ITAB_AWKEY-vbeln.

itab_bkpf-posnv = ITAB_AWKEY-posnv.

itab_bkpf-posnn = ITAB_AWKEY-posnn.

append itab_bkpf.

clear itab_bkpf.

endloop.

Read only

0 Likes
471

Hi sid,

I am populating itab_awkey from vbfa indirectly. I mean I am populating another internal table itab_vbfa from vbfa (filling up fields vbelv posnv vbeln posnn) and then copied this internal table to itab_awkey (because itab_awkey has one field awkey which I thought will be a problem while selecting. That's why I copied.

Hope I am clear from my side.

Thank you.

Read only

0 Likes
471

you are selecting vbelv posnv vbeln posnn from VBFA table and then moving it to another internal table itab_awkey, can you let us know how your are populating the feild awkey in the internal table.

Can you paste your code.