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: 

how to add data in fields

former_member659396
Participant
0 Kudos
142

Dear friends

i have created one report in that report jan_QUANTITY FEB_QUANTITY .........DEC_QUANTITY are there and below that fields i have to add material quantity...through vbak and vbap

kwmeng is the field for the material quantity...and that is total quantity which is devided in jan qty feb qty april qty......dec qty

what is the logic for that...following is my coding

REPORT ZMONTH_REPORT1.

TABLES: kna1,vbak,vbap.

SELECT-OPTIONS : date FOR vbak-erdat.

data: BEGIN OF it_itab OCCURS 0,

month(20) TYPE c ,

kunnr LIKE kna1-kunnr,

name1 LIKE kna1-name1,

vbeln LIKE vbak-vbeln,

erdat LIKE vbak-erdat,

meins LIKE vbap-meins,

kwmeng LIKE vbap-kwmeng,

END OF it_itab.

DATA : BEGIN OF ST_MONTH OCCURS 0,

JAN_QTY TYPE C,

FEB_QTY TYPE C,

MARCH_QTY TYPE C,

APRIL_QTY TYPE C,

MAY_QTY TYPE C,

JUN_QTY TYPE C,

JULLY_QTY TYPE C,

AUG_QTY TYPE C,

SEPT_QTY TYPE C,

OCT_QTY TYPE C,

NOV_QTY TYPE C,

DEC_QTY TYPE C,

END OF ST_MONTH.

**

*SELECT JAN_QTY FEB_QTY MARCH_QTY APRIL_QTY MAY_QTY JUN_QTY JULLY_QTY

  • AUG_QTY SEPT_QTY OCT_QTY NOV_QTY DEC_QTY INTO CORRESPONDING

  • FIELDS OF ST_MONTH UP TO 20 ROWS.

*PARAMETERS : pa RADIOBUTTON GROUP rad USER-COMMAND com MODIF ID mod,

  • pb RADIOBUTTON GROUP rad MODIF ID rad,

  • pc RADIOBUTTON GROUP rad MODIF ID cad.

*DATA : lv_dat TYPE TABLE OF it_itab,

*

*ls_vbak TYPE TABLE OF it_itab.

SELECT kna1kunnr kna1name1 vbakvbeln vbakerdat vbap~meins

vbap~kwmeng

INTO CORRESPONDING FIELDS OF TABLE it_itab UP TO 100 ROWS

FROM ( ( kna1 INNER JOIN

vbak ON kna1~kunnr =

vbak~kunnr )

INNER JOIN vbap ON vbakvbeln = vbapvbeln ) WHERE

vbak~erdat IN date.

wRITE :/1 'NUMBER' color 7 INTENSIFIED on, SY-VLINE,

7 'CUSTOMER NAME' COLOR 6 INTENSIFIED on,6 SY-VLINE,

39 'JAN_QTY' color 5 INTENSIFIED on ,27 sy-Vline,

47 'FEB_QTY' color 4 INTENSIFIED on , 46 SY-VLINE,

56 'MARCH_QTY' color 3 INTENSIFIED on, 55 SY-VLINE,

66 'APRIL_QTY' color 2 INTENSIFIED on, 65 SY-VLINE,

76 'MAY_QTY' color 1 INTENSIFIED on, 75 SY-VLINE,

83 'JUNE_QTY' color 5 INTENSIFIED on, 82 SY-VLINE,

91'JULLY_QTY' color 4 INTENSIFIED OFF, 90 SY-VLINE,

101 'AUG_QTY' color 6 INTENSIFIED OFF, 100 SY-VLINE,

109 'SEPT_QTY' color 7 INTENSIFIED OFF,108 SY-VLINE,

117 'OCT_QTY' color 2 INTENSIFIED OFF,116 SY-VLINE,

125 'NOV_QTY' color 6 INTENSIFIED OFF,124 SY-VLINE,

132 'DEC_QTY' color 7 INTENSIFIED OFF,131 SY-VLINE,

140 SY-VLINE.

LOOP AT it_itab.

WRITE :/1 it_itab-kunnr color 3 on, SY-VLINE,

7 it_itab-name1 color 2 on ,6 SY-VLINE,

28 IT_ITAB-KWMENG color 4 on,27 sy-vline.

LOOP AT ST_MONTH.

WRITE :/39 ST_MONTH-JAN_QTY color 1 on, 38 sy-vline,

47 ST_MONTH-FEB_QTY,46 SY-VLINE,

56 ST_MONTH-MARCH_QTY,55 SY-VLINE,

66 ST_MONTH-APRIL_QTY,65 SY-VLINE,

76 ST_MONTH-MAY_QTY,75 SY-VLINE,

83 ST_MONTH-JUN_QTY,82 SY-VLINE,

91 ST_MONTH-JULLY_QTY,90 SY-VLINE,

101 ST_MONTH-AUG_QTY,100 SY-VLINE,

109 ST_MONTH-SEPT_QTY,108 SY-VLINE,

117 ST_MONTH-OCT_QTY,116 SY-VLINE,

125 ST_MONTH-NOV_QTY,124 SY-VLINE,

132 ST_MONTH-DEC_QTY,131 SY-VLINE,

140 SY-VLINE.

ENDLOOP.

ENDLOOP.

LOOP AT ST_MONTH.

WRITE :/45 ST_MONTH-JAN_QTY,27 SY-VLINE,

55 ST_MONTH-FEB_QTY,54 SY-VLINE,

65 ST_MONTH-MARCH_QTY,64 SY-VLINE,

77 ST_MONTH-APRIL_QTY,76 SY-VLINE,

87 ST_MONTH-MAY_QTY,86 SY-VLINE,

98 ST_MONTH-JUN_QTY,97 SY-VLINE,

110 ST_MONTH-JULLY_QTY,109 SY-VLINE,

120 ST_MONTH-AUG_QTY,119 SY-VLINE,

131 ST_MONTH-SEPT_QTY,130 SY-VLINE,

117 ST_MONTH-OCT_QTY,140 SY-VLINE,

125 ST_MONTH-NOV_QTY,150 SY-VLINE,

132 ST_MONTH-DEC_QTY,160 SY-VLINE,

140 SY-VLINE.

ENDLOOP.

please help me out of this issue.

3 REPLIES 3

Former Member
0 Kudos
92

hi,

based upon month in erdat field u need to collect the quantity and u need to display.

0 Kudos
92

thats ok

i have tried that..but how to do it exactly

Former Member
0 Kudos
92

inur logic u have assigned value to only one month how can it can be possible for rest of months.