使用ALV输出中的复选框下载所选记录

时间:2014-12-30 08:23:30

标签: sap abap

我正在使用此代码下载所选记录。但我无法做到这一点。我做错了什么?

FORM ZUCOMM USING LV_OKCODE TYPE SY-UCOMM
             SEL_FIELD TYPE SLIS_SELFIELD.


CASE LV_OKCODE .

    WHEN 'DOWN' .
*   REFRESH IT_MARA1.
IF FLAG = 'X'.


         lOOP AT it_mara INTO wa_mara."  WHERE CHECK  = 'X'.
*
        wa_mara1-matnr =  wa_mara-matnr.
        wa_mara1-MTART = wa_mara-MTART.
        wa_mara1-MATKL = wa_mara-MATKL.

        APPEND wa_mara1 TO it_mara1.
                 ENDLOOP.

1 个答案:

答案 0 :(得分:0)

我不知道你想要做什么,但如果你想在内部表中找到alv某些记录,请使用像我这样的代码:

*&---------------------------------------------------------------------*
*&      Form  atusercommand
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->UCOMM      text
*      -->SELFIELD   text
*----------------------------------------------------------------------*
FORM ATUSERCOMMAND USING UCOMM LIKE SY-UCOMM
                SELFIELD TYPE SLIS_SELFIELD.
  CASE UCOMM.
    WHEN '&IC1'." On click
        PERFORM ME_CALL_DETAIL USING SELFIELD.
    WHEN 'HIST'." Button
        PERFORM ME_CALL_DETAIL USING SELFIELD.
  ENDCASE.

ENDFORM.                    "atusercommand

FORM ME_CALL_DETAIL USING SELFIELD.
  READ TABLE GT_ALV WITH key CHECK  = 'X' INTO wt_pom.
  "some logic
ENDFORM.

如果我想要访问选定的行我通常使用这个:

READ TABLE GT_ALV4 INTO LS_ALV4 INDEX U_PSELFIELD-TABINDEX.