Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

need modifications in my alv

*& Report ZMM_STOCKDIFFERENCE

REPORT ZMM_STOCKDIFFERENCE.

Tables: marc,

mard. "Sales Document: Header Data

data : it_marc LIKE marc OCCURS 0 WITH HEADER LINE,

it_mard like mard OCCURS 0 WITH HEADER LINE.

type-pools: slis.

data:t_listheader type slis_t_listheader,

it_events type slis_t_event,

is_layout type slis_layout_alv,

is_layout1 type slis_layout_alv..

data:fieldcatalog type slis_t_fieldcat_alv with header line,

gd_tab_group type slis_t_sp_group_alv,

gd_layout type slis_layout_alv ,

i_repid like sy-repid.

i_repid = sy-repid.

Data: begin of itab occurs 0,

matnr like marc-matnr,

labst like mard-labst,

EISBE like marc-eisbe,

eislo like marc-eislo,

a type i,

b type i,

end of itab.

data : matr like marc-matnr.

data : index(2).

****************************************************************************************************New Selection Screen

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

PARAMETERS : s_matnr type c RADIOBUTTON GROUP gp1 USER-COMMAND com DEFAULT 'X',

r_matnr TYPE c RADIOBUTTON GROUP gp1.

SELECT-OPTIONS : matr1 for marc-matnr MODIF ID g1 no INTERVALS no-EXTENSION..

SELECT-OPTIONS : matr2 FOR marc-matnr MODIF ID g2 .

SELECTION-SCREEN END OF BLOCK b1.

AT SELECTION-SCREEN OUTPUT.

IF s_matnr EQ 'X'.

LOOP AT SCREEN.

IF screen-group1 EQ 'G2'.

screen-active = 0.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

ELSEIF r_matnr EQ 'X'.

LOOP AT SCREEN.

IF screen-group1 EQ 'G1'.

screen-active = 0.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

ENDIF.

***********************************************************************************************************************

START-OF-SELECTION.

PERFORM clear.

PERFORM SELECT_DATA.

PERFORM display.

*& Form SELECT_DATA

----


FORM SELECT_DATA .

if s_matnr = 'X'.

SHIFT matr1 by 3 PLACES.

matr = matr1.

endif.

if r_matnr = 'X'.

SHIFT matr2 by 3 PLACES.

matr = matr2.

ENDIF.

if s_matnr = 'X'.

select * from marc into table it_marc where matnr = matr.

ELSEIF r_matnr = 'X'.

SELECT * from marc into table it_marc where matnr in matr2.

endif.

LOOP AT it_marc.

MOVE-CORRESPONDING it_marc to itab.

APPEND itab.

ENDLOOP.

Loop at itab.

select single labst

from mard

into itab-labst

where matnr = itab-matnr.

MODIFY itab.

Endloop.

LOOP AT itab.

itab-a = itab-labst - itab-eisbe.

itab-b = itab-labst - itab-eislo.

MODIFY itab.

ENDLOOP.

ENDFORM. " SELECT_DATA

FORM DISPLAY .

perform fill_layout.

perform list_header using t_listheader.

fieldcatalog-fieldname = 'MATNR'.

fieldcatalog-seltext_m = 'Material Number'.

fieldcatalog-outputlen = 15.

append fieldcatalog to fieldcatalog.

clear fieldcatalog.

fieldcatalog-fieldname = 'LABST'.

fieldcatalog-seltext_m = 'Actual Stock'.

fieldcatalog-outputlen = 25.

append fieldcatalog to fieldcatalog.

clear fieldcatalog.

fieldcatalog-fieldname = 'A'.

fieldcatalog-seltext_m = 'Difference to Safety Stock'.

fieldcatalog-outputlen = 38.

append fieldcatalog to fieldcatalog.

clear fieldcatalog.

fieldcatalog-fieldname = 'B'.

fieldcatalog-seltext_m = 'Difference to Minimum Safety Stock'.

fieldcatalog-outputlen = 38.

append fieldcatalog to fieldcatalog.

clear fieldcatalog.

perform fill_events.

******************************************************************************CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

call function 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = sy-repid

i_callback_top_of_page = 'TOP_OF_PAGE'

is_layout = is_layout

it_fieldcat = fieldcatalog[]

i_default = 'X'

i_save = 'A'

it_events = it_events

TABLES

t_outtab = itab

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. " DISPLAY

form clear .

clear itab.

clear itab[].

*

endform. " CLEAR

form list_header using p_t_listheader type slis_t_listheader.

data : if_date TYPE string ,

ef_date TYPE string,

if_date1 type string,

ef_date1 type string.

IF s_matnr = 'X'.

if_date = matr.

ELSEIF r_matnr = 'X'.

shift matr2 by 3 PLACES.

if_date = matr2+0(18).

if_date1 = matr2+18(18).

shift if_date by 9 PLACES.

SHIFT if_date1 by 9 PLACES.

CONCATENATE if_date ' to ' if_date1 INTO if_date.

endif.

data : wa_listheader type slis_listheader.

clear wa_listheader.

wa_listheader-typ = 'H'.

wa_listheader-info = 'Stock Position'.

append wa_listheader to t_listheader.

clear wa_listheader.

wa_listheader-typ = 'S'.

wa_listheader-key = 'Material Code'.

wa_listheader-info = if_date .

append wa_listheader to t_listheader.

endform. " LIST_HEADER

form fill_events .

data : wa_event type slis_alv_event.

wa_event-name = 'TOP_OF_PAGE'.

wa_event-form = 'TOP_OF_PAGE'.

append wa_event to it_events.

clear wa_event.

endform. " FILL_EVENTS

form top_of_page.

call function 'REUSE_ALV_COMMENTARY_WRITE'

exporting

it_list_commentary = t_listheader

.

endform. "TOP_OF_PAGE

form fill_layout .

is_layout-zebra = 'X'.

endform. "fill_layout

Modifications required are:

1.In Header - material number is coming with 3 extra suffix zeroes. i dont want this.

2.In the first column material numbers are coming with 9 prefix zeroes. i dont want this too.

3.last column negative numbers' minus sign is coming after the number. it should come before the number

4.header column is not coming completely. for example: last column i gave is difference to minimum safety stock. but it is showing only difference to minimu

pls help me...i am a fresher...thanks in advance

Tags:

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question