Skip to Content
0
Former Member
Sep 19, 2007 at 09:24 AM

Plz Help!

17 Views

Dear All,

Below is my pasting ALV Program. I have few question based on this prog:-

1- Check whether the select stament is correct or not based on my select-options.

2-It's my ALV Grid Display, And I want to show on top of page that: "Purcahse report for the financial year" and also want to show the date form and between, where it's been selected in select-option screen.

How I will do that.

tables: marc,

mkpf,

mseg,

ekko,

ekpo,

ekbe,

rseg.

type-pools: slis.

&----


data: begin of itab occurs 0,

matnr like marc-matnr,

budat like ekbe-budat,

maktx like makt-maktx,

bedat like ekko-bedat,

ebeln like mseg-ebeln,

menge like mseg-menge,

bprme like mseg-bprme,

netwr like ekpo-netwr,

bstmg like mseg-bstmg,

dmbtr like mseg-dmbtr,

bprbm like rseg-bprbm,

refwr like ekbe-refwr,

end of itab.

data: i_fieldcat type slis_t_fieldcat_alv with header line,

wa_fieldcat type slis_fieldcat_alv.

data v_repid type sy-repid.

&----


selection-screen begin of block b1 with frame title text-001.

select-options: s_matnr for marc-matnr,

s_budat for mkpf-budat.

selection-screen end of block b1.

&----


&----


initialization.

v_repid = sy-repid.

start-of-selection.

  • SELECT werks smbln bstmg dmbtr matnr ebeln FROM mseg INTO

  • CORRESPONDING FIELDS OF TABLE itab

  • WHERE matnr IN s_matnr.

**ENDSELECT.

*

*

  • SELECT SINGLE lifnr FROM ekko INTO CORRESPONDING FIELDS OF itab

  • WHERE ebeln = mseg-ebeln.

*

  • SELECT ebeln menge FROM ekpo INTO CORRESPONDING FIELDS OF itab

  • WHERE ebeln = mseg-ebeln.

  • ENDSELECT.

*

  • SELECT ebeln belnr refwr budat FROM ekbe INTO CORRESPONDING FIELDS OF

  • itab

  • WHERE budat IN s_budat AND

  • ebeln = mseg-ebeln.

  • ENDSELECT.

*

  • SELECT SINGLE matnr FROM marc INTO itab

  • WHERE matnr = mseg-matnr.

**APPEND itab.

**END-OF-SELECTION.

*----


  • SELECT matnr ebeln menge bprme bstmg dmbtr FROM mseg INTO

  • CORRESPONDING FIELDS OF TABLE itab

  • WHERE matnr IN s_matnr.

*

*

  • SELECT matnr maktx FROM makt INTO CORRESPONDING FIELDS OF TABLE itab

  • WHERE matnr = mseg-matnr.

*

  • SELECT ebeln bedat FROM ekko INTO CORRESPONDING FIELDS OF TABLE itab

  • WHERE ebeln = mseg-ebeln.

*

  • SELECT ebeln netwr FROM ekpo INTO CORRESPONDING FIELDS OF TABLE itab

  • WHERE ebeln = mseg-ebeln.

*

  • SELECT ebeln bprbm FROM rseg INTO CORRESPONDING FIELDS OF TABLE itab

  • WHERE ebeln = mseg-ebeln.

*

  • SELECT budat ebeln refwr FROM ekbe INTO CORRESPONDING FIELDS OF TABLE

  • itab

  • WHERE budat IN s_budat AND

  • ebeln = mseg-ebeln.

*----


  • ---

select matnr ebeln menge bprme bstmg dmbtr from mseg into

corresponding fields of table itab where matnr in s_matnr.

select matnr maktx from makt appending corresponding fields of table

itab for all entries in itab where matnr = itab-matnr.

select ebeln bedat from ekko appending corresponding fields of table

itab for all entries in itab where ebeln = itab-ebeln.

select ebeln netwr from ekpo appending corresponding fields of table

itab for all entries in itab where ebeln = itab-ebeln.

select ebeln bprbm from rseg appending corresponding fields of table

itab for all entries in itab where ebeln = itab-ebeln.

select budat ebeln refwr from ekbe appending corresponding fields of

table itab for all entries in itab

where budat in s_budat and

ebeln = itab-ebeln.

append itab.

&----


perform build_fieldcatlog.

perform display_alv_report.

&----


  • LOOP AT itab.

*

*WRITE:/ itab-menge, itab-werks, itab-smbln, itab-bstmg, itab-matnr,

*itab-ebeln, itab-lifnr, itab-menge, itab-belnr, itab-refwr, itab-budat.

*

  • ENDLOOP.

&----


*& Form build_fieldcatlog

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form build_fieldcatlog . "Form BUILD_FIELDCATLOG, Start

wa_fieldcat-fieldname = 'MAKTX'.

wa_fieldcat-seltext_m = 'Material Description'.

append wa_fieldcat to i_fieldcat.

clear wa_fieldcat.

wa_fieldcat-fieldname = 'BEDAT'.

wa_fieldcat-seltext_m = 'PO Date'.

append wa_fieldcat to i_fieldcat.

clear wa_fieldcat.

wa_fieldcat-fieldname = 'EBELN'.

wa_fieldcat-seltext_m = 'Purchase Order No'.

append wa_fieldcat to i_fieldcat.

clear wa_fieldcat.

wa_fieldcat-fieldname = 'MENGE'.

wa_fieldcat-seltext_m = 'Purchase Order QTY'.

append wa_fieldcat to i_fieldcat.

clear wa_fieldcat.

wa_fieldcat-fieldname = 'BPRME'.

wa_fieldcat-seltext_m = 'Order Price Unit'.

append wa_fieldcat to i_fieldcat.

clear wa_fieldcat.

wa_fieldcat-fieldname = 'NETWR'.

wa_fieldcat-seltext_m = 'Po Net Value'.

append wa_fieldcat to i_fieldcat.

clear wa_fieldcat.

wa_fieldcat-fieldname = 'BSTMG'.

wa_fieldcat-seltext_m = 'GR QTY'.

append wa_fieldcat to i_fieldcat.

clear wa_fieldcat.

wa_fieldcat-fieldname = 'DMBTR'.

wa_fieldcat-seltext_m = 'GR Value'.

append wa_fieldcat to i_fieldcat.

clear wa_fieldcat.

wa_fieldcat-fieldname = 'BPRBM'.

wa_fieldcat-seltext_m = 'Invoice Qty'.

append wa_fieldcat to i_fieldcat.

clear wa_fieldcat.

wa_fieldcat-fieldname = 'REFWR'.

wa_fieldcat-seltext_m = 'Invoivce value'.

append wa_fieldcat to i_fieldcat.

clear wa_fieldcat.

endform. "build_fieldcatlog

" build_fieldcatlog "Form BUILD_FIELDCATLOG, End

&----


*& Form display_alv_report

&----


  • text

----


form display_alv_report. "Form DISPLAY_ALV_REPORT, Start

v_repid = sy-repid.

call function 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = v_repid

it_fieldcat = i_fieldcat[]

i_callback_top_of_page = 'TOP-OF-PAGE'

i_save = 'A'

TABLES

t_outtab = itab.

endform. "display_alv_report

----


top-of-page.

write:/ 'Purchase request Print program'.

end-of-page.

Plz help me.

Thanks.