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

Изменение значений экрана с использованием Search-Help



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



Joined: 01 Sep 2007
Posts: 1639

PostPosted: Mon Sep 17, 2007 7:32 pm    Post subject: Изменение значений экрана с использованием Search-Help Reply with quote

Copy from F4IF_SHLP_EXIT_EXAMPLE

Code:
FUNCTION Z_F4IF_SHLP_EXIT_ROOM.
*"----------------------------------------------------------------------
*"*"Local interface:
*"  TABLES
*"      SHLP_TAB TYPE  SHLP_DESCR_TAB_T
*"      RECORD_TAB STRUCTURE  SEAHLPRES
*"  CHANGING
*"     VALUE(SHLP) TYPE  SHLP_DESCR_T
*"     VALUE(CALLCONTROL) LIKE  DDSHF4CTRL STRUCTURE  DDSHF4CTRL
*"----------------------------------------------------------------------

* data declarations for populating batch field on dynpro
DATA:  DYFIELDS LIKE DYNPREAD OCCURS 1 WITH HEADER LINE.
constants: c_dynumb(04)     value '1145'.
constants: c_werks(132) value 'ANLZ-WERKS'.
constants: c_stort(132) value 'ANLZ-STORT'.
DATA: w_selopt LIKE LINE OF shlp-selopt.
DATA:   wa_dynpfields LIKE DYNPREAD.
DATA: wa_room LIKE zroom.
DATA: ENV_INFO  TYPE  DDSHF4ENV.

* EXIT immediately, if you do not want to handle this step

  CHECK SY-TCODE EQ 'AS02'.

  IF CALLCONTROL-STEP <> 'SELONE' AND
     CALLCONTROL-STEP <> 'SELECT' AND
     CALLCONTROL-STEP <> 'PRESEL1' AND
     CALLCONTROL-STEP <> 'RETURN' AND
     " AND SO ON
     CALLCONTROL-STEP <> 'DISP'.
     EXIT.
  ENDIF.

  CALL FUNCTION 'F4UT_GET_ENVIRONMENT'
    IMPORTING
        ENV_INFO = ENV_INFO
    EXCEPTIONS
      F4_NOT_ACTIVE = 1.
     
  IF NOT SY-SUBRS IS INITIAL.
    ENV_INFO-SUBPROG = SY-CPROG.
    ENV_INFO-SUBDYNP = c_dynumb.
  ENDIF.
 
*"----------------------------------------------------------------------
* STEP SELONE  (Select one of the elementary searchhelps)
*"----------------------------------------------------------------------
* This step is only called for collective searchhelps. It may be used
* to reduce the amount of elementary searchhelps given in SHLP_TAB.
* The compound searchhelp is given in SHLP.
* If you do not change CALLCONTROL-STEP, the next step is the
* dialog, to select one of the elementary searchhelps.
* If you want to skip this dialog, you have to return the selected
* elementary searchhelp in SHLP and to change CALLCONTROL-STEP to
* either to 'PRESEL' or to 'SELECT'.
  IF CALLCONTROL-STEP = 'SELONE'.
*   PERFORM SELONE .........
    EXIT.
  ENDIF.

*"----------------------------------------------------------------------
* STEP PRESEL  (Enter selection conditions)
*"----------------------------------------------------------------------
* This step allows you, to influence the selection conditions either
* before they are displayed or in order to skip the dialog completely.
* If you want to skip the dialog, you should change CALLCONTROL-STEP
* to 'SELECT'.
* Normaly only SHLP-SELOPT should be changed in this step.
  IF CALLCONTROL-STEP = 'PRESEL'.
*   PERFORM PRESEL ..........
    EXIT.
  ENDIF.

  IF CALLCONTROL-STEP = 'PRESEL1'.

    DYFIELDS-FIELDNAME = c_werks.
    APPEND DYFIELDS.
    DYFIELDS-FIELDNAME = c_stort.
    APPEND DYFIELDS.

    CALL FUNCTION 'DYNP_VALUES_READ'
       EXPORTING
            DYNAME                   = ENV_INFO-SUBPROG
            DYNUMB                   = ENV_INFO-SUBDYNP
       TABLES
            DYNPFIELDS               = DYFIELDS
       EXCEPTIONS
            invalid_abapworkarea = 01
            invalid_dynprofield = 02
            invalid_dynproname = 03
            invalid_dynpronummer = 04
            invalid_request = 05
            no_fielddescription = 06
            undefind_error = 07.

    CHECK SY-SUBRC IS INITIAL.

    w_selopt-sign = 'I'.
    w_selopt-option = 'EQ'.
    LOOP AT DYFIELDS.
      CHECK NOT DYFIELDS-FIELDVALUE IS INITIAL.

      CASE DYFIELDS-FIELDNAME.
      WHEN c_werks.
        w_selopt-shlpfield = 'WERKS'.
        w_selopt-low = DYFIELDS-FIELDVALUE.
        append w_selopt to shlp-selopt.
      WHEN c_stort.
        w_selopt-shlpfield = 'STORT'.
        w_selopt-low = DYFIELDS-FIELDVALUE.
        append w_selopt to shlp-selopt.
      ENDCASE.
    ENDLOOP.
    EXIT.
  ENDIF.


*"----------------------------------------------------------------------
* STEP RETURN  (Select one of the elementary searchhelps)
*"----------------------------------------------------------------------

  IF CALLCONTROL-STEP = 'RETURN'.
    DATA: LEN TYPE I.
    DESCRIBE FIELD wa_room LENGTH LEN.
    MOVE RECORD_TAB(LEN) TO wa_room.

    MOVE c_werks  TO wa_dynpfields-fieldname.
    MOVE wa_room-WERKS TO wa_dynpfields-fieldvalue.
    TRANSLATE wa_dynpfields-fieldname TO UPPER CASE.
    APPEND wa_dynpfields TO DYFIELDS.

    MOVE c_stort  TO wa_dynpfields-fieldname.
    MOVE wa_room-STORT TO wa_dynpfields-fieldvalue.
    TRANSLATE wa_dynpfields-fieldname TO UPPER CASE.
    APPEND wa_dynpfields TO DYFIELDS.

    CALL FUNCTION 'DYNP_UPDATE_FIELDS'
        EXPORTING
          DYNAME               = ENV_INFO-SUBPROG
          DYNUMB               = ENV_INFO-SUBDYNP
          request              = 'A'
        TABLES
          dynpfields           = DYFIELDS
        EXCEPTIONS
          INVALID_ABAPWORKAREA = 1
          INVALID_DYNPROFIELD  = 2
          INVALID_DYNPRONAME   = 3
          INVALID_DYNPRONUMMER = 4
          INVALID_REQUEST      = 5
          NO_FIELDDESCRIPTION  = 6
          UNDEFIND_ERROR       = 7
          OTHERS               = 8.
    EXIT.
  ENDIF.

*"----------------------------------------------------------------------
* STEP SELECT    (Select values)
*"----------------------------------------------------------------------
* This step may be used to overtake the data selection completely.
* To skip the standard seletion, you should return 'DISP' as following
* step in CALLCONTROL-STEP.
* Normally RECORD_TAB should be filled after this step.
* Standard function module F4UT_RESULTS_MAP may be very helpfull in this
* step.
  IF CALLCONTROL-STEP = 'SELECT'.
*   PERFORM STEP_SELECT TABLES RECORD_TAB SHLP_TAB
*                       CHANGING SHLP CALLCONTROL RC.
*   IF RC = 0.
*     CALLCONTROL-STEP = 'DISP'.
*   ELSE.
*     CALLCONTROL-STEP = 'EXIT'.
*   ENDIF.
    EXIT. "Don't process STEP DISP additionally in this call.
  ENDIF.
*"----------------------------------------------------------------------
* STEP DISP     (Display values)
*"----------------------------------------------------------------------
* This step is called, before the selected data is displayed.
* You can e.g. modify or reduce the data in RECORD_TAB
* according to the users authority.
* If you want to get the standard display dialog afterwards, you
* should not change CALLCONTROL-STEP.
* If you want to overtake the dialog on you own, you must return
* the following values in CALLCONTROL-STEP:
* - "RETURN" if one line was selected. The selected line must be
*   the only record left in RECORD_TAB. The corresponding fields of
*   this line are entered into the screen.
* - "EXIT" if the values request should be aborted
* - "PRESEL" if you want to return to the selection dialog
* Standard function modules F4UT_PARAMETER_VALUE_GET and
* F4UT_PARAMETER_RESULTS_PUT may be very helpfull in this step.
  IF CALLCONTROL-STEP = 'DISP'.
*   PERFORM AUTHORITY_CHECK TABLES RECORD_TAB SHLP_TAB
*                           CHANGING SHLP CALLCONTROL.
    EXIT.
  ENDIF.
ENDFUNCTION.
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 -> Search Help, Match Code 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 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.