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

Problem in Normal Report

Former Member
0 Likes
410

Hi Friends

the report is dealer performance report.

i have a program in which i am getting the total of only one i.e., last plant instead of all the plants one after the other based on plant number.

here i am trying to display the total of a particular plant for a particular month.

please check the report below any send me the modified one .

its urgent i have to submit today itself. can anybody help please....

solution is highly rewarded .

REPORT zsd_clearance NO STANDARD PAGE HEADING LINE-SIZE 300 LINE-COUNT 55(2).

  • Tables----------------------------------------------------------------*

TABLES : j_1iexcdtl,

t001w.

.

  • Internal Tables -----------------------------------------------------*

DATA : BEGIN OF it_clearance OCCURS 0,

werks LIKE j_1iexcdtl-werks,

matnr LIKE j_1iexcdtl-matnr,

kunag LIKE j_1iexchdr-kunag,

exdat LIKE j_1iexcdtl-exdat,

menge LIKE j_1iexcdtl-menge,

zmmyy LIKE j_1iexcdtl-exdat,

spart LIKE mara-spart,

END OF it_clearance.

DATA : BEGIN OF it_mth OCCURS 0,

kunag LIKE j_1iexchdr-kunag,

werks LIKE j_1iexcdtl-werks,

zmmyy(6) ,

END OF it_mth.

DATA : it_fnl LIKE it_clearance OCCURS 0 WITH HEADER LINE.

DATA: v_from(8),

zmy(8),

ymmyy(8),

zspart LIKE mara-spart,

zmenge LIKE j_1iexcdtl-menge,

ymenge LIKE j_1iexcdtl-menge,

v_depo(90).

  • Selection Parameters ***********************************************

SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

SELECT-OPTIONS : s_exdat FOR j_1iexcdtl-exdat.

*PARAMETERS : s_kunag type j_1iexchdr-kunag .

SELECTION-SCREEN : END OF BLOCK b1.

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

*******************************SELECTION-SCREEN**************************

AT SELECTION-SCREEN.

  • Validate test for Plant in selections

  • IF NOT s_werks IS INITIAL.

  • SELECT SINGLE * FROM t001w

  • WHERE werks = s_werks.

  • IF sy-subrc NE 0.

  • MESSAGE e600(fr) WITH 'This Plant '

  • s_werks ' does not exist.'

  • ENDIF.

  • ENDIF.

                                                • Start of Selection ********************************

START-OF-SELECTION.

PERFORM clear_all.

PERFORM get_data.

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

  • Top of page-------------------------------------------------------------*

TOP-OF-PAGE.

WRITE :/45 'ADITYA BIRLA NUVO LIMITED. (UNIT : INDIAN RAYON) Run Date : ' ,sy-datum, 'Page No : ',sy-pagno.

ULINE AT /(185).

FORMAT COLOR 1 INTENSIFIED OFF.

WRITE 😕 'Plant' ,

  • 20 'Colour',

  • 40 'Type',

25 'Apr',

35 'May',

45 'Jun',

55 'Jul',

65 'Aug',

75 'Sep',

85 'Oct',

95 'Nov',

105 'Dec',

115 'Jan',

125 'Feb',

135 'Mar',

140 'Total'.

FORMAT COLOR OFF.

ULINE AT /(185).

  • End of page -----------------------------------------------------------------*

END-OF-PAGE.

ULINE (185).

&----


*& Form clear_all

&----


  • Clear All Iternal tables and Varialbes

----


FORM clear_all .

REFRESH: it_clearance.

ENDFORM. " clear_all

&----


*& Form get_data

&----


  • Get the Datas for Dealer Performance Report

----


FORM get_data .

SELECT awerks bmatnr akunag aexdat SUM( b~menge ) AS menge

INTO CORRESPONDING FIELDS OF TABLE it_clearance

FROM j_1iexcdtl AS b INNER JOIN j_1iexchdr AS a

ON awerks EQ bwerks

AND aexnum EQ bexnum

AND aexdat EQ bexdat

AND adocno EQ bdocno

AND adocyr EQ bdocyr

WHERE a~werks = '1010'

  • and a~kunag in s_kunag

AND a~exdat IN s_exdat

and a~exgrp = '11'

and a~srgrp = '08'

GROUP BY awerks bmatnr akunag aexdat.

IF sy-dbcnt EQ 0.

WRITE:/1 ' NO RECORDS FOUND'.

ENDIF.

CHECK NOT it_clearance[] IS INITIAL .

  • DELETE it_clearance WHERE matnr = ''.

it_fnl[] = it_clearance[].

LOOP AT it_fnl.

SELECT spart INTO zspart FROM mara

WHERE matnr = it_fnl-matnr.

ENDSELECT.

IF sy-subrc EQ 0.

MOVE zspart TO it_fnl-spart.

MODIFY TABLE it_fnl.

  • append it_fnl.

ENDIF.

ENDLOOP.

    • Select spart from mara

    • into corresponding fields of table it_fnl

    • for all entries in it_clearance

    • where matnr = it_clearance-matnr.

  • modify table it_fnl.

SORT it_fnl BY exdat kunag .

LOOP AT it_clearance WHERE exdat IN s_exdat.

  • CONCATENATE it_fnl-exdat6(2) it_fnl-exdat4(2) INTO zmy.

  • CONCATENATE it_clearance-exdat6(2) it_clearance-exdat4(2) INTO zmy.

CONCATENATE it_clearance-exdat0(4) it_clearance-exdat4(2) INTO zmy.

MOVE: it_clearance-exdat TO it_fnl-exdat,

it_clearance-menge TO it_fnl-menge,

it_clearance-werks TO it_fnl-werks,

zmy TO it_fnl-zmmyy.

it_mth-kunag = it_fnl-kunag.

it_mth-zmmyy = it_fnl-zmmyy.

it_mth-werks = it_fnl-werks.

it_fnl-zmmyy = zmy.

  • MODIFY TABLE it_fnl transporting zmmyy.

APPEND: it_fnl, it_mth.

  • MODIFY it_fnl.

  • APPEND zmy TO it_fnl.

  • CLEAR: it_fnl, it_clearance.

ENDLOOP.

APPEND zmy TO it_fnl.

  • SORT it_mth BY kunag zmmyy.

SORT it_fnl BY kunag exdat.

SORT it_mth BY zmmyy.

DELETE ADJACENT DUPLICATES FROM it_mth .

LOOP AT it_mth.

zmenge = ' '.

  • ymenge = ' '.

LOOP AT it_fnl WHERE kunag EQ it_mth-kunag AND zmmyy EQ it_mth-zmmyy and werks eq it_mth-werks.

  • ON CHANGE OF it_fnl-kunag.

*

  • MOVE: it_mth-zmmyy TO it_fnl-zmmyy,

  • it_mth-kunag TO it_fnl-kunag.

  • CLEAR zmenge.

  • ENDON.

zmenge = zmenge + it_fnl-menge.

ymenge = ymenge + it_fnl-menge.

      • if it_fnl-zmmyy+4(2) eq '04'.

      • WRITE: /10(4) it_fnl-werks right-justified.

      • write: 14(16) it_fnl-menge right-justified

      • .

      • endif.

ENDLOOP.

  • if it_fnl-zmmyy+4(2) eq '04'.

if it_fnl-zmmyy+4(2) eq '04'.

WRITE: /1(4) it_fnl-kunag right-justified.

write: 14(10) zmenge decimals 0 right-justified.

elseif it_fnl-zmmyy+4(2) eq '05'.

write: 24(10) zmenge decimals 0 right-justified.

elseif it_fnl-zmmyy+4(2) eq '06'.

write: 34(10) zmenge decimals 0 right-justified.

elseif it_fnl-zmmyy+4(2) eq '07'.

write: 44(10) zmenge decimals 0 right-justified.

elseif it_fnl-zmmyy+4(2) eq '08'.

write: 54(10) zmenge decimals 0 right-justified.

elseif it_fnl-zmmyy+4(2) eq '09'.

write: 64(10) zmenge decimals 0 right-justified.

elseif it_fnl-zmmyy+4(2) eq '10'.

write: 74(10) zmenge decimals 0 right-justified.

elseif it_fnl-zmmyy+4(2) eq '11'.

write: 84(10) zmenge decimals 0 right-justified.

elseif it_fnl-zmmyy+4(2) eq '12'.

write: 94(10) zmenge decimals 0 right-justified.

elseif it_fnl-zmmyy+4(2) eq '01'.

write: 104(10) zmenge decimals 0 right-justified.

elseif it_fnl-zmmyy+4(2) eq '02'.

write: 114(10) zmenge decimals 0 right-justified.

elseif it_fnl-zmmyy+4(2) eq '03'.

write: 124(10) zmenge decimals 0 right-justified.

else.

write: 134(10) zmenge decimals 0 right-justified.

endif.

  • WRITE: /10 it_fnl-werks,' Date total :' ,' ',zmenge.

  • CLEAR: it_fnl.

  • zmenge = ' '.

  • ymenge = ' '.

  • SKIP.

ENDLOOP.

SKIP.

SKIP.

ULINE.

WRITE: /29 'Grand total :' ,' ',ymenge.

ENDFORM. " get_data

regards,

Naveen.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
379

I did the changes for your porgram just copy and see it ....

REPORT zsd_clearance NO STANDARD PAGE HEADING LINE-SIZE 300 LINE-COUNT 55(2).

* Tables----------------------------------------------------------------*
TABLES : j_1iexcdtl,
t001w.
.
* Internal Tables -----------------------------------------------------*
DATA : BEGIN OF it_clearance OCCURS 0,
werks LIKE j_1iexcdtl-werks,
exdat LIKE j_1iexcdtl-exdat,
matnr LIKE j_1iexcdtl-matnr,
kunag LIKE j_1iexchdr-kunag,
menge LIKE j_1iexcdtl-menge,
zmmyy LIKE j_1iexcdtl-exdat,
spart LIKE mara-spart,
END OF it_clearance.

DATA : BEGIN OF it_mth OCCURS 0,
werks LIKE j_1iexcdtl-werks,
zmmyy(6) ,
kunag LIKE j_1iexchdr-kunag,

END OF it_mth.

DATA : it_fnl LIKE it_clearance OCCURS 0 WITH HEADER LINE.

DATA: v_from(8),
zmy(8),
ymmyy(8),
zspart LIKE mara-spart,
zmenge LIKE j_1iexcdtl-menge,
ymenge LIKE j_1iexcdtl-menge,
v_depo(90).

* Selection Parameters ***********************************************

SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS : s_exdat FOR j_1iexcdtl-exdat.

*PARAMETERS : s_kunag type j_1iexchdr-kunag .

SELECTION-SCREEN : END OF BLOCK b1.

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

********************************SELECTION-SCREEN***************************
AT SELECTION-SCREEN.
* Validate test for Plant in selections

* IF NOT s_werks IS INITIAL.
* SELECT SINGLE * FROM t001w
* WHERE werks = s_werks.
* IF sy-subrc NE 0.
* MESSAGE e600(fr) WITH 'This Plant '
* s_werks ' does not exist.'
* ENDIF.
* ENDIF.

************************ Start of Selection ********************************

START-OF-SELECTION.
PERFORM clear_all.
PERFORM get_data.

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

* Top of page-------------------------------------------------------------*
TOP-OF-PAGE.

WRITE :/45 'ADITYA BIRLA NUVO LIMITED. (UNIT : INDIAN RAYON) Run Date : ' ,sy-datum, 'Page No : ',sy-pagno.
ULINE AT /(185).

FORMAT COLOR 1 INTENSIFIED OFF.
WRITE :/ 'Plant' ,
* 20 'Colour',
* 40 'Type',
25 'Apr',
35 'May',
45 'Jun',
55 'Jul',
65 'Aug',
75 'Sep',
85 'Oct',
95 'Nov',
105 'Dec',
115 'Jan',
125 'Feb',
135 'Mar',
140 'Total'.

FORMAT COLOR OFF.
ULINE AT /(185).

* End of page -----------------------------------------------------------------*
END-OF-PAGE.

ULINE (185).

*&---------------------------------------------------------------------*
*& Form clear_all
*&---------------------------------------------------------------------*
* Clear All Iternal tables and Varialbes
*----------------------------------------------------------------------*
FORM clear_all .
REFRESH: it_clearance.
ENDFORM. " clear_all
*&---------------------------------------------------------------------*
*& Form get_data
*&---------------------------------------------------------------------*
* Get the Datas for Dealer Performance Report
*----------------------------------------------------------------------*
FORM get_data .

SELECT a~werks b~matnr a~kunag a~exdat SUM( b~menge ) AS menge
INTO CORRESPONDING FIELDS OF TABLE it_clearance
FROM j_1iexcdtl AS b INNER JOIN j_1iexchdr AS a
ON a~werks EQ b~werks
AND a~exnum EQ b~exnum
AND a~exdat EQ b~exdat
AND a~docno EQ b~docno
AND a~docyr EQ b~docyr
WHERE a~werks = '1010'
* and a~kunag in s_kunag
AND a~exdat IN s_exdat
and a~exgrp = '11'
and a~srgrp = '08'
GROUP BY a~werks b~matnr a~kunag a~exdat.

IF sy-dbcnt EQ 0.
WRITE:/1 ' NO RECORDS FOUND'.
ENDIF.

CHECK NOT it_clearance[] IS INITIAL .

* DELETE it_clearance WHERE matnr = ''.
sort  it_clearance by   werks   exdat .
it_fnl[] = it_clearance[].

LOOP AT it_fnl.
SELECT spart INTO zspart FROM mara
WHERE matnr = it_fnl-matnr.
ENDSELECT.
IF sy-subrc EQ 0.
MOVE zspart TO it_fnl-spart.
MODIFY TABLE it_fnl.
* append it_fnl.
ENDIF.
ENDLOOP.
sort  it_fnl by   werks   exdat .

** Select spart from mara
** into corresponding fields of table it_fnl
** for all entries in it_clearance
** where matnr = it_clearance-matnr.

* modify table it_fnl.

*SORT it_fnl BY exdat kunag .

LOOP AT it_clearance WHERE exdat IN s_exdat.

* CONCATENATE it_fnl-exdat+6(2) it_fnl-exdat+4(2) INTO zmy.

* CONCATENATE it_clearance-exdat+6(2) it_clearance-exdat+4(2) INTO zmy.

CONCATENATE it_clearance-exdat+0(4) it_clearance-exdat+4(2) INTO zmy.





MOVE: it_clearance-exdat TO it_fnl-exdat,
it_clearance-menge TO it_fnl-menge,
it_clearance-werks TO it_fnl-werks,
zmy TO it_fnl-zmmyy.

it_mth-kunag = it_fnl-kunag.
it_mth-zmmyy = it_fnl-zmmyy.
it_mth-werks = it_fnl-werks.

it_fnl-zmmyy = zmy.

* MODIFY TABLE it_fnl transporting zmmyy.

APPEND: it_fnl, it_mth.

* MODIFY it_fnl.


* APPEND zmy TO it_fnl.

* CLEAR: it_fnl, it_clearance.


ENDLOOP.

APPEND zmy TO it_fnl.

* SORT it_mth BY kunag zmmyy.
sort  it_fnl by   werks   exdat .

SORT it_mth BY werks zmmyy.
DELETE ADJACENT DUPLICATES FROM it_mth .

LOOP AT it_mth.

zmenge = ' '.
* ymenge = ' '.

LOOP AT it_fnl WHERE kunag EQ it_mth-kunag AND zmmyy EQ it_mth-zmmyy and werks eq it_mth-werks.

* ON CHANGE OF it_fnl-kunag.
*
* MOVE: it_mth-zmmyy TO it_fnl-zmmyy,
* it_mth-kunag TO it_fnl-kunag.
* CLEAR zmenge.
* ENDON.

zmenge = zmenge + it_fnl-menge.
ymenge = ymenge + it_fnl-menge.

*** if it_fnl-zmmyy+4(2) eq '04'.
*** WRITE: /10(4) it_fnl-werks right-justified.
*** write: 14(16) it_fnl-menge right-justified
*** .
*** endif.

ENDLOOP.
* if it_fnl-zmmyy+4(2) eq '04'.
if it_fnl-zmmyy+4(2) eq '04'.
WRITE: /1(4) it_fnl-kunag right-justified.
write: 14(10) zmenge decimals 0 right-justified.
elseif it_fnl-zmmyy+4(2) eq '05'.
write: 24(10) zmenge decimals 0 right-justified.
elseif it_fnl-zmmyy+4(2) eq '06'.
write: 34(10) zmenge decimals 0 right-justified.
elseif it_fnl-zmmyy+4(2) eq '07'.
write: 44(10) zmenge decimals 0 right-justified.
elseif it_fnl-zmmyy+4(2) eq '08'.
write: 54(10) zmenge decimals 0 right-justified.
elseif it_fnl-zmmyy+4(2) eq '09'.
write: 64(10) zmenge decimals 0 right-justified.
elseif it_fnl-zmmyy+4(2) eq '10'.
write: 74(10) zmenge decimals 0 right-justified.
elseif it_fnl-zmmyy+4(2) eq '11'.
write: 84(10) zmenge decimals 0 right-justified.
elseif it_fnl-zmmyy+4(2) eq '12'.
write: 94(10) zmenge decimals 0 right-justified.
elseif it_fnl-zmmyy+4(2) eq '01'.
write: 104(10) zmenge decimals 0 right-justified.
elseif it_fnl-zmmyy+4(2) eq '02'.
write: 114(10) zmenge decimals 0 right-justified.
elseif it_fnl-zmmyy+4(2) eq '03'.
write: 124(10) zmenge decimals 0 right-justified.
else.
write: 134(10) zmenge decimals 0 right-justified.
endif.

at end  of werks  .
sum .
WRITE: /29 'Grand total :' ,' ',ymenge.
endat .

at end  of exdat  .
sum .
WRITE: /29 'Grand total :' ,' ',ymenge.
endat .

* CLEAR: it_fnl.
* zmenge = ' '.
* ymenge = ' '.
* SKIP.

ENDLOOP.
SKIP.
SKIP.
ULINE.
WRITE: /29 'Grand total :' ,' ',ymenge.
ENDFORM. " get_data

reward points if it i s usefull ...

Girish

3 REPLIES 3
Read only

Former Member
0 Likes
380

I did the changes for your porgram just copy and see it ....

REPORT zsd_clearance NO STANDARD PAGE HEADING LINE-SIZE 300 LINE-COUNT 55(2).

* Tables----------------------------------------------------------------*
TABLES : j_1iexcdtl,
t001w.
.
* Internal Tables -----------------------------------------------------*
DATA : BEGIN OF it_clearance OCCURS 0,
werks LIKE j_1iexcdtl-werks,
exdat LIKE j_1iexcdtl-exdat,
matnr LIKE j_1iexcdtl-matnr,
kunag LIKE j_1iexchdr-kunag,
menge LIKE j_1iexcdtl-menge,
zmmyy LIKE j_1iexcdtl-exdat,
spart LIKE mara-spart,
END OF it_clearance.

DATA : BEGIN OF it_mth OCCURS 0,
werks LIKE j_1iexcdtl-werks,
zmmyy(6) ,
kunag LIKE j_1iexchdr-kunag,

END OF it_mth.

DATA : it_fnl LIKE it_clearance OCCURS 0 WITH HEADER LINE.

DATA: v_from(8),
zmy(8),
ymmyy(8),
zspart LIKE mara-spart,
zmenge LIKE j_1iexcdtl-menge,
ymenge LIKE j_1iexcdtl-menge,
v_depo(90).

* Selection Parameters ***********************************************

SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS : s_exdat FOR j_1iexcdtl-exdat.

*PARAMETERS : s_kunag type j_1iexchdr-kunag .

SELECTION-SCREEN : END OF BLOCK b1.

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

********************************SELECTION-SCREEN***************************
AT SELECTION-SCREEN.
* Validate test for Plant in selections

* IF NOT s_werks IS INITIAL.
* SELECT SINGLE * FROM t001w
* WHERE werks = s_werks.
* IF sy-subrc NE 0.
* MESSAGE e600(fr) WITH 'This Plant '
* s_werks ' does not exist.'
* ENDIF.
* ENDIF.

************************ Start of Selection ********************************

START-OF-SELECTION.
PERFORM clear_all.
PERFORM get_data.

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

* Top of page-------------------------------------------------------------*
TOP-OF-PAGE.

WRITE :/45 'ADITYA BIRLA NUVO LIMITED. (UNIT : INDIAN RAYON) Run Date : ' ,sy-datum, 'Page No : ',sy-pagno.
ULINE AT /(185).

FORMAT COLOR 1 INTENSIFIED OFF.
WRITE :/ 'Plant' ,
* 20 'Colour',
* 40 'Type',
25 'Apr',
35 'May',
45 'Jun',
55 'Jul',
65 'Aug',
75 'Sep',
85 'Oct',
95 'Nov',
105 'Dec',
115 'Jan',
125 'Feb',
135 'Mar',
140 'Total'.

FORMAT COLOR OFF.
ULINE AT /(185).

* End of page -----------------------------------------------------------------*
END-OF-PAGE.

ULINE (185).

*&---------------------------------------------------------------------*
*& Form clear_all
*&---------------------------------------------------------------------*
* Clear All Iternal tables and Varialbes
*----------------------------------------------------------------------*
FORM clear_all .
REFRESH: it_clearance.
ENDFORM. " clear_all
*&---------------------------------------------------------------------*
*& Form get_data
*&---------------------------------------------------------------------*
* Get the Datas for Dealer Performance Report
*----------------------------------------------------------------------*
FORM get_data .

SELECT a~werks b~matnr a~kunag a~exdat SUM( b~menge ) AS menge
INTO CORRESPONDING FIELDS OF TABLE it_clearance
FROM j_1iexcdtl AS b INNER JOIN j_1iexchdr AS a
ON a~werks EQ b~werks
AND a~exnum EQ b~exnum
AND a~exdat EQ b~exdat
AND a~docno EQ b~docno
AND a~docyr EQ b~docyr
WHERE a~werks = '1010'
* and a~kunag in s_kunag
AND a~exdat IN s_exdat
and a~exgrp = '11'
and a~srgrp = '08'
GROUP BY a~werks b~matnr a~kunag a~exdat.

IF sy-dbcnt EQ 0.
WRITE:/1 ' NO RECORDS FOUND'.
ENDIF.

CHECK NOT it_clearance[] IS INITIAL .

* DELETE it_clearance WHERE matnr = ''.
sort  it_clearance by   werks   exdat .
it_fnl[] = it_clearance[].

LOOP AT it_fnl.
SELECT spart INTO zspart FROM mara
WHERE matnr = it_fnl-matnr.
ENDSELECT.
IF sy-subrc EQ 0.
MOVE zspart TO it_fnl-spart.
MODIFY TABLE it_fnl.
* append it_fnl.
ENDIF.
ENDLOOP.
sort  it_fnl by   werks   exdat .

** Select spart from mara
** into corresponding fields of table it_fnl
** for all entries in it_clearance
** where matnr = it_clearance-matnr.

* modify table it_fnl.

*SORT it_fnl BY exdat kunag .

LOOP AT it_clearance WHERE exdat IN s_exdat.

* CONCATENATE it_fnl-exdat+6(2) it_fnl-exdat+4(2) INTO zmy.

* CONCATENATE it_clearance-exdat+6(2) it_clearance-exdat+4(2) INTO zmy.

CONCATENATE it_clearance-exdat+0(4) it_clearance-exdat+4(2) INTO zmy.





MOVE: it_clearance-exdat TO it_fnl-exdat,
it_clearance-menge TO it_fnl-menge,
it_clearance-werks TO it_fnl-werks,
zmy TO it_fnl-zmmyy.

it_mth-kunag = it_fnl-kunag.
it_mth-zmmyy = it_fnl-zmmyy.
it_mth-werks = it_fnl-werks.

it_fnl-zmmyy = zmy.

* MODIFY TABLE it_fnl transporting zmmyy.

APPEND: it_fnl, it_mth.

* MODIFY it_fnl.


* APPEND zmy TO it_fnl.

* CLEAR: it_fnl, it_clearance.


ENDLOOP.

APPEND zmy TO it_fnl.

* SORT it_mth BY kunag zmmyy.
sort  it_fnl by   werks   exdat .

SORT it_mth BY werks zmmyy.
DELETE ADJACENT DUPLICATES FROM it_mth .

LOOP AT it_mth.

zmenge = ' '.
* ymenge = ' '.

LOOP AT it_fnl WHERE kunag EQ it_mth-kunag AND zmmyy EQ it_mth-zmmyy and werks eq it_mth-werks.

* ON CHANGE OF it_fnl-kunag.
*
* MOVE: it_mth-zmmyy TO it_fnl-zmmyy,
* it_mth-kunag TO it_fnl-kunag.
* CLEAR zmenge.
* ENDON.

zmenge = zmenge + it_fnl-menge.
ymenge = ymenge + it_fnl-menge.

*** if it_fnl-zmmyy+4(2) eq '04'.
*** WRITE: /10(4) it_fnl-werks right-justified.
*** write: 14(16) it_fnl-menge right-justified
*** .
*** endif.

ENDLOOP.
* if it_fnl-zmmyy+4(2) eq '04'.
if it_fnl-zmmyy+4(2) eq '04'.
WRITE: /1(4) it_fnl-kunag right-justified.
write: 14(10) zmenge decimals 0 right-justified.
elseif it_fnl-zmmyy+4(2) eq '05'.
write: 24(10) zmenge decimals 0 right-justified.
elseif it_fnl-zmmyy+4(2) eq '06'.
write: 34(10) zmenge decimals 0 right-justified.
elseif it_fnl-zmmyy+4(2) eq '07'.
write: 44(10) zmenge decimals 0 right-justified.
elseif it_fnl-zmmyy+4(2) eq '08'.
write: 54(10) zmenge decimals 0 right-justified.
elseif it_fnl-zmmyy+4(2) eq '09'.
write: 64(10) zmenge decimals 0 right-justified.
elseif it_fnl-zmmyy+4(2) eq '10'.
write: 74(10) zmenge decimals 0 right-justified.
elseif it_fnl-zmmyy+4(2) eq '11'.
write: 84(10) zmenge decimals 0 right-justified.
elseif it_fnl-zmmyy+4(2) eq '12'.
write: 94(10) zmenge decimals 0 right-justified.
elseif it_fnl-zmmyy+4(2) eq '01'.
write: 104(10) zmenge decimals 0 right-justified.
elseif it_fnl-zmmyy+4(2) eq '02'.
write: 114(10) zmenge decimals 0 right-justified.
elseif it_fnl-zmmyy+4(2) eq '03'.
write: 124(10) zmenge decimals 0 right-justified.
else.
write: 134(10) zmenge decimals 0 right-justified.
endif.

at end  of werks  .
sum .
WRITE: /29 'Grand total :' ,' ',ymenge.
endat .

at end  of exdat  .
sum .
WRITE: /29 'Grand total :' ,' ',ymenge.
endat .

* CLEAR: it_fnl.
* zmenge = ' '.
* ymenge = ' '.
* SKIP.

ENDLOOP.
SKIP.
SKIP.
ULINE.
WRITE: /29 'Grand total :' ,' ',ymenge.
ENDFORM. " get_data

reward points if it i s usefull ...

Girish

Read only

0 Likes
379

Hi Giri ,

thanks for ur efforts , but at the same time u have to point out him where he went wrong while coding ?

1.no select stamts in b/w loop and endloop.

LOOP AT it_fnl.

SELECT spart INTO zspart FROM mara

WHERE matnr = it_fnl-matnr.

ENDSELECT.

IF sy-subrc EQ 0.

MOVE zspart TO it_fnl-spart.

MODIFY TABLE it_fnl.

  • append it_fnl.

ENDIF.

ENDLOOP.

break this statement into 2 pieces.

Regards

Peram

Read only

0 Likes
379

Hi girish sorry to say i am getting Error as

" No Component exists with the Name "EXDAT"."EXDAT".

Can you help me in this so that i can be thankful to you.