Go on link..

link us with ...

Thursday, December 30, 2010

program for Rebate Calculation For GSM Differences

*&---------------------------------------------------------------------*
*& Report ZVVF_MR035_REBATE *
*& *
*&---------------------------------------------------------------------*

REPORT ZVVF_MR035_REBATE no standard page heading line-size 110
MESSAGE-ID ZMM .

*----------------------------------------------------------------------
** Module Sales *
*----------------------------------------------------------------------
** Objective: program for Rebate Calculation For GSM Differences
** Program : Updates tables ( ) Download data ( )
** Output Lists (X) ALV
**
** Technical Spec No :
** Date Created :
** Author :
** Location :
**---------------------------------------------------------------------*
* External Dependencies
**---------------------------------------------------------------------*
*
**---------------------------------------------------------------------*
* Amendment History
**---------------------------------------------------------------------*
* Who Change ID Reason
*** ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
*---------------------------------------------------------------------**
* Type-pools
*----------------------------------------------------------------------*
TYPE-POOLS : slis.
*---------------------------------------------------------------------*
**TABLES :
*---------------------------------------------------------------------*
Tables : QALS, "Inspection lot record
QAMV, "Characteristic specifications for inspection processing
QAMR, "Characteristic results during inspection processing
RBKP, "Document Header: Invoice Receipt
RSEG, "Document Item: Incoming Invoice
MSEG, "Document Segment: Material
BKPF, "Accounting Document Header
MARC, "Plant Data for Material
ZVVF_MT035_MATNR, "Material Characteristics Tolerance
ZVVF_MT035_PODAT, "Rebate Calculation Table
ZVVF_MT035_BLART. "Document Types Vs Plant
*---------------------------------------------------------------------*
**TYPES :
*---------------------------------------------------------------------*

*---------------------------------------------------------------------*
**CONSTANTS :
*---------------------------------------------------------------------*
*--- For ALV ----*
CONSTANTS: c_top_of_page_db TYPE slis_formname VALUE 'TOP_OF_PAGE_DB'.
*---------------------------------------------------------------------*
**DATA :
*---------------------------------------------------------------------*
DATA : W_AMT_DEB LIKE ZVVF_MT035_PODAT-AMT_DEB,
W_MENGE_CHR LIKE ZVVF_MT035_PODAT-MENGE_CHR,
W_MENGE_temp LIKE ZVVF_MT035_PODAT-MENGE_CHR,
W_repid LIKE sy-repid, " For ALV
W_AWKEY LIKE BKPF-AWKEY,
W_ANS type n,
W_TEMP LIKE MARA-MATNR,
w_value type p decimals 2 .
*---------------------------------------------------------------------*
**INTERNAL TABLES :
*---------------------------------------------------------------------*
*--- For ALV ----*
DATA: it_list_top_of_page TYPE slis_t_listheader,
it_events TYPE slis_t_event,
it_fieldcat TYPE slis_t_fieldcat_alv.
*---------------*
DATA: IT_PODAT TYPE TABLE OF ZVVF_MT035_PODAT WITH HEADER LINE.
DATA: IT_matnr TYPE TABLE OF ZVVF_MT035_matnr WITH HEADER LINE.


DATA: begin of it_RSEG occurs 0,
BELNR like RBKP-BELNR,
BLDAT like RBKP-BLDAT,
GJAHR like RBKP-GJAHR,
RMWWR like RBKP-RMWWR,
waers like RBKP-waers,
BUZEI like RSEG-BUZEI,
EBELN like RSEG-EBELN,
EBELP like RSEG-EBELP,
MATNR like RSEG-MATNR,
MENGE_I like RSEG-MENGE,
BUKRS LIKE RSEG-BUKRS,
PRUEFLOS like QALS-PRUEFLOS,
MBLNR like QALS-MBLNR,
MJAHR like QALS-MJAHR,
ZEILE like QALS-ZEILE,
WERKS like QALS-WERK,
LIFNR like QALS-LIFNR,
end of it_RSEG .



DATA: begin of it_MSEG occurs 0,
MBLNR like MSEG-MBLNR,
MJAHR like MSEG-MJAHR,
ZEILE like MSEG-ZEILE,
MATNR like MSEG-MATNR,
MENGE like MSEG-MENGE,
LSMNG like MSEG-LSMNG,
PRCTR like MARC-PRCTR,
end of it_MSEG .


DATA: begin of IT_RSEG_SUM occurs 0,
PRUEFLOS like QALS-PRUEFLOS,
EBELN like RSEG-EBELN,
EBELP like RSEG-EBELP,
MATNR like RSEG-MATNR,
MBLNR like MSEG-MBLNR,
MJAHR like MSEG-MJAHR,
ZEILE like MSEG-ZEILE,
BELNR like RBKP-BELNR,
BLDAT like RBKP-BLDAT,
GJAHR like RBKP-GJAHR,
MENGE_I like RSEG-MENGE,
WERKS like QALS-WERK,
LIFNR like QALS-LIFNR,
BUKRS LIKE RSEG-BUKRS,
end of IT_RSEG_SUM .

DATA: begin of it_QALS occurs 0,
PRUEFLOS like QALS-PRUEFLOS,
matnr like QALS-matnr,
VERWMERKM like QAMV-VERWMERKM,
MITTELWERT like QAMR-MITTELWERT,
end of it_QALS .

*---------------------------------------------------------------------*
**WORK AREAS
*---------------------------------------------------------------------*
DATA: WA_MSEG LIKE LINE OF IT_MSEG,
WA_RSEG LIKE LINE OF IT_RSEG,
WA_RSEG_SUM LIKE LINE OF IT_RSEG_SUM,
WA_QALS LIKE LINE OF IT_QALS,
WA_matnr LIKE LINE OF IT_matnr,
WA_PODAT LIKE LINE OF IT_PODAT,
WA_layout TYPE slis_layout_alv. " For ALV

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

SELECT-OPTIONS : SO_EBELN FOR RSEG-EBELN . " Select option

SELECT-OPTIONS : SO_MATNR FOR ZVVF_MT035_MATNR-MATNR. " Select option

SELECT-OPTIONS : SO_BLDAT FOR RBKP-BLDAT OBLIGATORY. " Select option

SELECTION-SCREEN END OF BLOCK MAIN.

*---------------------------------------------------------------------*
**INITIALIZATION :
*---------------------------------------------------------------------*
INITIALIZATION.

w_repid = SY-REPID.
*---------------------------------------------------------------------*
**AT SELECTION SCREEN :
*---------------------------------------------------------------------*
AT SELECTION-SCREEN.
** Material No.converted to suitable format
IF NOT SO_MATNR[] IS INITIAL.
PERFORM matnr_FORMAT.
ENDIF.
*---------------------------------------------------------------------*
**START OF SELECTION :
*---------------------------------------------------------------------*
START-OF-SELECTION.

PERFORM SELECT_RSEG_DATA.

IF SY-SUBRC = 0.
PERFORM SELECT_QAMV_DATA.

IF SY-SUBRC = 0.
PERFORM SELECT_MSEG_DATA.

IF SY-SUBRC = 0.
PERFORM REBATE_CALC.
ELSE.
MESSAGE E005.
ENDIF.
ELSE.
MESSAGE E005.

ENDIF.
ELSE.
MESSAGE E005.
ENDIF.
*---------------------------------------------------------------------*
**END OF SELECTION :
*---------------------------------------------------------------------*
END-OF-SELECTION.
IF IT_PODAT[] IS INITIAL.
MESSAGE E022.
ENDIF.
PERFORM fieldcat_init USING it_fieldcat[].
PERFORM eventtab_build USING it_events[].
PERFORM comment_build USING it_list_top_of_page[].
PERFORM layout_build USING WA_layout.
PERFORM write_alv_grid.

*&---------------------------------------------------------------------*
*& Form SELECT_MSEG_DATA
*&---------------------------------------------------------------------*
FORM SELECT_RSEG_DATA.

**Selecting data joining RBKP,RSEG & QALS

select RBKP~BELNR
RBKP~BLDAT
RBKP~GJAHR
RBKP~RMWWR
RBKP~waers
RSEG~BUZEI
RSEG~EBELN
RSEG~EBELP
RSEG~MATNR
RSEG~MENGE
RSEG~BUKRS
QALS~PRUEFLOS
QALS~MBLNR
QALS~MJAHR
QALS~ZEILE
QALS~WERK
QALS~LIFNR
into table it_RSEG
from RSEG inner join RBKP on
RSEG~BELNR = RBKP~BELNR AND
RSEG~GJAHR = RBKP~GJAHR
INNER JOIN QALS ON
RSEG~WERKS = QALS~WERK AND
RSEG~MATNR = QALS~MATNR AND
RSEG~EBELN = QALS~EBELN AND
RSEG~EBELP = QALS~EBELP
where RSEG~MATNR IN SO_MATNR AND
RSEG~EBELN IN SO_EBELN AND
RBKP~BLDAT IN SO_BLDAT AND
RSEG~BUSTW = 'RE01' .

ENDFORM. "SELECT_RSEG_DATA

*&--------------------------------------------------------------------*
*& Form SELECT_QAMV_DATA
*&--------------------------------------------------------------------*
FORM SELECT_QAMV_DATA.


**Selecting data from ZVVF_MT035_MATNR & characteristic details ,joining
**QALS,QAMV and QAMR
select * from ZVVF_MT035_MATNR into corresponding fields of table
it_matnr FOR ALL ENTRIES IN it_RSEG WHERE matnr = it_RSEG-matnr and
ZVVF_MT035_MATNR~FROMDATE LE SY-DATUM AND
ZVVF_MT035_MATNR~TODATE GE SY-DATUM.
IF SY-SUBRC = 0.
select
QAls~PRUEFLOS
QAls~matnr
QAMV~VERWMERKM
QAMR~MITTELWERT
into table it_QALS
from QAMV inner join QAMR on
QAMV~PRUEFLOS = QAMR~PRUEFLOS AND
QAMV~VORGLFNR = QAMR~VORGLFNR AND
QAMV~MERKNR = QAMR~MERKNR
inner join qals on
QAMV~PRUEFLOS = QAls~PRUEFLOS
FOR ALL ENTRIES IN it_matnr WHERE VERWMERKM = it_matnr-VERWMERKM.

ENDIF.

ENDFORM. "SELECT_QAMV_DATA

*&--------------------------------------------------------------------*
*& Form SELECT_MSEG_DATA
*&--------------------------------------------------------------------*
FORM SELECT_MSEG_DATA.

**Selecting data from MSEG joining MARC for getting Profit center

select MSEG~MBLNR MSEG~MJAHR MSEG~ZEILE MSEG~MATNR MSEG~MENGE
MSEG~LSMNG MARC~PRCTR
into table it_MSEG from MSEG INNER JOIN MARC ON
MSEG~MATNR = MARC~MATNR AND
MSEG~WERKS = MARC~WERKS
FOR ALL ENTRIES IN it_RSEG WHERE
MSEG~MBLNR = it_RSEG-MBLNR AND
MSEG~ZEILE = it_RSEG-ZEILE AND
MSEG~MJAHR = it_RSEG-MJAHR AND
MSEG~WERKS = it_RSEG-WERKS AND
MSEG~MATNR = it_RSEG-MATNR AND
MSEG~EBELN = it_RSEG-EBELN AND
MSEG~EBELP = it_RSEG-EBELP .

SORT IT_MSEG BY MBLNR.
ENDFORM. "SELECT_MSEG_DATA



*&--------------------------------------------------------------------*
*& Form REBATE_CALC
*&--------------------------------------------------------------------*
* text
*---------------------------------------------------------------------*
FORM REBATE_CALC.

**Looping it_rseg Rebate value of each material is calculated
LOOP AT IT_RSEG INTO WA_RSEG .

read table IT_QALS with key PRUEFLOS = WA_RSEG-PRUEFLOS
matnr = WA_RSEG-matnr.
if sy-subrc ne 0.
CONTINUE.
endif.
**Getting different characteristics for the same material
LOOP AT IT_QALS INTO WA_QALS WHERE PRUEFLOS = WA_RSEG-PRUEFLOS and
matnr = WA_RSEG-matnr.


READ TABLE it_MSEG INTO WA_MSEG WITH KEY
MBLNR = WA_RSEG-MBLNR
MJAHR = WA_RSEG-MJAHR
ZEILE = WA_RSEG-ZEILE
MATNR = WA_RSEG-MATNR
BINARY SEARCH.
if sy-subrc = 0.

read table it_matnr into wa_matnr with key
matnr = WA_QALS-MATNR
verwmerkm = WA_QALS-verwmerkm.
if sy-subrc ne 0.
CONTINUE.
endif.

IF WA_QALS-MITTELWERT = WA_matnr-STDGSM.
CONTINUE.
ENDIF.
****Debited value is calculated according to the calculation key
CASE WA_matnr-CALKEY.

WHEN 'A'.
IF WA_QALS-MITTELWERT LT wa_matnr-LOWLIMIT OR
WA_QALS-MITTELWERT GT wa_matnr-UPLIMIT.

ENDIF.

IF WA_QALS-MITTELWERT LT wa_matnr-LOWLIMIT.
W_AMT_DEB =
( ( wa_matnr-LOWLIMIT - WA_QALS-MITTELWERT ) / wa_matnr-LOWLIMIT ) *
WA_RSEG-rmwwr .
endif.

IF WA_QALS-MITTELWERT GT wa_matnr-UPLIMIT.
W_AMT_DEB =
( ( WA_QALS-MITTELWERT - wa_matnr-UPLIMIT ) / wa_matnr-UPLIMIT ) *
WA_RSEG-rmwwr .
endif.


WHEN 'B'.
IF WA_QALS-MITTELWERT LT wa_matnr-LOWLIMIT OR
WA_QALS-MITTELWERT GT wa_matnr-UPLIMIT.

IF WA_RSEG-MENGE_I GT WA_MSEG-MENGE.

W_MENGE_CHR = ( WA_MSEG-MENGE + ( WA_MSEG-MENGE / 100 ) ).

W_MENGE_temp = WA_RSEG-MENGE_I - W_MENGE_CHR.


if W_MENGE_temp gt 0 .
W_AMT_DEB = ( WA_RSEG-rmwwr * W_MENGE_temp ) /
WA_RSEG-MENGE_I.
endif.
ENDIF.

ENDIF.

WHEN 'C'.

IF NOT WA_QALS-MITTELWERT LT wa_matnr-LOWLIMIT.

IF WA_QALS-MITTELWERT GT wa_matnr-UPLIMIT.

W_AMT_DEB = W_AMT_DEB +
( ( ( wa_qals-MITTELWERT - wa_matnr-UPLIMIT ) * 20 ) +
( ( wa_matnr-UPLIMIT - WA_matnr-LOWLIMIT ) * 10 ) ) *
WA_RSEG-MENGE_I .
ELSE.

W_AMT_DEB =
( ( wa_matnr-UPLIMIT - wa_matnr-LOWLIMIT ) * 10 ) *
WA_RSEG-MENGE_I .

ENDIF.

ENDIF.


WHEN 'D' or 'E'.

IF NOT WA_QALS-MITTELWERT LT wa_matnr-LOWLIMIT.


W_AMT_DEB = W_AMT_DEB +
( ( ( WA_QALS-MITTELWERT - wa_matnr-STDGSM ) / 100 ) * 2 ) *
WA_RSEG-rmwwr .


ENDIF.
ENDCASE.

if not W_AMT_DEB = 0.
MOVE-CORRESPONDING WA_QALS TO WA_PODAT.
MOVE-CORRESPONDING WA_RSEG TO WA_PODAT.
MOVE-CORRESPONDING WA_matnr TO WA_PODAT.

WA_PODAT-MENGE_GR = WA_MSEG-MENGE.
WA_PODAT-LSMNG = WA_MSEG-LSMNG.
WA_PODAT-PRCTR = WA_MSEG-PRCTR.
WA_PODAT-kostl = WA_MSEG-PRCTR.
WA_PODAT-MENGE_INV = WA_RSEG-MENGE_I.

WA_PODAT-MENGE_CHR = W_MENGE_CHR.
WA_PODAT-AMT_DEB = W_AMT_DEB.

***select Accounting Doc.from BKPF
CONCATENATE WA_RSEG-BELNR WA_RSEG-GJAHR INTO W_AWKEY.

SELECT SINGLE BELNR FROM BKPF INTO WA_PODAT-BELNR_ACC WHERE
AWKEY = W_AWKEY.
IF SY-SUBRC NE 0.
WA_PODAT-BELNR_ACC = 0.
ENDIF.

***select document type needed for posting
SELECT SINGLE BLART FROM ZVVF_MT035_BLART INTO
ZVVF_MT035_BLART-BLART WHERE WERKS = WA_RSEG-WERKS.

IF SY-SUBRC NE 0.
WA_PODAT-BLART = 0.
ELSE.
WA_PODAT-BLART = ZVVF_MT035_BLART-BLART.
ENDIF.

***truncate leading zeros of material and vendor No.
PERFORM convert_format CHANGING WA_PODAT-MATNR.
PERFORM convert_format CHANGING WA_PODAT-LIFNR.

APPEND WA_PODAT TO IT_PODAT .

SELECT SINGLE PRUEFLOS FROM ZVVF_MT035_PODAT
INTO ZVVF_MT035_PODAT-PRUEFLOS WHERE
EBELN = WA_PODAT-EBELN AND
EBELP = WA_PODAT-EBELP AND
BELNR = WA_PODAT-BELNR AND
BELNR_ACC = WA_PODAT-BELNR_ACC AND
BLDAT = WA_PODAT-BLDAT AND
VERWMERKM = WA_PODAT-VERWMERKM .

IF SY-SUBRC = 0.


MODIFY ZVVF_MT035_PODAT FROM WA_PODAT.

ELSE.
INSERT ZVVF_MT035_PODAT FROM WA_PODAT.
ENDIF.


CLEAR : WA_PODAT,W_AMT_DEB,W_MENGE_CHR,W_MENGE_CHR,W_MENGE_temp.
endif.


endif.

endloop.

ENDLOOP.
ENDFORM. " GET_DATA



*&--------------------------------------------------------------------*
*& Form fieldcat_init
*&--------------------------------------------------------------------*
FORM fieldcat_init USING lt_fieldcat TYPE slis_t_fieldcat_alv.
DATA : wa_fieldcat TYPE slis_fieldcat_alv.
DATA :w_pos TYPE i VALUE 0.

w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'BUKRS'.
wa_fieldcat-seltext_m = 'Company'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO lt_fieldcat.

w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'WERKS'.
wa_fieldcat-seltext_m = 'Plant'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO lt_fieldcat.

w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'MATNR'.
wa_fieldcat-seltext_m = 'Material'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO lt_fieldcat.

w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'EBELN'.
wa_fieldcat-seltext_m = 'PO No.'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO lt_fieldcat.


w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'EBELP'.
wa_fieldcat-seltext_m = 'PO Item'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO lt_fieldcat.

w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'LIFNR'.
wa_fieldcat-seltext_m = 'Vendor'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO lt_fieldcat.

w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'MBLNR'.
wa_fieldcat-seltext_m = 'GR No.'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO lt_fieldcat.

w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'MENGE_GR'.
wa_fieldcat-seltext_m = 'GR Quantity'.
wa_fieldcat-do_sum = 'X'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO lt_fieldcat.

w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'PRUEFLOS'.
wa_fieldcat-seltext_m = 'Inspection Lot No.'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO lt_fieldcat.

w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'VERWMERKM'.
wa_fieldcat-seltext_m = 'Characteristic'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO lt_fieldcat.

w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'CALKEY'.
wa_fieldcat-seltext_m = 'Calculation Key'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO lt_fieldcat.

w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'STDGSM'.
wa_fieldcat-seltext_m = 'Standard Value'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO lt_fieldcat.

w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'LOWLIMIT'.
wa_fieldcat-seltext_m = 'Low Limit'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO lt_fieldcat.


w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'UPLIMIT'.
wa_fieldcat-seltext_m = 'Upper Limit'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO lt_fieldcat.

w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'MITTELWERT'.
wa_fieldcat-seltext_m = 'Observed Value'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO lt_fieldcat.

w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'BELNR'.
wa_fieldcat-seltext_m = 'Invoice No.'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO lt_fieldcat.


w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'BLDAT'.
wa_fieldcat-seltext_m = 'Invoice Date'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO lt_fieldcat.

w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'BELNR_ACC'.
wa_fieldcat-seltext_m = 'Accounting Doc.'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO lt_fieldcat.

w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'MENGE_INV'.
wa_fieldcat-seltext_m = 'Invoice Quantity'.
wa_fieldcat-do_sum = 'X'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO lt_fieldcat.

w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'MENGE_CHR'.
wa_fieldcat-seltext_m = 'Chargeable Quantity'.
wa_fieldcat-do_sum = 'X'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO lt_fieldcat.


w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'RMWWR'.
wa_fieldcat-seltext_m = 'Invoice Value'.
wa_fieldcat-do_sum = 'X'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO lt_fieldcat.


w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'AMT_DEB'.
wa_fieldcat-seltext_m = 'Amount to be Debited'.
wa_fieldcat-do_sum = 'X'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO lt_fieldcat.

w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'WAERS'.
wa_fieldcat-seltext_m = 'Currency'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO lt_fieldcat.

w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'PRCTR'.
wa_fieldcat-seltext_m = 'Profit Center'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO lt_fieldcat.

w_pos = w_pos + 1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = w_pos.
wa_fieldcat-tabname = 'IT_PODAT'.
wa_fieldcat-fieldname = 'KOSTL'.
wa_fieldcat-seltext_m = 'Cost Center'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO lt_fieldcat.

ENDFORM. " fieldcat_init

*&---------------------------------------------------------------------*
*& Form eventtab_build
*&---------------------------------------------------------------------*
FORM eventtab_build USING lt_events TYPE slis_t_event.
DATA: wa_event TYPE slis_alv_event.
DATA: c_top_of_page TYPE slis_formname.

c_top_of_page = c_top_of_page_db.

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = lt_events.
READ TABLE lt_events WITH KEY name = slis_ev_top_of_page
INTO wa_event.
IF sy-subrc <> 0.
MOVE c_top_of_page TO wa_event-form.
APPEND wa_event TO lt_events.
ELSE.
MOVE c_top_of_page TO wa_event-form.
MODIFY lt_events FROM wa_event INDEX sy-tabix .
ENDIF.

ENDFORM. " eventtab_build

*&---------------------------------------------------------------------*
*& Form comment_build
*&---------------------------------------------------------------------*
FORM comment_build USING lt_top_of_page TYPE slis_t_listheader.
DATA: wa_line TYPE slis_listheader.
CLEAR wa_line.
wa_line-typ = 'H'.
wa_line-info = 'VVF LTD. Mumbai'.
APPEND wa_line TO lt_top_of_page.

wa_line-typ = 'H'.
wa_line-info = SY-ULINE.
APPEND wa_line TO lt_top_of_page.

wa_line-typ = 'H'.
wa_line-info = 'Rebate Calculation for Specification Differences'.
APPEND wa_line TO lt_top_of_page.

ENDFORM. " comment_build

*&---------------------------------------------------------------------*
*& Form layout_build
*&---------------------------------------------------------------------*
FORM layout_build USING wa_layout TYPE slis_layout_alv.
wa_layout-zebra = 'X'.
wa_layout-colwidth_optimize = 'X'.
wa_layout-no_totalline = 'X'.
ENDFORM. " layout_build

*&---------------------------------------------------------------------*
*& Form write_alv_grid
*&---------------------------------------------------------------------*
FORM write_alv_grid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = w_repid
i_background_id = 'ALV_BACKGROUND'
I_CALLBACK_TOP_OF_PAGE = c_top_of_page_db
is_layout = WA_layout
it_fieldcat = it_fieldcat[]
it_events = it_events[]
i_save = 'A'
TABLES
t_outtab = IT_PODAT
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.





ENDFORM. " write_alv_grid

*&--------------------------------------------------------------------*
*& Form TOP_OF_PAGE_DB
*&--------------------------------------------------------------------*
FORM TOP_OF_PAGE_DB.
*
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = it_list_top_of_page
i_logo = ' '.
ENDFORM. "top_of_page_db


*&--------------------------------------------------------------------*
*& Form convert_format
*&--------------------------------------------------------------------*
FORM convert_format CHANGING
W_temp.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
INPUT = W_temp
IMPORTING
OUTPUT = W_temp.
ENDFORM . "convert_format

*&---------------------------------------------------------------------*
*& Form MATNR_FORMAT
*&---------------------------------------------------------------------*
** convert fields to suitable format
*----------------------------------------------------------------------*
FORM MATNR_FORMAT .
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = so_matnr-low
IMPORTING
OUTPUT = so_matnr-low.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = so_matnr-high
IMPORTING
OUTPUT = so_matnr-high.
DELETE so_matnr INDEX 1.
APPEND so_matnr.

ENDFORM. " MATNR_FORMAT

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)