Thursday, October 13, 2011

SAP sample coding of a almost complete understanding of the screen

*&---------------------------------------------------------------------*
*& Report ZDC_SALES_REP
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT ZDC_SALES_REP no standard page heading
line-size 132
line-count 65(3).

data:
line_no(5) type n.

data:
v_matnr type vbap-matnr.


data:
it_salesdet type table of zdc_sales_doc,
wa_salesdet like line of it_salesdet.


* selection screen
parameters:
p_vkorg type vbak-vkorg obligatory.

select-options:
s_matnr for v_matnr.

parameters:
p_flag as checkbox.


initialization.
p_vkorg = 1000.

s_matnr-sign = 'I'.
s_matnr-option = 'BT'.
s_matnr-low = 'M-01'.
s_matnr-high = 'M-03'.
append s_matnr.

clear s_matnr.
s_matnr-sign = 'E'.
s_matnr-option = 'EQ'.
s_matnr-low = 'M-02'.
append s_matnr.


at selection-screen.
if p_flag = 'X' and s_matnr[] is not initial.
message e010(ad) with 'Error'.
endif.



start-of-selection.

" get data
select * into table it_salesdet
from zdc_sales_doc
where vkorg = p_vkorg
and matnr in s_matnr.

" display report
loop at it_salesdet into wa_salesdet.
add 1 to line_no.
write: / line_no,
wa_salesdet-vbeln color col_key,
wa_salesdet-posnr color col_key,
wa_salesdet-kunnr color col_positive,
wa_salesdet-netwr,
wa_salesdet-matnr,
wa_salesdet-ZMEng color col_total.
endloop.



end-of-selection.



top-of-page.
write: /80 'Page:', sy-pagno.
uline.
clear line_no.

end-of-page.
format color col_total.
write: /(132) '--Continued--' centered.

No comments:

Post a Comment