SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Purchase order performance report



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ММ
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1640

PostPosted: Sat Mar 27, 2010 12:58 am    Post subject: Purchase order performance report Reply with quote

Code:
*----------------------------------------------------------------------
* Modification Log:
* 1) Changed by : Suchon Poomcharoen
* Changed on : 14/10/2009
* Transport :
* Correction-No : CH01
* Description : 1) Add Pur. Doc , WBS , find Acct Doc.
*----------------------------------------------------------------------

REPORT zmm005 MESSAGE-ID zrtc .

*--------------------------------------------
TABLES:
*--------------------------------------------
ekko, ekpo, eket, ekbe, ekkn.


*--------------------------------------------
*SELECTION
*--------------------------------------------
*BLOCK 0
SELECTION-SCREEN BEGIN OF BLOCK 0 WITH
FRAME TITLE text-001.
SELECT-OPTIONS s_lifnr FOR ekko-lifnr NO INTERVALS.
SELECT-OPTIONS s_matnr FOR ekpo-matnr NO INTERVALS.
SELECT-OPTIONS s_matkl FOR ekpo-matkl NO INTERVALS.
SELECT-OPTIONS s_ekgrp FOR ekko-ekgrp NO INTERVALS.
SELECT-OPTIONS s_bedat FOR ekko-bedat.
SELECT-OPTIONS s_purdoc FOR ekko-ebeln.
PARAMETER s_wbs LIKE ekkn-ps_psp_pnr .
*SELECT-OPTIONS S_WBS for EKKN-PS_PSP_PNR NO INTERVALS.
SELECTION-SCREEN END OF BLOCK 0.
*BLOCK 2
SELECTION-SCREEN BEGIN OF BLOCK 2 WITH
FRAME TITLE text-010.
PARAMETERS: p_vari LIKE disvariant-variant. " ALV Variant
*SELECTION-SCREEN SKIP.
*SELECTION-SCREEN PUSHBUTTON /10(20) SUMMA USER-COMMAND ABCD.
SELECTION-SCREEN END OF BLOCK 2.


*--------------------------------------------
*DATA
*--------------------------------------------
*ALV DATA
TYPE-POOLS: slis.
DATA: gt_list_top_of_page TYPE slis_t_listheader,
gt_events TYPE slis_t_event,
gs_layout TYPE slis_layout_alv,
gt_sort TYPE slis_t_sortinfo_alv,
gt_fieldcat TYPE slis_t_fieldcat_alv,
fieldcat_ln LIKE LINE OF gt_fieldcat,
repname LIKE sy-repid,
g_save(1) TYPE c,
g_exit(1) TYPE c,
g_variant LIKE disvariant,
gx_variant LIKE disvariant.

*USER DATA
DATA vwcase(3) TYPE n.
DATA sdat LIKE eket-eindt.


*--------------------------------------------
*INTERNAL TABLE
*--------------------------------------------
*ITAB
DATA: BEGIN OF itab OCCURS 0,
belnr LIKE ekbe-belnr, "Start insert by suchon CH01
lifnr LIKE ekko-lifnr,
bedat LIKE ekko-bedat,
waers LIKE ekko-waers,
ebeln LIKE ekpo-ebeln,
ebelp LIKE ekpo-ebelp,
matnr LIKE ekpo-matnr,
txz01 LIKE ekpo-txz01,
menge LIKE ekpo-menge,
meins LIKE ekpo-meins,
netpr LIKE ekpo-netpr,
elikz LIKE ekpo-elikz,
eindt LIKE eket-eindt,
budat LIKE ekbe-budat,
menge2 LIKE ekbe-menge,
delp TYPE i,
cmt(15) TYPE c,
*BELNR LIKE EKBE-BELNR, "Start insert by suchon CH01
buzei LIKE ekbe-buzei,
dmbtr LIKE ekbe-dmbtr,
ps_psp_pnr LIKE ekkn-ps_psp_pnr,"End insert by suchon CH01
dmbtr1 LIKE ekbe-dmbtr,
dmbtr2 LIKE ekbe-dmbtr,
dmbtr3 LIKE ekbe-dmbtr,
dmbtr4 LIKE ekbe-dmbtr,
dmbtr5 LIKE ekbe-dmbtr,
dmbtr6 LIKE ekbe-dmbtr,
dmbtr7 LIKE ekbe-dmbtr,
dmbtr8 LIKE ekbe-dmbtr,
dmbtr9 LIKE ekbe-dmbtr,
dmbtr10 LIKE ekbe-dmbtr,
dmbtr11 LIKE ekbe-dmbtr,
dmbtr12 LIKE ekbe-dmbtr,
*BRTWR1 LIKE EKPO-BRTWR,
brtwr1(13) TYPE c,
brtwr2(13) TYPE c,
brtwr3(13) TYPE c,
brtwr4(13) TYPE c,
brtwr5(13) TYPE c,
brtwr6(13) TYPE c,
brtwr7(13) TYPE c,
brtwr8(13) TYPE c,
brtwr9(13) TYPE c,
brtwr10(13) TYPE c,
brtwr11(13) TYPE c,
brtwr12(13) TYPE c,
sum_brtwr LIKE ekpo-brtwr,
post1 LIKE prps-post1,
h_note LIKE tline-tdline,
sum_out LIKE ekpo-brtwr,
sum_act LIKE ekbe-dmbtr,
END OF itab.

*ITAB1
DATA: BEGIN OF itab1 OCCURS 0,
lifnr LIKE ekko-lifnr,
bedat LIKE ekko-bedat,
waers LIKE ekko-waers,
ebeln LIKE ekpo-ebeln,
ebelp LIKE ekpo-ebelp,
matnr LIKE ekpo-matnr,
txz01 LIKE ekpo-txz01,
menge LIKE ekpo-menge,
meins LIKE ekpo-meins,
netpr LIKE ekpo-netpr,
elikz LIKE ekpo-elikz,
eindt LIKE eket-eindt,
budat LIKE ekbe-budat,
menge2 LIKE ekbe-menge,
delp TYPE i,
cmt(15) TYPE c,
belnr LIKE ekbe-belnr, "Start insert by suchon CH01
buzei LIKE ekbe-buzei,
dmbtr LIKE ekbe-dmbtr,
ps_psp_pnr LIKE ekkn-ps_psp_pnr, "End insert by suchon CH01
dmbtr1 LIKE ekbe-dmbtr,
dmbtr2 LIKE ekbe-dmbtr,
dmbtr3 LIKE ekbe-dmbtr,
dmbtr4 LIKE ekbe-dmbtr,
dmbtr5 LIKE ekbe-dmbtr,
dmbtr6 LIKE ekbe-dmbtr,
dmbtr7 LIKE ekbe-dmbtr,
dmbtr8 LIKE ekbe-dmbtr,
dmbtr9 LIKE ekbe-dmbtr,
dmbtr10 LIKE ekbe-dmbtr,
dmbtr11 LIKE ekbe-dmbtr,
dmbtr12 LIKE ekbe-dmbtr,
*BRTWR1 LIKE EKPO-BRTWR,
brtwr1(13) TYPE c,
brtwr2(13) TYPE c,
brtwr3(13) TYPE c,
brtwr4(13) TYPE c,
brtwr5(13) TYPE c,
brtwr6(13) TYPE c,
brtwr7(13) TYPE c,
brtwr8(13) TYPE c,
brtwr9(13) TYPE c,
brtwr10(13) TYPE c,
brtwr11(13) TYPE c,
brtwr12(13) TYPE c,
sum_brtwr LIKE ekpo-brtwr,
post1 LIKE prps-post1,
h_note LIKE tline-tdline,
sum_out LIKE ekpo-brtwr,
sum_act LIKE ekbe-dmbtr,

END OF itab1.
*MTEXT
DATA: BEGIN OF mtext OCCURS 50.
        INCLUDE STRUCTURE tline.
DATA: END OF mtext.
*Temp data
DATA temp1 LIKE itab1.

*EKKOTAB
DATA: BEGIN OF ekkotab OCCURS 0,
ebeln LIKE ekko-ebeln,
lifnr LIKE ekko-lifnr,
bedat LIKE ekko-bedat,
waers LIKE ekko-waers,
END OF ekkotab.

*EKPOTAB
DATA: BEGIN OF ekpotab OCCURS 0,
ebeln LIKE ekpo-ebeln,
ebelp LIKE ekpo-ebelp,
lifnr LIKE ekko-lifnr,
bedat LIKE ekko-bedat,
waers LIKE ekko-waers,
matnr LIKE ekpo-matnr,
txz01 LIKE ekpo-txz01,
menge LIKE ekpo-menge,
meins LIKE ekpo-meins,
netpr LIKE ekpo-netpr,
elikz LIKE ekpo-elikz,
eindt LIKE eket-eindt,
brtwr LIKE ekpo-brtwr,
END OF ekpotab.




*--------------------------------------------
INITIALIZATION.
*--------------------------------------------
  repname = sy-repid.
  PERFORM build.
  PERFORM eventtab_build CHANGING gt_events.
  PERFORM comment_build CHANGING gt_list_top_of_page.
  PERFORM initialize_variant.



*--------------------------------------------
AT SELECTION-SCREEN.
*--------------------------------------------
  IF s_bedat IS INITIAL.
    MESSAGE e000
    WITH 'Please enter a date in Main Selection Criteria'.
  ENDIF.

* IF P_01 = 'X' AND P_D01 IS INITIAL.
* MESSAGE E000
* WITH 'Please enter a number on Delivered Before Plan Delivery'.
* ENDIF.
*
* IF P_02 = 'X' AND P_D02 IS INITIAL.
* MESSAGE E000
* WITH 'Please enter a number on Delivered After Plan Delivery'.
* ENDIF.
*
* IF P_04 = 'X' AND P_D04 IS INITIAL.
* MESSAGE E000
* WITH 'Please enter a number on Un-delivered Before Plan Delivery'.
* ENDIF.
*
* IF P_05 = 'X' AND P_D05 IS INITIAL.
* MESSAGE E000
* WITH 'Please enter a number on Un-delivered After Plan Delivery'.
* ENDIF.

  PERFORM pai_of_selection_screen.


*--------------------------------------------
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.
*--------------------------------------------
  PERFORM f4_for_variant.


*--------------------------------------------
START-OF-SELECTION.
*--------------------------------------------
  PERFORM start.


*--------------------------------------------
END-OF-SELECTION.
*--------------------------------------------
  PERFORM call_alv.





*--------------------------------------------
FORM start.
*--------------------------------------------

  PERFORM get_ekkotab.
  PERFORM get_ekpotab.
  PERFORM get_itab1.
  PERFORM move_itab1_to_itab.
* START INSERT BY SUCHON CH01
  IF NOT s_wbs IS INITIAL.
    DELETE itab WHERE ps_psp_pnr <> s_wbs.
  ENDIF.
ENDFORM. "START
* END INSERT BY SUCHON CH01


*--------------------------------------------
FORM get_ekkotab.
*--------------------------------------------
  REFRESH ekkotab. CLEAR ekkotab.

  SELECT ebeln lifnr bedat waers
  INTO (ekko-ebeln, ekko-lifnr, ekko-bedat, ekko-waers)
  FROM ekko WHERE
  lifnr IN s_lifnr AND
  ekgrp IN s_ekgrp AND
  bedat IN s_bedat
  AND ebeln IN s_purdoc. " INSERT BY SUCHON , CH01

    MOVE ekko-ebeln TO ekkotab-ebeln.
    MOVE ekko-lifnr TO ekkotab-lifnr.
    MOVE ekko-bedat TO ekkotab-bedat.
    MOVE ekko-waers TO ekkotab-waers.
    APPEND ekkotab. CLEAR ekkotab.

  ENDSELECT.


ENDFORM. "GET_EKKOTAB



*--------------------------------------------
FORM get_ekpotab.
*--------------------------------------------
  REFRESH ekpotab. CLEAR ekpotab.

  LOOP AT ekkotab.

    SELECT ebeln ebelp matnr txz01 menge meins netpr elikz brtwr
    INTO (ekpo-ebeln, ekpo-ebelp, ekpo-matnr, ekpo-txz01,
    ekpo-menge, ekpo-meins, ekpo-netpr, ekpo-elikz,
    ekpo-brtwr)
    FROM ekpo WHERE
    ebeln = ekkotab-ebeln AND
    matnr IN s_matnr AND
    matkl IN s_matkl.

      SELECT SINGLE eindt INTO eket-eindt
      FROM eket WHERE
      ebeln = ekpo-ebeln AND ebelp = ekpo-ebelp.
      MOVE ekkotab-lifnr TO ekpotab-lifnr.
      MOVE ekkotab-bedat TO ekpotab-bedat.
      MOVE ekkotab-waers TO ekpotab-waers.
      MOVE ekpo-ebeln TO ekpotab-ebeln.
      MOVE ekpo-ebelp TO ekpotab-ebelp.
      MOVE ekpo-matnr TO ekpotab-matnr.
      MOVE ekpo-txz01 TO ekpotab-txz01.
      MOVE ekpo-menge TO ekpotab-menge.
      MOVE ekpo-meins TO ekpotab-meins.
      MOVE ekpo-netpr TO ekpotab-netpr.
      MOVE ekpo-elikz TO ekpotab-elikz.
      MOVE eket-eindt TO ekpotab-eindt.
      MOVE ekpo-brtwr TO ekpotab-brtwr.
      APPEND ekpotab. CLEAR ekpotab.

    ENDSELECT.

  ENDLOOP.

ENDFORM. "GET_EKPOTAB

*--------------------------------------------
FORM get_itab1.
*--------------------------------------------
  DATA dvplan TYPE i.
  DATA commt(15) TYPE c.
  DATA tname LIKE thead-tdname.



  REFRESH itab1. CLEAR itab1.

  LOOP AT ekpotab.

    SELECT SINGLE ps_psp_pnr
    INTO (itab1-ps_psp_pnr)
    FROM ekkn WHERE ebeln = ekpotab-ebeln
    AND ebelp = ekpotab-ebelp.

    SELECT SINGLE post1
    INTO (itab1-post1)
    FROM prps
    WHERE pspnr = itab1-ps_psp_pnr.

    MOVE ekpotab-ebeln TO tname.

***************CALL HEADER NOTES*******************
    CALL FUNCTION 'READ_TEXT'
      EXPORTING
        id                      = 'F02'
        language                = 'E'
        name                    = tname
        object                  = 'EKKO'
      TABLES
        lines                   = mtext
      EXCEPTIONS
        id                      = 1
        language                = 2
        name                    = 3
        not_found               = 4
        object                  = 5
        reference_check         = 6
        wrong_access_to_archive = 7
        OTHERS                  = 8.
****************************************************
    IF sy-subrc = 0.
      READ TABLE mtext INDEX 1 ."INTO itab1-h_note.
      MOVE mtext-tdline TO itab1-h_note.
    ENDIF.

    itab1-sum_brtwr = itab1-sum_brtwr + ekpotab-brtwr.

    SELECT dmbtr budat
    INTO (itab1-dmbtr,itab1-budat)
    FROM ekbe WHERE ebeln = ekpotab-ebeln
    AND ebelp = ekpotab-ebelp AND bewtp = 'Q'.
      temp1-dmbtr = temp1-dmbtr + itab1-dmbtr.
      temp1-budat = itab1-budat.
    ENDSELECT.

    itab1-sum_act = itab1-sum_act + temp1-dmbtr .

    CASE ekpotab-eindt+4(2) .
      WHEN 1.
        itab1-brtwr1 = ekpotab-brtwr - temp1-dmbtr.

        IF ekpotab-eindt+4(2) = temp1-budat+4(2).
          itab1-dmbtr1 = temp1-dmbtr.
        ELSE.
          PERFORM chk_date_inv.
        ENDIF.
        CLEAR temp1.
      WHEN 2.
        itab1-brtwr2 = ekpotab-brtwr.
        IF ekpotab-eindt+4(2) = temp1-budat+4(2).
          itab1-dmbtr2 = temp1-dmbtr.
        ELSE.
          PERFORM chk_date_inv.
        ENDIF.
        CLEAR temp1.
      WHEN 3.
        itab1-brtwr3 = ekpotab-brtwr.
        IF ekpotab-eindt+4(2) = temp1-budat+4(2).
          itab1-dmbtr3 = temp1-dmbtr.
        ELSE.
          PERFORM chk_date_inv.
        ENDIF.
        CLEAR temp1.

      WHEN 4.
        itab1-brtwr4 = ekpotab-brtwr.
        IF ekpotab-eindt+4(2) = temp1-budat+4(2).
          itab1-dmbtr4 = temp1-dmbtr.
        ELSE.
          PERFORM chk_date_inv.
        ENDIF.
        CLEAR temp1.

      WHEN 5.
        itab1-brtwr5 = ekpotab-brtwr.
        IF ekpotab-eindt+4(2) = temp1-budat+4(2).
          itab1-dmbtr5 = temp1-dmbtr.
        ELSE.
          PERFORM chk_date_inv.
        ENDIF.
        CLEAR temp1.

      WHEN 6.
        itab1-brtwr6 = ekpotab-brtwr.
        IF ekpotab-eindt+4(2) = temp1-budat+4(2).
          itab1-dmbtr6 = temp1-dmbtr.
        ELSE.
          PERFORM chk_date_inv.
        ENDIF.
        CLEAR temp1.

      WHEN 7.
        itab1-brtwr7 = ekpotab-brtwr.
        IF ekpotab-eindt+4(2) = temp1-budat+4(2).
          itab1-dmbtr7 = temp1-dmbtr.
        ELSE.
          PERFORM chk_date_inv.
        ENDIF.
        CLEAR temp1.

      WHEN 8.
        itab1-brtwr8 = ekpotab-brtwr.
        IF ekpotab-eindt+4(2) = temp1-budat+4(2).
          itab1-dmbtr8 = temp1-dmbtr.
        ELSE.
          PERFORM chk_date_inv.
        ENDIF.
        CLEAR temp1.

      WHEN 9.
        itab1-brtwr9 = ekpotab-brtwr.
        IF ekpotab-eindt+4(2) = temp1-budat+4(2).
          itab1-dmbtr9 = temp1-dmbtr.
        ELSE.
          PERFORM chk_date_inv.
        ENDIF.
        CLEAR temp1.

      WHEN 10.
        itab1-brtwr10 = ekpotab-brtwr.
        IF ekpotab-eindt+4(2) = temp1-budat+4(2).
          itab1-dmbtr10 = temp1-dmbtr.
        ELSE.
          PERFORM chk_date_inv.
        ENDIF.
        CLEAR temp1.

      WHEN 11.
        itab1-brtwr11 = ekpotab-brtwr.
        IF ekpotab-eindt+4(2) = temp1-budat+4(2).
          itab1-dmbtr11 = temp1-dmbtr.
        ELSE.
          PERFORM chk_date_inv.
        ENDIF.
        CLEAR temp1.

      WHEN 12.
        itab1-brtwr12 = ekpotab-brtwr.
        IF ekpotab-eindt+4(2) = temp1-budat+4(2).
          itab1-dmbtr12 = temp1-dmbtr.
        ELSE.
          PERFORM chk_date_inv.
        ENDIF.
        CLEAR temp1.

    ENDCASE.
    PERFORM move_ekpotab_to_itab1.
    AT END OF ebeln .
      SUM.
      itab1-sum_out = ekpotab-brtwr.
      APPEND itab1.
      CLEAR itab1.
      CLEAR temp1.
    ENDAT.

  ENDLOOP.


ENDFORM.                                                    "GET_ITAB1

*--------------------------------------------
FORM move_itab1_to_itab.
*--------------------------------------------

  REFRESH itab. CLEAR itab.
  PERFORM get_filter_case.

  LOOP AT itab1.

    CLEAR sdat.
    CASE vwcase.

*Deliver - Select All
      WHEN '003'.
        IF itab1-budat <> space.
          MOVE-CORRESPONDING itab1 TO itab.
          APPEND itab. CLEAR itab.
        ENDIF.
*UnDeliver - Select All
      WHEN '006'.
        IF itab1-budat IS INITIAL OR itab1-budat = ''.
          MOVE-CORRESPONDING itab1 TO itab.
          APPEND itab. CLEAR itab.
        ENDIF.
*Select All
      WHEN '007'.
        MOVE-CORRESPONDING itab1 TO itab.
        APPEND itab. CLEAR itab.

    ENDCASE. "VWCASE

  ENDLOOP.                                                  "ITAB1

ENDFORM. "MOVE_ITAB1_TO_ITAB

*--------------------------------------------
FORM get_filter_case.
*--------------------------------------------
  CLEAR vwcase.
  MOVE '007' TO vwcase.
ENDFORM. "GET_FILTER_CASE


*--------------------------------------------
FORM f4_for_variant.
*--------------------------------------------
  CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
    EXPORTING
      is_variant = g_variant
      i_save     = g_save
    IMPORTING
      e_exit     = g_exit
      es_variant = gx_variant
    EXCEPTIONS
      not_found  = 2.
  IF sy-subrc = 2.
    MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ELSE.
    IF g_exit = space.
      p_vari = gx_variant-variant.
    ENDIF.
  ENDIF.
ENDFORM. " F4_FOR_VARIANT



*--------------------------------------------
FORM pai_of_selection_screen.
*--------------------------------------------
  IF NOT p_vari IS INITIAL.
    MOVE g_variant TO gx_variant.
    MOVE p_vari TO gx_variant-variant.
    CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
      EXPORTING
        i_save     = g_save
      CHANGING
        cs_variant = gx_variant.
    g_variant = gx_variant.
  ELSE.
    PERFORM initialize_variant.
  ENDIF.
ENDFORM. " PAI_OF_SELECTION_SCREEN



*--------------------------------------------
FORM call_alv.
*--------------------------------------------
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
  EXPORTING
  i_callback_program = repname
* I_STRUCTURE_NAME = 'ITAB1'
  is_layout = gs_layout
  it_fieldcat = gt_fieldcat[]
  it_sort = gt_sort[]
  it_events = gt_events[]
  is_variant = g_variant
  i_default = 'A'
  i_save = g_save
  TABLES
  t_outtab = itab
  EXCEPTIONS
  program_error = 1
  OTHERS = 2.
ENDFORM. "CALL ALV

*--------------------------------------------
FORM initialize_variant.
*--------------------------------------------
  g_save = 'A'.
  CLEAR g_variant.
  g_variant-report = repname.
  gx_variant = g_variant.
  CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
    EXPORTING
      i_save     = g_save
    CHANGING
      cs_variant = gx_variant
    EXCEPTIONS
      not_found  = 2.
  IF sy-subrc = 0.
    p_vari = gx_variant-variant.
  ENDIF.
ENDFORM. " INITIALIZE_VARIANT



*--------------------------------------------
FORM comment_build CHANGING gt_top_of_page TYPE slis_t_listheader.
*--------------------------------------------
  DATA: gs_line TYPE slis_listheader.

  CLEAR gs_line.
  gs_line-typ = 'H'.
  gs_line-info = 'Rodenstock (Thailand) Co.,Ltd.'.
  APPEND gs_line TO gt_top_of_page.

  CLEAR gs_line.
  gs_line-typ = 'S'.
  gs_line-info = 'Purchase Order Performance Report'.
  APPEND gs_line TO gt_top_of_page.
ENDFORM. "COMMENT_BUILD


*--------------------------------------------
FORM eventtab_build CHANGING lt_events TYPE slis_t_event.
*--------------------------------------------
  CONSTANTS:
  gc_formname_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE'.
  DATA: ls_event TYPE slis_alv_event.

  CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
    EXPORTING
      i_list_type = 0
    IMPORTING
      et_events   = lt_events.

  READ TABLE lt_events WITH KEY name = slis_ev_top_of_page
  INTO ls_event.
  IF sy-subrc = 0.
    MOVE gc_formname_top_of_page TO ls_event-form.
    APPEND ls_event TO lt_events.
  ENDIF.
ENDFORM. "EVENTTAB_BUILD



*--------------------------------------------
FORM top_of_page.
*--------------------------------------------
  CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
      it_list_commentary = gt_list_top_of_page.
ENDFORM. "TOP_OF_PAGE



*--------------------------------------------
FORM build.
*--------------------------------------------

  fieldcat_ln-tabname = 'ITAB'.

  fieldcat_ln-fieldname = 'PS_PSP_PNR'.
  fieldcat_ln-seltext_l = 'WBS element'.
  APPEND fieldcat_ln TO gt_fieldcat.

  fieldcat_ln-fieldname = 'POST1'.
  fieldcat_ln-seltext_l = 'Description'.
  fieldcat_ln-fix_column = 'X'.
  APPEND fieldcat_ln TO gt_fieldcat.

  fieldcat_ln-fieldname = 'EBELN'.
  fieldcat_ln-seltext_l = 'PO No.'.
  APPEND fieldcat_ln TO gt_fieldcat.

  fieldcat_ln-fieldname = 'H_NOTE'.
  fieldcat_ln-seltext_l = 'Detail.'.
  APPEND fieldcat_ln TO gt_fieldcat.


  fieldcat_ln-fieldname = 'SUM_BRTWR'.
  fieldcat_ln-seltext_l = 'PO Amount'.
  fieldcat_ln-no_zero = 'X'.
  APPEND fieldcat_ln TO gt_fieldcat.

  fieldcat_ln-fieldname = 'BRTWR1'.
  fieldcat_ln-seltext_l = 'Outstanding / Jan'.
* FIELDCAT_LN-NO_ZERO = 'X'.
  APPEND fieldcat_ln TO gt_fieldcat.

  fieldcat_ln-fieldname = 'DMBTR1'.
  fieldcat_ln-seltext_l = 'Actual / Jan'.
  fieldcat_ln-no_zero = 'X'.
  APPEND fieldcat_ln TO gt_fieldcat.

  fieldcat_ln-fieldname = 'BRTWR2'.
  fieldcat_ln-seltext_l = 'Outstanding / Feb'.
  fieldcat_ln-no_zero = 'X'.
  APPEND fieldcat_ln TO gt_fieldcat.

  fieldcat_ln-fieldname = 'DMBTR2'.
  fieldcat_ln-seltext_l = 'Actual / Feb'.
  fieldcat_ln-no_zero = 'X'.
  APPEND fieldcat_ln TO gt_fieldcat.

  fieldcat_ln-fieldname = 'BRTWR3'.
  fieldcat_ln-seltext_l = 'Outstanding / Mar'.
  fieldcat_ln-no_zero = 'X'.
  APPEND fieldcat_ln TO gt_fieldcat.

  fieldcat_ln-fieldname = 'DMBTR3'.
  fieldcat_ln-seltext_l = 'Actual / Mar'.
  fieldcat_ln-no_zero = 'X'.
  APPEND fieldcat_ln TO gt_fieldcat.

  fieldcat_ln-fieldname = 'BRTWR4'.
  fieldcat_ln-seltext_l = 'Outstanding / Apr'.
  fieldcat_ln-no_zero = 'X'.
  APPEND fieldcat_ln TO gt_fieldcat.

  fieldcat_ln-fieldname = 'DMBTR4'.
  fieldcat_ln-seltext_l = 'Actual / Apr'.
  fieldcat_ln-no_zero = 'X'.
  APPEND fieldcat_ln TO gt_fieldcat.

  fieldcat_ln-fieldname = 'BRTWR5'.
  fieldcat_ln-seltext_l = 'Outstanding / May'.
  fieldcat_ln-no_zero = 'X'.
  APPEND fieldcat_ln TO gt_fieldcat.

  fieldcat_ln-fieldname = 'DMBTR5'.
  fieldcat_ln-seltext_l = 'Actual / May'.
  fieldcat_ln-no_zero = 'X'.
  APPEND fieldcat_ln TO gt_fieldcat.

  fieldcat_ln-fieldname = 'BRTWR6'.
  fieldcat_ln-seltext_l = 'Outstanding / Jun'.
  fieldcat_ln-no_zero = 'X'.
  APPEND fieldcat_ln TO gt_fieldcat.

  fieldcat_ln-fieldname = 'DMBTR6'.
  fieldcat_ln-seltext_l = 'Actual / Jun'.
  fieldcat_ln-no_zero = 'X'.
  APPEND fieldcat_ln TO gt_fieldcat.

  fieldcat_ln-fieldname = 'BRTWR7'.
  fieldcat_ln-seltext_l = 'Outstanding / July'.
  fieldcat_ln-no_zero = 'X'.
  APPEND fieldcat_ln TO gt_fieldcat.

  fieldcat_ln-fieldname = 'DMBTR7'.
  fieldcat_ln-seltext_l = 'Actual / July'.
  fieldcat_ln-no_zero = 'X'.
  APPEND fieldcat_ln TO gt_fieldcat.

  fieldcat_ln-fieldname = 'BRTWR8'.
  fieldcat_ln-seltext_l = 'Outstanding / Aug'.
  fieldcat_ln-no_zero = 'X'.
  APPEND fieldcat_ln TO gt_fieldcat.

  fieldcat_ln-fieldname = 'DMBTR8'.
  fieldcat_ln-seltext_l = 'Actual / Aug'.
  fieldcat_ln-no_zero = 'X'.
  APPEND fieldcat_ln TO gt_fieldcat.

  fieldcat_ln-fieldname = 'BRTWR9'.
  fieldcat_ln-seltext_l = 'Outstanding / Sep'.
  fieldcat_ln-no_zero = 'X'.
  APPEND fieldcat_ln TO gt_fieldcat.

  fieldcat_ln-fieldname = 'DMBTR9'.
  fieldcat_ln-seltext_l = 'Actual / Sep'.
  fieldcat_ln-no_zero = 'X'.
  APPEND fieldcat_ln TO gt_fieldcat.

  fieldcat_ln-fieldname = 'BRTWR10'.
  fieldcat_ln-seltext_l = 'Qutstanding / Oct'.
  fieldcat_ln-no_zero = 'X'.
  APPEND fieldcat_ln TO gt_fieldcat.

  fieldcat_ln-fieldname = 'DMBTR10'.
  fieldcat_ln-seltext_l = 'Actual / Oct'.
  fieldcat_ln-no_zero = 'X'.
  APPEND fieldcat_ln TO gt_fieldcat.

  fieldcat_ln-fieldname = 'BRTWR11'.
  fieldcat_ln-seltext_l = 'Outstanding / Nov'.
  fieldcat_ln-no_zero = 'X'.
  APPEND fieldcat_ln TO gt_fieldcat.

  fieldcat_ln-fieldname = 'DMBTR11'.
  fieldcat_ln-seltext_l = 'Actual / Nov'.
  fieldcat_ln-no_zero = 'X'.
  APPEND fieldcat_ln TO gt_fieldcat.

  fieldcat_ln-fieldname = 'BRTWR12'.
  fieldcat_ln-seltext_l = 'Outstanding / Dec'.
  fieldcat_ln-no_zero = 'X'.
  APPEND fieldcat_ln TO gt_fieldcat.

  fieldcat_ln-fieldname = 'DMBTR12'.
  fieldcat_ln-seltext_l = 'Actual / Dec'.
  fieldcat_ln-no_zero = 'X'.
  APPEND fieldcat_ln TO gt_fieldcat.

  fieldcat_ln-fieldname = 'SUM_OUT'.
  fieldcat_ln-seltext_l = 'TOTAL Outstanding'.
  fieldcat_ln-no_zero = 'X'.
  APPEND fieldcat_ln TO gt_fieldcat.

  fieldcat_ln-fieldname = 'SUM_ACT'.
  fieldcat_ln-seltext_l = 'TOTAL Actual'.
  fieldcat_ln-no_zero = 'X'.
  APPEND fieldcat_ln TO gt_fieldcat.




  DATA: gs_sort TYPE slis_sortinfo_alv.
  CLEAR gs_sort.
  gs_sort-fieldname = 'PS_PSP_PNR'.
  gs_sort-spos = 1.
* GS_SORT-UP = 'X'.
  gs_sort-subtot = 'X'.
  APPEND gs_sort TO gt_sort.

  gs_layout-totals_before_items = 'X'.
  gs_layout-colwidth_optimize = 'X'.
  gs_layout-f2code = '&ETA'.
  gs_layout-zebra = 'X'.

ENDFORM. "BUILD
*&---------------------------------------------------------------------*
*& Form move_ekpotab_to_itab1
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM move_ekpotab_to_itab1.
  MOVE ekpotab-lifnr TO itab1-lifnr.
  MOVE ekpotab-bedat TO itab1-bedat.
  MOVE ekpotab-waers TO itab1-waers.
  MOVE ekpotab-ebeln TO itab1-ebeln.
  MOVE ekpotab-ebelp TO itab1-ebelp.
  MOVE ekpotab-matnr TO itab1-matnr.
  MOVE ekpotab-txz01 TO itab1-txz01.
  MOVE ekpotab-menge TO itab1-menge.
  MOVE ekpotab-meins TO itab1-meins.
  MOVE ekpotab-netpr TO itab1-netpr.
  MOVE ekpotab-elikz TO itab1-elikz.
  MOVE ekpotab-eindt TO itab1-eindt.
  MOVE ekbe-budat TO itab1-budat.
  MOVE ekbe-menge TO itab1-menge2.
* MOVE DVPLAN TO ITAB1-DELP.
* MOVE COMMT TO ITAB1-CMT.
* APPEND ITAB1. CLEAR ITAB1.
ENDFORM. " move_ekpotab_to_itab1
*&---------------------------------------------------------------------*
*& Form GET_INV
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_P1 text
*----------------------------------------------------------------------
*&---------------------------------------------------------------------*
*& Form CHK_DATE_INV
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM chk_date_inv.
  CASE temp1-budat+4(2).
    WHEN 1.
      itab1-dmbtr1 = itab1-dmbtr1 + temp1-dmbtr.
      CONCATENATE itab1-brtwr1 '*' INTO itab1-brtwr1 .
    WHEN 2.
      itab1-dmbtr2 = itab1-dmbtr2 + temp1-dmbtr.
      CONCATENATE itab1-brtwr2 '*' INTO itab1-brtwr2.
    WHEN 3.
      itab1-dmbtr3 = itab1-dmbtr3 + temp1-dmbtr.
      CONCATENATE itab1-brtwr3 '*' INTO itab1-brtwr3 .
    WHEN 4.
      itab1-dmbtr4 = itab1-dmbtr4 + temp1-dmbtr.
      CONCATENATE itab1-brtwr4 '*' INTO itab1-brtwr4.
    WHEN 5.
      itab1-dmbtr5 = itab1-dmbtr5 + temp1-dmbtr.
      CONCATENATE itab1-brtwr5 '*' INTO itab1-brtwr5.
    WHEN 6.
      itab1-dmbtr6 = itab1-dmbtr6 + temp1-dmbtr.
      CONCATENATE itab1-brtwr6 '*' INTO itab1-brtwr6.
    WHEN 7.
      itab1-dmbtr7 = itab1-dmbtr7 + temp1-dmbtr.
      CONCATENATE itab1-brtwr7 '*' INTO itab1-brtwr7 .
    WHEN 8.
      itab1-dmbtr8 = itab1-dmbtr8 + temp1-dmbtr.
      CONCATENATE itab1-brtwr8 '*' INTO itab1-brtwr8 .
    WHEN 9.
      itab1-dmbtr9 = itab1-dmbtr9 + temp1-dmbtr.
      CONCATENATE itab1-brtwr9 '*' INTO itab1-brtwr9.
    WHEN 10.
      itab1-dmbtr10 = itab1-dmbtr10 + temp1-dmbtr.
      CONCATENATE itab1-brtwr10 '*' INTO itab1-brtwr10.
    WHEN 11.
      itab1-dmbtr11 = itab1-dmbtr11 + temp1-dmbtr.
      CONCATENATE itab1-brtwr11 '*' INTO itab1-brtwr11 .
    WHEN 12.
      itab1-dmbtr12 = itab1-dmbtr12 + temp1-dmbtr.
      CONCATENATE itab1-brtwr12 '*' INTO itab1-brtwr12 .
  ENDCASE.
ENDFORM. "chk_date_inv.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ММ All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.