ABAP顾问
分类:
2009-02-26 14:36:06
REPORT z_barry_test123.
TYPE-POOLS: slis.
TABLES mara.
DATA: gd_fieldcat TYPE slis_t_fieldcat_alv.
DATA: sla TYPE slis_layout_alv ,
ivariant LIKE disvariant,
i_repid LIKE sy-repid ,
i_excluding TYPE slis_t_extab.
DATA:BEGIN OF itab OCCURS 0 ,
objek LIKE ksskausp-objek ,
klart LIKE ksskausp-klart ,
atinn LIKE ksskausp-atinn ,
class LIKE ewa_cawnksml-class ,
atwrt LIKE ewa_cawnksml-atwrt ,
atbez LIKE ewa_cawnksml-atbez ,
atwtb LIKE ewa_cawnksml-atwtb ,
spras LIKE ewa_cawnksml-spras ,
END OF itab.
SELECT-OPTIONS: s_matnr FOR mara-matnr OBLIGATORY.
START-OF-SELECTION.
PERFORM getdata.
PERFORM outdata.
*&---------------------------------------------------------------------*
*& Form getdata
*&---------------------------------------------------------------------*
FORM getdata.
SELECT ksskausp~objek
ksskausp~klart
ksskausp~atinn
ewa_cawnksml~class
ewa_cawnksml~atbez
ewa_cawnksml~atwrt
ewa_cawnksml~atwtb
ewa_cawnksml~spras
* ewa_cawnksml~clint
INTO CORRESPONDING FIELDS OF TABLE itab
FROM ksskausp INNER JOIN ewa_cawnksml ON
ewa_cawnksml~atinn = ksskausp~atinn AND
ewa_cawnksml~atwrt = ksskausp~atwrt AND
ewa_cawnksml~clint = ksskausp~clint AND
ewa_cawnksml~klart1 = ksskausp~klart
WHERE ksskausp~objek IN s_matnr .
LOOP AT itab.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
input = itab-objek
IMPORTING
output = itab-objek.
MODIFY itab.
ENDLOOP.
ENDFORM. "getdata
*&---------------------------------------------------------------------*
*& Form OUTDATA
*&---------------------------------------------------------------------*
FORM outdata .
PERFORM fieldcat_init .
sla-colwidth_optimize = 'X'.
sla-zebra = 'X'.
i_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = i_repid
it_fieldcat = gd_fieldcat[]
i_save = 'A'
is_variant = ivariant
is_layout = sla
TABLES
t_outtab = itab
EXCEPTIONS
program_error = 1
OTHERS = 2.
ENDFORM. " OUTDATA
*---------------------------------------------------------------------*
* FORM fieldcat_init *
*---------------------------------------------------------------------*
FORM fieldcat_init .
PERFORM frm_catlg_set USING: 'OBJEK' '物料' ,
'KLART' '类别种类' ,
'CLASS' '类别' ,
'ATINN' '内部特性' ,
'ATBEZ' '特性描述' ,
'ATWRT' '特性值' ,
'ATWTB' '特性值描述' ,
'SPRAS' '语言' .
ENDFORM. "fieldcat_init
*---------------------------------------------------------------------*
* FORM frm_catlg_set *
*---------------------------------------------------------------------*
FORM frm_catlg_set USING p_field
p_text.
DATA: ls_fieldcat TYPE slis_fieldcat_alv.
ls_fieldcat-fieldname = p_field.
ls_fieldcat-seltext_l = p_text.
APPEND ls_fieldcat TO gd_fieldcat .
CLEAR ls_fieldcat .
ENDFORM. "frm_catlg_set