Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

QUESTION ABOUT PS

Hi!

can you help me for this situation i want to delect line n° 2 because is open

Nom : ZDI_PS_0120_20080903_171907

00000406 BS-BNP__-08-0246-11-JMD test PR00000406 10000001 00000000 00000000 BS-BNP__-08-0246-01 fr 00000000 00000000 I0046 E0001

HERE>>>> 00000425 BS-BNP__-08-0246-0211 Test PR00000425 10000002 00000000 00000000 BS-BNP__-08-0246-02 Test 00000000 00000000 E0001

my programme :

DATA i_xvbpa.

DATA i_yvbadr.

  • TABLES INTERNE

TYPES: BEGIN OF ty_exportfile,

exporttext(1000) TYPE c,

END OF ty_exportfile.

DATA : BEGIN OF ty_sortie OCCURS 0,

ma(1000) TYPE c,

*

END OF ty_sortie.

TYPE-POOLS : icon, slis.

*declaration des tables

TABLES: prps, prhi, proj, vbak, tj02t, tj30t, vbap, jest, tvarvc,kna1,vbpa.

*Structure du fichier en sortie

TYPES : BEGIN OF ty_sortie,

pspnr TYPE prps-pspnr,

posid TYPE prps-posid,

post1 TYPE prps-post1,

objnr TYPE prps-objnr,

vernr TYPE prps-vernr,

usr08 TYPE prps-usr08,

usr09 TYPE prps-usr09,

pspid TYPE proj-pspid,

post1_proj TYPE proj-post1,

guebg TYPE vbak-guebg,

gueen TYPE vbak-gueen,

kunnr TYPE vbpa-kunnr,

name1 TYPE kna1-name1,

istat TYPE tj02-istat,

estat TYPE tj30-estat,

END OF ty_sortie.

*Structure des tables prps

TYPES : BEGIN OF ty_prps,

pspnr TYPE prps-pspnr,

posid TYPE prps-posid,

post1 TYPE prps-post1,

objnr TYPE prps-objnr,

vernr TYPE prps-vernr,

usr08 TYPE prps-usr08,

usr09 TYPE prps-usr09,

pspid TYPE proj-pspid,

post1_proj TYPE proj-post1,

END OF ty_prps.

TYPES : BEGIN OF ty_vbak,

pspnr TYPE vbap-ps_psp_pnr,

vbeln TYPE vbak-vbeln,

guebg TYPE vbak-guebg,

gueen TYPE vbak-gueen,

kunnr TYPE vbak-kunnr,

END OF ty_vbak.

TYPES : BEGIN OF ty_vbpa,

kunnr TYPE vbpa-kunnr ,

END OF ty_vbpa.

TYPES: BEGIN OF it_vbak_line,

vbeln LIKE vbak-vbeln,

vkorg LIKE vbak-vkorg,

vtweg LIKE vbak-vtweg,

spart LIKE vbak-spart,

kunnr LIKE vbak-kunnr,

END OF it_vbak_line.

  • END OF ty_vbpa.

TYPES : BEGIN OF ty_kna1,

name1 TYPE kna1-name1 ,

END OF ty_kna1.

TYPES : BEGIN OF ty_jest,

objnr TYPE jest-objnr,

stat TYPE jest-stat,

END OF ty_jest.

DATA t_sadrvb TYPE TABLE OF sadrvb WITH HEADER LINE.

DATA t_vbpavb TYPE TABLE OF vbpavb WITH HEADER LINE.

DATA t_prps TYPE TABLE OF ty_prps.

DATA w_prps LIKE LINE OF t_prps.

DATA w_sortie TYPE ty_sortie.

DATA ty_exportfile TYPE table of ty_exportfile.

DATA w_exportfile TYPE ty_exportfile.

*table et structure pour exportation des parametres vers la fonction

DATA t_vbpa TYPE TABLE OF ty_vbpa .

DATA w_vbpa TYPE TABLE OF ty_vbpa .

DATA t_vbak TYPE TABLE OF ty_vbak.

DATA w_vbak LIKE LINE OF t_vbak.

DATA r_stat TYPE RANGE OF tj30-estat.

DATA w_stat LIKE LINE OF r_stat.

*DATA w_exportfile TYPE ty_exportfile.

TYPES : BEGIN OF ty_tj30t,

estat TYPE tj30t-estat,

txt04 TYPE tj30t-txt04,

END OF ty_tj30t.

DATA t_tj30t TYPE TABLE OF tj30t.

DATA w_tj30t LIKE LINE OF t_tj30t.

DATA t_tj02t TYPE TABLE OF tj02t.

DATA w_tj02t LIKE LINE OF t_tj02t.

DATA t_jest TYPE TABLE OF ty_jest.

DATA w_jest LIKE LINE OF t_jest.

DATA t_zpar_ps_0120 TYPE TABLE OF zpar_ps_0120.

DATA w_zpar_ps_0120 LIKE LINE OF t_zpar_ps_0120.

CONSTANTS k_filename TYPE filename-fileintern VALUE 'ZDI_PS_0120'.

DATA w_filename TYPE string.

DATA w_nb_enr TYPE i.

  • initialiser la table zpar_ps_0120

INITIALIZATION.

SELECT * INTO TABLE t_zpar_ps_0120 FROM zpar_ps_0120.

IF sy-subrc NE 0.

MESSAGE e398(00) WITH 'Table ZPAR_PS_0120 non gérée'(a01).

ENDIF.

  • ALIMENTER LA TABLE zpar_ps_0120

PERFORM fill_zpar_ps_0120.

  • Libellés TJ02T TJ30T chargés en T_TJ02T T_TJ30T

PERFORM get_description.

  • Récupérer la dernière date de traitement

SELECT SINGLE * FROM tvarvc WHERE name = 'ZDI_PS_0120_DER_EXE'.

  • Renvoie un nom de fichier physique à partir d'un nom de fichier logique

PERFORM get_file.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

START-OF-SELECTION.

REFRESH t_prps.

REFRESH t_vbak.

REFRESH t_vbpa.

*sélectionner les champs pspnr posid post1

PERFORM select_projects.

*ouvrir un fichier texte afin que celui-ci soit lu

OPEN DATASET w_filename FOR OUTPUT

IN TEXT MODE ENCODING UTF-8.

SORT t_vbak BY pspnr.

SORT t_jest BY objnr stat.

SORT t_tj02t.

SORT t_tj30t.

CLEAR w_nb_enr.

  • utiliser une boucle pour la table prps

PERFORM fill_w_filename.

CLOSE DATASET w_filename.

  • Si fin normale, mettre à jour la date dans variable

UPDATE tvarvc

SET low = sy-datum

WHERE name = 'ZDI_PS_0120_DER_EXE'.

COMMIT WORK.

*écriture de fichier

WRITE : / 'Fichier',

w_filename,

'écrit'.

*écriture de nbre d' enregistrement

WRITE : / 'Nb enregistrements : ',

w_nb_enr.

***********************************************************************

*******************************ROUTINES******************************

***********************************************************************

*&----


*

*& Form GET_FILE

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM get_file .

CALL FUNCTION 'FILE_GET_NAME'

EXPORTING

logical_filename = k_filename

IMPORTING

file_name = w_filename

EXCEPTIONS

file_not_found = 1

OTHERS = 2.

ENDFORM. " GET_FILE

*&----


*

*& Form SELECT_PROJECTS

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM select_projects .

SELECT prpspspnr prpsposid prps~post1

prpsobjnr prpsvernr prpsusr08 prpsusr08 projpspid projpost1

INTO TABLE t_prps

FROM prps

INNER JOIN prhi

ON prhiposnr = prpspspnr

INNER JOIN proj

ON projpspnr = prhipsphi

WHERE prps~stufe IN ('2', '3')

AND prps~belkz = 'X'

AND ( prps~erdat GE tvarvc-low

OR prps~aedat GE tvarvc-low ).

IF NOT t_prps[] IS INITIAL.

SELECT vbapps_psp_pnr vbakvbeln vbakguebg vbakgueen vbak~kunnr

INTO TABLE t_vbak

FROM vbap

INNER JOIN vbak

ON vbakvbeln = vbapvbeln

FOR ALL entries IN t_prps

WHERE vbap~ps_psp_pnr = t_prps-pspnr.

SELECT objnr stat

INTO TABLE t_jest

FROM jest

FOR ALL ENTRIES IN t_prps

WHERE objnr = t_prps-objnr

AND inact NE 'X'

AND stat IN r_stat.

ENDIF.

ENDFORM. " SELECT_PROJECTS

*&----


*

*& Form FILL_W_FILENAME

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM fill_w_filename .

LOOP AT t_prps INTO w_prps.

CLEAR w_sortie.

MOVE-CORRESPONDING w_prps TO w_sortie .

READ TABLE t_vbak INTO w_vbak WITH KEY pspnr = w_prps-pspnr BINARY SEARCH.

IF sy-subrc = 0.

MOVE-CORRESPONDING w_vbak TO w_sortie.

CALL FUNCTION 'SD_PARTNER_READ'

EXPORTING

f_vbeln = w_vbak-vbeln

object = 'VBPA'

no_master_adress = 'X'

TABLES

i_xvbadr = t_sadrvb

i_xvbpa = t_vbpavb

  • I_YVBADR =

  • I_YVBPA =

  • I_XVBPA2 =

  • I_YVBPA2 =

.

READ TABLE t_vbpavb WITH KEY parvw = 'WE'.

IF sy-subrc = 0.

w_sortie-kunnr = t_vbpavb-kunnr.

w_sortie-name1 = t_vbpavb-name1.

ELSE.

READ TABLE t_vbpavb WITH KEY parvw = 'AG'.

w_sortie-kunnr = t_vbpavb-kunnr.

w_sortie-name1 = t_vbpavb-name1.

ENDIF.

ENDIF.

*alimenter t_jest

LOOP AT t_jest INTO w_jest WHERE objnr = w_prps-objnr.

IF w_jest-stat(1) = 'E'.

  • lecture de t_tj30t

READ TABLE t_tj30t INTO w_tj30t WITH KEY estat = w_jest-stat

BINARY SEARCH.

IF sy-subrc = 0.

w_sortie-estat = w_jest-stat.

  • w_sortie-estat = w_tj30t-txt04.

ELSE .

w_sortie-estat = w_tj30t-txt04.

  • w_sortie-estat = w_jest-stat.

ENDIF.

ELSEIF w_jest-stat(1) = 'I'.

  • lecture de t_tj02t

READ TABLE t_tj02t INTO w_tj02t WITH KEY istat = w_jest-stat

BINARY SEARCH.

IF sy-subrc = 0.

w_sortie-istat = w_jest-stat.

  • w_sortie-istat = w_tj02t-txt04.

ELSE.

w_sortie-istat = w_tj02t-txt04.

*w_sortie-istat = w_jest-stat.

ENDIF.

ENDIF.

ENDLOOP.

*Fill table exportfile with separators

  • LOOP AT w_sortie.

CONCATENATE

w_sortie-pspnr

'| ' w_sortie-posid

'| ' w_sortie-post1

'| ' w_sortie-objnr

'| ' w_sortie-vernr

'| ' w_sortie-usr08

'| ' w_sortie-usr09

'| ' w_sortie-pspid

'| ' w_sortie-post1_proj

'| ' w_sortie-guebg

'| ' w_sortie-gueen

'| ' w_sortie-kunnr

'| ' w_sortie-name1

'| ' w_sortie-istat

'| ' w_sortie-estat into w_exportfile-exporttext.

  • APPEND w_exportfile.

  • ENDLOOP.

TRANSFER w_exportfile TO w_filename .

ADD 1 TO w_nb_enr.

  • TRANSFER w_sortie TO w_filename .

  • ADD 1 TO w_nb_enr.

ENDLOOP.

ENDFORM. " FILL_W_FILENAME

*&----


*

*& Form FILL_ZPAR_PS_0120

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM fill_zpar_ps_0120 .

LOOP AT t_zpar_ps_0120 INTO w_zpar_ps_0120.

w_stat-sign = 'I'.

w_stat-option = 'EQ'.

IF NOT w_zpar_ps_0120-statut_systeme IS INITIAL.

w_stat-low = w_zpar_ps_0120-statut_systeme.

APPEND w_stat TO r_stat.

ENDIF.

IF NOT w_zpar_ps_0120-statut_utilisat IS INITIAL.

w_stat-low = w_zpar_ps_0120-statut_utilisat.

APPEND w_stat TO r_stat.

ENDIF.

ENDLOOP.

ENDFORM. " FILL_ZPAR_PS_0120

*&----


*

*& Form GET_DESCRIPTION

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM get_description .

SELECT *

INTO TABLE t_tj02t

FROM tj02t

FOR ALL ENTRIES IN t_zpar_ps_0120

WHERE istat = t_zpar_ps_0120-statut_systeme

AND spras = sy-langu.

SELECT *

INTO TABLE t_tj30t

FROM tj30t

FOR ALL ENTRIES IN t_zpar_ps_0120

WHERE stsma = t_zpar_ps_0120-stsma

AND estat = t_zpar_ps_0120-statut_utilisat

AND spras = sy-langu.

ENDFORM. " GET_DESCRIPTION

THANKS.

Tags:
Former Member
Not what you were looking for? View more on this topic or Ask a question