Skip to Content
0
Former Member
Apr 13, 2007 at 01:20 PM

my code has given some error is there in that pls correct that one

17 Views

TABLES:mseg,mard,mkpf.

TYPE-POOLS slis.

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

SELECT-OPTIONS:smblnr FOR mseg-mblnr MODIF ID m1,

smatnr FOR mseg-matnr MODIF ID m2,

swerks FOR mard-werks MODIF ID m3,

slgort FOR mard-lgort MODIF ID m4,

slgpbe FOR mard-lgpbe MODIF ID m5,

scharg FOR mseg-charg MODIF ID m6,

sbwart FOR mseg-bwart MODIF ID m7,

skostl FOR mseg-kostl MODIF ID m8,

saufnr FOR mseg-aufnr MODIF ID m9,

srsnum FOR mseg-rsnum MODIF ID m10.

SELECTION-SCREEN END OF BLOCK b1.

SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.

PARAMETERS:pre RADIOBUTTON GROUP radi USER-COMMAND ucomm DEFAULT 'X',

pse RADIOBUTTON GROUP radi,

bps RADIOBUTTON GROUP radi.

SELECTION-SCREEN END OF BLOCK b2.

SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-003.

PARAMETER:lay TYPE i.

SELECTION-SCREEN END OF BLOCK b3.

DATA:BEGIN OF st_output,

mblnr LIKE mseg-mblnr,

matnr LIKE mseg-matnr,

werks LIKE mard-werks,

lgort LIKE mard-lgort,

lgpbe LIKE mard-lgpbe,

charg LIKE mseg-charg,

bwart LIKE mseg-bwart,

budat LIKE mkpf-budat,

menge LIKE mseg-menge,

meins LIKE mseg-meins,

kostl LIKE mseg-kostl,

aufnr LIKE mseg-aufnr,

rsnum LIKE mseg-rsnum,

checkbox TYPE c,

END OF st_output, it_output LIKE TABLE OF st_output.

DATA:it_fieldcat TYPE slis_t_fieldcat_alv,

st_fieldcat TYPE slis_fieldcat_alv,

st_layout TYPE slis_layout_alv.

START-OF-SELECTION.

IF sy-subrc EQ 0.

SORT it_output BY matnr.

PERFORM display_alv_output.

ENDIF

.

&----


*& Form display_alv_output

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM display_alv_output .

REFRESH it_fieldcat.

st_fieldcat-col_pos = 1.

st_fieldcat-tabname = 'IT_OUTPUT'.

st_fieldcat-fieldname = 'MBLNR'.

st_fieldcat-seltext_l = 'Mat.Doc.'.

st_fieldcat-key = 'X'.

APPEND st_fieldcat TO it_fieldcat.

CLEAR st_fieldcat.

st_fieldcat-col_pos = 1.

st_fieldcat-tabname = 'IT_OUTPUT'.

st_fieldcat-fieldname = 'MATNR'.

st_fieldcat-seltext_l = 'Material'.

st_fieldcat-key = ' '.

APPEND st_fieldcat TO it_fieldcat.

CLEAR st_fieldcat.

st_fieldcat-col_pos = 1.

st_fieldcat-tabname = 'IT_OUTPUT'.

st_fieldcat-fieldname = 'WERKS'.

st_fieldcat-seltext_l = 'Plnt'.

st_fieldcat-key = ' '.

APPEND st_fieldcat TO it_fieldcat.

CLEAR st_fieldcat.

st_fieldcat-col_pos = 1.

st_fieldcat-tabname = 'IT_OUTPUT'.

st_fieldcat-fieldname = 'LGORT'.

st_fieldcat-seltext_l = 'SLoc'.

st_fieldcat-key = ' '.

APPEND st_fieldcat TO it_fieldcat.

CLEAR st_fieldcat.

st_fieldcat-col_pos = 1.

st_fieldcat-tabname = 'IT_OUTPUT'.

st_fieldcat-fieldname = 'LGPBE'.

st_fieldcat-seltext_l = 'Bin'.

st_fieldcat-key = ' '.

APPEND st_fieldcat TO it_fieldcat.

CLEAR st_fieldcat.

st_fieldcat-col_pos = 1.

st_fieldcat-tabname = 'IT_OUTPUT'.

st_fieldcat-fieldname = 'CHARG'.

st_fieldcat-seltext_l = 'Batch'.

st_fieldcat-key = ' '.

APPEND st_fieldcat TO it_fieldcat.

CLEAR st_fieldcat.

st_fieldcat-col_pos = 1.

st_fieldcat-tabname = 'IT_OUTPUT'.

st_fieldcat-fieldname = 'BWART'.

st_fieldcat-seltext_l = 'MvT'.

st_fieldcat-key = ' '.

APPEND st_fieldcat TO it_fieldcat.

CLEAR st_fieldcat.

st_fieldcat-col_pos = 1.

st_fieldcat-tabname = 'IT_OUTPUT'.

st_fieldcat-fieldname = 'BUDAT'.

st_fieldcat-seltext_l = 'Pstng Data'.

st_fieldcat-key = ' '.

APPEND st_fieldcat TO it_fieldcat.

CLEAR st_fieldcat.

st_fieldcat-col_pos = 1.

st_fieldcat-tabname = 'IT_OUTPUT'.

st_fieldcat-fieldname = 'MENGE'.

st_fieldcat-seltext_l = 'Quantity'.

st_fieldcat-key = ' '.

APPEND st_fieldcat TO it_fieldcat.

CLEAR st_fieldcat.

st_fieldcat-col_pos = 1.

st_fieldcat-tabname = 'IT_OUTPUT'.

st_fieldcat-fieldname = 'MEINS'.

st_fieldcat-seltext_l = 'BUn'.

st_fieldcat-key = ' '.

APPEND st_fieldcat TO it_fieldcat.

CLEAR st_fieldcat.

st_fieldcat-col_pos = 1.

st_fieldcat-tabname = 'IT_OUTPUT'.

st_fieldcat-fieldname = 'KOSTL'.

st_fieldcat-seltext_l = 'Cost ctr'.

st_fieldcat-key = ' '.

APPEND st_fieldcat TO it_fieldcat.

CLEAR st_fieldcat.

st_fieldcat-col_pos = 1.

st_fieldcat-tabname = 'IT_OUTPUT'.

st_fieldcat-fieldname = 'AUFNR'.

st_fieldcat-seltext_l = 'Order'.

st_fieldcat-key = ' '.

APPEND st_fieldcat TO it_fieldcat.

CLEAR st_fieldcat.

st_fieldcat-col_pos = 1.

st_fieldcat-tabname = 'IT_OUTPUT'.

st_fieldcat-fieldname = 'RSNUM'.

st_fieldcat-seltext_l = 'Reserv.No.'.

st_fieldcat-key = ' '.

APPEND st_fieldcat TO it_fieldcat.

CLEAR st_fieldcat.

st_fieldcat-col_pos = 1.

st_fieldcat-fieldname = 'CHECKBOX'.

st_fieldcat-seltext_l = 'Compltd'.

st_fieldcat-checkbox = 'X'.

st_fieldcat-edit = 'X'.

APPEND st_fieldcat TO it_fieldcat.

CLEAR st_fieldcat.

SELECT mseg~mblnr

mseg~matnr

mard~werks

mard~lgort

mard~lgpbe

mseg~charg

mseg~bwart

mkpf~budat

mseg~menge

mseg~meins

mseg~kostl

mseg~aufnr

mseg~rsnum

INTO TABLE it_output FROM

mseg JOIN mard ON mardmatnr EQ msegmatnr

JOIN mkpf ON msegmblnr EQ mkpfmblnr

WHERE mseg~matnr IN smatnr.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = 'ZRREPORT'

I_CALLBACK_PF_STATUS_SET = 'PF_STATUS'

I_CALLBACK_USER_COMMAND = 'USER_COMMAND'

is_layout = st_layout

it_fieldcat = it_fieldcat

TABLES

t_outtab = it_output

EXCEPTIONS

program_error = 1

OTHERS = 2.

ENDFORM. " display_alv_output

*----


*----


*

FORM USER_COMMAND USING P_UCOMM TYPE SY-UCOMM

P_SELFLD TYPE SLIS_SELFIELD.

case p_ucomm.

when 'SAVE'.

DATA: ref1 type ref to cl_gui_alv_grid.

CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'

IMPORTING

E_GRID = ref1.

call method ref1->check_changed_data

  • Here you wil have the table with updated data

IT_OUTPUT2[] = IT_OUTPUT[].

delete IT_OUTPUT2 where checkbox = space. "Mark is the field for the checkbox

modify ztable from table IT_OUTPUT.

endcase.

ENDFORM.