Code: Alles auswählen.
*&---------------------------------------------------------------------*
*& Report Z_SINAN
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT z_sinan.
* Authority-check object 'S_TABU_NAM'
** link to the authorithy object S_RFC
* ID 'ACTVT' Field '03'
* ID 'TABLE' Field 'KNA1'.
*If Sy-subrc NE 0.
* RAISE NOT_AUTHORIZED.
* Exit.
* Endif.
TYPES: BEGIN OF struct,
mandt TYPE mandt,
kunnr TYPE char10,
land1 TYPE char3,
name1 TYPE char35,
name2 TYPE char35,
ort01 TYPE char35,
pstlz TYPE char20,
regio TYPE char3,
stras TYPE char35,
telf1 TYPE char16,
adrnr TYPE char10,
mcod1 TYPE char25,
mcod2 TYPE char25,
mcod3 TYPE char25,
anred TYPE char15,
aufsd TYPE char2,
brsch TYPE char4,
konzs TYPE char10,
ktokd TYPE char4,
kukla TYPE char2,
lifnr TYPE char10,
lifsd TYPE char2,
locco TYPE char10,
name3 TYPE char35,
name4 TYPE char35,
niels TYPE char2,
ort02 TYPE char35,
pfach TYPE char10,
pstl2 TYPE char10,
counc TYPE char3,
cityc TYPE char4,
sperr TYPE char1,
spras TYPE lang,
telf2 TYPE char16,
stceg TYPE char20,
dear1 TYPE char1,
dear2 TYPE char1,
dear3 TYPE char1,
dear4 TYPE char1,
bran1 TYPE char10,
bran2 TYPE char10,
bran3 TYPE char10,
bran4 TYPE char10,
bran5 TYPE char10,
umsat LIKE rbkp-wskto,
umjah TYPE n,
uwaer LIKE rbkp-waers,
jmzah TYPE n,
jmjah TYPE n,
katr1 TYPE char2,
katr2 TYPE char2,
katr3 TYPE char2,
katr4 TYPE char2,
katr5 TYPE char2,
katr6 TYPE char3,
katr7 TYPE char3,
katr8 TYPE char3,
katr9 TYPE char3,
katr10 TYPE char3,
stkzn TYPE char1,
umsa1 like rbkp-wskto,
pfort TYPE char35,
werks TYPE char4,
sperz TYPE char1,
cassd TYPE char2,
psoo1 TYPE char50,
psoo2 TYPE char50,
psoo3 TYPE char50,
psoo4 TYPE char50,
psoo5 TYPE char50,
extra TYPE string,
END OF struct.
DATA: lt_workarea TYPE TABLE OF struct,
ls_workarea TYPE struct,
go_table TYPE REF TO cl_salv_table,
go_functions TYPE REF TO cl_salv_functions.
SELECT
mandt
kunnr
land1
name1
name2
ort01
pstlz
regio
stras
telf1
adrnr
mcod1
mcod2
mcod3
anred
aufsd
brsch
konzs
ktokd
kukla
lifnr
lifsd
locco
name3
name4
niels
ort02
pfach
pstl2
counc
cityc
sperr
spras
telf2
stceg
dear1
dear2
dear3
dear4
bran1
bran2
bran3
bran4
bran5
umsat
umjah
uwaer
jmzah
jmjah
katr1
katr2
katr3
katr4
katr5
katr6
katr7
katr8
katr9
katr10
stkzn
umsa1
pfort
werks
sperz
cassd
psoo1
psoo2
psoo3
psoo4
psoo5
FROM kna1
UP TO 100 ROWS
INTO CORRESPONDING FIELDS OF TABLE lt_workarea.
TRY.
CL_SALV_TABLE=>FACTORY(
IMPORTING r_salv_table = go_table
CHANGING t_table = lt_workarea
).
CATCH cx_salv_msg.
ENDTRY.
go_functions = go_table->get_functions( ).
go_functions->set_all( abap_true ).
go_table->display( ).
Code: Alles auswählen.
go_table->get_columns( )->get_column( columnname = 'DEAR1' )->set_long_text( value = 'dies ist der lange Text' ).
Code: Alles auswählen.
* Statt
TYPES: BEGIN OF struct,
mandt TYPE mandt,
kunnr TYPE char10,
land1 TYPE char3,
*...
END OF struct.
* Variante 1
TYPES: BEGIN OF struct,
mandt TYPE mandt,
kunnr TYPE kunnr,
land1 TYPE land1_gp,
*...
END OF struct.
* Variante 2
TYPES: BEGIN OF struct,
mandt TYPE kna1-mandt,
kunnr TYPE kna1-kunnr,
land1 TYPE kna1-land1,
*...
END OF struct.
Folgende Benutzer bedankten sich beim Autor a-dead-trousers für den Beitrag:
Schäfer_anfänger