Skip to Content
0
Former Member
Apr 22, 2008 at 04:06 AM

OUTPUT from Internal tables

30 Views

Hi All,

Data is comming to Internal tables but I am unable to show out put some where I am missing,any one please help me.

REPORT ztest2.

TABLES:s031,s032,makt,marc.

DATA : BEGIN OF itab1 OCCURS 0,

matnr TYPE s031-matnr,

lgort TYPE s031-lgort,

werks TYPE s031-werks,

spmon TYPE s031-spmon,

magbb TYPE s031-magbb,

wagbb TYPE s031-wagbb,

azubb TYPE s031-azubb,

aagbb TYPE s031-aagbb,

END OF itab1.

DATA : BEGIN OF itab2 OCCURS 0,

matnr LIKE makt-matnr,

maktx LIKE makt-maktx,

END OF itab2.

DATA : BEGIN OF itab3 OCCURS 0,

matnr TYPE marc-matnr,

werks TYPE marc-werks,

ekgrp TYPE marc-ekgrp,

END OF itab3.

DATA : BEGIN OF itab4 OCCURS 0 ,

matnr TYPE s032-matnr,

lgort TYPE s032-lgort,

werks TYPE s032-werks,

mbwbest TYPE s032-mbwbest,

wbwbest TYPE s032-wbwbest,

END OF itab4.

DATA: BEGIN OF itab5 OCCURS 0,

matnr LIKE s031-matnr,

atinn LIKE cawn-atinn,

atwrt LIKE cawn-atwrt,

objek LIKE ausp-objek,

END OF itab5.

DATA : BEGIN OF itab_final1 OCCURS 0,

matnr TYPE s031-matnr,

lgort TYPE s031-lgort,

werks TYPE s031-werks,

magbb TYPE s031-magbb,

wagbb TYPE s031-wagbb,

azubb TYPE s031-azubb,

aagbb TYPE s031-aagbb,

maktx TYPE makt-maktx,

ekgrp TYPE marc-ekgrp,

mbwbest TYPE s032-mbwbest,

wbwbest TYPE s032-wbwbest,

atwrt TYPE cawn-atwrt,

END OF itab_final1.

DATA : BEGIN OF itab_final OCCURS 0,

matnr TYPE s031-matnr,

lgort TYPE s031-lgort,

werks TYPE s031-werks,

magbb TYPE s031-magbb,

wagbb TYPE s031-wagbb,

azubb TYPE s031-azubb,

aagbb TYPE s031-aagbb,

maktx TYPE makt-maktx,

ekgrp TYPE marc-ekgrp,

mbwbest TYPE s032-mbwbest,

wbwbest TYPE s032-wbwbest,

atwrt TYPE cawn-atwrt,

END OF itab_final.

DATA: wa_itab5 LIKE LINE OF itab5.

DATA : wa_itab_final LIKE LINE OF itab_final.

SELECT-OPTIONS:s_matnr FOR s031-matnr.

SELECT amatnr algort awerks aspmon amagbb awagbb aazubb aaagbb

bmaktx cekgrp dmbwbest dwbwbest

INTO CORRESPONDING FIELDS OF TABLE itab_final1

FROM ( ( ( s031 AS a

INNER JOIN makt AS b ON bmatnr = amatnr )

INNER JOIN marc AS c ON cmatnr = bmatnr )

INNER JOIN s032 AS d ON dwerks = cwerks ) WHERE a~matnr IN s_matnr.

SORT itab_final1 BY matnr werks ekgrp .

DELETE ADJACENT DUPLICATES FROM itab_final1 COMPARING matnr werks ekgrp.

LOOP AT itab_final1 INTO wa_itab_final.

itab_final-matnr = wa_itab_final-matnr.

itab_final-lgort = wa_itab_final-lgort.

itab_final-werks = wa_itab_final-werks.

itab_final-magbb = wa_itab_final-magbb.

itab_final-wagbb = wa_itab_final-wagbb.

itab_final-azubb = wa_itab_final-azubb.

itab_final-aagbb = wa_itab_final-aagbb.

itab_final-maktx = wa_itab_final-maktx.

itab_final-mbwbest = wa_itab_final-mbwbest.

itab_final-wbwbest = wa_itab_final-wbwbest.

ENDLOOP.

SELECT eatinn eatwrt fatinn fobjek

INTO CORRESPONDING FIELDS OF TABLE itab5

FROM ( cawn AS e

INNER JOIN ausp AS f ON fatinn = eatinn ) WHERE f~objek IN s_matnr.

LOOP AT itab5 INTO wa_itab5 .

itab_final-atwrt = wa_itab5-atwrt.

ENDLOOP.

append Itab_final.

LOOP AT itab_final.

WRITE: /2 itab_final-matnr COLOR 1, 23 itab_final-lgort COLOR 2,29 itab_final-werks COLOR 3,44 itab_final-magbb COLOR 5,66 itab_final-wagbb COLOR 6,86 itab_final-azubb COLOR 7,97 itab_final-aagbb COLOR 5,

110 itab_final-maktx COLOR 1, 130 itab_final-ekgrp COLOR 3,150 itab_final-wbwbest COLOR 6,190 itab_final-mbwbest COLOR 3,200 itab_final1-atwrt COLOR 5.

ENDLOOP.

ThanKs&regds,

Sree.