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: 

Simple Program - - - - Help

Former Member
0 Kudos

I am Farooq, working on ABAP in a Tulip IT from abt 3 months & this is my first assignment & frst company on ABAP. Above all, I am the Only guy working on ABAP in the whole company. So I have lot of trouble at work.Pllzz look into the Program below. I am unable to get the data from MKPF table. all SELECT statements r correct. I am getting the data when I debugged. But am unable to show it in the list (Output). May be some Problem in the code after "PERFORM TOP_OF_PAGE. & ULINE."

Plzz gothru this Prog below...

&----


*& Report ZMMSF01

*&

&----


*&

*&

&----


REPORT ZMMSF01 NO STANDARD PAGE HEADING LINE-SIZE 137.

INITIALIZATION.

TABLES : MKPF,

MSEG.

DATA : BEGIN OF ITAB OCCURS 1000,

    • MBLNR LIKE MSEG-MBLNR, "Material Document

MBLNR LIKE MKPF-MBLNR, "Material Document

BUDAT LIKE MKPF-BUDAT, "Posting Date in the Document

    • MATNR LIKE MSEG-MATNR, "Material

    • BWART LIKE MSEG-BWART, "Movement Type

    • WERKS LIKE MSEG-WERKS, "Supplying Plant

    • UMWRK LIKE MSEG-UMWRK, "Receiving plant

END OF ITAB.

DATA : BEGIN OF ITAB1 OCCURS 1000,

    • MBLNR LIKE MKPF-MBLNR, "Material Document

MATNR LIKE MSEG-MATNR, "Material

BWART LIKE MSEG-BWART, "Movement Type

WERKS LIKE MSEG-WERKS, "Supplying Plant

UMWRK LIKE MSEG-UMWRK, "Receiving plant

END OF ITAB1.

DATA : BEGIN OF ITFINAL OCCURS 1000,

MBLNR LIKE MKPF-MBLNR, "Material Document

  • MBLNR LIKE MSEG-MBLNR, "Material Document

MATNR LIKE MSEG-MATNR, "Material

BWART LIKE MSEG-BWART, "Movement Type

WERKS LIKE MSEG-WERKS, "Supplying Plant

UMWRK LIKE MSEG-UMWRK, "Receiving plant

BUDAT LIKE MKPF-BUDAT, "Posting Date in the Document

END OF ITFINAL.

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.

SELECTION-SCREEN SKIP 1.

SELECT-OPTIONS: S_MBLNR FOR MKPF-MBLNR, "Material Document

S_MATNR FOR MSEG-MATNR, "Material

S_BUDAT FOR MKPF-BUDAT, "Posting Date in the Document

S_BWART FOR MSEG-BWART, "Movement Type

S_WERKS FOR MSEG-WERKS, "Supplying Plant

S_UMWRK FOR MSEG-UMWRK. "Receiving plant

SELECTION-SCREEN SKIP 1.

SELECTION-SCREEN END OF BLOCK B1.

AT SELECTION-SCREEN.

ULINE.

START-OF-SELECTION.

SELECT MBLNR BUDAT

FROM MKPF

INTO TABLE ITAB

WHERE MBLNR IN S_MBLNR.

**BREAK-POINT.

if not ITAB[] is INITIAL.

SELECT MATNR BWART WERKS UMWRK

INTO TABLE ITAB1

FROM MSEG FOR ALL ENTRIES in ITAB

WHERE MBLNR EQ ITAB-MBLNR

AND MATNR in S_MATNR

AND BWART in S_BWART

AND WERKS in S_WERKS

AND UMWRK in S_UMWRK.

ENDIF.

*BREAK-POINT.

perform top_of_page.

ULINE.

LOOP AT ITab. "Problem Starts here

ITFINAL-mblnr = ITAB-mblnr.

ITFINAL-budat = ITAB-budat.

ITFINAL-MATNR = ITAB1-MATNR.

ITFINAL-BWART = ITAB1-BWART.

ITFINAL-WERKS = ITAB1-WERKS.

ITFINAL-UMWRK = ITAB1-UMWRK.

APPEND ITFINAL.

CLEAR ITFINAL.

ENDLOOP. "Ends Here

Loop at ITFINAL.

WRITE 😕 '|',(20) ITFINAL-MBLNR, "Material Document

'|',(25) ITFINAL-MATNR, "Material Number

'|',(17) ITFINAL-WERKS, "Supplying Plant

'|',(17) ITFINAL-UMWRK, "Receiving plant

'|',(14) ITFINAL-BWART, "Movement Type

'|',(25) ITFINAL-BUDAT,'|'. "Date Last Goods Movmnt

ULINE.

ENDLOOP.

&----


*& Form top_of_page

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM top_of_page .

ULINE.

WRITE:/ '|',(20) 'Material Document' COLOR 4,

'|',(25) 'Material Number' COLOR 4,

'|',(17) 'Supplying Plant' COLOR 4,

'|',(17) 'Receiving plant' COLOR 4,

'|',(14) 'Movement Type' COLOR 4,

'|',(25) 'Date Last Goods Movmnt' COLOR 4,'|'.

ENDFORM. " top_of_page

1 ACCEPTED SOLUTION

Former Member
0 Kudos

I have modified ur coding just execute & see the output

REPORT ZMMSF01 NO STANDARD PAGE HEADING LINE-SIZE 137.

INITIALIZATION.

TABLES : MKPF,

MSEG.

DATA : BEGIN OF ITAB OCCURS 1000,

    • MBLNR LIKE MSEG-MBLNR, "Material Document

MBLNR LIKE MKPF-MBLNR, "Material Document

BUDAT LIKE MKPF-BUDAT, "Posting Date in the Document

    • MATNR LIKE MSEG-MATNR, "Material

    • BWART LIKE MSEG-BWART, "Movement Type

    • WERKS LIKE MSEG-WERKS, "Supplying Plant

    • UMWRK LIKE MSEG-UMWRK, "Receiving plant

END OF ITAB.

DATA : BEGIN OF ITAB1 OCCURS 1000,

MBLNR LIKE MKPF-MBLNR, "Material Document

MATNR LIKE MSEG-MATNR, "Material

BWART LIKE MSEG-BWART, "Movement Type

WERKS LIKE MSEG-WERKS, "Supplying Plant

UMWRK LIKE MSEG-UMWRK, "Receiving plant

END OF ITAB1.

DATA : BEGIN OF ITFINAL OCCURS 1000,

MBLNR LIKE MKPF-MBLNR, "Material Document

  • MBLNR LIKE MSEG-MBLNR, "Material Document

MATNR LIKE MSEG-MATNR, "Material

BWART LIKE MSEG-BWART, "Movement Type

WERKS LIKE MSEG-WERKS, "Supplying Plant

UMWRK LIKE MSEG-UMWRK, "Receiving plant

BUDAT LIKE MKPF-BUDAT, "Posting Date in the Document

END OF ITFINAL.

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.

SELECTION-SCREEN SKIP 1.

SELECT-OPTIONS: S_MBLNR FOR MKPF-MBLNR, "Material Document

S_MATNR FOR MSEG-MATNR, "Material

S_BUDAT FOR MKPF-BUDAT, "Posting Date in the Document

S_BWART FOR MSEG-BWART, "Movement Type

S_WERKS FOR MSEG-WERKS, "Supplying Plant

S_UMWRK FOR MSEG-UMWRK. "Receiving plant

SELECTION-SCREEN SKIP 1.

SELECTION-SCREEN END OF BLOCK B1.

AT SELECTION-SCREEN.

ULINE.

START-OF-SELECTION.

SELECT MBLNR BUDAT

FROM MKPF

INTO TABLE ITAB

WHERE MBLNR IN S_MBLNR.

BREAK-POINT.

if not ITAB[] is INITIAL.

SELECT mblnr MATNR BWART WERKS UMWRK

INTO TABLE ITAB1

FROM MSEG FOR ALL ENTRIES in ITAB

WHERE MBLNR EQ ITAB-MBLNR

AND MATNR in S_MATNR

AND BWART in S_BWART

AND WERKS in S_WERKS

AND UMWRK in S_UMWRK.

ENDIF.

*BREAK-POINT.

perform top_of_page.

ULINE.

LOOP AT ITab. "Problem Starts here

read table itab1 with key mblnr = itab-mblnr.

ITFINAL-mblnr = ITAB-mblnr.

ITFINAL-budat = ITAB-budat.

ITFINAL-MATNR = ITAB1-MATNR.

ITFINAL-BWART = ITAB1-BWART.

ITFINAL-WERKS = ITAB1-WERKS.

ITFINAL-UMWRK = ITAB1-UMWRK.

APPEND ITFINAL.

CLEAR ITFINAL.

ENDLOOP. "Ends Here

Loop at ITFINAL.

WRITE 😕 '|',(20) ITFINAL-MBLNR, "Material Document

'|',(25) ITFINAL-MATNR, "Material Number

'|',(17) ITFINAL-WERKS, "Supplying Plant

'|',(17) ITFINAL-UMWRK, "Receiving plant

'|',(14) ITFINAL-BWART, "Movement Type

'|',(25) ITFINAL-BUDAT,'|'. "Date Last Goods Movmnt

ULINE.

ENDLOOP.

&----


*& Form top_of_page

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM top_of_page .

ULINE.

WRITE:/ '|',(20) 'Material Document' COLOR 4,

'|',(25) 'Material Number' COLOR 4,

'|',(17) 'Supplying Plant' COLOR 4,

'|',(17) 'Receiving plant' COLOR 4,

'|',(14) 'Movement Type' COLOR 4,

'|',(25) 'Date Last Goods Movmnt' COLOR 4,'|'.

ENDFORM. " top_of_page

11 REPLIES 11

Former Member
0 Kudos

go to debugging mode and click on button contents and press F5 untill the whole report completes so u can able to know where the error is occuring in the code and which part of code is not working.

Former Member
0 Kudos

Hi,

try using the event names before starting any event.

before peform top-of-page,there is no event name ??

try that.

regards,

pankaj singh

Former Member
0 Kudos

LOOP AT ITab. "Problem Starts here

ITFINAL-mblnr = ITAB-mblnr.

ITFINAL-budat = ITAB-budat.

***here you have to read the itab1 table because it is not

****updated here you are looping through itab not itab1.

***try to read the itab1 table here

ITFINAL-MATNR = ITAB1-MATNR.

ITFINAL-BWART = ITAB1-BWART.

ITFINAL-WERKS = ITAB1-WERKS.

ITFINAL-UMWRK = ITAB1-UMWRK.

APPEND ITFINAL.

CLEAR ITFINAL.

ENDLOOP. "Ends Here

Former Member
0 Kudos

LOOP AT ITab. "Problem Starts here

ITFINAL-mblnr = ITAB-mblnr.

ITFINAL-budat = ITAB-budat.

ITFINAL-MATNR = ITAB1-MATNR.

ITFINAL-BWART = ITAB1-BWART.

ITFINAL-WERKS = ITAB1-WERKS.

ITFINAL-UMWRK = ITAB1-UMWRK.

APPEND ITFINAL.

CLEAR ITFINAL.

ENDLOOP. "Ends Here

Change the above code as below.

sort itab by mblnr.

sort itab1 by mblnr.

LOOP AT ITab. "Problem Starts here

ITFINAL-mblnr = ITAB-mblnr.

ITFINAL-budat = ITAB-budat.

read table itab1 with key mblnr = itab-mblnr binary search.

if sy-subrc = 0.

ITFINAL-MATNR = ITAB1-MATNR.

ITFINAL-BWART = ITAB1-BWART.

ITFINAL-WERKS = ITAB1-WERKS.

ITFINAL-UMWRK = ITAB1-UMWRK.

endif.

APPEND ITFINAL.

CLEAR ITFINAL.

ENDLOOP. "Ends Here

Former Member
0 Kudos

Hi ,

Please look at the code and the comments i have added

ITFINAL-mblnr = ITAB-mblnr.
ITFINAL-budat = ITAB-budat.
ITFINAL-MATNR = ITAB1-MATNR.       " How do you get the value in itab1
ITFINAL-BWART = ITAB1-BWART.      " How do you get the value in itab1
ITFINAL-WERKS = ITAB1-WERKS.     " How do you get the value in itab1
ITFINAL-UMWRK = ITAB1-UMWRK " How do you get the value in itab1

.

So i feel you must be gettin values od mblnr and budat , but not the other fields.

Regards

Arun

Former Member
0 Kudos

&----


*& Report ZMMSF01

*&

&----


*&

*&

&----


REPORT ZMMSF01 NO STANDARD PAGE HEADING LINE-SIZE 137.

INITIALIZATION.

TABLES : MKPF,

MSEG.

DATA : BEGIN OF ITAB OCCURS 1000,

    • MBLNR LIKE MSEG-MBLNR, "Material Document

MBLNR LIKE MKPF-MBLNR, "Material Document

BUDAT LIKE MKPF-BUDAT, "Posting Date in the Document

    • MATNR LIKE MSEG-MATNR, "Material

    • BWART LIKE MSEG-BWART, "Movement Type

    • WERKS LIKE MSEG-WERKS, "Supplying Plant

    • UMWRK LIKE MSEG-UMWRK, "Receiving plant

END OF ITAB.

DATA : BEGIN OF ITAB1 OCCURS 1000,

    • MBLNR LIKE MKPF-MBLNR, "Material Document

MATNR LIKE MSEG-MATNR, "Material

BWART LIKE MSEG-BWART, "Movement Type

WERKS LIKE MSEG-WERKS, "Supplying Plant

UMWRK LIKE MSEG-UMWRK, "Receiving plant

END OF ITAB1.

DATA : BEGIN OF ITFINAL OCCURS 1000,

MBLNR LIKE MKPF-MBLNR, "Material Document

  • MBLNR LIKE MSEG-MBLNR, "Material Document

MATNR LIKE MSEG-MATNR, "Material

BWART LIKE MSEG-BWART, "Movement Type

WERKS LIKE MSEG-WERKS, "Supplying Plant

UMWRK LIKE MSEG-UMWRK, "Receiving plant

BUDAT LIKE MKPF-BUDAT, "Posting Date in the Document

END OF ITFINAL.

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.

SELECTION-SCREEN SKIP 1.

SELECT-OPTIONS: S_MBLNR FOR MKPF-MBLNR, "Material Document

S_MATNR FOR MSEG-MATNR, "Material

S_BUDAT FOR MKPF-BUDAT, "Posting Date in the Document

S_BWART FOR MSEG-BWART, "Movement Type

S_WERKS FOR MSEG-WERKS, "Supplying Plant

S_UMWRK FOR MSEG-UMWRK. "Receiving plant

SELECTION-SCREEN SKIP 1.

SELECTION-SCREEN END OF BLOCK B1.

AT SELECTION-SCREEN.

ULINE.

START-OF-SELECTION.

SELECT MBLNR BUDAT

FROM MKPF

INTO TABLE ITAB

WHERE MBLNR IN S_MBLNR.

**BREAK-POINT.

if not ITAB[] is INITIAL.

SELECT MATNR BWART WERKS UMWRK

INTO TABLE ITAB1

FROM MSEG FOR ALL ENTRIES in ITAB

WHERE MBLNR EQ ITAB-MBLNR

AND MATNR in S_MATNR

AND BWART in S_BWART

AND WERKS in S_WERKS

AND UMWRK in S_UMWRK.

ENDIF.

*BREAK-POINT.

LOOP AT ITab. "Problem Starts here

ITFINAL-mblnr = ITAB-mblnr.

ITFINAL-budat = ITAB-budat.

ITFINAL-MATNR = ITAB1-MATNR.

ITFINAL-BWART = ITAB1-BWART.

ITFINAL-WERKS = ITAB1-WERKS.

ITFINAL-UMWRK = ITAB1-UMWRK.

APPEND ITFINAL.

CLEAR ITFINAL.

ENDLOOP. "Ends Here

Loop at ITFINAL.

WRITE 😕 '|',(20) ITFINAL-MBLNR, "Material Document

'|',(25) ITFINAL-MATNR, "Material Number

'|',(17) ITFINAL-WERKS, "Supplying Plant

'|',(17) ITFINAL-UMWRK, "Receiving plant

'|',(14) ITFINAL-BWART, "Movement Type

'|',(25) ITFINAL-BUDAT,'|'. "Date Last Goods Movmnt

ULINE.

ENDLOOP.

<b>top-of-page.</b>

perform top_of_page.

LINE.

&----


*& Form top_of_page

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM top_of_page .

ULINE.

WRITE:/ '|',(20) 'Material Document' COLOR 4,

'|',(25) 'Material Number' COLOR 4,

'|',(17) 'Supplying Plant' COLOR 4,

'|',(17) 'Receiving plant' COLOR 4,

'|',(14) 'Movement Type' COLOR 4,

'|',(25) 'Date Last Goods Movmnt' COLOR 4,'|'.

ENDFORM. " top_of_page

top-of-page is a event for triggering top of page..

Reward if usefull..

Former Member
0 Kudos

Hi

In this part..

LOOP AT ITab. "Problem Starts here

ITFINAL-mblnr = ITAB-mblnr.

ITFINAL-budat = ITAB-budat.

ITFINAL-MATNR = ITAB1-MATNR.

ITFINAL-BWART = ITAB1-BWART.

ITFINAL-WERKS = ITAB1-WERKS.

ITFINAL-UMWRK = ITAB1-UMWRK.

APPEND ITFINAL.

CLEAR ITFINAL.

ENDLOOP. "Ends Here

U are not reading the entries of ITAB1. U need to read the data of ITAB1 using a read statement.

Rgds,

Prakash

Former Member
0 Kudos

I have modified ur coding just execute & see the output

REPORT ZMMSF01 NO STANDARD PAGE HEADING LINE-SIZE 137.

INITIALIZATION.

TABLES : MKPF,

MSEG.

DATA : BEGIN OF ITAB OCCURS 1000,

    • MBLNR LIKE MSEG-MBLNR, "Material Document

MBLNR LIKE MKPF-MBLNR, "Material Document

BUDAT LIKE MKPF-BUDAT, "Posting Date in the Document

    • MATNR LIKE MSEG-MATNR, "Material

    • BWART LIKE MSEG-BWART, "Movement Type

    • WERKS LIKE MSEG-WERKS, "Supplying Plant

    • UMWRK LIKE MSEG-UMWRK, "Receiving plant

END OF ITAB.

DATA : BEGIN OF ITAB1 OCCURS 1000,

MBLNR LIKE MKPF-MBLNR, "Material Document

MATNR LIKE MSEG-MATNR, "Material

BWART LIKE MSEG-BWART, "Movement Type

WERKS LIKE MSEG-WERKS, "Supplying Plant

UMWRK LIKE MSEG-UMWRK, "Receiving plant

END OF ITAB1.

DATA : BEGIN OF ITFINAL OCCURS 1000,

MBLNR LIKE MKPF-MBLNR, "Material Document

  • MBLNR LIKE MSEG-MBLNR, "Material Document

MATNR LIKE MSEG-MATNR, "Material

BWART LIKE MSEG-BWART, "Movement Type

WERKS LIKE MSEG-WERKS, "Supplying Plant

UMWRK LIKE MSEG-UMWRK, "Receiving plant

BUDAT LIKE MKPF-BUDAT, "Posting Date in the Document

END OF ITFINAL.

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.

SELECTION-SCREEN SKIP 1.

SELECT-OPTIONS: S_MBLNR FOR MKPF-MBLNR, "Material Document

S_MATNR FOR MSEG-MATNR, "Material

S_BUDAT FOR MKPF-BUDAT, "Posting Date in the Document

S_BWART FOR MSEG-BWART, "Movement Type

S_WERKS FOR MSEG-WERKS, "Supplying Plant

S_UMWRK FOR MSEG-UMWRK. "Receiving plant

SELECTION-SCREEN SKIP 1.

SELECTION-SCREEN END OF BLOCK B1.

AT SELECTION-SCREEN.

ULINE.

START-OF-SELECTION.

SELECT MBLNR BUDAT

FROM MKPF

INTO TABLE ITAB

WHERE MBLNR IN S_MBLNR.

BREAK-POINT.

if not ITAB[] is INITIAL.

SELECT mblnr MATNR BWART WERKS UMWRK

INTO TABLE ITAB1

FROM MSEG FOR ALL ENTRIES in ITAB

WHERE MBLNR EQ ITAB-MBLNR

AND MATNR in S_MATNR

AND BWART in S_BWART

AND WERKS in S_WERKS

AND UMWRK in S_UMWRK.

ENDIF.

*BREAK-POINT.

perform top_of_page.

ULINE.

LOOP AT ITab. "Problem Starts here

read table itab1 with key mblnr = itab-mblnr.

ITFINAL-mblnr = ITAB-mblnr.

ITFINAL-budat = ITAB-budat.

ITFINAL-MATNR = ITAB1-MATNR.

ITFINAL-BWART = ITAB1-BWART.

ITFINAL-WERKS = ITAB1-WERKS.

ITFINAL-UMWRK = ITAB1-UMWRK.

APPEND ITFINAL.

CLEAR ITFINAL.

ENDLOOP. "Ends Here

Loop at ITFINAL.

WRITE 😕 '|',(20) ITFINAL-MBLNR, "Material Document

'|',(25) ITFINAL-MATNR, "Material Number

'|',(17) ITFINAL-WERKS, "Supplying Plant

'|',(17) ITFINAL-UMWRK, "Receiving plant

'|',(14) ITFINAL-BWART, "Movement Type

'|',(25) ITFINAL-BUDAT,'|'. "Date Last Goods Movmnt

ULINE.

ENDLOOP.

&----


*& Form top_of_page

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM top_of_page .

ULINE.

WRITE:/ '|',(20) 'Material Document' COLOR 4,

'|',(25) 'Material Number' COLOR 4,

'|',(17) 'Supplying Plant' COLOR 4,

'|',(17) 'Receiving plant' COLOR 4,

'|',(14) 'Movement Type' COLOR 4,

'|',(25) 'Date Last Goods Movmnt' COLOR 4,'|'.

ENDFORM. " top_of_page

Former Member
0 Kudos

hi try this its workin here.

INITIALIZATION.

TABLES : MKPF,

MSEG.

DATA : BEGIN OF ITAB OCCURS 1000,

*MBLNR LIKE MSEG-MBLNR, "Material Document

MBLNR LIKE MKPF-MBLNR, "Material Document

BUDAT LIKE MKPF-BUDAT, "Posting Date in the Document

    • MATNR LIKE MSEG-MATNR, "Material

    • BWART LIKE MSEG-BWART, "Movement Type

    • WERKS LIKE MSEG-WERKS, "Supplying Plant

    • UMWRK LIKE MSEG-UMWRK, "Receiving plant

END OF ITAB.

DATA : BEGIN OF ITAB1 OCCURS 1000,

<b> MBLNR LIKE MKPF-MBLNR, "Material Document</b>

MATNR LIKE MSEG-MATNR, "Material

BWART LIKE MSEG-BWART, "Movement Type

WERKS LIKE MSEG-WERKS, "Supplying Plant

UMWRK LIKE MSEG-UMWRK, "Receiving plant

END OF ITAB1.

DATA : BEGIN OF ITFINAL OCCURS 1000,

MBLNR LIKE MKPF-MBLNR, "Material Document

  • MBLNR LIKE MSEG-MBLNR, "Material Document

MATNR LIKE MSEG-MATNR, "Material

BWART LIKE MSEG-BWART, "Movement Type

WERKS LIKE MSEG-WERKS, "Supplying Plant

UMWRK LIKE MSEG-UMWRK, "Receiving plant

BUDAT LIKE MKPF-BUDAT, "Posting Date in the Document

END OF ITFINAL.

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.

SELECTION-SCREEN SKIP 1.

SELECT-OPTIONS: S_MBLNR FOR MKPF-MBLNR, "Material Document

S_MATNR FOR MSEG-MATNR, "Material

S_BUDAT FOR MKPF-BUDAT, "Posting Date in the Document

S_BWART FOR MSEG-BWART, "Movement Type

S_WERKS FOR MSEG-WERKS, "Supplying Plant

S_UMWRK FOR MSEG-UMWRK. "Receiving plant

SELECTION-SCREEN SKIP 1.

SELECTION-SCREEN END OF BLOCK B1.

AT SELECTION-SCREEN.

ULINE.

START-OF-SELECTION.

SELECT MBLNR BUDAT

FROM MKPF

INTO TABLE ITAB

WHERE MBLNR IN S_MBLNR.

**BREAK-POINT.

if not ITAB[] is INITIAL.

SELECT mblnr MATNR BWART WERKS UMWRK

INTO TABLE ITAB1

FROM MSEG FOR ALL ENTRIES in ITAB

WHERE MBLNR EQ ITAB-MBLNR

AND MATNR in S_MATNR

AND BWART in S_BWART

AND WERKS in S_WERKS

AND UMWRK in S_UMWRK.

ENDIF.

*BREAK-POINT.

perform top_of_page.

ULINE.

LOOP AT ITab. "Problem Starts here

<b>READ TABLE ITAB1 WITH KEY MBLNR = ITAB-MBLNR.</b>

ITFINAL-mblnr = ITAB-mblnr.

ITFINAL-budat = ITAB-budat.

ITFINAL-MATNR = ITAB1-MATNR.

ITFINAL-BWART = ITAB1-BWART.

ITFINAL-WERKS = ITAB1-WERKS.

ITFINAL-UMWRK = ITAB1-UMWRK.

APPEND ITFINAL.

CLEAR ITFINAL.

ENDLOOP. "Ends Here

Loop at ITFINAL.

WRITE 😕 '|',(20) ITFINAL-MBLNR, "Material Document

'|',(25) ITFINAL-MATNR, "Material Number

'|',(17) ITFINAL-WERKS, "Supplying Plant

'|',(17) ITFINAL-UMWRK, "Receiving plant

'|',(14) ITFINAL-BWART, "Movement Type

'|',(25) ITFINAL-BUDAT,'|'. "Date Last Goods Movmnt

ULINE.

ENDLOOP.

&----


*& Form top_of_page

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM top_of_page .

ULINE.

WRITE:/ '|',(20) 'Material Document' COLOR 4,

'|',(25) 'Material Number' COLOR 4,

'|',(17) 'Supplying Plant' COLOR 4,

'|',(17) 'Receiving plant' COLOR 4,

'|',(14) 'Movement Type' COLOR 4,

'|',(25) 'Date Last Goods Movmnt' COLOR 4,'|'.

ENDFORM. " top_of_page

Message was edited by:

Usman Sheriff

Former Member
0 Kudos

HI,

U are assiging values of yable ITAB1 inside ITAB loop, so u are not getting values from ITAB,

Solu use a loop inside loop or a read stmt inside the ITAB loop to read the values from the ITAB1 table for every material no in ITAB.

Regards,

VAibhav B GAwlai.

&----


*& Report ZMMSF01

*&

&----


*&

*&

&----


REPORT ZMMSF01 NO STANDARD PAGE HEADING LINE-SIZE 137.

INITIALIZATION.

TABLES : MKPF,

MSEG.

DATA : BEGIN OF ITAB OCCURS 1000,

    • MBLNR LIKE MSEG-MBLNR, "Material Document

MBLNR LIKE MKPF-MBLNR, "Material Document

BUDAT LIKE MKPF-BUDAT, "Posting Date in the Document

    • MATNR LIKE MSEG-MATNR, "Material

    • BWART LIKE MSEG-BWART, "Movement Type

    • WERKS LIKE MSEG-WERKS, "Supplying Plant

    • UMWRK LIKE MSEG-UMWRK, "Receiving plant

END OF ITAB.

DATA : BEGIN OF ITAB1 OCCURS 1000,

MBLNR LIKE MKPF-MBLNR, "Material Document " Added by Vaibhav

MATNR LIKE MSEG-MATNR, "Material

BWART LIKE MSEG-BWART, "Movement Type

WERKS LIKE MSEG-WERKS, "Supplying Plant

UMWRK LIKE MSEG-UMWRK, "Receiving plant

END OF ITAB1.

DATA : BEGIN OF ITFINAL OCCURS 1000,

MBLNR LIKE MKPF-MBLNR, "Material Document

  • MBLNR LIKE MSEG-MBLNR, "Material Document

MATNR LIKE MSEG-MATNR, "Material

BWART LIKE MSEG-BWART, "Movement Type

WERKS LIKE MSEG-WERKS, "Supplying Plant

UMWRK LIKE MSEG-UMWRK, "Receiving plant

BUDAT LIKE MKPF-BUDAT, "Posting Date in the Document

END OF ITFINAL.

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.

SELECTION-SCREEN SKIP 1.

SELECT-OPTIONS: S_MBLNR FOR MKPF-MBLNR, "Material Document

S_MATNR FOR MSEG-MATNR, "Material

S_BUDAT FOR MKPF-BUDAT, "Posting Date in the Document

S_BWART FOR MSEG-BWART, "Movement Type

S_WERKS FOR MSEG-WERKS, "Supplying Plant

S_UMWRK FOR MSEG-UMWRK. "Receiving plant

SELECTION-SCREEN SKIP 1.

SELECTION-SCREEN END OF BLOCK B1.

AT SELECTION-SCREEN.

ULINE.

START-OF-SELECTION.

SELECT MBLNR BUDAT

FROM MKPF

INTO TABLE ITAB

WHERE MBLNR IN S_MBLNR.

**BREAK-POINT.

if not ITAB[] is INITIAL.

SELECT mblnr MATNR BWART WERKS UMWRK

INTO TABLE ITAB1

FROM MSEG FOR ALL ENTRIES in ITAB

WHERE MBLNR EQ ITAB-MBLNR

AND MATNR in S_MATNR

AND BWART in S_BWART

AND WERKS in S_WERKS

AND UMWRK in S_UMWRK.

ENDIF.

*BREAK-POINT.

perform top_of_page.

ULINE.

LOOP AT ITab. "Problem Starts here

ITFINAL-mblnr = ITAB-mblnr.

ITFINAL-budat = ITAB-budat.

loop at itab1 where mblnr eq itab-mblnr. "Vaibhav

ITFINAL-MATNR = ITAB1-MATNR.

ITFINAL-BWART = ITAB1-BWART.

ITFINAL-WERKS = ITAB1-WERKS.

ITFINAL-UMWRK = ITAB1-UMWRK.

APPEND ITFINAL.

CLEAR ITFINAL.

endloop. "Vaibhav

ENDLOOP. "Ends Here

Loop at ITFINAL.

WRITE 😕 '|',(20) ITFINAL-MBLNR, "Material Document

'|',(25) ITFINAL-MATNR, "Material Number

'|',(17) ITFINAL-WERKS, "Supplying Plant

'|',(17) ITFINAL-UMWRK, "Receiving plant

'|',(14) ITFINAL-BWART, "Movement Type

'|',(25) ITFINAL-BUDAT,'|'. "Date Last Goods Movmnt

ULINE.

ENDLOOP.

&----


*& Form top_of_page

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM top_of_page .

ULINE.

WRITE:/ '|',(20) 'Material Document' COLOR 4,

'|',(25) 'Material Number' COLOR 4,

'|',(17) 'Supplying Plant' COLOR 4,

'|',(17) 'Receiving plant' COLOR 4,

'|',(14) 'Movement Type' COLOR 4,

'|',(25) 'Date Last Goods Movmnt' COLOR 4,'|'.

ENDFORM. " top_of_page

Modified ur code .

Regards,

Vaibhav

Former Member
0 Kudos

Dear All,

<b>Thanks a lot</b> for ur responses. I am overwhelmed to see all ur responses. Its Really gr88*. Responses from Ms.Kalpana, Mr.Usman, Mr.Vaibhav completely served my Purpose. Also I got to know other things from other's responses. again I wish u all a very heart felt Thanks.

Best Regards.

Farooq