Age: 70 Joined: 04 Oct 2007 Posts: 1218 Location: Санкт-Петербург
Posted: Sat Nov 29, 2008 4:12 pm Post subject: Status excludes
For example, when processing Manufacturing orders exclude certain status to be able to customize the following code.
On the selection screen, the status in the 'clear' will be selected.
Code:
DATA:
h_fehler,
help_system LIKE tj02t-txt04,
help_status LIKE jest-stat.
DATA: fufi TYPE c.
SELECT-OPTIONS: s_syste FOR help_system NO INTERVALS,
s_systh FOR help_status NO-DISPLAY.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_syste-low.
DATA: stsma LIKE atj49-stsma.
DATA: f4_cstate LIKE atj49-cstate.
PERFORM value_state(saplcoss) USING stsma
CHANGING f4_cstate s_syste-low.
* Prüfen der Selektionseingaben
PERFORM selektionen_pruefen.
IF h_fehler = 'X'.
EXIT.
ENDIF. " h_fehler = 'X'
* Daten anreichern
LOOP AT ifauf INTO wa_ifauf. " iauf enthält die Fertigungsaufträge
my_tabix = sy-tabix.
CLEAR fufi.
PERFORM status_check.
IF fufi = 'A'.
* Status soll ausgeschlossen werden
DELETE ifauf INDEX my_tabix.
CONTINUE.
ENDIF.
ENDLOOP. " AT ifauf INTO wa_ifauf
*&---------------------------------------------------------------------*
*& Form SELEKTIONEN_PRUEFEN
*&---------------------------------------------------------------------*
FORM selektionen_pruefen .
* Status prüfen
LOOP AT s_syste.
IF NOT s_syste-high IS INITIAL.
MESSAGE i000(z_uo) WITH
'Eingabe von Intervallen für Status nicht zulässig.'(e02).
h_fehler = 'X'.
EXIT.
ENDIF. " not s_syste-high is initial
IF s_syste-option NE 'EQ'.
MESSAGE i000(z_uo) WITH
'Status nur als gleich oder ungleich eingeben.'(e03).
h_fehler = 'X'.
EXIT.
ENDIF. " s_syste-option ne 'EQ'
CLEAR s_systh.
MOVE-CORRESPONDING s_syste TO s_systh.
PERFORM system_state_check(ppio_entry)
USING 'X' CHANGING s_syste-low s_systh-low.
IF s_syste-low IS INITIAL.
MESSAGE i000(z_uo) WITH
'Status'(e04) s_syste-low 'nicht zulässig.'(e05).
h_fehler = 'X'.
EXIT.
ELSE. " s_syste-low is initial
* jawohl, diesen Status gibt es
APPEND s_systh.
ENDIF. " s_syste-low is initial
ENDLOOP. " at s_syste
ENDFORM. " SELEKTIONEN_PRUEFEN
*&---------------------------------------------------------------------*
*& Form STATUS_CHECK
*&---------------------------------------------------------------------*
FORM status_check .
* Aus- bzw. Einschluss verschiedener Status laut Selektionsbildschirm
LOOP AT s_systh.
IF s_systh-sign = 'E'.
* Status soll ausgeschlossen sein
CALL FUNCTION 'STATUS_CHECK'
EXPORTING
* BYPASS_BUFFER = ' '
client = sy-mandt
objnr = wa_ifauf-objnr
status = s_systh-low
EXCEPTIONS
object_not_found = 1
status_not_active = 2
OTHERS = 3.
IF sy-subrc EQ 0. " CALL FUNCTION 'STATUS_CHECK'
* Status ist vorhanden
fufi = 'A'.
EXIT. " erster Treffer zählt
ENDIF. " sy-subrc ne 0. " CALL FUNCTION 'STATUS_CHECK'
ENDIF. " s_systh-sign = 'I'
ENDLOOP. " at s_systh
ENDFORM. " STATUS_CHECK
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.