Skip to Content

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

REUSE_ALV_POPUP_TO_SELECT

i ask again:

i get a list of itab.

i get 'X' of the row i want, now how i can apeend the new rows into new itab.

2. how i can add a buttton of all the rows,and none like in sm30

Tags:
replied

Please check this sample program.


report zrich_0001.

type-pools: slis.

data: begin of ima occurs 0,
      check type c,
      matnr type makt-matnr,
      maktx type makt-maktx,
      end of ima.

data: begin of ima2 occurs 0,
      check type c,
      matnr type makt-matnr,
      maktx type makt-maktx,
      end of ima2.

data: ifldc type slis_t_fieldcat_alv .
data: xfldc type slis_fieldcat_alv .

select matnr maktx into corresponding fields of table ima
         from makt up to 100 rows.


clear xfldc.
xfldc-reptext_ddic    = ' '.
xfldc-fieldname  = 'CHECK'.
xfldc-tabname   = 'IMA'.
xfldc-outputlen  = '1'.
append xfldc to ifldc.

clear xfldc.
xfldc-reptext_ddic    = 'Material Number'.
xfldc-fieldname  = 'MATNR'.
xfldc-tabname   = 'IMA'.
xfldc-outputlen  = '18'.
append xfldc to ifldc.

clear xfldc.
xfldc-reptext_ddic    = 'Material Description'.
xfldc-fieldname  = 'MAKTX'.
xfldc-tabname   = 'IMA'.
xfldc-outputlen  = '40'.
append xfldc to ifldc.

call function 'REUSE_ALV_POPUP_TO_SELECT'
     exporting
          i_checkbox_fieldname = 'CHECK'
          i_tabname            = 'IMA'
          it_fieldcat          = ifldc
     tables
          t_outtab             = ima
     exceptions
          program_error        = 1
          others               = 2.

check sy-subrc  = 0.


* Write selected lines to anther itab.
loop at ima where check = 'X'.
  clear ima2.
  move ima to ima2.
  append ima2.
endloop.


* Write out other itab.

loop at ima2.
  write:/ ima2-matnr, ima2-maktx.
endloop.

Regards,

Rich Heilman

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question