Posted: Thu Feb 19, 2009 3:51 pm Post subject: Show IDOCs by period
Author : Mickael QUESNOT
Code:
REPORT z0lidocs0101 .
************************************************************************
* Declaration des donnees
************************************************************************
INCLUDE z0lidocs0101top.
DEFINE datum.
call function 'CONVERT_DATE_TO_INTERN_FORMAT'
exporting
datum = &1
dtype = 'DATS'
importing
idate = date.
END-OF-DEFINITION.
************************************************************************
* Ecran de Selection
************************************************************************
SELECTION-SCREEN BEGIN OF BLOCK b01 WITH FRAME TITLE text-t01.
*Date de creation de l'IDoc
SELECT-OPTIONS so_creda FOR sy-datum OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b01.
alv_declare_variant.
************************************************************************
* Programme Principal
************************************************************************
START-OF-SELECTION.
alv_variant.
* Selection des IDOCS
PERFORM selection_idoc.
IF sy-subrc = 0.
* Affichage des IDOCS
PERFORM affichage_idoc.
ELSE.
MESSAGE s349(e0).
* Selection de donnees impossible
ENDIF.
*&---------------------------------------------------------------------*
*& Form SELECTION_IDOC
*&---------------------------------------------------------------------*
FORM selection_idoc.
*1) Selection des Idocs a traiter
CLEAR t_edidc.
REFRESH t_edidc.
SELECT * FROM edidc
INTO TABLE t_edidc
WHERE direct = '2'
AND sndprn LIKE 'VG%'
AND sndprt = 'LS'
AND ( status = '51'
OR status = '53'
OR status = '64' )
AND credat IN so_creda.
*Selection des Idocs 51 (Error)
PERFORM select_idocs51 USING l_edidc-sndprn.
WHEN '53'.
*Selection des IDOCS 53 (document posted)
PERFORM select_idocs53 USING l_edidc-sndprn.
WHEN '64'.
*Selection des Idocs 64 (ready to be transferred)
PERFORM select_idocs64 USING l_edidc-sndprn.
ENDCASE.
ENDLOOP.
ENDIF.
ENDFORM. " SELECTION_IDOC
*&---------------------------------------------------------------------*
*& Form select_idocs51
*&---------------------------------------------------------------------*
* Selection des IDOCS 51 (en erreur) par site
*----------------------------------------------------------------------*
* -->P_WA_EDIDC_SNDPRN text
*----------------------------------------------------------------------*
FORM select_idocs51 USING p_l_edidc_sndprn.
CASE p_l_edidc_sndprn(4).
WHEN 'VGLN'. "Le Neubourg
s_edidc_ln-st51 = s_edidc_ln-st51 + 1.
WHEN 'VGLV'. "Le vaudreuil
s_edidc_lv-st51 = s_edidc_lv-st51 + 1.
WHEN 'VGVR'. "Verneuil
s_edidc_vr-st51 = s_edidc_vr-st51 + 1.
WHEN 'VGAZ'. "Espagne
s_edidc_az-st51 = s_edidc_az-st51 + 1.
WHEN 'VGCG'. "USA
s_edidc_cg-st51 = s_edidc_cg-st51 + 1.
WHEN 'VGIR'. "Irlande
s_edidc_ir-st51 = s_edidc_ir-st51 + 1.
WHEN 'VGLG'. "Suisse
s_edidc_lg-st51 = s_edidc_lg-st51 + 1.
ENDCASE.
ENDFORM. "select_idocs51
*&---------------------------------------------------------------------*
*& Form select_idocs53
*&---------------------------------------------------------------------*
* Selection des IDOCS 53 (traites) par site
*----------------------------------------------------------------------*
* -->P_WA_EDIDC_SNDPRN text
*----------------------------------------------------------------------*
FORM select_idocs53 USING p_l_edidc_sndprn.
CASE p_l_edidc_sndprn(4).
WHEN 'VGLN'. "Le Neubourg
s_edidc_ln-st53 = s_edidc_ln-st53 + 1.
WHEN 'VGLV'. "Le vaudreuil
s_edidc_lv-st53 = s_edidc_lv-st53 + 1.
WHEN 'VGVR'. "Verneuil
s_edidc_vr-st53 = s_edidc_vr-st53 + 1.
WHEN 'VGAZ'. "Espagne
s_edidc_az-st53 = s_edidc_az-st53 + 1.
WHEN 'VGCG'. "USA
s_edidc_cg-st53 = s_edidc_cg-st53 + 1.
WHEN 'VGIR'. "Irlande
s_edidc_ir-st53 = s_edidc_ir-st53 + 1.
WHEN 'VGLG'. "Suisse
s_edidc_lg-st53 = s_edidc_lg-st53 + 1.
ENDCASE.
ENDFORM. "select_idocs53
*&---------------------------------------------------------------------*
*& Form select_idocs64
*&---------------------------------------------------------------------*
* Selection des IDOCS 64 (non traites) par site
*----------------------------------------------------------------------*
* -->P_WA_EDIDC_SNDPRN text
*----------------------------------------------------------------------*
FORM select_idocs64 USING p_l_edidc_sndprn.
CASE p_l_edidc_sndprn(4).
WHEN 'VGLN'. "Le Neubourg
s_edidc_ln-st64 = s_edidc_ln-st64 + 1.
WHEN 'VGLV'. "Le vaudreuil
s_edidc_lv-st64 = s_edidc_lv-st64 + 1.
WHEN 'VGVR'. "Verneuil
s_edidc_vr-st64 = s_edidc_vr-st64 + 1.
WHEN 'VGAZ'. "Espagne
s_edidc_az-st64 = s_edidc_az-st64 + 1.
WHEN 'VGCG'. "USA
s_edidc_cg-st64 = s_edidc_cg-st64 + 1.
WHEN 'VGIR'. "Irlande
s_edidc_ir-st64 = s_edidc_ir-st64 + 1.
WHEN 'VGLG'. "Suisse
s_edidc_lg-st64 = s_edidc_lg-st64 + 1.
ENDCASE.
ENDFORM. "select_idocs64
*&---------------------------------------------------------------------*
*& Form affichage_idoc
*&---------------------------------------------------------------------*
* Affichage de la liste des IDOCS 51/53/64
*----------------------------------------------------------------------*
FORM affichage_idoc.
LOOP AT it_events INTO bev_ev1.
CONCATENATE 'F_' bev_ev1-name INTO bev_ev1-form.
MODIFY it_events FROM bev_ev1.
CHECK bev_ev1-name NE 'TOP_OF_PAGE'.
CHECK bev_ev1-name NE 'USER_COMMAND'.
DELETE it_events .
ENDLOOP.
* Catalogue de caracteristiques des champs
PERFORM fieldcat_init.
*&---------------------------------------------------------------------*
*& Form fieldcat_init
*&---------------------------------------------------------------------*
* Mise en forme des caracteristiques des champs la liste
*----------------------------------------------------------------------*
FORM fieldcat_init.
**Division/Plant
IF w_fieldcat_lvc-fieldname = 'NAME1'.
w_fieldcat_lvc-coltext = text-011.
MODIFY it_fieldcat_lvc FROM w_fieldcat_lvc.
ENDIF.
**TOTAL IDOCS 51
IF w_fieldcat_lvc-fieldname = 'ST51'.
w_fieldcat_lvc-coltext = text-012.
w_fieldcat_lvc-col_id = '6'.
MODIFY it_fieldcat_lvc FROM w_fieldcat_lvc.
ENDIF.
**TOTAL IDOCS 53
IF w_fieldcat_lvc-fieldname = 'ST53'.
w_fieldcat_lvc-coltext = text-013.
MODIFY it_fieldcat_lvc FROM w_fieldcat_lvc.
ENDIF.
**TOTAL IDOCS 64
IF w_fieldcat_lvc-fieldname = 'ST64'.
w_fieldcat_lvc-coltext = text-014.
MODIFY it_fieldcat_lvc FROM w_fieldcat_lvc.
ENDIF.
ENDLOOP.
* optimisation de la largeur des colonnes
MOVE 'X' TO is_layout_lvc-cwidth_opt.
* Field that identify cell color in internal table
MOVE 'COLOR_LINE' TO is_layout_lvc-info_fname.
MOVE 'COLOR_CELL' TO is_layout_lvc-ctab_fname.
* data is_print_lvc type lvc_s_prnt.
is_print_lvc-reservelns = '3'.
ENDFORM. " fieldcat_init
*---------------------------------------------------------------------*
* FORM f_top_of_page *
*---------------------------------------------------------------------*
* Donnees d'en-tete *
*---------------------------------------------------------------------*
FORM f_top_of_page.
* Declaration des variables
alv_selection_declare.
* En-tete
IF sy-ucomm NE 'PRIN'. "impression de la liste
IF ( sy-langu = 'F' AND
sy-ucomm IS INITIAL OR
sy-ucomm = 'REFR' ).
LOOP AT so_creda.
CONCATENATE so_creda-low+6(2)
so_creda-low+4(2)
so_creda-low(4)
INTO so_creda-low.
MODIFY so_creda.
* Appel de la fonction d'affichage des selections
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = l_xheader.
ENDIF.
ENDFORM. "f_top_of_page
*---------------------------------------------------------------------*
* FORM statut_specifique *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
* --> RT_EXTAB *
*---------------------------------------------------------------------*
FORM statut_specifique USING rt_extab.
SET PF-STATUS 'SPECIFIQUE'.
ENDFORM.
*---------------------------------------------------------------------*
* FORM f_user_command *
*---------------------------------------------------------------------*
* Gestion des boutons specifiques *
*---------------------------------------------------------------------*
* --> UCO_UCOMM *
* --> UCO_SEL *
*---------------------------------------------------------------------*
FORM f_user_command USING uco_ucomm
uco_sel.
CASE uco_ucomm.
WHEN 'REFR'.
SET SCREEN 0.
LOOP AT so_creda.
CLEAR date.
datum so_creda-low.
so_creda-low = date.
MODIFY so_creda.
CLEAR date.
datum so_creda-high.
so_creda-high = date.
MODIFY so_creda.
ENDLOOP.
PERFORM selection_idoc.
IF sy-subrc = 0.
PERFORM affichage_idoc.
ENDIF.
ENDCASE.
ENDFORM. "f_user_command
*&---------------------------------------------------------------------*
*& Form couleur
*&---------------------------------------------------------------------*
* Gestion des couleurs dans l'affichage
*----------------------------------------------------------------------*
* -->P_T_AFFICHAGE text
*----------------------------------------------------------------------*
FORM couleur USING p_iz0idocs01 TYPE z0idocs01
CHANGING p_t_affichage LIKE t_affichage.
** TI pour affichage des couleurs
DATA : it_color TYPE TABLE OF lvc_s_scol WITH HEADER LINE.
REFRESH it_color.
CLEAR it_color.
* IF p_t_affichage-st51 >= '50'.
IF p_t_affichage-st51 >= p_iz0idocs01-st51.
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 can 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.