Code: Alles auswählen.
:
:
* authority display or change
PERFORM authority_tcode USING 'FB02' subrc.
IF subrc EQ 0.
x_change = 'X'.
ELSE.
x_change = space.
ENDIF.
* leave to ALV:
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
text = text-009.
CALL FUNCTION 'FI_ITEMS_DISPLAY'
EXPORTING
caller_repid = c_repid_ar
acctype = c_koart_ar
x_change = x_change
i_u_save = gd_alvsave
is_u_variant = gs_variant
it_u_fieldcat = gt_fieldcat[]
it_kontab = it_accts[]
it_slbtab = it_comps[]
it_t001 = it_h_t001[]
it_kna1 = it_h_kna1[]
it_knb1 = it_h_knb1[]
x_grid = x_grid
x_inet = pa_inet
TABLES
it_items = it_pos.
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
titlebar = 'Drucken'
text_question = 'Soll gedruckt werden ?'(011)
* TEXT_BUTTON_1 = 'Ja'(001)
* ICON_BUTTON_1 = ' '
* TEXT_BUTTON_2 = 'Nein'(002)
* ICON_BUTTON_2 = ' '
* DEFAULT_BUTTON = '1'
* DISPLAY_CANCEL_BUTTON = 'X'
* USERDEFINED_F1_HELP = ' '
* START_COLUMN = 25
* START_ROW = 6
* POPUP_TYPE =
* IV_QUICKINFO_BUTTON_1 = ' '
* IV_QUICKINFO_BUTTON_2 = ' '
IMPORTING
answer = lv_ans
* TABLES
* PARAMETER =
EXCEPTIONS
text_not_found = 1
OTHERS = 2.
IF sy-subrc = 0 AND lv_ans = '1'.
PERFORM print_sf.
ENDIF.
FREE it_h_t001. "1236371
FREE it_h_kna1. "1236371
FREE it_h_knb1. "1236371
FREE it_pos. "1236371
:
:
Code: Alles auswählen.
FORM print_sf.
DATA lv_fname TYPE tdsfname VALUE 'ZFI_OPEN_ITEMS'.
DATA lv_fm_name TYPE rs38l_fnam.
DATA is_data TYPE yttfi_rfitema.
DATA ls_options TYPE itcpo.
DATA sf_options TYPE ssfctrlop.
DATA: ls_output_options TYPE ssfcompop.
DATA: l_devtype TYPE rspoptype.
PERFORM f_display_data.
CHECK NOT t_pos[] IS INITIAL.
IF NOT pa_sf IS INITIAL.
lv_fname = pa_sf.
ENDIF.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = lv_fname
IMPORTING
fm_name = lv_fm_name
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3.
IF sy-subrc NE 0.
EXIT.
ENDIF.
CALL FUNCTION 'GET_TEXT_PRINT_PARAMETERS'
IMPORTING
newoptions = ls_options
* PRINT_FORMAT =
EXCEPTIONS
canceled = 1
archive_error = 2
device = 3
OTHERS = 4.
IF sy-subrc <> 0.
EXIT.
ENDIF.
sf_options-no_dialog = 'X'.
sf_options-preview = ls_options-tdpreview.
sf_options-langu = sy-langu.
MOVE-CORRESPONDING ls_options TO ls_output_options.
ls_output_options-tdimmed = 'X'.
* Loop über Konten
LOOP AT it_accts.
FREE is_data.
* IT_ACCTS[]
APPEND it_accts TO is_data-it_accts.
*IT_COMPS[]
LOOP AT it_comps WHERE bukrs = it_accts-bukrs.
APPEND it_comps TO is_data-it_comps.
ENDLOOP.
*IT_H_T001[]
LOOP AT it_h_t001 WHERE bukrs = it_accts-bukrs.
APPEND it_h_t001 TO is_data-it_h_t001.
ENDLOOP.
*IT_H_KNA1[]
LOOP AT it_h_kna1 WHERE kunnr = it_accts-konto.
APPEND it_h_kna1 TO is_data-it_h_kna1.
ENDLOOP.
*customer language
IF it_h_kna1-spras = 'D'.
sf_options-langu = 'D'.
ELSE.
sf_options-langu = 'E'.
ENDIF.
*IT_H_KNB1[]
LOOP AT it_h_knb1 WHERE kunnr = it_accts-konto.
APPEND it_h_knb1 TO is_data-it_h_knb1.
ENDLOOP.
*IT_POS[] = t_pos
LOOP AT t_pos INTO it_pos WHERE konto = it_accts-konto.
APPEND it_pos TO is_data-it_pos.
ENDLOOP.
* Sel Parameter
is_data-stida = pa_stida.
IF NOT is_data-it_pos[] IS INITIAL.
CALL FUNCTION lv_fm_name
EXPORTING
control_parameters = sf_options
output_options = ls_output_options
user_settings = ' '
is_data = is_data
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
IF sy-subrc <> 0.
ENDIF.
ENDIF."it_pos[] is initial
ENDLOOP.
ENDFORM. "print_sf
Code: Alles auswählen.
*---------------------------------------------------------------------*
* Form f_display_data
*---------------------------------------------------------------------*
FORM f_display_data.
* Macro definition
DEFINE m_fieldcat.
add 1 to ls_fieldcat-col_pos.
ls_fieldcat-fieldname = &1.
ls_fieldcat-ref_tabname = &2.
append ls_fieldcat to lt_fieldcat.
END-OF-DEFINITION.
TYPE-POOLS: slis. " ALV Global types
DATA:
l_exit,
ls_private TYPE slis_data_caller_exit,
ls_seldat TYPE ty_sel,
ls_fieldcat TYPE slis_fieldcat_alv,
lt_fieldcat TYPE slis_t_fieldcat_alv.
* Copy entries for selection
LOOP AT it_pos.
MOVE-CORRESPONDING it_pos TO ls_seldat.
ls_seldat-checkbox = 'X'.
APPEND ls_seldat TO gt_seldat.
ENDLOOP.
* Build the field catalog
m_fieldcat 'BELNR' 'RFPOSXEXT'.
m_fieldcat 'BUDAT' 'RFPOSXEXT'.
m_fieldcat 'BUKRS' 'RFPOSXEXT'.
m_fieldcat 'BLART' 'RFPOSXEXT'.
m_fieldcat 'KONTO' 'RFPOSXEXT'.
m_fieldcat 'ZUONR' 'RFPOSXEXT'.
m_fieldcat 'UMSKZ' 'RFPOSXEXT'.
m_fieldcat 'WRSHB' 'RFPOSXEXT'.
m_fieldcat 'WAERS' 'RFPOSXEXT'.
m_fieldcat 'SGTXT' 'RFPOSXEXT'.
* Optimize column width
ls_private-columnopt = 'X'.
* Display data in a POPUP
CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
EXPORTING
i_title = 'Please select items'
i_selection = 'X'
i_zebra = 'X'
it_fieldcat = lt_fieldcat
i_tabname = 'GT_SELDAT'
i_checkbox_fieldname = 'CHECKBOX'
is_private = ls_private
IMPORTING
e_exit = l_exit
TABLES
t_outtab = gt_seldat.
CHECK l_exit = space.
REFRESH t_pos.
* What has been selected ?
LOOP AT gt_seldat INTO ls_seldat WHERE checkbox = 'X'.
* MESSAGE i368(00) WITH ls_user-bname 'selected'.
READ TABLE it_pos INDEX sy-tabix.
IF sy-subrc = 0.
* IF it_pos-umskz IN so_umskz.
APPEND it_pos TO t_pos.
* ENDIF.
ENDIF.
ENDLOOP.
ENDFORM. " F_DISPLAY_DATA