Code: Alles auswählen.
parameters: p_struct like dd02d-strname obligatory.
data: dref type ref to data.
field-symbols: <fs> type table.
create data dref type (p_struct).
assign dref->* to <fs>.
call function 'BAPI_AR_ACC_GETOPENITEMS'
exporting
companycode = ls_bukrs
customer = ls_kunnr
keydate = p_date
noteditems = ' '
importing
return = gs_err
tables
lineitems = <fs>.
Code: Alles auswählen.
PARAMETERS: p_struct LIKE dd02d-strname OBLIGATORY
DEFAULT 'BAPI3007_2'.
DATA: lt_dfies LIKE STANDARD TABLE OF dfies,
ls_dfies LIKE LINE OF lt_dfies,
ls_fieldcatalog TYPE lvc_s_fcat,
lt_fieldcatalog LIKE STANDARD TABLE OF ls_fieldcatalog.
DATA: my_table TYPE REF TO data.
CALL FUNCTION 'DDIF_NAMETAB_GET'
EXPORTING
tabname = p_struct
* ALL_TYPES = ' '
* LFIELDNAME = ' '
* GROUP_NAMES = ' '
* IMPORTING
* X030L_WA =
* DTELINFO_WA =
* TTYPINFO_WA =
* DDOBJTYPE =
* DFIES_WA =
TABLES
* X031L_TAB =
dfies_tab = lt_dfies.
* EXCEPTIONS
* NOT_FOUND = 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.
LOOP AT lt_dfies INTO ls_dfies.
IF ls_dfies-inttype EQ 'P'.
ls_fieldcatalog-datatype = 'QUAN'.
ls_fieldcatalog-inttype = ls_dfies-inttype.
ls_fieldcatalog-intlen = ls_dfies-intlen.
ls_fieldcatalog-decimals = ls_dfies-decimals.
ELSE.
ls_fieldcatalog-ref_table = ls_dfies-tabname.
ls_fieldcatalog-ref_field = ls_dfies-fieldname.
ENDIF.
ls_fieldcatalog-fieldname = ls_dfies-fieldname.
APPEND ls_fieldcatalog TO lt_fieldcatalog.
ENDLOOP.
* Tabelle mit Feldkatalog erstellen
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = lt_fieldcatalog
IMPORTING
ep_table = my_table
.
CALL FUNCTION 'BAPI_AR_ACC_GETOPENITEMS'
EXPORTING
companycode = '1000'
customer = '9999999999'
keydate = sy-datum
noteditems = ' '
* IMPORTING
* return = gs_err
TABLES
lineitems = my_table.
Code: Alles auswählen.
FIELD-SYMBOLS: <lt_table> TYPE ANY TABLE.
[...]
CALL METHOD cl_alv_table_create=>create_dynamic_table...
[...]
ASSIGN my_table->* TO <lt_table>.
Code: Alles auswählen.
loop at tab_lineitems into wa_lineitems.
move-corresponding wa_lineitems to wa_itab2.
insert wa_itab2 into table <itab2>.
endloop.
Code: Alles auswählen.
gt_op LIKE STANDARD TABLE OF bapi3007_2 WITH HEADER LINE.
Code: Alles auswählen.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = lt_fieldcatalog
IMPORTING
ep_table = my_table
.
ASSIGN my_table->* TO <lt_table>.
Code: Alles auswählen.
DATA: my_table TYPE REF TO data.
FIELD-SYMBOLS: <lt_table> TYPE STANDARD TABLE.
Code: Alles auswählen.
LOOP AT gt_op INTO gs_op.
MOVE gs_op TO <fs>.
insert <fs> into table <lt_table>.
ENDLOOP.
Code: Alles auswählen.
FIELD-SYMBOLS: <fs> TYPE ANY.
Code: Alles auswählen.
field-symbols: <fs> type any.
create data dref type (p_struct).
assign dref->* to <fs>.
Code: Alles auswählen.
LOOP AT gt_op INTO gs_op.
MOVE-CORRESPONDING gs_op TO <fs>.
insert <fs> into table <lt_table>.
ENDLOOP.