Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

how to stored data after clicking checkbox save in database table

Former Member
0 Kudos
41

REPORT zreport .

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:layout TYPE i.

SELECTION-SCREEN END OF BLOCK b3.

DATA:BEGIN OF itab OCCURS 0,

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 itab.

DATA: gt_fieldcat TYPE slis_t_fieldcat_alv,

gw_fieldcat TYPE slis_fieldcat_alv,

gt_layout TYPE slis_layout_alv.

START-OF-SELECTION.

SELECT msegmblnr msegmatnr mardwerks mardlgort mardlgpbe msegcharg msegbwart mkpfbudat

msegmenge msegmeins msegkostl msegaufnr mseg~rsnum

INTO TABLE itab FROM

mseg JOIN mard ON mardmatnr EQ msegmatnr

JOIN mkpf ON msegmblnr EQ mkpfmblnr

WHERE mseg~matnr IN smatnr.

IF sy-subrc EQ 0.

SORT itab BY matnr.

PERFORM display_alv_output.

ENDIF.

&----


*& Form display_alv_output

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM display_alv_output.

REFRESH gt_fieldcat.

gw_fieldcat-fieldname = 'MBLNR'.

gw_fieldcat-tabname = 'itab'.

gw_fieldcat-col_pos = 1.

gw_fieldcat-seltext_m = 'material document'.

gw_fieldcat-key = 'x'.

APPEND gw_fieldcat TO gt_fieldcat.

CLEAR gw_fieldcat.

gw_fieldcat-fieldname = 'MATNR'.

gw_fieldcat-tabname = 'itab'.

gw_fieldcat-col_pos = 2.

gw_fieldcat-seltext_m = 'material'.

gw_fieldcat-key = ' '.

APPEND gw_fieldcat TO gt_fieldcat.

CLEAR gw_fieldcat.

gw_fieldcat-fieldname = 'WERKS'.

gw_fieldcat-tabname = 'itab'.

gw_fieldcat-col_pos = 3.

gw_fieldcat-seltext_m = 'plant'.

gw_fieldcat-key = ' '.

APPEND gw_fieldcat TO gt_fieldcat.

CLEAR gw_fieldcat.

gw_fieldcat-fieldname = 'LGORT'.

gw_fieldcat-tabname = 'itab'.

gw_fieldcat-col_pos = 4.

gw_fieldcat-seltext_m = 'storage location'.

gw_fieldcat-key = ' '.

APPEND gw_fieldcat TO gt_fieldcat.

CLEAR gw_fieldcat.

gw_fieldcat-fieldname = 'LGPBE'.

gw_fieldcat-tabname = 'itab'.

gw_fieldcat-col_pos = 5.

gw_fieldcat-seltext_m = 'storage bin'.

gw_fieldcat-key = ' '.

APPEND gw_fieldcat TO gt_fieldcat.

CLEAR gw_fieldcat.

gw_fieldcat-fieldname = 'CHARG'.

gw_fieldcat-tabname = 'itab'.

gw_fieldcat-col_pos = 6.

gw_fieldcat-seltext_m = 'Batch number'.

gw_fieldcat-key = ' '.

APPEND gw_fieldcat TO gt_fieldcat.

CLEAR gw_fieldcat.

gw_fieldcat-fieldname = 'BWART'.

gw_fieldcat-tabname = 'itab'.

gw_fieldcat-col_pos = 7.

gw_fieldcat-seltext_m = 'Movement Type (Inventory Management)'.

gw_fieldcat-key = ' '.

APPEND gw_fieldcat TO gt_fieldcat.

CLEAR gw_fieldcat.

gw_fieldcat-fieldname = 'BUDAT'.

gw_fieldcat-tabname = 'itab'.

gw_fieldcat-col_pos = 8.

gw_fieldcat-seltext_m = 'Posting Date in the Document'.

gw_fieldcat-key = ' '.

APPEND gw_fieldcat TO gt_fieldcat.

CLEAR gw_fieldcat.

gw_fieldcat-fieldname = 'MENGE'.

gw_fieldcat-tabname = 'itab'.

gw_fieldcat-col_pos = 9.

gw_fieldcat-seltext_m = 'QUANTITY'.

gw_fieldcat-key = ' '.

APPEND gw_fieldcat TO gt_fieldcat.

CLEAR gw_fieldcat.

gw_fieldcat-fieldname = 'MEINS'.

gw_fieldcat-tabname = 'itab'.

gw_fieldcat-col_pos = 10.

gw_fieldcat-seltext_m = 'Basic unit of measure'.

gw_fieldcat-key = ' '.

APPEND gw_fieldcat TO gt_fieldcat.

CLEAR gw_fieldcat.

gw_fieldcat-fieldname = 'KOSTL'.

gw_fieldcat-tabname = 'itab'.

gw_fieldcat-col_pos = 11.

gw_fieldcat-seltext_m = 'Cost center'.

gw_fieldcat-key = ' '.

APPEND gw_fieldcat TO gt_fieldcat.

CLEAR gw_fieldcat.

gw_fieldcat-fieldname = 'AUFNR'.

gw_fieldcat-tabname = 'itab'.

gw_fieldcat-col_pos = 12.

gw_fieldcat-seltext_m = 'Order Number'.

gw_fieldcat-key = ' '.

APPEND gw_fieldcat TO gt_fieldcat.

CLEAR gw_fieldcat.

gw_fieldcat-fieldname = 'RSNUM'.

gw_fieldcat-tabname = 'itab'.

gw_fieldcat-col_pos = 13.

gw_fieldcat-seltext_m = 'Number of Reservation / Depe'.

gw_fieldcat-key = ' '.

APPEND gw_fieldcat TO gt_fieldcat.

CLEAR gw_fieldcat.

gw_fieldcat-col_pos = 14.

gw_fieldcat-fieldname = 'CHECKBOX'.

gw_fieldcat-seltext_m = 'Compltd'.

gw_fieldcat-checkbox = 'X'.

gw_fieldcat-edit = 'X'.

APPEND gw_fieldcat TO gt_fieldcat.

CLEAR gw_fieldcat.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = 'ZREPORT'

  • I_CALLBACK_PF_STATUS_SET = 'PF_STATUS'

  • I_CALLBACK_USER_COMMAND = 'USER_COMMAND'

IS_LAYOUT = gt_layout

IT_FIELDCAT = gt_fieldcat

TABLES

t_outtab = itab

EXCEPTIONS

PROGRAM_ERROR = 1

OTHERS = 2.

ENDFORM. " display_alv_output

FORM USER_COMMAND USING P_UCOMM TYPE SY-UCOMM

P_SELFLD TYPE SLIS_SELFIELD.

set pf-stATUS 'YSTATUS'.

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

itab2[] = itab[].

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

modify ztable from table itab[].

endcase.

this is my code , my error is itab2 = itab

plz check that after send me

send me reply

1 REPLY 1

Former Member
0 Kudos
24

hi,

1) how did u define itab2??

2) the field for checkbox in itab is checkbox and not mark...

so u need to give..

delete itab where checkbox = space.

regards,

priya.