Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 3560

Hotspot in an existing structure

$
0
0

Hi all.

 

I would like to add enable three columns with hotspot feature.

The code is below and i am not sure at where i should attach the relevant lines and what is the relevant lines

 

I would like to see second column with hotspot functionality.

 

Thanks

 

Eddy

Regards

 

 

REPORT ZERMMTL.

 

TABLES : zedm_mmsettl_fin, euitrans.

 

*-Type

type-pools    : slis,kkblo.

   TYPES: BEGIN OF ty_output,

            status_icon(4), "Ampel

            settldoc    like eedmsettluf-SETTLDOC,

            ext_ui      like EUITRANS-ext_ui,

            nlp_profile like eedmsettluf-profile,

            cversno     like EEDMSETTLDOCSNDP-CVERSNO,

            usefactor   like eedmsettluf-usefactor,

            datum       like eedmsettluf-datefrom,

            day_sum type p DECIMALS 11,

            status_txt(60),

          END OF ty_output.

 

*-InternalTables

data : begin of gt_output occurs 10 , "MasterInternalTable

            status_icon(4), "Ampel

            settldoc    like eedmsettluf-SETTLDOC,

            ext_ui      like EUITRANS-ext_ui,

            nlp_profile like eedmsettluf-profile,

            cversno     like EEDMSETTLDOCSNDP-CVERSNO,

            usefactor   like eedmsettluf-usefactor,

            datum       like eedmsettluf-datefrom,

            day_sum TYPE p DECIMALS 11,

            status_txt(60),

          mark                       ,

        end of gt_output             .

 

 

   TYPES: tty_output TYPE STANDARD TABLE OF ty_output.

 

 

 

   TYPES: BEGIN OF ty_settl_result,

            settldoc  TYPE e_edmsettldoc,

            settlunit TYPE e_edmsettlunit,

            seltype   TYPE e_edmseltype,

*          grid_id       TYPE grid_id,

            dateto    TYPE e_edmdateto,

*          timeto       TYPE e_edmtimeto,

            int_ui    TYPE int_ui,

            datefrom  TYPE e_edmdatefrom,

*          timefrom     TYPE e_edmtimefrom,

            anlage    TYPE anlage,

            profrole  TYPE profrole,

            profile   TYPE e_profile,

            usefactor TYPE usefactor,

            ext_ui    TYPE ext_ui,

          END OF ty_settl_result.

 

 

   TYPES: BEGIN OF ty_nlp_day_sum,

            profile TYPE e_profile,

            cversno TYPE cversno,

            date    TYPE e_edmdatefrom,

            day_sum TYPE profval,

          END OF ty_nlp_day_sum.

 

 

   TYPES: tt_settl_result TYPE TABLE OF ty_settl_result,

          tt_nlp_day_sum  TYPE TABLE OF ty_nlp_day_sum.

 

   CONSTANTS:

     co_last_second_of_day TYPE  /idexge/e_eqs_duetime VALUE '235959',

     co_default_time       TYPE  /idexge/e_eqs_duetime VALUE '000000',

     co_timezone_cet       TYPE  timezone               VALUE 'CET'.

 

   DATA: gt_synth_profval   TYPE tt_nlp_day_sum,

         gt_analyth_profval TYPE tt_nlp_day_sum,

         gt_profval         TYPE eprofile_t,

         gv_error           TYPE kennzx.

 

   DATA: gv_err  TYPE smp_dyntxt,

         gv_inf  TYPE smp_dyntxt,

         gv_warn TYPE smp_dyntxt.

 

 

*-Field Symbols

field-symbols : <vout>   type table ,

                 <fcat>   type table ,

                 <oth>    type table ,

                 <layout> type any   .

 

*-AlvData

data: alv_fieldcat  type slis_t_fieldcat_alv        with header line,

       alv_events    type slis_t_event               with header line,

       alv_sort      type slis_sortinfo_alv occurs 0 with header line.

 

data: alv_event_exit       type slis_t_event_exit                   ,

       alv_tabname_header   type slis_tabname                        ,

       alv_tabname          type slis_tabname                        ,

       alv_repid            like sy-repid                            ,

       alv_variant          like disvariant                          ,

       alv_list_top_of_page type slis_t_listheader                   ,

       alv_layout           type slis_layout_alv                     ,

       alv_sort_1           type slis_sortinfo_alv-fieldname         ,

       alv_colors           type kkblo_t_specialcol with header line ,

       gs_private           type slis_data_caller_exit               ,

       gs_selfield          type slis_selfield                       ,

       gs_grid              type lvc_title                           .

 

*- Varyant ...

data  : h_variant        like disvariant,

         def_variante    like disvariant,

         variant_exit(1) type c,

         variant_save(1) type c,

         variant_def(1type c.

 

data : begin of alv_list occurs 0,

          typ(1type c,

          key(20) type c,

          info    type slis_entry,

        end of alv_list.

 

define alv_list.

   alv_list-typ  = &1.

   alv_list-key  = &2.

   alv_list-info = &3.

   append alv_list.

end-of-definition.

 

*-Initialization.

*INITIALIZATION.

 

 

 

*-SelectionScreen

SELECTION-SCREEN BEGIN OF BLOCK b002 WITH FRAME TITLE text-T01.

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN  COMMENT (31) text-T02.

PARAMETERS p_ab  TYPE datum DEFAULT '20140101' OBLIGATORY.

SELECTION-SCREEN  COMMENT 52(5) text-T05.

PARAMETERS p_bis TYPE datum DEFAULT '20140131' OBLIGATORY.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN END   OF BLOCK b002.

 

SELECTION-SCREEN BEGIN OF BLOCK b001 WITH FRAME TITLE text-T04.

SELECT-OPTIONS:

     so_sdoc FOR zedm_mmsettl_fin-settldoc OBLIGATORY,

     so_zp FOR euitrans-ext_ui.

SELECTION-SCREEN END   OF BLOCK b001.

 

SELECTION-SCREEN BEGIN OF BLOCK b003 WITH FRAME TITLE text-T03.

PARAMETERS:

     p_sim type kennzx default 'X'.

SELECTION-SCREEN END   OF BLOCK b003.

 

 

*-AtSelectionScreen

at selection-screen.

 

 

*-AtSelectionScreenOutpu

*AT SELECTION-SCREEN OUTPUT.

 

 

*-StartOfSelection

start-of-selection.

     perform get_data.

 

*-EndOfSelection.

end-of-selection.

   perform display_alv using 'GT_OUTPUT'."TableName

 

 

 

*&---------------------------------------------------------------------*

*&  Alv User Command

*&---------------------------------------------------------------------*

form user_command using r_ucomm       like   sy-ucomm

                         rs_selfield   type   slis_selfield.

   case r_ucomm .

     when '&IC1' .

   endcase .

endform .

*&---------------------------------------------------------------------*

*FORM set_status_alv

*&---------------------------------------------------------------------*

form set_status_alv using extab type slis_t_extab.

   set pf-status 'GUI'  .

endform  .

*&---------------------------------------------------------------------*

*&      Form  initialization_for_alv

*&---------------------------------------------------------------------*

form initialization_for_alv using p_tablename .

   data : lv_date(15) .

   clear : alv_list[] , alv_list .

   write sy-datum to lv_date dd/mm/yyyy.

 

 

   case p_tablename.

    when 'GT_OUTPUT'.

     alv_list 'H'  'DGR.' sy-title.

     alv_list 'S'  'User Name' sy-uname       .

     alv_list 'S'  'Date' lv_date  .

   endcase.

endform.    " initialization_for_alv

*&---------------------------------------------------------------------*

*&      Form  alv_set_events

*&---------------------------------------------------------------------*

form alv_get_events using  eventtab.

   assign (eventtab) to <oth> .

   refresh <oth> .

* Get All List Events

   call function 'REUSE_ALV_EVENTS_GET'

     exporting

       i_list_type     = 0

     importing

       et_events       = alv_events[]

     exceptions

       list_type_wrong = 1

       others          = 2.

 

   if sy-subrc ne 0.     exit.   endif.

endform.                    " alv_set_events

*&---------------------------------------------------------------------*

*&      Form  alv_fieldcat_merge

*&---------------------------------------------------------------------*

form alv_fieldcat_merge using    fcatname tabname .

   if alv_repid is initial.

     alv_repid = sy-repid .

   endif.

   alv_tabname = tabname .

   assign (fcatname) to <fcat> .

   refresh <fcat> .

   call function 'REUSE_ALV_FIELDCATALOG_MERGE'

     exporting

       i_program_name         = alv_repid

       i_internal_tabname     = alv_tabname

       i_inclname             = alv_repid

       i_client_never_display = 'X'

       i_bypassing_buffer     = 'X'

     changing

       ct_fieldcat            = <fcat>

     exceptions

       others                 = 3.

endform.                    " alv_fieldcat_merge

*&---------------------------------------------------------------------*

*&      Form  set_alv_fieldcat_merge

*&---------------------------------------------------------------------*

form set_alv_fieldcat using  tabname   type slis_tabname.

   data : dada(20) .

   move 'STATUS' to dada .

   data : temp(45) .

   move : 'SELTEXT_L/SELTEXT_M/SELTEXT_S/REPTEXT_DDIC' to temp.

 

  perform list_set_attribute tables alv_fieldcat

     using : tabname   'MARK'        "field

                       'NO_OUT'      "option

                       'X'    ,      "option value

             tabname   'STATUS_ICON'      "field

                       temp          "all text option

                       'Ikon',"field text value

             tabname   'EXT_UI'

                       temp

                       'Zählpunkt'  ,

             tabname   'SETTLDOC'      "field

                       temp          "all text option

                       'Bilanzierungsbeleg',"field text value

             tabname   'NLP_PROFILE'

                       temp

                       'Profil '  ,

             tabname   'CVERSNO'

                       temp

                       'Vers. No'  ,

             tabname   'USEFACTOR'

                       temp

                       'Verb. Fakt.'  ,

             tabname   'DATUM'

                       temp

                       'Datum'  ,

             tabname   'DAY_SUM'

                       temp

                       'Tagessumme'  ,

             tabname   'STATUS_TXT'

                       temp

                       'Statusmeldung' .

 

endform.                    " set_alv_fieldcat_merge

 

 

 

*&---------------------------------------------------------------------*

*&      Form  call_alv_function

*&---------------------------------------------------------------------*

form call_alv_function using tabname fcatname layname.

   assign : (tabnameto <vout>   ,

            (fcatname) to <fcat>   ,

            (laynameto <layout> .

 

     call function 'REUSE_ALV_GRID_DISPLAY'

       exporting

         i_callback_program       = alv_repid

         i_callback_pf_status_set = 'SET_STATUS_ALV'

         i_callback_user_command  = slis_ev_user_command

         i_callback_top_of_page   = 'TOP_OF_PAGE'

         i_background_id          = 'ALV_BACKGROUND'

         is_layout                = alv_layout

         it_fieldcat              = <fcat>

         i_grid_title             = gs_grid

         it_sort                  = alv_sort[]

         i_save                   = 'A'

         is_variant               = h_variant

         it_events                = alv_events[]

       tables

         t_outtab                 = <vout>.

endform.

*&---------------------------------------------------------------------*

*&      Form  LIST_SET_ATTRIBUTE

*&---------------------------------------------------------------------*

form list_set_attribute tables   ti_fcat   structure alv_fieldcat

                         using    i_tabname type      slis_tabname

                                  i_fieldname

                                  i_target

                                  i_value.

  data: li_field  type standard table of slis_fieldname with header line,

        li_target type standard table of slis_fieldname with header line.

   data tabix like sy-tabix.

   field-symbols: <f1>.

 

   split i_fieldname at '/' into table li_field.

   split i_target    at '/' into table li_target.

   loop at li_field.

     read table ti_fcat with key tabname   = i_tabname

                                 fieldname = li_field.

     tabix = sy-tabix.

     if sy-subrc = 0.

       loop at li_target.

         assign component li_target of structure ti_fcat to <f1>.

         <f1> = i_value.

         modify ti_fcat index tabix.

       endloop.

     endif.

   endloop.

endform.                               " LIST_SET_ATTRIBUTE

*&---------------------------------------------------------------------

*&      Form  top_of_page

*----------------------------------------------------------------------

form top_of_page.

   call function 'REUSE_ALV_COMMENTARY_WRITE'

     exporting

       it_list_commentary = alv_list[]

       i_logo             = ''

.

endform.                    " top_of_page

*&---------------------------------------------------------------------*

*&      Form  DISPLAY_ALV

*&---------------------------------------------------------------------*

form display_alv using if_tablename.

   data : lv_tablename type char50.

 

   concatenate if_tablename '[]' into lv_tablename.

 

*  perform initialization_for_alv using  if_tablename                 .

   perform alv_get_events         using  'ALV_EVENTS[]'               .

   perform alv_fieldcat_merge     using  'ALV_FIELDCAT[]' if_tablename.

   perform set_alv_fieldcat       using  if_tablename                 .

   perform set_alv_layout .

   perform call_alv_function      using  lv_tablename

                                         'ALV_FIELDCAT[]' 'ALV_LAYOUT'.

endform.                    " DISPLAY_ALV

*&---------------------------------------------------------------------*

*&      Form  SET_ALV_LAYOUT

*&---------------------------------------------------------------------*

form set_alv_layout .

   alv_layout-box_fieldname = 'MARK'  .

endform.                    " SET_ALV_LAYOUT

*&---------------------------------------------------------------------*

*&      Form  GET_DATA

*&---------------------------------------------------------------------*

form get_data .

 

 

   DATA: lt_settl_result      TYPE tt_settl_result,

         lt_ref_profile       TYPE tt_settl_result,

         ls_sdoc              TYPE isu_ranges,

         lv_settldoc          TYPE e_edmsettldoc,

         lv_str               TYPE string,

         lt_settldoc          TYPE TABLE OF eedmsettldoc,

         ls_settldoc          TYPE eedmsettldoc,

         lv_daily_consumption TYPE profval,

         lv_date              TYPE e_edmdatefrom,

         ls_mmsettl_fin       TYPE zedm_mmsettl_fin,

         lt_mmsettl_fin       TYPE TABLE OF zedm_mmsettl_fin

         WITH KEY mandt settldoc settlunit seltype int_ui datum,

         ls_output            TYPE ty_output,

         lv_text              TYPE string,

         lv_day_sum           TYPE string,

         lf_synthetisch       TYPE kennzx,

         lv_err               TYPE i,

         lv_warn              TYPE i,

         lv_inf               TYPE i,

         lv_parname           TYPE e_edmsettlparname.

 

   FIELD-SYMBOLS : <fs_settl_result> TYPE ty_settl_result.

 

   CLEAR : lt_mmsettl_fin, lt_settl_result,

           lv_daily_consumption, lv_date, ls_mmsettl_fin,

lt_mmsettl_fin, ls_output, lf_synthetisch, gv_error,

           gt_synth_profval, gt_analyth_profval,gt_profval.

 

   IF so_zp IS NOT INITIAL.

*#  Bestimmung aller Zählpunkte der vorgegebenen Bilanzierungsbelege

*im angegebenen Zeitraum

*   Bestimmung Verbrauchsfaktoren der darin relevanten

*SLP/TLP-Zählpunkte über EEDMSETTLUF

     SELECT settldoc settlunit seltype eedmsettluf~dateto

eedmsettluf~int_ui eedmsettluf~datefrom anlage profrole profile

usefactor ext_ui

     FROM eedmsettluf

     INNER JOIN euitrans ON euitrans~int_ui = eedmsettluf~int_ui

     INTO CORRESPONDING FIELDS OF TABLE lt_settl_result

     WHERE settldoc IN so_sdoc

           AND eedmsettluf~datefrom LE p_bis

           AND eedmsettluf~dateto GE p_ab

           AND euitrans~ext_ui IN so_zp

* wenn ZP-ID eingegeben, nur ausgewählte ZP selektieren

           AND euitrans~datefrom LE eedmsettluf~datefrom

           AND euitrans~dateto GE eedmsettluf~dateto.

   ELSE.

     SELECT  settldoc settlunit seltype eedmsettluf~dateto

eedmsettluf~int_ui

     eedmsettluf~datefrom anlage profrole profile usefactor ext_ui

     FROM eedmsettluf

     INNER JOIN euitrans ON euitrans~int_ui = eedmsettluf~int_ui

     INTO CORRESPONDING FIELDS OF TABLE lt_settl_result

     WHERE settldoc IN so_sdoc

            AND eedmsettluf~datefrom LE p_bis

            AND eedmsettluf~dateto GE p_ab

            AND euitrans~datefrom LE eedmsettluf~datefrom

            AND euitrans~dateto GE eedmsettluf~dateto.

   ENDIF.

 

   SORT lt_settl_result BY settldoc.

 

   SELECT * FROM eedmsettldoc

     INTO TABLE lt_settldoc

     WHERE settldoc IN so_sdoc.

   IF sy-subrc NE 0 OR lt_settl_result IS INITIAL.

     ls_output-status_icon = '@0A@'.

     ls_output-status_txt

     = 'Bil.Belege/Bil.Ergebnis konnten nicht ermittelt werden'.

     APPEND ls_output TO gt_output.

*    PERFORM display_alv  USING gt_output. " Show ALV

     EXIT.

   ENDIF.

 

   LOOP AT lt_settldoc INTO ls_settldoc.

     CLEAR : ls_output.

     ls_output-settldoc = ls_settldoc-settldoc.

 

****** Kundenspezifische Prüfung implementieren: Ermittlung

*synthetisch/analytisch.

****** DEFAULT -> synthetisch

     PERFORM is_synthetic USING ls_settldoc CHANGING lf_synthetisch

lt_settl_result.

     IF gv_error IS NOT INITIAL. EXIT.   ENDIF.

 

     LOOP AT lt_settl_result ASSIGNING <fs_settl_result>

         WHERE settldoc = ls_settldoc-settldoc.

       CLEAR : gv_error, ls_output.

       ls_output-settldoc = ls_settldoc-settldoc.

       ls_output-ext_ui = <fs_settl_result>-ext_ui.

       ls_output-usefactor = <fs_settl_result>-usefactor.

 

*#  Berechnung der bilanzierten Menge

       IF <fs_settl_result>-datefrom GT p_ab.

         ls_output-status_icon = '@09@'.

         lv_str = ls_settldoc-settldoc.

         SHIFT lv_str LEFT DELETING LEADING '0'.

         CONCATENATE 'Sel. Ab-Datum < EEDMSETTLUF-Datum'

<fs_settl_result>-datefrom 'Bil. Beleg' lv_str INTO

ls_output-status_txt SEPARATED BY space.

         APPEND ls_output TO gt_output.

         lv_date = <fs_settl_result>-datefrom.

       ELSE.

         lv_date = p_ab.

       ENDIF.

 

       IF p_bis GT <fs_settl_result>-dateto.

         ls_output-status_icon = '@09@'.

         lv_str = ls_settldoc-settldoc.

         SHIFT lv_str LEFT DELETING LEADING '0'.

         CONCATENATE 'Sel. Bis-Datum > EEDMSETTLUF-Datum'

         <fs_settl_result>-dateto 'Bil. Beleg'

         lv_str INTO ls_output-status_txt SEPARATED BY space.

         APPEND ls_output TO gt_output.

         lv_date = <fs_settl_result>-datefrom.

       ENDIF.

 

       DO.

         ls_output-datum = lv_date.

         IF gv_error IS NOT INITIAL. EXIT. ENDIF.

         CLEAR : lv_daily_consumption, ls_mmsettl_fin.

 

         IF lf_synthetisch IS NOT INITIAL. "Synthetische Bilanzierung

           PERFORM get_synth_daily_consumption

           USING <fs_settl_result>-profile lv_date ls_output

                 CHANGING lv_daily_consumption ls_output-nlp_profile.

           IF gv_error IS NOT INITIAL. EXIT. ENDIF.

         ELSE. "Analytische Bilanzierung

****** Kundenspezifische Parametername ermitteln.

           PERFORM get_settl_parname CHANGING lv_parname.

           PERFORM get_analyth_daily_consumption

           USING ls_settldoc <fs_settl_result>-profile

                 lv_date lv_parname ls_output

                 CHANGING lv_daily_consumption

                   ls_output-nlp_profile ls_output-cversno.

           IF gv_error IS NOT INITIAL. EXIT. ENDIF.

         ENDIF.

 

         " Append result into Z-table

         ls_mmsettl_fin-settldoc = <fs_settl_result>-settldoc.

         ls_mmsettl_fin-settlunit = <fs_settl_result>-settlunit.

         ls_mmsettl_fin-seltype = <fs_settl_result>-seltype.

         ls_mmsettl_fin-int_ui = <fs_settl_result>-int_ui.

         ls_mmsettl_fin-datum = lv_date.

         ls_mmsettl_fin-profvalue = lv_daily_consumption *

          <fs_settl_result>-usefactor.

         APPEND ls_mmsettl_fin TO lt_mmsettl_fin.

 

         " Append result into ALV-Table

         ls_output-day_sum = ls_mmsettl_fin-profvalue.

         ls_output-status_icon = '@08@'.

         ls_output-status_txt = 'Tagesmenge ermittelt'.

         APPEND ls_output TO gt_output.

 

         lv_date = lv_date + 1.

         IF lv_date GT <fs_settl_result>-dateto.

           EXIT.

         ENDIF.

       ENDDO.

     ENDLOOP.

   ENDLOOP.

 

 

 

endform.                    " GET_DATA

*&---------------------------------------------------------------------*

*&      Form  GET_SYNTH_DAILY_CONSUMPTION

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

*      -->P_LS_output_NLP_PROFILE  text

*      -->P_LV_DATE  text

*      <--P_LV_DAILY_CONSUMPTION  text

*----------------------------------------------------------------------*

FORM get_synth_daily_consumption  USING    iv_ref_profile

                                            iv_date

                                            is_output

                                   CHANGING cv_daily_consumption

                                            cv_nlp_profile.

 

   DATA: ls_synth_profval TYPE ty_nlp_day_sum,

         ls_output          TYPE ty_output.

 

   ls_output = is_output.

   READ TABLE gt_synth_profval WITH KEY date = iv_date profile =

iv_ref_profile

             INTO ls_synth_profval.

   IF sy-subrc EQ 0.

     cv_daily_consumption = ls_synth_profval-day_sum.

   ELSE.

 

     " Profilverbrauch tagesscharf

     CALL FUNCTION 'ISU_S_SYNPROF_GET_CONSUMPTION'

       EXPORTING

         x_profile_number     = iv_ref_profile

         x_datefrom           = iv_date

         x_dateto             = iv_date

         x_timefrom           = '000000' " Gastag wird mit Profil

*Offset korrekt erkannt

         x_timeto             = '235959'

*       X_TIMEZONE           = SY-ZONLO

*       X_ENQUEU_MODE_READ   = 'X'

       IMPORTING

         y_consumption        = cv_daily_consumption

*       Y_MASS               =

*   CHANGING

*       XY_OBJ               =

       EXCEPTIONS

         error_occurred       = 1

         not_found            = 2

         not_generated        = 3

         data_invalid         = 4

         foreign_lock         = 5

         no_synthetic_profile = 6

         OTHERS               = 7.

     IF sy-subrc <> 0.

       ls_output-status_icon = '@0A@'.

       ls_output-nlp_profile = iv_ref_profile.

*      ls_output-status_txt = 'Synth. Profilwerte konnten nicht

*ermittelt werden'.

       CONCATENATE 'Synth. Profilwerte' iv_ref_profile 'am'  iv_date

'fehlen' INTO ls_output-status_txt SEPARATED BY space.

       APPEND ls_output TO gt_output.

       gv_error = 'X'.

       EXIT.

     ENDIF.

 

     CLEAR ls_synth_profval.

     ls_synth_profval-profile = iv_ref_profile.

     ls_synth_profval-date = iv_date.

     ls_synth_profval-day_sum = cv_daily_consumption.

     APPEND ls_synth_profval TO gt_synth_profval.

   ENDIF.

 

   cv_nlp_profile = iv_ref_profile.

ENDFORM.

*&---------------------------------------------------------------------*

*&      Form  GET_ANALYTH_DAILY_CONSUMPTION

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

*      -->P_LS_output_NLP_PROFILE  text

*      -->P_LV_DATE  text

*      <--P_LV_DAILY_CONSUMPTION  text

*----------------------------------------------------------------------*

FORM get_analyth_daily_consumption  USING    is_settldoc TYPE

eedmsettldoc

                                              iv_ref_profile

                                              iv_date

                                              iv_parname

                                              is_output

                                     CHANGING cv_daily_consumption

                                              cv_nlp_profile

                                              c_cversno.

 

   DATA: ls_analyt_profval TYPE ty_nlp_day_sum,

         lt_profval        TYPE eprofile_t,

         ls_profval        TYPE eprofile,

         lt_teprofvalues   TYPE teprofvalues,

         ls_eprofvalue     TYPE eprofvalue,

         ls_output           TYPE ty_output,

         ls_profversion    TYPE eprofversion.

 

   ls_output = is_output.

   IF gt_profval IS INITIAL.

     " alle Analytische Lastprofile aus Bilanzierungsergebnis-Profil

*ermitteln

     CALL FUNCTION 'Z_EDM_MM_GET_PROFVAL_SETTLDOC'

       EXPORTING

         x_settldoc        = is_settldoc-settldoc

         x_parname         = iv_parname " Bilanzierungsparameter

         x_datefrom        = is_settldoc-datefrom

         x_dateto          = is_settldoc-dateto

         x_timefrom        = is_settldoc-timefrom

         x_timeto          = is_settldoc-timeto

       IMPORTING

         yt_profval        = gt_profval

       EXCEPTIONS

         profile_not_found = 1

         profval_not_found = 2

         version_not_found = 3

         OTHERS            = 4.

     IF sy-subrc NE 0. " Fahlermeldung schreiben.

       ls_output-status_icon = '@0A@'.

       IF sy-subrc EQ 1.

         ls_output-status_txt

         = 'Analytische Profil konnte nicht ermittelt werden'.

       ELSEIF sy-subrc EQ 2.

         ls_output-status_txt

         = 'Analytische Profilwerte konnten nicht ermittelt werden'.

       ELSEIF sy-subrc EQ 3.

         ls_output-status_txt

= 'Analytische Profilwerte konnten nicht aus Version ermittelt werden'.

       ENDIF.

       APPEND ls_output TO gt_output.

       gv_error = 'X'.

       EXIT.

     ENDIF.

   ENDIF.

 

   " analyt. Profilsumme pro Tag

   READ TABLE gt_profval INTO ls_profval

           WITH KEY profhead_data-ref_profile = iv_ref_profile.

   IF sy-subrc NE 0.

     ls_output-status_icon = '@0A@'.

     ls_output-status_txt =

     'Analytische Profil konnte nicht ermittelt werden'.

     APPEND ls_output TO gt_output.

     gv_error = 'X'.

     EXIT.

   ENDIF.

   cv_nlp_profile = ls_profval-profilenr.

   lt_teprofvalues = ls_profval-profvalues.

 

   " get profile version

   READ TABLE ls_profval-profversions INDEX 1 INTO ls_profversion.

   IF sy-subrc EQ 0.

     c_cversno = ls_profversion-cversno.

   ENDIF.

 

   READ TABLE gt_analyth_profval WITH KEY date = iv_date profile =

cv_nlp_profile cversno = c_cversno

               INTO ls_analyt_profval.

   IF sy-subrc EQ 0.

     cv_daily_consumption = ls_analyt_profval-day_sum.

   ELSE.

     LOOP AT lt_teprofvalues INTO ls_eprofvalue

         WHERE prof_date EQ iv_date.

       cv_daily_consumption = cv_daily_consumption +

ls_eprofvalue-prof_value.

     ENDLOOP.

     IF sy-subrc NE 0. " Fehlermeldung

       " Append result into ALV-Table

       ls_output-datum = iv_date.

       ls_output-day_sum = cv_daily_consumption.

       ls_output-status_icon = '@0A@'.

       ls_output-status_txt =

       'Tagesmenge konnten nicht ermittelt werden'.

       APPEND ls_output TO gt_output.

       gv_error = 'X'.

       EXIT.

     ENDIF.

     "Append daily consumption to internal table

     ls_analyt_profval-profile = cv_nlp_profile.

     ls_analyt_profval-cversno = c_cversno.

     ls_analyt_profval-date = iv_date.

     ls_analyt_profval-day_sum = cv_daily_consumption.

     APPEND ls_analyt_profval TO gt_analyth_profval.

   ENDIF.

ENDFORM.

 

*&---------------------------------------------------------------------*

*&      Form  IS_SYNTHETIC

*&---------------------------------------------------------------------*

*       Bilanzierungsart prüfen: Synthetisch oder analytisch

* TODO: Unterprogramm kundenspezifisch implementieren

*----------------------------------------------------------------------*

*      -->P_LS_SETTLDOC  text

*      <--P_LF_SYNTHETISCH  text

*----------------------------------------------------------------------*

FORM is_synthetic  USING    is_settldoc TYPE eedmsettldoc

                    CHANGING p_synthetisch ct_settl_result

                      TYPE tt_settl_result.

 

   DATA: ls_output TYPE ty_output.

 

*** Beispiel Prüfung über Bilanzierungsverfahren:

*** Ist es eine Einspeiser- oder Ausspeiser-Bilanzierung ?

*  CLEAR gv_error.

*  IF is_settldoc-settlprocess EQ 'ZEXTANALYT'. "

"Ausspeiser-Bilanzierung -> Analytische Verfahren

*    CLEAR p_synthetisch.

*  ELSEIF is_settldoc-settlprocess EQ 'Z_EINSPEIS'

"OR is_settldoc-settlprocess EQ 'ZOGF'

*          OR is_settldoc-settlprocess EQ 'Z_OGF_BILA'.

"" Einspieser-Bilanzierung -> Synthetischer Verfahren

*    p_synthetisch = 'X'.

*    IF is_settldoc-settlprocess EQ 'Z_OGF_BILA'. "

   "Doppelte Einträge wegen Selektionstyp 05 löschen.

*      DELETE ct_settl_result WHERE seltype NE '01'.

*    ENDIF.

*  ELSE.

*    ls_output-settldoc = is_settldoc-settldoc.

*    ls_output-status_icon = '1'.

*    CONCATENATE 'Bil. Beleg mit Bil.Verfahren'

" is_settldoc-settlprocess 'ist inakzeptabel'

"INTO ls_output-status_txt SEPARATED BY space.

*    APPEND ls_output TO gt_output.

*    gv_error = 'X'.

*  ENDIF.

 

   p_synthetisch = 'X'.

 

 

ENDFORM. " USER_COMMAND_output

 

 

 

 

 

 

 

 

 

 

 

 

 

*&---------------------------------------------------------------------*

*&      Form  GET_SETTL_PARNAME

*&---------------------------------------------------------------------*

*       Parametername womit man die analytische Profil aus

*Bilanzierungsergebnissprofile selektieren können

*----------------------------------------------------------------------*

*      <--P_LV_PARNAME  text

*----------------------------------------------------------------------*

FORM get_settl_parname  CHANGING cv_parname.

*  cv_parname = 'ZPrLoadGrp01n'.

ENDFORM.


Viewing all articles
Browse latest Browse all 3560

Trending Articles