Friday, February 12, 2010

MAINTENANCE VIEW WITH CUSTOM F4

1.While executing the maintenance view using the sm30 transaction, go to the menu System, status and fetch the program name then go to the se38 transaction and edit it.

2.Add to the screen flow logic .
PROCESS ON VALUE-REQUEST. "F4
  FIELD ZVA_ZTASPIRANTE-PNACI MODULE matchcode_estad.

3.Function

MODULE matchcode_estad INPUT.
  DATA: BEGIN OF help_item OCCURS 0,
          carrid TYPE s_carr_id,
          connid TYPE s_conn_id,
        END OF help_item.
  SELECT carrid  connid
  INTO TABLE help_item
  FROM spfli.
  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
      retfield    = 'CARRID'
      dynprofield = 'CONNID'
      dynpprog    = sy-cprog
      dynpnr      = sy-dynnr
      value_org   = 'S'
    TABLES
      value_tab   = help_item.
ENDMODULE.

4.    Whether you need to validate the input, uncheck the field foreign .. in the screen layout for the modified field and go back to the screen flow logic and within the loop add the module

PROCESS AFTER INPUT.
  MODULE liste_exit_command AT EXIT-COMMAND.
  MODULE liste_before_loop.
  LOOP AT extract.
...
    FIELD zva_ztaspirante-pnaci MODULE validar_pais ON REQUEST.
  ENDLOOP.
  MODULE liste_after_loop. .

5. Function validar_pais

MODULE validar_pais INPUT.
  DATA ls_carrid TYPE s_carr_id.
  SELECT SINGLE carrid INTO ls_carrid  FROM spfli
         WHERE carrid = zva_ztaspirante-pnaci.
  IF sy-subrc <> 0.
    MESSAGE: 'No existe el valor ingresado' TYPE 'E'.
  ENDIF.
ENDMODULE.     

No comments:

Post a Comment