2007 Oct 15 6:12 AM
There are twelve fields ( for 12 months material consumption saved ) in MVER Table. I want to display Previous Three Months Consumption Based On In Put Date.How Can I write The Coading.
Ex-12-Months Material Consumption Saved In GSV01...GSV12 In MVER Table.I want If I input 01.10.2007. Then Consumption Of 09.2007, 08.2007,06.2007 Material Consumption Should Display In My Out Put Table.
If I input 01.06.2007. Then Consumption Of 05.2007, 04.2007,03.2007 Material Consumption Should Display In My Out Put Table.
*********now i have witing the coading As ***
CONSUMPTION VALUES**
SELECT SINGLE GSV01 GSV02 GSV03 GSV04 GSV05 GSV06 GSV07 GSV08 GSV09
GSV10 GSV11 GSV12
FROM MVER
INTO (IT_MVER-GSV01,IT_MVER-GSV02,IT_MVER-GSV03,IT_MVER-GSV04,
IT_MVER-GSV05,IT_MVER-GSV06,IT_MVER-GSV07,IT_MVER-GSV08, IT_MVER-GSV09,
IT_MVER-GSV10, IT_MVER-GSV11, IT_MVER-GSV12 )
WHERE MATNR = IT_MARC-MATNR AND
WERKS = P_WERKS AND
GJAHR = S_DATE-LOW+0(4).
****How Can I Display Here Plz Help Me Here...
APPEND IT_FINAL.(Final Internal Display Table)
***********what
There are twelve fields ( for 12 months material consumption saved ) in MVER Table. I want to display Previous Three Months Consumption Based On In Put Date.How Can I write The Coading.
Ex-12-Months Material Consumption Saved In GSV01...GSV12 In MVER Table.I want If I input 01.10.2007. Then Consumption Of 09.2007, 08.2007,06.2007 Material Consumption Should Display In My Out Put Table.
If I input 01.06.2007. Then Consumption Of 05.2007, 04.2007,03.2007 Material Consumption Should Display In My Out Put Table.
*********now i have witing the coading As ***
CONSUMPTION VALUES**
SELECT SINGLE GSV01 GSV02 GSV03 GSV04 GSV05 GSV06 GSV07 GSV08 GSV09
GSV10 GSV11 GSV12
FROM MVER
INTO (IT_MVER-GSV01,IT_MVER-GSV02,IT_MVER-GSV03,IT_MVER-GSV04,
IT_MVER-GSV05,IT_MVER-GSV06,IT_MVER-GSV07,IT_MVER-GSV08, IT_MVER-GSV09,
IT_MVER-GSV10, IT_MVER-GSV11, IT_MVER-GSV12 )
WHERE MATNR = IT_MARC-MATNR AND
WERKS = P_WERKS AND
GJAHR = S_DATE-LOW+0(4).
****How Can I Display Here Plz Help Me Here...
APPEND IT_FINAL.(Final Internal Display Table)
***********what
2007 Oct 15 6:18 AM
<b>loop at it_mver into wa_mver.
move corresponding it_mver to it_final.
endloop.
*OR if you want to display data then...
loop at it_mver into wa_mver.
write:/ wa_MVER-GSV01,
write:/ wa_MVER-GSV02,
.
.
.
..
.
endloop.</b>
2007 Oct 15 7:02 AM
SELECT SINGLE GSV01 GSV02 GSV03 GSV04 GSV05 GSV06 GSV07 GSV08 GSV09
GSV10 GSV11 GSV12
FROM MVER
INTO (IT_MVER-GSV01,IT_MVER-GSV02,IT_MVER-GSV03,IT_MVER-GSV04,
IT_MVER-GSV05,IT_MVER-GSV06,IT_MVER-GSV07,IT_MVER-GSV08, IT_MVER-GSV09,
IT_MVER-GSV10, IT_MVER-GSV11, IT_MVER-GSV12 )
WHERE MATNR = IT_MARC-MATNR AND
WERKS = P_WERKS AND
GJAHR = S_DATE-LOW+0(4).
if date is 01.10.2007
IT_FINAL-consum1 = IT_MVER-GSV08 .
IT_FINAL-consum2= IT_MVER-GSV07 .
IT_FINAL-consum3 = IT_MVER-GSV06 .
APPEND IT_FINAL.
if date is 01.05.2007
IT_FINAL-consum1 = IT_MVER-GSV04 .
IT_FINAL-consum2= IT_MVER-GSV03 .
IT_FINAL-consum3 = IT_MVER-GSV02 .
append it_final.
like wise based on input date i will Show Last Three Monts Consumption Material Form MVER Table Which Stored Data From GSV01....To GSV12.
How Can I write Coading Plz Help Me...Bcz Input Date Varies According To User Requirements..
2007 Oct 15 6:26 AM
Hi Anil,
What u can do is take a variable say f_date of type sy-datum.
And say, the use has input the date in field s_date.
Then, what u can do is as follows :
f_date(4) = s_date(4).
f_date4(2) = s_date4(2) - 3.
f_date+6(2) = '01'.
now in ur select query, u can use where date between f_date and s_date.
Hope it helps.
Regards,
Himanshu
2007 Oct 15 6:26 AM
Hi Anil,
You can write
<b>IT_FINAL. = IT_MVER.
Append IT_FINAL.</b>
to get data into final table and display using
<b>Loop at IT_FINAL.
Write 😕 IT_FINAL.
ENDLOOP.</b>
But I could not find any field in the table where months are stored so as to get data for three months. May I know which field is storing Months details?
Regards,
Amit
2007 Oct 15 6:59 AM
SELECT SINGLE GSV01 GSV02 GSV03 GSV04 GSV05 GSV06 GSV07 GSV08 GSV09
GSV10 GSV11 GSV12
FROM MVER
INTO (IT_MVER-GSV01,IT_MVER-GSV02,IT_MVER-GSV03,IT_MVER-GSV04,
IT_MVER-GSV05,IT_MVER-GSV06,IT_MVER-GSV07,IT_MVER-GSV08, IT_MVER-GSV09,
IT_MVER-GSV10, IT_MVER-GSV11, IT_MVER-GSV12 )
WHERE MATNR = IT_MARC-MATNR AND
WERKS = P_WERKS AND
GJAHR = S_DATE-LOW+0(4).
if date is 01.10.2007
IT_FINAL-consum1 = IT_MVER-GSV08 .
IT_FINAL-consum2= IT_MVER-GSV07 .
IT_FINAL-consum3 = IT_MVER-GSV06 .
APPEND IT_FINAL.
if date is 01.05.2007
IT_FINAL-consum1 = IT_MVER-GSV04 .
IT_FINAL-consum2= IT_MVER-GSV03 .
IT_FINAL-consum3 = IT_MVER-GSV02 .
append it_final.
like wise based on input date i will Show Last Three Monts Consumption Material Form MVER Table Which Stored Data From GSV01....To GSV12.
How Can I write Coading Plz Help Me...Bcz Input Date Varies According To User Requirements..
2007 Oct 15 7:07 AM
Hi Amit,
In this case u can use Field Symbols.
data : month(2) type n,
fname type str,
ctr type i value 1.
FIELD-SYMBOLS <fs>.
Now say if the user entered the date s_date as 01.11.2007.
Then u need to pick up s_date+4(2).
month = s_date+4(2).
do 3 times
month = month - 1.
concatenate 'IT_MVER-GSV' month into str.
condense str no gaps.
assign (str) to <fs>.
case ctr.
when 1.
itab-consum1 = <fs>.
when 2.
itab-consum2 = <fs>.
when 3.
itab-consum3 = <fs>.
endcase.
ctr = ctr + 1.
enddo.
Hope this helps u.
Regards,
Himanshu
2007 Oct 15 8:19 AM
Dear Sir ,
Now I am Writting This Code but It's Not Working ..Plz Help Me Sir..
SELECT SINGLE GSV01 GSV02 GSV03 GSV04 GSV05 GSV06 GSV07 GSV08 GSV09
GSV10 GSV11 GSV12
FROM MVER
INTO (IT_MVER-GSV01,IT_MVER-GSV02,IT_MVER-GSV03,IT_MVER-GSV04,
IT_MVER-GSV05,IT_MVER-GSV06,IT_MVER-GSV07,IT_MVER-GSV08, IT_MVER-GSV09,
IT_MVER-GSV10, IT_MVER-GSV11, IT_MVER-GSV12 )
WHERE MATNR = IT_MARC-MATNR AND
WERKS = P_WERKS AND
GJAHR = S_DATE-LOW+0(4).
*LINE ADDED BY ANIL ON 15.10.2007
month = s_date-LOW+4(2).
do 3 times.
month = month - 1.
concatenate 'IT_MVER-GSV' month into str.
condense str no-gaps.
assign (str) to <fs>.
case ctr.
when 1.
IT_FINAL-consum1 = <fs>.
when 2.
IT_FINAL-consum2 = <fs>.
when 3.
IT_FINAL-consum3 = <fs>.
endcase.
ctr = ctr + 1.
enddo.
2007 Oct 15 10:58 AM
2007 Oct 15 11:02 AM
Hi Anil,
Is it giving u some sort of error or what?
Also, send me ur complete code so that it can be analyzed.
Please explain so that i can help u out.
Regards,
Himanshu
Message was edited by:
Himanshu Aggarwal
2014 Feb 13 4:38 PM
Hi ANILKUMAR
i write you for your help about the topic" How to Display" that you wrote
I wonder if you got the answer because i have the same problem i hope you can help me please thanks.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |