Skip to Content
0
Aug 09, 2012 at 10:42 AM

can anyone help me to fix the error

20 Views

*&---------------------------------------------------------------------*

*& Report ZPRGS4

*&

*&---------------------------------------------------------------------*

*&

*&

*&---------------------------------------------------------------------*

REPORT ZPRGS4.

TABLES: mseg,mkpf,inob,ausp.

type-pools: slis.

DATA: FIELDCATALOG TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,

g_repid type sy-repid,

I_LAYOUT TYPE SLIS_LAYOUT_ALV.

data: BEGIN OF i_mseg occurs 0,

mblnr like mseg-mblnr,

matnr like mseg-matnr,

lgort LIKE mseg-lgort,

bwart like mseg-bwart,

zeile like mseg-zeile,

erfmg like mseg-erfmg,

erfme like mseg-erfme,

insmk like mseg-insmk,

END OF i_mseg.

data: begin of i_mkpf OCCURS 0,

mblnr like mkpf-mblnr,

budat like mkpf-budat,

END OF i_mkpf.

data : begin of i_inob occurs 0,

objek like inob-objek,

matnr like inob-matnr,

end of i_inob.

data: begin of i_ausp occurs 0,

atwrt like ausp-atwrt,

objek like ausp-objek,

end of i_ausp.

data: BEGIN OF i_final occurs 10 ,

mblnr like mseg-mblnr,

matnr like mseg-matnr,

bwart like mseg-bwart,

insmk LIKE mseg-insmk,

lgort LIKE mseg-lgort,

zeile like mseg-zeile,

erfmg like mseg-erfmg,

erfme like mseg-erfme,

budat like mkpf-budat,

objek like inob-objek,

"matnr like inob-matnr,

atwrt like ausp-atwrt,

"objek like ausp-objek,

END OF i_final.

SELECTION-SCREEN: begin of block b1 with frame title text-001.

SELECT-OPTIONS: s_matnr for mseg-matnr.

parameters : p_bwart type mseg-bwart.

select-options : g_budat for mkpf-budat.

SELECTION-SCREEN: end of BLOCK b1.

start-of-selection.

PERFORM: retrieval.

PERFORM: formcatalog.

PERFORM: layout.

PERFORM: alv_grid_display.

form retrieval.

select

a~mblnr

a~matnr

a~lgort

a~bwart

a~zeile

a~erfmg

a~erfme

a~insmk

b~budat

"b~mblnr

c~objek

"c~matnr

d~atwrt

"d~objek

into corresponding fields of table i_final from mseg as a inner join mkpf as b on a~mblnr = b~mblnr

inner join inob as c on a~matnr = c~matnr

inner join ausp as d on c~objek = d~objek

where a~matnr in s_matnr and a~bwart = p_bwart and b~budat in g_budat .

ENDFORM.

form formcatalog.

fieldcatalog-fieldname = 'mblnr'.

fieldcatalog-seltext_m = 'material docu'.

fieldcatalog-col_pos = 0.

fieldcatalog-outputlen = 0.

fieldcatalog-emphasize = 'X'.

fieldcatalog-key = 'X'.

append fieldcatalog to fieldcatalog.

clear fieldcatalog.

fieldcatalog-fieldname = 'matnr'.

fieldcatalog-seltext_m = 'material number'.

fieldcatalog-col_pos = 1.

fieldcatalog-outputlen = 20.

fieldcatalog-emphasize = 'X'.

fieldcatalog-key = 'X'.

append fieldcatalog to fieldcatalog.

clear fieldcatalog.

fieldcatalog-fieldname = 'bwart'.

fieldcatalog-seltext_m = 'movement type'.

fieldcatalog-col_pos = 2.

fieldcatalog-outputlen = 20.

fieldcatalog-emphasize = 'X'.

fieldcatalog-key = 'X'.

append fieldcatalog to fieldcatalog.

* clear fieldcatalog.

fieldcatalog-fieldname = 'insmk'.

fieldcatalog-seltext_m = 'stock type'.

fieldcatalog-col_pos = 3.

fieldcatalog-outputlen = 20.

fieldcatalog-emphasize = 'X'.

fieldcatalog-key = 'X'.

append fieldcatalog to fieldcatalog.

clear fieldcatalog.

fieldcatalog-fieldname = 'lgort'.

fieldcatalog-seltext_m = 'stock location'.

fieldcatalog-col_pos = 4.

fieldcatalog-outputlen = 20.

fieldcatalog-emphasize = 'X'.

fieldcatalog-key = 'X'.

append fieldcatalog to fieldcatalog.

clear fieldcatalog.

fieldcatalog-fieldname = 'zeile'.

fieldcatalog-seltext_m = 'item'.

fieldcatalog-col_pos = 5.

fieldcatalog-outputlen = 20.

fieldcatalog-emphasize = 'X'.

fieldcatalog-key = 'X'.

append fieldcatalog to fieldcatalog.

clear fieldcatalog.

fieldcatalog-fieldname = 'erfmg'.

fieldcatalog-seltext_m = ' qty in un. of entry'.

fieldcatalog-col_pos = 6.

fieldcatalog-outputlen = 20.

fieldcatalog-emphasize = 'X'.

fieldcatalog-key = 'X'.

append fieldcatalog to fieldcatalog.

clear fieldcatalog.

fieldcatalog-fieldname = 'erfme'.

fieldcatalog-seltext_m = ' eun'.

fieldcatalog-col_pos = 7.

fieldcatalog-outputlen = 20.

fieldcatalog-emphasize = 'X'.

fieldcatalog-key = 'X'.

append fieldcatalog to fieldcatalog.

clear fieldcatalog.

fieldcatalog-fieldname = 'budat'.

fieldcatalog-seltext_m = 'posting date'.

fieldcatalog-col_pos = 8 .

fieldcatalog-outputlen = 20.

fieldcatalog-emphasize = 'X'.

fieldcatalog-key = 'X'.

append fieldcatalog to fieldcatalog.

clear fieldcatalog.

fieldcatalog-fieldname = 'atwrt'.

fieldcatalog-seltext_m = 'characteristic value'.

fieldcatalog-col_pos = 9.

fieldcatalog-outputlen = 20.

fieldcatalog-emphasize = 'X'.

fieldcatalog-key = 'X'.

append fieldcatalog to fieldcatalog.

clear fieldcatalog.

ENDFORM.

form layout.

I_LAYOUT-NO_INPUT = 'X'.

i_layout-colwidth_optimize = 'X'.

i_layout-totals_text = 'Totals'(201).

ENDFORM.

form alv_grid_display.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

* I_INTERFACE_CHECK = ' '

* I_BYPASSING_BUFFER = ' '

* I_BUFFER_ACTIVE = ' '

I_CALLBACK_PROGRAM = 'sy-repid'

* I_CALLBACK_PF_STATUS_SET = ' '

* I_CALLBACK_USER_COMMAND = ' '

* I_CALLBACK_TOP_OF_PAGE = ' '

* I_CALLBACK_HTML_TOP_OF_PAGE = ' '

* I_CALLBACK_HTML_END_OF_LIST = ' '

* I_STRUCTURE_NAME =

* I_BACKGROUND_ID = ' '

* I_GRID_TITLE =

* I_GRID_SETTINGS =''

IS_LAYOUT = i_layout

IT_FIELDCAT = fieldcatalog[]

* IT_EXCLUDING =

* IT_SPECIAL_GROUPS =

* IT_SORT =

* IT_FILTER =

* IS_SEL_HIDE =

* I_DEFAULT = 'X'

*

* I_SAVE = 'X'

* IS_VARIANT =

* IT_EVENTS =

* IT_EVENT_EXIT =

* IS_PRINT =

* IS_REPREP_ID =

* I_SCREEN_START_COLUMN = 0

* I_SCREEN_START_LINE = 0

* I_SCREEN_END_COLUMN = 0

* I_SCREEN_END_LINE = 0

* I_HTML_HEIGHT_TOP = 0

* I_HTML_HEIGHT_END = 0

* IT_ALV_GRAPHICS =

* IT_HYPERLINK =

* IT_ADD_FIELDCAT =

* IT_EXCEPT_QINFO =

* IR_SALV_FULLSCREEN_ADAPTER =

* IMPORTING

* E_EXIT_CAUSED_BY_CALLER =

* ES_EXIT_CAUSED_BY_USER =

TABLES

T_OUTTAB = i_final

EXCEPTIONS

PROGRAM_ERROR = 1

OTHERS = 2.

IF SY-SUBRC <> 0.

"Implement suitable error handling here

ENDIF.

ENDFORM.