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

How to Display.

Former Member
0 Likes
1,503

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

10 REPLIES 10
Read only

Former Member
0 Likes
1,441

<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>

Read only

0 Likes
1,441

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..

Read only

Former Member
0 Likes
1,441

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

Read only

Former Member
0 Likes
1,441

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

Read only

0 Likes
1,441

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..

Read only

0 Likes
1,441

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

Read only

0 Likes
1,441

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.

Read only

0 Likes
1,441

Hello Sir,

Plz Solve My queris..

Read only

0 Likes
1,441

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

Read only

Former Member
0 Likes
1,441

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.