Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Code listing for: ZFI30300_CLASSES
- Description: Klase za program ZFI30300
- *&---------------------------------------------------------------------*
- *& Include ZFI30300_CLASSES
- *&---------------------------------------------------------------------*
- class lcl_app definition.
- public section.
- types:
- t_zpci type p length 8 decimals 2,
- begin of t_ska1,
- saknr_lact type saknr,
- saknr_grup type saknr,
- saknr_podu type saknr,
- end of t_ska1,
- begin of t_out,
- bukrs type bukrs,
- butxt type butxt,
- saknr_lact type saknr,
- txt50_lact type txt50_skat,
- saknr_kons type saknr,
- txt50_kons type txt50_skat,
- ktopl type ktopl,
- saknr type saknr,
- txt50 type txt50_skat,
- matnr type matnr,
- maktx type maktx,
- meins type meins,
- waers type waers,
- werks type werks_d,
- name1 type t001w-name1,
- lbkum_i type lbkum,
- salk3_i type salk3,
- zpci_i type t_zpci,
- salk3pci_i type salk3,
- salk3eur_i type salk3,
- lbkum_u type lbkum,
- salk3_u type salk3,
- zpci_u type t_zpci,
- salk3pci_u type salk3,
- salk3eur_u type salk3,
- end of t_out,
- begin of t_co_pci,
- kadky type ckhs-kadky,
- hwges type ckhs-hwges,
- menge type ckhs-menge,
- end of t_co_pci,
- tt_ska1 type hashed table of t_ska1 with unique key saknr_podu,
- tt_out type standard table of t_out.
- class-data:
- app type ref to lcl_app.
- class-methods:
- make_it_so,
- f4_saknr_lact,
- f4_saknr,
- authority_check,
- find_layout,
- check_layout.
- data:
- mt_out type tt_out,
- mt_fc type lvc_t_fcat.
- methods:
- constructor,
- main,
- handle_pbo,
- handle_pai importing i_ucomm type syucomm.
- private section.
- data:
- mt_t001 type hashed table of t001 with unique key bukrs,
- mt_ska1 type tt_ska1,
- mt_skat type hashed table of skat with unique key ktopl saknr,
- mt_makt type hashed table of makt with unique key matnr,
- mt_t001w type hashed table of t001w with unique key werks,
- mt_zbfrpci type standard table of zbfrpci,
- mt_zbfrklvar type standard table of zbfrklvar,
- m_last_date_report type d,
- m_last_date_compare type d.
- data:
- m_alv type ref to cl_gui_alv_grid,
- m_splitter type ref to cl_gui_splitter_container,
- m_container type ref to cl_gui_container,
- m_html_container type ref to cl_gui_container,
- m_header_document type ref to cl_dd_document.
- methods:
- select_data,
- get_sd_pci importing i_matnr type matnr
- i_date type d
- returning value(r_pci) type t_zpci
- exceptions not_found,
- get_co_pci importing i_matnr type matnr
- i_date type d
- i_werks type werks_d
- returning value(r_pci) type t_zpci,
- build_fc changing c_fc type lvc_t_fcat,
- display_header.
- endclass. "lcl_app DEFINITION
- *----------------------------------------------------------------------*
- * CLASS lcl_app IMPLEMENTATION
- *----------------------------------------------------------------------*
- *
- *----------------------------------------------------------------------*
- class lcl_app implementation.
- method make_it_so.
- if lcl_app=>app is initial.
- create object lcl_app=>app.
- endif.
- lcl_app=>app->main( ).
- endmethod. "make_it_so
- method constructor.
- concatenate s_spmoni-low '01' into me->m_last_date_report.
- concatenate s_spmonu-low '01' into me->m_last_date_compare.
- call function 'RP_LAST_DAY_OF_MONTHS'
- exporting
- day_in = me->m_last_date_report
- importing
- last_day_of_month = me->m_last_date_report
- exceptions
- day_in_no_date = 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.
- call function 'RP_LAST_DAY_OF_MONTHS'
- exporting
- day_in = me->m_last_date_compare
- importing
- last_day_of_month = me->m_last_date_compare
- exceptions
- day_in_no_date = 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.
- me->build_fc( changing c_fc = me->mt_fc ).
- * Daj mi sva konta na svijetu, svaèija...sve mi poveži... to mi treba... to mi radi. aaaaaaa...
- select distinct
- ska1_poduzeca~saknr as saknr_podu
- ska1_grupe~saknr as saknr_grup
- zlkon01~saknr as saknr_lact
- into corresponding fields of table me->mt_ska1
- from
- zlkon01 inner join ska1 as ska1_grupe on
- zlkon01~saknr = ska1_grupe~bilkt
- inner join ska1 as ska1_poduzeca on
- ska1_poduzeca~bilkt = ska1_grupe~saknr
- inner join t001 on
- ska1_poduzeca~ktopl = t001~ktopl
- where
- zlkon01~zstock <> '' and
- ska1_grupe~ktopl = 'KONS' and
- t001~bukrs in s_bukrs and
- zlkon01~saknr in s_saknrl and
- ska1_poduzeca~saknr in s_saknr.
- select * from t001 into table me->mt_t001 where bukrs in s_bukrs.
- select * from skat into table me->mt_skat where spras = sy-langu.
- select * from makt into table me->mt_makt where spras = sy-langu.
- select * from t001w into table me->mt_t001w.
- endmethod. "constructor
- method main.
- me->select_data( ).
- call screen 100.
- endmethod. "main
- method select_data.
- data: lt_zbfrstock_i type hashed table of zbfrstock with unique key bukrs bwkey zktopo zktogr zktola matnr,
- ls_zbfrstock_i type zbfrstock,
- lt_zbfrstock_u type hashed table of zbfrstock with unique key bukrs bwkey zktopo zktogr zktola matnr,
- ls_zbfrstock_u type zbfrstock,
- ls_out type t_out,
- ls_skat type skat,
- ls_makt type makt,
- ls_t001 type t001,
- ls_t001w type t001w,
- ls_exch_rate type bapi1093_0,
- l_sobsk type marc-sobsk.
- field-symbols: <out> type t_out.
- select
- bukrs
- bwkey
- zktopo
- zktogr
- zktola
- matnr
- meins
- waers
- sum( lbkum ) as lbkum
- sum( salk3 ) as salk3
- from
- zbfrstock
- into
- corresponding fields of table lt_zbfrstock_i
- where
- bukrs in s_bukrs and
- zktopo in s_saknr and
- zktola in s_saknrl and
- ryear = s_spmoni-low(4) and
- zmm = s_spmoni-low+4(2) and
- matnr in s_matnr
- group by
- bukrs
- bwkey
- zktopo
- zktogr
- zktola
- matnr
- meins
- waers.
- select
- bukrs
- bwkey
- zktopo
- zktogr
- zktola
- matnr
- meins
- waers
- sum( lbkum ) as lbkum
- sum( salk3 ) as salk3
- from
- zbfrstock
- into
- corresponding fields of table lt_zbfrstock_u
- where
- bukrs in s_bukrs and
- zktopo in s_saknr and
- zktola in s_saknrl and
- ryear = s_spmonu-low(4) and
- zmm = s_spmonu-low+4(2) and
- matnr in s_matnr
- group by
- bukrs
- bwkey
- zktopo
- zktogr
- zktola
- matnr
- meins
- waers.
- loop at lt_zbfrstock_i into ls_zbfrstock_i.
- clear: ls_out-werks, l_sobsk.
- move-corresponding ls_zbfrstock_i to ls_out.
- ls_out-saknr_lact = ls_zbfrstock_i-zktola.
- ls_out-saknr_kons = ls_zbfrstock_i-zktogr.
- ls_out-saknr = ls_zbfrstock_i-zktopo.
- read table lt_zbfrstock_u
- with table key
- bukrs = ls_zbfrstock_i-bukrs
- bwkey = ls_zbfrstock_i-bwkey
- zktopo = ls_zbfrstock_i-zktopo
- zktogr = ls_zbfrstock_i-zktogr
- zktola = ls_zbfrstock_i-zktola
- matnr = ls_zbfrstock_i-matnr
- into
- ls_zbfrstock_u.
- if sy-subrc <> 0.
- clear ls_zbfrstock_u.
- endif.
- ls_out-lbkum_i = ls_zbfrstock_i-lbkum.
- ls_out-salk3_i = ls_zbfrstock_i-salk3.
- ls_out-lbkum_u = ls_zbfrstock_u-lbkum.
- ls_out-salk3_u = ls_zbfrstock_u-salk3.
- select
- single t460a~wrk02 marc~sobsk
- from
- t460a inner join marc on
- t460a~werks = marc~werks and
- t460a~sobsl = marc~sobsk
- into
- (ls_out-werks, l_sobsk)
- where
- t460a~werks = ls_zbfrstock_i-bwkey and
- marc~matnr = ls_zbfrstock_i-matnr.
- if sy-subrc = 0 and l_sobsk = '52'.
- ls_out-werks = ls_zbfrstock_i-bwkey.
- endif.
- collect ls_out into me->mt_out.
- endloop.
- * Sad još moram nadoštukat ove kojih imam u usporednom razdoblju a nemam u izvještajnom...
- loop at lt_zbfrstock_u into ls_zbfrstock_u.
- read table lt_zbfrstock_i
- with table key
- bukrs = ls_zbfrstock_u-bukrs
- bwkey = ls_zbfrstock_u-bwkey
- zktopo = ls_zbfrstock_u-zktopo
- zktogr = ls_zbfrstock_u-zktogr
- zktola = ls_zbfrstock_u-zktola
- matnr = ls_zbfrstock_u-matnr
- transporting no fields.
- if sy-subrc = 0.
- continue.
- endif.
- clear: ls_out, l_sobsk.
- move-corresponding ls_zbfrstock_u to ls_out.
- ls_out-saknr_lact = ls_zbfrstock_u-zktola.
- ls_out-saknr_kons = ls_zbfrstock_u-zktogr.
- ls_out-saknr = ls_zbfrstock_u-zktopo.
- ls_out-lbkum_u = ls_zbfrstock_u-lbkum.
- ls_out-salk3_u = ls_zbfrstock_u-salk3.
- select
- single t460a~wrk02 marc~sobsk
- from
- t460a inner join marc on
- t460a~werks = marc~werks and
- t460a~sobsl = marc~sobsk
- into
- (ls_out-werks, l_sobsk)
- where
- t460a~werks = ls_zbfrstock_u-bwkey and
- marc~matnr = ls_zbfrstock_u-matnr.
- if sy-subrc = 0 and l_sobsk = '52'.
- ls_out-werks = ls_zbfrstock_u-bwkey.
- endif.
- collect ls_out into me->mt_out.
- endloop.
- loop at me->mt_out assigning <out>.
- * Prvo tražim PCI u SD cijeniku, pa ako ga ne naðem onda tražim u CO
- call method me->get_sd_pci
- exporting
- i_matnr = <out>-matnr
- i_date = me->m_last_date_report
- receiving
- r_pci = <out>-zpci_i
- exceptions
- not_found = 1.
- if sy-subrc = 1.
- <out>-zpci_i = me->get_co_pci( i_matnr = <out>-matnr
- i_date = me->m_last_date_report
- i_werks = <out>-werks ).
- endif.
- call method me->get_sd_pci
- exporting
- i_matnr = <out>-matnr
- i_date = me->m_last_date_compare
- receiving
- r_pci = <out>-zpci_u
- exceptions
- not_found = 1.
- if sy-subrc = 1.
- <out>-zpci_u = me->get_co_pci( i_matnr = <out>-matnr
- i_date = me->m_last_date_compare
- i_werks = <out>-werks ).
- endif.
- <out>-salk3pci_i = <out>-lbkum_i * <out>-zpci_i.
- <out>-salk3pci_u = <out>-lbkum_u * <out>-zpci_u.
- call function 'BAPI_EXCHANGERATE_GETDETAIL'
- exporting
- rate_type = p_kurst
- from_curr = 'EUR'
- to_currncy = <out>-waers
- date = me->m_last_date_report
- importing
- exch_rate = ls_exch_rate.
- if ls_exch_rate-exch_rate <> 0.
- if <out>-salk3pci_i <> 0.
- <out>-salk3eur_i = <out>-salk3pci_i / ls_exch_rate-exch_rate.
- else.
- <out>-salk3eur_i = <out>-salk3_i / ls_exch_rate-exch_rate.
- endif.
- else.
- clear <out>-salk3eur_i.
- endif.
- call function 'BAPI_EXCHANGERATE_GETDETAIL'
- exporting
- rate_type = p_kurst
- from_curr = 'EUR'
- to_currncy = <out>-waers
- date = me->m_last_date_compare
- importing
- exch_rate = ls_exch_rate.
- if ls_exch_rate-exch_rate <> 0.
- if <out>-salk3pci_u <> 0.
- <out>-salk3eur_u = <out>-salk3pci_u / ls_exch_rate-exch_rate.
- else.
- <out>-salk3eur_u = <out>-salk3_u / ls_exch_rate-exch_rate.
- endif.
- else.
- clear <out>-salk3eur_u.
- endif.
- * Nazivi iz matiènih...
- read table me->mt_t001 with table key bukrs = <out>-bukrs into ls_t001.
- if sy-subrc = 0.
- <out>-butxt = ls_t001-butxt.
- <out>-ktopl = ls_t001-ktopl.
- endif.
- read table me->mt_skat with table key ktopl = <out>-ktopl saknr = <out>-saknr into ls_skat.
- if sy-subrc = 0.
- <out>-txt50 = ls_skat-txt50.
- endif.
- read table me->mt_skat with table key ktopl = 'KONS' saknr = <out>-saknr_kons into ls_skat.
- if sy-subrc = 0.
- <out>-txt50_kons = ls_skat-txt50.
- endif.
- read table me->mt_skat with table key ktopl = 'LACT' saknr = <out>-saknr_lact into ls_skat.
- if sy-subrc = 0.
- <out>-txt50_lact = ls_skat-txt50.
- endif.
- read table me->mt_makt with table key matnr = <out>-matnr into ls_makt.
- if sy-subrc = 0.
- <out>-maktx = ls_makt-maktx.
- endif.
- read table me->mt_t001w with table key werks = <out>-werks into ls_t001w.
- if sy-subrc = 0.
- <out>-name1 = ls_t001w-name1.
- endif.
- endloop.
- endmethod. "select_data
- method get_sd_pci.
- data: l_kbetr type konp-kbetr,
- l_kpein type konp-kpein.
- select single
- konp~kbetr konp~kpein
- from a550 inner join konp on
- a550~knumh = konp~knumh
- into
- (l_kbetr, l_kpein)
- where
- a550~kappl = 'V' and
- a550~kschl in s_kschl and
- a550~matnr = i_matnr and
- a550~datab <= i_date and
- a550~datbi >= i_date.
- if sy-subrc <> 0.
- raise not_found.
- endif.
- r_pci = l_kbetr / l_kpein.
- endmethod. "get_sd_pci
- method get_co_pci.
- data: lt_co_pci type standard table of t_co_pci,
- ls_co_pci type t_co_pci,
- lt_zbfrklvar type standard table of zbfrklvar,
- lt_zbfrpci type standard table of zbfrpci,
- ls_zbfrklvar type zbfrklvar,
- ls_zbfrpci type zbfrpci.
- select single * from zbfrklvar into ls_zbfrklvar where werks = i_werks and begda <= i_date and endda >= i_date.
- select single * from zbfrpci into ls_zbfrpci where werks = i_werks and begda <= i_date and endda >= i_date.
- select
- ckhs~kadky ckhs~hwges ckhs~menge
- from
- ckhs inner join keko on
- ckhs~bzobj = keko~bzobj and
- ckhs~kalnr = keko~kalnr and
- ckhs~kalka = keko~kalka and
- ckhs~kadky = keko~kadky and
- ckhs~tvers = keko~tvers and
- ckhs~bwvar = keko~bwvar
- inner join tka02 on
- keko~kokrs = tka02~kokrs
- into
- corresponding fields of table lt_co_pci
- where
- ckhs~lednr = '00' and
- ckhs~bzobj = '00' and
- ckhs~bukrs in s_bukrs and
- ckhs~kadky between ls_zbfrklvar-begda and ls_zbfrklvar-endda and
- keko~matnr = i_matnr and
- tka02~bukrs in s_bukrs and
- keko~werks = i_werks and
- keko~sowrk = '' and
- keko~klvar = ls_zbfrklvar-klvar.
- sort lt_co_pci by kadky ascending.
- read table lt_co_pci into ls_co_pci index 1.
- r_pci = ( ls_co_pci-hwges / ls_co_pci-menge ).
- r_pci = r_pci + ( r_pci * ls_zbfrpci-pcimp / 100 ).
- * r_pci * ( 1 + ( ls_zbfrpci-pcimp / 100 ) ) .
- endmethod. "get_co_pci
- method handle_pbo.
- data: ls_layo type lvc_s_layo,
- variant type disvariant.
- set pf-status 'PF100'.
- set titlebar 'TB100'.
- if me->m_splitter is initial.
- create object me->m_splitter
- exporting
- parent = cl_gui_container=>default_screen
- rows = 2
- columns = 1.
- me->m_splitter->set_row_height( exporting height = 120
- id = 1 ).
- me->m_html_container = me->m_splitter->get_container( row = 1
- column = 1 ).
- endif.
- me->m_splitter->set_row_mode( mode = cl_gui_splitter_container=>mode_absolute ).
- if me->m_alv is initial.
- me->m_container = me->m_splitter->get_container( row = 2
- column = 1 ).
- create object me->m_alv
- exporting
- i_parent = me->m_container.
- ls_layo-cwidth_opt = 'X'.
- ls_layo-grid_title = ''.
- variant-report = sy-repid.
- variant-username = sy-uname.
- variant-variant = p_layout.
- me->m_alv->set_table_for_first_display( exporting is_layout = ls_layo
- i_save = 'A'
- i_default = 'X'
- is_variant = variant
- changing it_outtab = me->mt_out
- it_fieldcatalog = me->mt_fc ).
- me->display_header( ).
- endif.
- me->m_alv->refresh_table_display( i_soft_refresh = 'X' ).
- endmethod. "handle_pbo
- method handle_pai.
- case i_ucomm.
- when 'PCI'.
- when 'KLVAR'.
- when 'BACK' or 'CANCEL'.
- set screen 0.
- when 'EXIT'.
- leave program.
- endcase.
- endmethod. "handle_pai
- method build_fc.
- data:
- ls_fc type lvc_s_fcat,
- l_coltext type lvc_txtcol,
- l_fieldname type lvc_fname.
- define add_field.
- ls_fc-fieldname = &1.
- ls_fc-ref_field = &2.
- ls_fc-ref_table = &3.
- if &4 is not initial.
- ls_fc-coltext = ls_fc-tooltip = &4.
- endif.
- ls_fc-emphasize = &5.
- append ls_fc to c_fc.
- clear ls_fc.
- end-of-definition.
- add_field:
- 'BUKRS' 'BUKRS' 'T001' '' 'C400',
- 'BUTXT' 'BUTXT' 'T001' '' 'C400',
- 'SAKNR_LACT' 'SAKNR' 'ZLKON01' 'Lactalis konto' 'C400',
- 'TXT50_LACT' 'TXT50' 'SKAT' 'Naziv Lactalis konta' 'C400',
- 'SAKNR_KONS' 'SAKNR' 'SKA1' 'Konto KONS' 'C400',
- 'TXT50_KONS' 'TXT50' 'SKAT' 'Naziv konta KONS' 'C400',
- 'SAKNR' 'SAKNR' 'SKA1' '' 'C400',
- 'TXT50' 'TXT50' 'SKAT' '' 'C400',
- 'MATNR' 'MATNR' 'MARA' '' 'C400',
- 'MAKTX' 'MAKTX' 'MAKT' '' 'C400',
- 'MEINS' 'MEINS' 'MARA' '' 'C400',
- 'WERKS' 'WRK02' 'T460A' '' 'C400',
- 'NAME1' 'NAME1' 'T001W' '' 'C400',
- 'LBKUM_I' 'LBKUM' 'ZBFRSTOCK' 'Ukupna zaliha razd izv.' 'C500',
- 'SALK3_I' 'SALK3' 'ZBFRSTOCK' 'Ukupna vrijednost zalihe razd. izv' 'C500',
- 'ZPCI_I' 'KBETR' 'KONP' 'PCI cijena za razd. izv' 'C500',
- 'SALK3PCI_I' 'SALK3' 'ZBFRSTOCK' 'Vrijednost ukupne zalihe PCI razd. izv' 'C500',
- 'SALK3EUR_I' 'SALK3' 'ZBFRSTOCK' 'Vrijednost ukupne zalihe EUR razd. izv' 'C500',
- 'LBKUM_U' 'LBKUM' 'ZBFRSTOCK' 'Ukupna zaliha razd usporedbe' 'C700',
- 'SALK3_U' 'SALK3' 'ZBFRSTOCK' 'Ukupna vrijednost zalihe razd. usp' 'C700',
- 'ZPCI_U' 'KBETR' 'KONP' 'PCI cijena za razd. usp' 'C700',
- 'SALK3PCI_U' 'SALK3' 'ZBFRSTOCK' 'Vrijednost ukupne zalihe PCI razd. usp' 'C700',
- 'SALK3EUR_U' 'SALK3' 'ZBFRSTOCK' 'Vrijednost ukupne zalihe EUR razd. usp' 'C700'.
- endmethod. "build_fc
- method display_header.
- data:
- l_text(255) type c,
- l_dummy(255) type c,
- right type ref to cl_dd_area,
- ls_t001 type t001.
- create object me->m_header_document.
- me->m_header_document->vertical_split(
- exporting split_area = me->m_header_document
- split_width = '200'
- importing
- right_area = right ).
- l_text = 'Poduzeæe:'.
- me->m_header_document->add_text( text = l_text sap_emphasis = 'STRONG' ).
- loop at me->mt_t001 into ls_t001.
- write ls_t001-bukrs to l_text.
- right->add_text( text = l_text sap_color = cl_dd_document=>list_key ).
- l_text = ls_t001-butxt.
- right->add_text( text = l_text ).
- endloop.
- me->m_header_document->new_line( ).
- right->new_line( ).
- l_text = 'Razdoblje izvješæivanja:'.
- me->m_header_document->add_text( text = l_text sap_emphasis = 'STRONG' ).
- write s_spmoni-low to l_text.
- right->add_text( text = l_text sap_color = cl_dd_document=>list_positive ).
- me->m_header_document->new_line( ).
- right->new_line( ).
- l_text = 'Razdoblje usporedbe:'.
- me->m_header_document->add_text( text = l_text sap_emphasis = 'STRONG' ).
- write s_spmonu-low to l_text.
- right->add_text( text = l_text sap_color = cl_dd_document=>list_group ).
- me->m_header_document->new_line( ).
- right->new_line( ).
- l_text = 'Tip teèaja:'.
- me->m_header_document->add_text( text = l_text sap_emphasis = 'STRONG' ).
- write p_kurst to l_text.
- right->add_text( text = l_text sap_color = cl_dd_document=>list_key ).
- me->m_header_document->set_document_background( 'Z_PATTERN_PAPER' ).
- * Prikaži zaglavlje
- me->m_header_document->merge_document( ).
- me->m_header_document->display_document( parent = me->m_html_container ).
- endmethod. "display_header
- method f4_saknr_lact.
- types: begin of t_lact_saknr,
- saknr type ska1-saknr,
- txt50 type skat-txt50,
- end of t_lact_saknr.
- data: lt_lact_saknr type standard table of t_lact_saknr,
- lt_return type standard table of ddshretval.
- select distinct
- zlkon01~saknr
- skat~txt50
- into corresponding fields of table lt_lact_saknr
- from
- zlkon01 inner join ska1 as ska1_grupe on
- zlkon01~saknr = ska1_grupe~bilkt
- inner join ska1 as ska1_poduzeca on
- ska1_poduzeca~bilkt = ska1_grupe~saknr
- left outer join skat on
- zlkon01~saknr = skat~saknr and
- skat~ktopl = 'LACT' and
- skat~spras = sy-langu
- where
- zlkon01~zstock <> '' and
- ska1_grupe~ktopl = 'KONS'.
- call function 'F4IF_INT_TABLE_VALUE_REQUEST'
- exporting
- retfield = 'SAKNR'
- dynpprog = sy-repid
- dynpnr = sy-dynnr
- dynprofield = 'S_SAKNRL'
- window_title = 'Lactalis konto'
- value_org = 'S'
- tables
- value_tab = lt_lact_saknr
- return_tab = lt_return
- exceptions
- parameter_error = 1
- no_values_found = 2
- others = 3.
- if sy-subrc <> 0.
- message id sy-msgid type sy-msgty number sy-msgno
- with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
- endif.
- endmethod. "f4_saknr_lact
- method f4_saknr.
- types: begin of t_saknr,
- saknr type ska1-saknr,
- txt50 type skat-txt50,
- end of t_saknr.
- data: lt_saknr type standard table of t_saknr,
- lt_return type standard table of ddshretval.
- select distinct
- ska1_poduzeca~saknr
- skat~txt50
- into corresponding fields of table lt_saknr
- from
- zlkon01 inner join ska1 as ska1_grupe on
- zlkon01~saknr = ska1_grupe~bilkt
- inner join ska1 as ska1_poduzeca on
- ska1_poduzeca~bilkt = ska1_grupe~saknr
- inner join t001 on
- ska1_poduzeca~ktopl = t001~ktopl
- left outer join skat on
- skat~saknr = ska1_poduzeca~saknr and
- skat~ktopl = ska1_poduzeca~ktopl and
- skat~spras = sy-langu
- where
- zlkon01~zstock <> '' and
- ska1_grupe~ktopl = 'KONS' and
- t001~bukrs in s_bukrs and
- zlkon01~saknr in s_saknrl.
- call function 'F4IF_INT_TABLE_VALUE_REQUEST'
- exporting
- retfield = 'SAKNR'
- dynpprog = sy-repid
- dynpnr = sy-dynnr
- dynprofield = 'S_SAKNR'
- value_org = 'S'
- tables
- value_tab = lt_saknr
- return_tab = lt_return
- exceptions
- parameter_error = 1
- no_values_found = 2
- others = 3.
- if sy-subrc <> 0.
- message id sy-msgid type sy-msgty number sy-msgno
- with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
- endif.
- endmethod. "f4_saknr
- method authority_check.
- data:
- l_message type string,
- lt_t001 type standard table of t001,
- ls_t001 type t001.
- select * from t001 into table lt_t001 where bukrs in s_bukrs.
- loop at lt_t001 into ls_t001.
- authority-check object 'F_BKPF_BUK'
- id 'BUKRS' field ls_t001-bukrs
- id 'ACTVT' field '03'.
- if sy-subrc ne 0.
- concatenate 'Nemate autorizaciju za poduzeæe' ls_t001-bukrs into l_message separated by space.
- message l_message type 'E'.
- endif.
- endloop.
- endmethod. "authority_check
- method find_layout.
- data:
- l_exit,
- ls_variant type disvariant.
- ls_variant-report = sy-repid.
- call function 'LVC_VARIANT_F4'
- exporting
- is_variant = ls_variant
- i_save = 'X'
- importing
- e_exit = l_exit
- es_variant = ls_variant
- exceptions
- not_found = 1
- others = 2.
- if sy-subrc ne 0.
- message id sy-msgid type sy-msgty number sy-msgno
- with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
- elseif l_exit ne 'X'.
- p_layout = ls_variant-variant.
- endif.
- endmethod. "find_variant
- method check_layout.
- data: ls_variant type disvariant.
- if not p_layout is initial.
- move p_layout to ls_variant-variant.
- move sy-repid to ls_variant-report.
- call function 'LVC_VARIANT_EXISTENCE_CHECK'
- exporting
- i_save = 'X'
- changing
- cs_variant = ls_variant
- exceptions
- wrong_input = 1
- not_found = 2
- program_error = 3
- others = 4.
- if sy-subrc <> 0.
- message id sy-msgid type sy-msgty number sy-msgno
- with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
- else.
- endif.
- endif.
- endmethod. "check_variant
- endclass. "lcl_app IMPLEMENTATION
- Extracted by Mass Download version 1.5.5 - E.G.Mellodew. 1998-2016. Sap Release 700
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement