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: 

problem in table data transfer

Former Member
0 Kudos
95

hello,

i am takin some fields from three different table and i hav to merge it into a single table and den display consequently.

e.g.

type-pools : slis.

"break-point.

tables: vbap,

vbak,

mara.

data: begin of itab occurs 0,

vbeln like vbak-vbeln,

erdat like vbak-erdat,

end of itab.

data: begin of ktab occurs 0,

posnr like vbap-posnr,

matnr like vbap-matnr,

kwmeng like vbap-kwmeng,

netpr like vbap-netpr,

end of ktab.

data: begin of jtab occurs 0,

ernam like mara-ernam,

end of jtab.

data: begin of atab occurs 0,

vbeln like vbak-vbeln,

erdat like vbak-erdat,

posnr like vbap-posnr,

matnr like vbap-matnr,

kwmeng like vbap-kwmeng,

netpr like vbap-netpr,

ernam like mara-ernam,

end of atab.

data: alv_fieldcat type slis_t_fieldcat_alv.

********************************************

  • * selection screen declaration

********************************************

selection-screen: begin of block abc with frame title text-001.

select-options: vb for vbak-vbeln.

selection-screen: end of block abc.

start-of-selection.

perform get_data.

perform display.

form get_data.

select * from vbak into corresponding fields of table itab

where vbeln in vb.

select * from vbap into corresponding fields of table ktab for all entries in

itab where vbeln = itab-vbeln.

select ernam from mara into corresponding fields of table jtab

where matnr = ktab-matnr.

atab[] = itab[].

atab[] = ktab[].

atab[] = jtab[].

endform.

but first 2 are executing and im getting the values also but 3rd query is not working .im not getting the values in jtab.

and also for atab[] = ktab[] im getting syntax error ""ATAB" and "KTAB" are not mutually convertible. In Unicode programs,"ATAB" must have the same structure layout as "KTAB", independent of the length of a Unicode character."

please help me out with this problem.

thnks n regards,

mukesh.

1 ACCEPTED SOLUTION

SuhaSaha
Advisor
Advisor
0 Kudos
66

Hello Mukesh,

You need to add the FOR ALL ENTRIES stmt.


select ernam from mara into corresponding fields of table jtab
for all entries in ktab
where matnr = ktab-matnr.

You cannot assign ITAB, JTAB & KTAB to ATAB as done by you.

BR,

Suhas

4 REPLIES 4

SuhaSaha
Advisor
Advisor
0 Kudos
67

Hello Mukesh,

You need to add the FOR ALL ENTRIES stmt.


select ernam from mara into corresponding fields of table jtab
for all entries in ktab
where matnr = ktab-matnr.

You cannot assign ITAB, JTAB & KTAB to ATAB as done by you.

BR,

Suhas

Former Member
0 Kudos
66

Hi,

use the below logic.


select * from vbak into corresponding fields of table itab
where vbeln in vb.
if itab[] is not initial.
select * from vbap into corresponding fields of table ktab for all entries in
itab where vbeln = itab-vbeln.
if ktab[] is not initial.
select ernam from mara into corresponding fields of table jtab for all entries in ktab
where matnr = ktab-matnr.
endif.
endif.

regards,

Santosh Thorat

Former Member
0 Kudos
66

Hi,

Use inner join to update into a custom table and then pick up required data from the table.

Former Member
0 Kudos
66

Have few suggestions for you,

Modify Structure of "ktab" like

 
DATA: BEGIN OF ktab OCCURS 0,
vbeln      LIKE vbap-vbeln, "<---- New field  
posnr     LIKE vbap-posnr,
matnr     LIKE vbap-matnr,
kwmeng LIKE vbap-kwmeng,
netpr      LIKE vbap-netpr,
END OF ktab.

after getting the data from database

loop at Item table "ktab"

inside the loop

read header table "itab" (here u will need the new field in katab) & material table "jtab".

get all the feilds which u want from these table in a work area which is like line of atab.

then just append this work area to "atab" at the end of loop.

One more thing is

you should make sure that when getting ernam from mara internal table used "ktab"

should not have duplicate entries for matnr it will improve performance