Go on link..

link us with ...

Thursday, December 30, 2010

Report for printing the reservation

REPORT ZVVF_MR047_RESPRINT
NO STANDARD PAGE HEADING LINE-COUNT 27(6) line-size 170
.

*---------------------------------------------------------------------*
* Report ZVVF_MR047_RESPRINT *
*---------------------------------------------------------------------*
* *
* MODULE : Material Management *
* *
*---------------------------------------------------------------------*
* Objective : Report for printing the reservation *
*
* *
* Program : Update Tables( ) Download Data( ) Outputs List (X) *
* Technical Specs No : *
* Date Created : *
* Author : *
* Location : *
* LDB : *
*---------------------------------------------------------------------*



*---------------------------------------------------------------------*
* Tables *
*---------------------------------------------------------------------*
Tables : rkpf,
resb.
*----------------------------------------------------------------------*
*Types *
*----------------------------------------------------------------------*
TYPES : BEGIN OF TY_DATA,
RSNUM LIKE RKPF-RSNUM,
USNAM LIKE RKPF-USNAM,
KOSTL LIKE RKPF-KOSTL,
AUFNR LIKE RKPF-AUFNR,
ANLN1 LIKE RKPF-ANLN1,
MATNR LIKE RESB-MATNR,
MAKTX LIKE MAKT-MAKTX,
LGORT LIKE RESB-LGORT,
BDMNG LIKE RESB-BDMNG,
MEINS LIKE RESB-MEINS,
CHARG LIKE RESB-CHARG,
BDTER LIKE RESB-BDTER,
SGTXT LIKE RESB-SGTXT,
END OF TY_DATA.

TYPES : BEGIN OF TY_MAKT,
MATNR LIKE MARA-MATNR,
MAKTX LIKE MAKT-MAKTX,
END OF TY_MAKT.

*---------------------------------------------------------------------*
* INTERNAL TABLE Begin with IT *
*---------------------------------------------------------------------*

DATA : IT_DATA type standard table of TY_DATA WITH HEADER LINE.
DATA : IT_MAKT TYPE STANDARD TABLE OF TY_MAKT WITH HEADER LINE.

*---------------------------------------------------------------------*
* WORK AREAS Begin with WA *
*---------------------------------------------------------------------*


*----------------------------------------------------------------------*
*Constants Begin with C_
*----------------------------------------------------------------------*


*---------------------------------------------------------------------*
* Data Variables Begin with w_
*
*---------------------------------------------------------------------*

DATA:W_TABIX(2) TYPE C.
DATA:W_AUFNR LIKE RKPF-AUFNR.
DATA:W_KOSTL LIKE RKPF-KOSTL.
DATA:W_ANLN1 LIKE RKPF-ANLN1.
DATA:W_MATNR(18) TYPE C.
DATA:W_LGORT(6) TYPE C.
DATA:W_MEINS(7) TYPE C.


*---------------------------------------------------------------------*
* parameters *
*---------------------------------------------------------------------*
selection-screen begin of block b1 with frame title text-002.
Parameters : pr_rsnum type resb-rsnum obligatory.
selection-screen end of block b1.


*---------------------------------------------------------------------*
* Select-options *
*---------------------------------------------------------------------*



*---------------------------------------------------------------------*
* INITIALIZATION *
*---------------------------------------------------------------------*

INITIALIZATION.



*---------------------------------------------------------------------*
* AT SELECTION-SCREEN output.
*---------------------------------------------------------------------*

At Selection-screen output .


*---------------------------------------------------------------------*
* At selection screen *
*---------------------------------------------------------------------*

At Selection-screen.

PERFORM F004_VALIDATE.



*---------------------------------------------------------------------*
* START-OF-SELECTION *
*---------------------------------------------------------------------*


START-OF-SELECTION .

PERFORM F001_GETDATA.


*---------------------------------------------------------------------*
* END-OF-SELECTION *
*---------------------------------------------------------------------*

END-OF-SELECTION.

*----------------------------------------------------------------------*
* TOP-OF-PAGE *
*----------------------------------------------------------------------*
TOP-OF-PAGE.

PERFORM F002_HEAD.

*----------------------------------------------------------------------*
* TOP-OF-PAGE *
*----------------------------------------------------------------------*
END-OF-PAGE.

PERFORM F003_END.

*&---------------------------------------------------------------------*
*& Form F001_GETDATA
*&---------------------------------------------------------------------*
FORM F001_GETDATA .


SELECT MATNR MAKTX INTO CORRESPONDING FIELDS OF TABLE IT_MAKT
FROM MAKT
FOR ALL ENTRIES IN IT_DATA
WHERE MATNR = IT_DATA-MATNR.

IF SY-SUBRC = 0.
ENDIF.
LOOP AT IT_DATA.
READ TABLE IT_MAKT WITH KEY MATNR = IT_DATA-MATNR.
IF SY-SUBRC = 0.
IT_DATA-MAKTX = IT_MAKT-MAKTX.
MODIFY IT_DATA TRANSPORTING MAKTX.
ENDIF.
ENDLOOP.


LOOP AT IT_DATA.
SHIFT IT_DATA-MATNR LEFT DELETING LEADING '0'.

W_MATNR = IT_DATA-MATNR.
W_LGORT = IT_DATA-LGORT.
W_MEINS = IT_DATA-MEINS.
W_TABIX = SY-TABIX.
WRITE : /3 sy-vline,
4 W_TABIX CENTERED,
7 sy-vline,
8 W_MATNR CENTERED,
26 sy-vline,
27 IT_DATA-MAKTX LEFT-JUSTIFIED,
67 sy-vline,
68 W_LGORT CENTERED,
74 sy-vline,
75 IT_DATA-BDMNG RIGHT-JUSTIFIED,
90 sy-vline,
91 W_MEINS CENTERED,
97 sy-vline,
98 IT_DATA-CHARG CENTERED,
109 sy-vline,
110 IT_DATA-BDTER CENTERED,
120 sy-vline,
121 IT_DATA-SGTXT LEFT-JUSTIFIED,
170 sy-vline.


* IF IT_DATA-MATNR+9(9) IS NOT INITIAL OR
* IT_DATA-MAKTX+15(15) IS NOT INITIAL OR
* IT_DATA-SGTXT+10(10) IS NOT INITIAL.


*IF IT_DATA-MAKTX+30(10) IS NOT INITIAL OR
* IT_DATA-SGTXT+20(10) IS NOT INITIAL.
*
* WRITE : /1 sy-vline,
* 5 SY-VLINE,
* 15 sy-vline,
* 16 IT_DATA-MAKTX+30(10),
* 31 SY-VLINE,
* 36 SY-VLINE,
* 50 SY-VLINE,
* 55 SY-VLINE,
* 66 SY-VLINE,
* 77 SY-VLINE,
* 78 IT_DATA-SGTXT+20(10) CENTERED,
* 87 SY-VLINE.
*
* ENDIF.
*IF IT_DATA-SGTXT+30(10) IS NOT INITIAL.
*
* WRITE : /1 sy-vline,
* 5 SY-VLINE,
* 15 sy-vline,
* 31 SY-VLINE,
* 36 SY-VLINE,
* 50 SY-VLINE,
* 55 SY-VLINE,
* 66 SY-VLINE,
* 77 SY-VLINE,
* 78 IT_DATA-SGTXT+30(10) CENTERED,
* 87 SY-VLINE.
*
* ENDIF.
*IF IT_DATA-SGTXT+40(10) IS NOT INITIAL.
*
* WRITE : /1 sy-vline,
* 5 SY-VLINE,
* 15 sy-vline,
* 31 SY-VLINE,
* 36 SY-VLINE,
* 50 SY-VLINE,
* 55 SY-VLINE,
* 66 SY-VLINE,
* 77 SY-VLINE,
* 78 IT_DATA-SGTXT+40(10) CENTERED,
* 87 SY-VLINE.
*
* ENDIF.
*

ULINE AT /3(170).
ENDLOOP.

IF SY-LINNO < 21.
SKIP TO LINE 22.
ENDIF.
ENDFORM. " F001_GETDATA
*&---------------------------------------------------------------------*
*& Form F002_HEAD
*&---------------------------------------------------------------------*
FORM F002_HEAD .

FORMAT COLOR 1 INTENSIFIED OFF.

WRITE : /3(170) 'VVF LIMITED' CENTERED.
WRITE : /3(170) 'Material Requisition Note / Reservation Slip' CENTERED.

SHIFT PR_RSNUM LEFT DELETING LEADING '0'.

FORMAT RESET.
skip 1.
write : /5 'Material Requisition / Reservation No :',pr_rsnum,80
'Date :', sy-datum.
IF W_AUFNR IS NOT initial.

write : 130 'Order No :', w_aufnr.

ELSEIF W_KOSTL IS NOT initial.

write : 130 'Cost Center :', w_kostl.


ELSE.
write : 130 'Asset No :', w_anln1.


endif.
SKIP 1.
ULINE AT 3(170).

WRITE : /3 sy-vline, 4(3) 'SNO' CENTERED,7
sy-vline, 8(18) 'MATERIAL' CENTERED,26
sy-vline, 27(40) 'MATERIAL DESCRIPTION' CENTERED,67
sy-vline, 68(6) 'STO' CENTERED,74
sy-vline, 75(15) 'QTY' CENTERED,90
sy-vline, 91(6) 'UOM' CENTERED,97
sy-vline, 98(11) 'BATCH NO' CENTERED,109
sy-vline, 110(10) 'REQ DATE' CENTERED,120
sy-vline, 121(50) 'REMARKS' CENTERED,170
sy-vline.

WRITE : /3 sy-vline, 7
sy-vline, 26
sy-vline, 67
sy-vline, 68(6) 'LOC' CENTERED,74
sy-vline, 75(15) 'REQUIRED' CENTERED,90
sy-vline, 91(6) ' ' CENTERED,97
sy-vline, 98(11) ' ' CENTERED,109
sy-vline, 110(10) 'IN RESERVN' CENTERED,120
sy-vline, 121(50) ' ' CENTERED,170
sy-vline.


ULINE AT /3(170).

ENDFORM. " F002_HEAD
*&---------------------------------------------------------------------*
*& Form F003_END
*&---------------------------------------------------------------------*
FORM F003_END .
SKIP 1.
ULINE AT 3(170).

WRITE : /3 sy-vline, 4(70) IT_DATA-USNAM CENTERED,74
sy-vline, 75(79) ' ' CENTERED,170
sy-vline.
ULINE AT /3(170).

WRITE : /3 sy-vline, 4(70) 'CREATED BY ' CENTERED,74
sy-vline, 75(79) ' ' CENTERED,170
sy-vline.

ULINE AT /3(170).


ENDFORM. " F003_END

*&---------------------------------------------------------------------*
*& Form F004_VALIDATE
*&---------------------------------------------------------------------*

FORM F004_VALIDATE .

SELECT P~RSNUM P~KOSTL P~AUFNR P~ANLN1 P~USNAM
Q~MATNR Q~LGORT Q~BDMNG Q~MEINS Q~CHARG Q~BDTER Q~SGTXT
INTO CORRESPONDING FIELDS OF TABLE IT_DATA
FROM RKPF AS P INNER JOIN RESB AS Q
ON P~RSNUM = Q~RSNUM
WHERE P~RSNUM = PR_RSNUM.

IF SY-SUBRC NE 0.
MESSAGE E000(ZVVF_MESSAGE047).
endif.

IF SY-SUBRC = 0.
READ TABLE IT_DATA INDEX 1.
IF SY-SUBRC = 0.
W_AUFNR = IT_DATA-AUFNR.
W_KOSTL = IT_DATA-KOSTL.
W_ANLN1 = IT_DATA-ANLN1.
ENDIF.
ENDIF.

ENDFORM. " F004_VALIDATE

No comments:

link us...

For Visitors

if you want to publish or Add something on ERP, SAP , SAP FUNCTIONAL, SAP ABAP then mail us along with your email-id. contain must be yours

email-id :- avinashkr_raj@yahoo.com(any email)

email-id :- avinaskr_raj.abap@blogger.com ( use only gmail)