Hi all,
please, can you help me? I have a script, and my first select does not work (see rows 166-170 in code attached). I don know why my output value of this select is blank.
I am selecting corrective invoices list regarding to input value iv_inv - invoice.
Thank you very much for any answer.
Dimitrij
*&---------------------------------------------------------------------*
*& Report ZBICINVLINK
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZBICINVLINK.
TABLES: DFKKINVDOC_H, ZBICBDOCH.
type-pools: slis. "ALV Deklarace
*Deklarace dat
*----------------
TYPES: BEGIN OF t_link,
SEl, "Ktere radky uzivatel vybral
invdocno TYPE ZBICBDOCH-invdocno,
doctype TYPE DFKKINVDOC_H-doctype,
crdate TYPE DFKKINVDOC_H-crdate,
crtime TYPE DFKKINVDOC_H-crtime,
total_curr TYPE DFKKINVDOC_H-total_curr,
total_amt TYPE DFKKINVDOC_H-total_amt,
reversaldoc TYPE DFKKINVDOC_H-reversaldoc,
END OF t_link.
DATA: it_link TYPE STANDARD TABLE OF t_link INITIAL SIZE 0,
wa_link TYPE t_link.
*Deklarace ALV dat
data: fieldcatalog type slis_t_fieldcat_alv with header line,
gd_tab_group type slis_t_sp_group_alv,
gd_layout type slis_layout_alv,
gd_repid like sy-repid.
************************************************************************
*Start-of-selection.
SELECTION-SCREEN Begin of Block b1 With Frame Title TEXT-T01.
PARAMETERS iv_inv TYPE ZBICBDOCH-invdocno_opr.
SELECTION-SCREEN End of Block b1.
START-OF-SELECTION.
perform data_retrieval.
perform build_fieldcatalog.
perform build_layout.
perform display_alv_report.
*&---------------------------------------------------------------------*
*& Form BUILD_FIELDCATALOG
*&---------------------------------------------------------------------*
* Build Fieldcatalog for ALV Report
*----------------------------------------------------------------------*
form build_fieldcatalog.
fieldcatalog-fieldname = 'INVDOCNO'.
fieldcatalog-seltext_m = 'Císlo fakturacniho dokladu'.
fieldcatalog-col_pos = 0.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
fieldcatalog-key = 'X'.
* fieldcatalog-do_sum = 'X'.
* fieldcatalog-no_zero = 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'DOCTYPE'.
fieldcatalog-seltext_m = 'Druh dokladu'.
fieldcatalog-col_pos = 1.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'CRDATE'.
fieldcatalog-seltext_m = 'Datum vytvoreni fakturacniho dokladu'.
fieldcatalog-col_pos = 2.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'CRTIME'.
fieldcatalog-seltext_m = 'Cas vytvoreni fakturacniho dokladu'.
fieldcatalog-col_pos = 3.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'TOTAL_AMT'.
fieldcatalog-seltext_m = 'Castka ve mene transakce se znamenkem'.
fieldcatalog-col_pos = 4.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'TOTAL_CURR'.
fieldcatalog-seltext_m = 'Mena transakce'.
fieldcatalog-col_pos = 5.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'REVERSALDOC'.
fieldcatalog-seltext_m = 'Cislo stornovaciho dokladu k fakturacnimu dokladu'.
fieldcatalog-col_pos = 6.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
endform. " BUILD_FIELDCATALOG
*&---------------------------------------------------------------------*
*& Form BUILD_LAYOUT
*&---------------------------------------------------------------------*
* Build layout for ALV grid report
*----------------------------------------------------------------------*
form build_layout.
gd_layout-box_fieldname = 'SEL'.
"set field name to store row selection
gd_layout-edit = 'X'. "makes whole ALV table editable
gd_layout-zebra = 'X'.
endform. " BUILD_LAYOUT
*&---------------------------------------------------------------------*
*& Form DISPLAY_ALV_REPORT
*&---------------------------------------------------------------------*
* Display report using ALV grid
*----------------------------------------------------------------------*
form display_alv_report.
gd_repid = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = gd_repid
* i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM
i_callback_user_command = 'USER_COMMAND'
* i_grid_title = outtext
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
* it_special_groups = gd_tabgroup
* IT_EVENTS = GT_XEVENTS
i_save = 'X'
* is_variant = z_template
tables
t_outtab = it_link
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_ALV_REPORT
*&---------------------------------------------------------------------*
*& Form DATA_RETRIEVAL
*&---------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
form data_retrieval.
DATA: invdocno_opr TYPE ZBICBDOCH-invdocno_opr,
iv_inv TYPE ZBICBDOCH-invdocno_opr.
IF iv_inv is initial.
MESSAGE s002(00) WITH 'Message'.
ENDIF.
IF iv_inv is not initial.
select invdocno
from ZBICBDOCH
into corresponding fields of table it_link
where invdocno_opr EQ iv_inv.
select doctype crdate crtime total_curr total_amt reversaldoc
from DFKKINVDOC_H
into corresponding fields of table it_link.
ENDIF.
endform. " DATA_RETRIEVAL
*------------------------------------------------------------------*
* FORM USER_COMMAND *
*------------------------------------------------------------------*
* --> R_UCOMM *
* --> RS_SELFIELD *
*------------------------------------------------------------------*
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
* Kontrola funkcniho kodu
CASE r_ucomm.
WHEN '&IC1'.
* Kontrola poli ALV reportu
IF rs_selfield-fieldname = 'INVDOCNO'.
* Nacteni tabulky dat pomocí indexu radku, na ktery uživatel klikl
READ TABLE it_link INTO wa_link INDEX rs_selfield-tabindex.
* Nastavi parametr ID pro oblast obrazovky transakci
SET PARAMETER ID 'BES' FIELD wa_link-invdocno.
* Zavola transakci ME23N a prejde na uvodni obrazovku pro zadavani dat
CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
ENDIF.
WHEN '&DATA_SAVE'. "uzovatel zmackne ULOZIT
loop at it_link into wa_link.
if wa_link-sel EQ 'X'.
* Zpracuje zaznamy, ktere byly vybrany
endif.
endloop.
ENDCASE.
ENDFORM. "user_command