메뉴 건너뛰기

SAP 한국 커뮤니티

[요청]필드카탈로그를 적용했는데 덤프가 뜨네요.

로미오 2009.03.13 09:35 조회 수 : 1534

아래 소스르 작성해서 실행해보니 그림같은 덤프가 뜨네요.


필드카달로그와 REUSE_ALV_LIST_DISPLAY 그리고 LAYOUT설정을 넣고 해봤는데


뭐가 잘못된지 알려주세요. 아직 ALV기초가 부족한 것 같네요. 기본적인것 같은데


뭐가 잘못됀는지 알수가 없네요. 책보고 참고해서 한것인데..


 


*&---------------------------------------------------------------------*
*& Report  ZTEST0004
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*


REPORT  ztest0004_1_alv MESSAGE-ID zfi.


TABLES: spfli, scarr.


DATA: BEGIN OF itab_spfli OCCURS 0.
        INCLUDE STRUCTURE spfli.
DATA: END OF itab_spfli.


DATA: BEGIN OF itab_scarr OCCURS 0.
        INCLUDE STRUCTURE scarr.
DATA: END OF itab_scarr.


DATA :  BEGIN OF itab OCCURS 0,
          carrid    LIKE spfli-carrid,
          carrname  LIKE scarr-carrname,
          connid    LIKE spfli-connid,
          cityto LIKE spfli-cityto,
          cityfrom LIKE spfli-cityfrom,
        END OF itab.


DATA: ok_code LIKE sy-ucomm.


DATA : l_cnt TYPE i.


DATA : l_field(20),
       l_value(20).


 


*// ALV? ?? ?? ?? //*
TYPE-POOLS : slis.
* STATUS
DATA : gv_status TYPE slis_formname VALUE 'STANDARD'.
DATA : gs_extab  TYPE slis_t_extab.


** Fieldcat
DATA : gt_fieldcat    TYPE slis_t_fieldcat_alv,
       gt_fieldcat_ln LIKE LINE OF gt_fieldcat.
** Layout
DATA : gs_layout TYPE slis_layout_alv.


** IT_EVENT_EXIT
DATA : gt_event_exit TYPE slis_t_event_exit.


** I_CALL_USER_COMMANT
DATA : g_user_command TYPE slis_formname VALUE 'USER_COMMAND'.
DATA : r_ucomm        TYPE sy-ucomm.
DATA : rs_selfield    TYPE slis_selfield.


** VARIANT ?? ??
DATA : gs_variant     TYPE disvariant.
*// ALV? ?? ?? ? //*



*----------------------------------------------------------------------*
* Selection Screen
*----------------------------------------------------------------------*


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


SELECTION-SCREEN BEGIN OF LINE.


SELECTION-SCREEN COMMENT 3(12) text-002 FOR FIELD p_carrid.
*SELECTION-SCREEN POSITION 32.
PARAMETERS : p_carrid AS CHECKBOX USER-COMMAND pcarrid.
*SELECTION-SCREEN END OF LINE.
*
*SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 20(12) text-003 FOR FIELD p_carna.
*SELECTION-SCREEN POSITION 40.
PARAMETERS : p_carna AS CHECKBOX USER-COMMAND pcarrname.


SELECTION-SCREEN END OF LINE.


SELECTION-SCREEN END OF BLOCK bl1.


*SKIP 1.


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


SELECT-OPTIONS: s_carrid FOR spfli-carrid MODIF ID g1.


SELECTION-SCREEN END OF BLOCK bl2.


*SKIP 1.


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


SELECT-OPTIONS: s_carrna FOR scarr-carrname NO INTERVALS NO-EXTENSION MODIF ID g2.


SELECTION-SCREEN END OF BLOCK bl3.


*----------------------------------------------------------------------*
* INITIALIZATION.
*----------------------------------------------------------------------*


INITIALIZATION.


  s_carrid-sign = 'I'.
  s_carrid-option = 'BT'.
  s_carrid-low = 'AA'.
  s_carrid-high = 'AB'.
  APPEND s_carrid.


AT SELECTION-SCREEN OUTPUT.


  LOOP AT SCREEN.
    IF screen-group1 = 'G1'.
      IF p_carrid EQ 'X'.
        screen-active = 1.
      ELSE.
        screen-active = 0.
      ENDIF.
      MODIFY SCREEN.
    ENDIF.
    IF screen-group1 = 'G2'.
      IF p_carna EQ 'X'.
        screen-active = 1.
      ELSE.
        screen-active = 0.
      ENDIF.
      MODIFY SCREEN.
    ENDIF.
  ENDLOOP.


 


*----------------------------------------------------------------------*
* Start of Selection *
*----------------------------------------------------------------------*


START-OF-SELECTION.


  PERFORM select_data.
  PERFORM set_fieldcat.
  PERFORM set_layout.



END-OF-SELECTION.


  PERFORM display_data.


AT USER-COMMAND.


  CASE sy-ucomm.
    WHEN 'SELECT'.
      MESSAGE i001 WITH text-m01.
    WHEN 'SELECTALL'.
      MESSAGE i001 WITH text-m02.
  ENDCASE.



*&---------------------------------------------------------------------*
*&      Form  select_data
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM select_data .


  IF p_carrid EQ space.
    p_carrid = '%'.
  ELSE.
    CONCATENATE s_carrna '%' INTO s_carrna.
  ENDIF.


  SELECT *
    INTO CORRESPONDING FIELDS OF TABLE itab_spfli
    FROM spfli
    WHERE carrid IN s_carrid.


  SELECT carrid carrname
  INTO CORRESPONDING FIELDS OF TABLE itab_scarr
  FROM scarr
  FOR ALL ENTRIES IN itab_spfli
  WHERE carrid = itab_spfli-carrid AND
  carrname IN s_carrna.


*  LOOP AT itab_spfli.
*
** 1)
*    MOVE-CORRESPONDING  itab_spfli TO itab.
*    CLEAR itab_scarr.
*    READ TABLE itab_scarr WITH KEY carrid = itab_spfli-carrid.
*    itab-carrname = itab_scarr-carrname.
*
*    APPEND itab.
*    CLEAR itab.
*


* 2)
*    CLEAR itab_scarr.
*    READ TABLE itab_scarr WITH KEY carrid = itab_spfli-carrid.
*
*    IF sy-subrc = 0.
*      itab-carrname = itab_scarr-carrname.
*
*      APPEND itab.
*
*    ENDIF.
*    CLEAR itab.


*
*    IF NOT itab_spfli[] IS INITIAL.
*
*      l_cnt = LINES( itab_spfli ).
*
*    ENDIF.
*
*  ENDLOOP.


*-----------------------------------------------------------------------


  IF NOT itab_spfli[] IS INITIAL.


    l_cnt = LINES( itab_spfli ).


    LOOP AT itab_spfli.


* 1)
      MOVE-CORRESPONDING  itab_spfli TO itab.
      CLEAR itab_scarr.
      READ TABLE itab_scarr WITH KEY carrid = itab_spfli-carrid.
      itab-carrname = itab_scarr-carrname.


      APPEND itab.
      CLEAR itab.
    ENDLOOP.


  ENDIF.



*END-OF-SELECTION.
*
*
*  IF NOT itab[] IS INITIAL.
*    SET PF-STATUS 'MENUBAR'.
*
*    LOOP AT itab.
*
*      WRITE:/ sy-vline,
*            (10) itab-carrid COLOR 5,
*            sy-vline,
*            (25) itab-carrname,
*            sy-vline,
*            (10) itab-connid,
*            sy-vline,
*            (20) itab-cityto,
*            sy-vline,
*            (20) itab-cityfrom,
*            sy-vline.
*      ULINE.
*
*      HIDE: itab.
*
*    ENDLOOP.
*
*  ENDIF.


*  ENDIF.


ENDFORM.                    " select_data
*&---------------------------------------------------------------------*
*&      Form  display_data
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM display_data.


  CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
     i_interface_check              = ' '
*   I_BYPASSING_BUFFER             =
*   I_BUFFER_ACTIVE                = ' '
     i_callback_program             = sy-repid
     i_callback_pf_status_set       = gv_status
*   i_callback_pf_status_set       = sy-pfkey
     i_callback_user_command        = g_user_command
*   I_STRUCTURE_NAME               =
     is_layout                      = gs_layout
     it_fieldcat                    = gt_fieldcat
*   IT_EXCLUDING                   =
*   IT_SPECIAL_GROUPS              =
*   IT_SORT                        =
*   IT_FILTER                      =
*   IS_SEL_HIDE                    =
*   i_default                      = 'X'
*   i_save                         = 'A' "U: USER ONLY,X: PUBLIC, A:BOTH
*   is_variant                     = gs_variant
*   IT_EVENTS                      =
*   it_event_exit                  = gt_event_exit
*   IS_PRINT                       =
*   IS_REPREP_ID                   =
*   I_SCREEN_START_COLUMN          = 0
*   I_SCREEN_START_LINE            = 0
*   I_SCREEN_END_COLUMN            = 0
*   I_SCREEN_END_LINE              = 0
* IMPORTING
*   E_EXIT_CAUSED_BY_CALLER        =
*   ES_EXIT_CAUSED_BY_USER         =
    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_data
*&---------------------------------------------------------------------*
*&      Form  set_fieldcat
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM set_fieldcat.


  CLEAR : gt_fieldcat_ln,  gt_fieldcat.
  gt_fieldcat_ln-fieldname    = 'CARRID'.
  gt_fieldcat_ln-col_pos      = '1'.
*  gt_fieldcat_ln-just         = 'L'.
  gt_fieldcat_ln-fix_column   = 'X'.
  gt_fieldcat_ln-reptext_ddic = 'CARR-ID'.
  APPEND gt_fieldcat_ln TO gt_fieldcat.


*  gt_fieldcat_ln-ref_tabname      = 'ZHMSTR'.
*  gt_fieldcat_ln-ref_fieldname    = 'IDNO'.
*  gt_fieldcat_ln-emphasize    = 'C610'.


  CLEAR gt_fieldcat_ln.
  gt_fieldcat_ln-fieldname    = 'CARRNAME'.
  gt_fieldcat_ln-col_pos      = '2'.
  gt_fieldcat_ln-just         = 'L'.
  gt_fieldcat_ln-fix_column   = 'X'.
  gt_fieldcat_ln-reptext_ddic = 'CARR-NAME'.
  APPEND gt_fieldcat_ln TO gt_fieldcat.


  CLEAR gt_fieldcat_ln.
  gt_fieldcat_ln-fieldname    = 'CONNID'.
  gt_fieldcat_ln-col_pos      = '3'.
  gt_fieldcat_ln-just         = 'L'.
  gt_fieldcat_ln-reptext_ddic = 'CONN-ID'.
  APPEND gt_fieldcat_ln TO gt_fieldcat.


  CLEAR gt_fieldcat_ln.
  gt_fieldcat_ln-fieldname    = 'CITYTO'.
  gt_fieldcat_ln-col_pos      = '4'.
  gt_fieldcat_ln-just         = 'L'.
  gt_fieldcat_ln-reptext_ddic = 'CITY-TO'.
  APPEND gt_fieldcat_ln TO gt_fieldcat.


  CLEAR gt_fieldcat_ln.
  gt_fieldcat_ln-fieldname    = 'CITYFORM'.
  gt_fieldcat_ln-col_pos      = '5'.
  gt_fieldcat_ln-just         = 'L'.
  gt_fieldcat_ln-reptext_ddic = 'CITY-FROM'.
  APPEND gt_fieldcat_ln TO gt_fieldcat.


ENDFORM.                    " set_fieldcat
*&---------------------------------------------------------------------*
*&      Form  set_layout
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM set_layout.


  gs_layout-colwidth_optimize = 'X'.
  gs_layout-zebra             = 'X'.
  gs_layout-info_fieldname    = 'COLOR'.
  gs_layout-coltab_fieldname  = 'C610'.
  gs_layout-box_fieldname = 'CARRID'.
  gs_layout-box_tabname = 'ITAB'.


ENDFORM.                    " set_layout

번호 제목 글쓴이 날짜 조회 수
3372 <b>[완료]</b>질문있습니다~~ 급해서요.. 펑션을 가지고 프로그램 찾기가... [2] 쭈니 2009.03.13 1149
» [요청]필드카탈로그를 적용했는데 덤프가 뜨네요. [4] file 로미오 2009.03.13 1534
3370 <b>[완료]</b>텍스트요소 - 선택텍스트, 텍스트기호 [3] 용군 2009.03.13 2793
3369 <b>[완료]</b>에러를 해결하고 NW04를 깔고 GUI도 설치했으나 sapmmc 난관이....도와주세요 [10] Abap consultant 2009.03.13 1595
3368 [요청]루프 문제입니다...^^;; 도서 관리...... [6] file 快结婚的男人 2009.03.12 1325
3367 [요청]테이블컨트롤에서 tab key event가 가능한가요? [3] 은우야 2009.03.12 1531
3366 <img src=3.gif border=0>[요청]3437 번 에 질문 했던것 다시 질문 드릴께요. [6] 신조 2009.03.12 984
3365 <b>[완료]</b>Function 에서 pc 로 백업받을때 PERFORM 쓴 것까지 INCLUDE 로 받을수 있나요? [3] 도움이 2009.03.12 1025
3364 <b>[완료]</b>스마트 폼, 수량 단위 적용 안 되는 문제. [2] file JiruMi 2009.03.12 2743
3363 <img src=3.gif border=0>[요청]스마트폼에서 컬러로 된 이미지가 프린트가 되지 않습니다. [2] 별이 2009.03.12 1265
3362 [요청]아밥에서 한글입력 안되게 하는 구문이나, 펑션아시나요?. [2] 프로복서™ 2009.03.11 2404
3361 [요청]문자열에서 특정 문자열 삭제하기 [5] 봉봉봉 2009.03.11 2001
3360 <img src=3.gif border=0>[요청]ALV 를 이용하여 특정 Field Display 해 주는 Report 샘플좀 부탁 합니다. [3] 신조 2009.03.11 1014
3359 <b>[완료]</b>selection texts 수정 관련 질문입니다. [2] 불근모자 2009.03.11 1291
3358 [요청]insert시 키값이 비어 있으면 DB에 값이 들어가는게 맞는건가요? [5] 댕댕 2009.03.11 1929
3357 <b>[완료]</b>cl_gui_custom_container 관련 질문입니다 [3] 아밥어렵네요 2009.03.11 2116
3356 [요청]get cursor field와 기타질문입니다. [2] 로미오 2009.03.11 1926
3355 [요청]function key 차이점에 관한 질문입니다. [2] file 앙리 2009.03.11 2913
3354 [요청]오더시 userexit부분에 fcode가 뭔가요? [3] SD2 2009.03.11 2193
3353 [요청]변경 계정 관리 에서 계정 유형을 변경 시키고자 합니다. [1] 별나라대마왕 2009.03.11 1910