Skip to Content
0
Former Member
Jul 12, 2010 at 02:47 PM

Populate dialogue processing box when raised work flow manually

22 Views

Dear all,

Wish to seek your expertise on this. When users raise work flow manually using t-code OAWD, they have to fill in the dialogue processing box. In the dialog box, user need to fill in company code, division of the company and country of the company.

As this is prone to error, it is suggested that to enter the company code only, then the division and country will be auto populate. To do this, a customized table will be maintained for the company code, division and country.

The given function module to bring out the above dialogue is Z_POPUP_GET_REQ_VALUES as shown in the coding below.

Do you know how modify the function module to import back the country and division from the customized table and populate the fields? Is there a need to use User Exit or Screen Exit for the dialogue processing box so that when user press "Enter" the company code and division will be filled in automatically?

Thanks in advance for your help.

FUNCTION Z_POPUP_GET_REQ_VALUES .
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  EXPORTING
*"     VALUE(EV_BUKRS) TYPE  BUKRS
*"     VALUE(EV_LAND1) TYPE  LAND1
*"     VALUE(EV_SPART) TYPE  ZELE_SPART
*"  EXCEPTIONS
*"      USER_CANCELLED
*"----------------------------------------------------------------------

  DATA LT_FIELDS TYPE TABLE OF SVAL.
  DATA LS_FIELDS TYPE SVAL.
  DATA LV_REPID TYPE SY-REPID.
  DATA LV_RETURNCODE TYPE C.

  LS_FIELDS-FIELD_OBL = 'X'.

  LS_FIELDS-TABNAME = 'ZTBL_WF_DOCINFO'.
  LS_FIELDS-FIELDNAME = 'BUKRS'.
  APPEND LS_FIELDS TO LT_FIELDS.

  LS_FIELDS-TABNAME = 'ZTBL_WF_DOCINFO'.
  LS_FIELDS-FIELDNAME = 'ZLOC'.
  APPEND LS_FIELDS TO LT_FIELDS.

  LS_FIELDS-TABNAME = 'ZTBL_WF_DOCINFO'.
  LS_FIELDS-FIELDNAME = 'SPART'.
  APPEND LS_FIELDS TO LT_FIELDS.

*  LS_FIELDS-TABNAME = 'ZTBL_WF_DOCINFO'.  "Doc type is no longer required
*  LS_FIELDS-FIELDNAME = 'AR_OBJECT'.
*  APPEND LS_FIELDS TO LT_FIELDS.

  LV_REPID = SY-REPID.

  CALL FUNCTION 'POPUP_GET_VALUES_USER_CHECKED'
    EXPORTING
      FORMNAME                        = 'VALIDATE_VALUE'
      POPUP_TITLE                     = 'DWM - Manual Workflow Entry'(001)
      PROGRAMNAME                     = LV_REPID
*     START_COLUMN                    = '5'
*     START_ROW                       = '5'
*     NO_CHECK_FOR_FIXED_VALUES       = ' '
    IMPORTING
      RETURNCODE                      = LV_RETURNCODE
    TABLES
      FIELDS                          = LT_FIELDS
    EXCEPTIONS
      ERROR_IN_FIELDS                 = 1
      OTHERS                          = 2
            .
  IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

  IF LV_RETURNCODE = 'A'.
    MESSAGE E000(K#) WITH 'User cancelled'(e01) RAISING USER_CANCELLED.
  ELSE.
    READ TABLE LT_FIELDS INTO LS_FIELDS INDEX 1.
    EV_BUKRS = LS_FIELDS-VALUE.
    READ TABLE LT_FIELDS INTO LS_FIELDS INDEX 2.
    EV_LAND1 = LS_FIELDS-VALUE.
    READ TABLE LT_FIELDS INTO LS_FIELDS INDEX 3.
    EV_SPART = LS_FIELDS-VALUE.
*    READ TABLE LT_FIELDS INTO LS_FIELDS INDEX 4. Doc type is no longer required
*    EV_AR_OBJECT = LS_FIELDS-VALUE.
  ENDIF.


ENDFUNCTION.

FORM VALIDATE_VALUE TABLES   fields STRUCTURE sval
                    CHANGING error  STRUCTURE svale.
  TABLES ZTBL_WF_DOCINFO.

* Validate Company Code
  READ TABLE fields INDEX 1.
  ZTBL_WF_DOCINFO-BUKRS = fields-value.
  SELECT SINGLE BUKRS INTO ZTBL_WF_DOCINFO-BUKRS FROM T001 WHERE BUKRS = ZTBL_WF_DOCINFO-BUKRS .
  IF sy-subrc <> 0.
    CLEAR error.
    error-errortab   = 'ZTBL_WF_DOCINFO'.
    error-errorfield = 'BUKRS' .
    error-msgty      = 'E'.
    error-msgid      = 'GJ'.
    error-msgno      = '450'.
    error-msgv1      = ZTBL_WF_DOCINFO-BUKRS .
    exit.
  ENDIF.

* Validate Country
  READ TABLE fields INDEX 2.
  ZTBL_WF_DOCINFO-ZLOC = fields-value.
  SELECT SINGLE LAND1 INTO ZTBL_WF_DOCINFO-ZLOC FROM T005 WHERE LAND1 = ZTBL_WF_DOCINFO-ZLOC.
  IF sy-subrc <> 0.
    CLEAR error.
    error-errortab   = 'ZTBL_WF_DOCINFO'.
    error-errorfield = 'ZLOC' .
    error-msgty      = 'E'.
    error-msgid      = '63'.
    error-msgno      = '721'.
    error-msgv1      = ZTBL_WF_DOCINFO-ZLOC .
    exit.
  ENDIF.

* Validate Division
  READ TABLE fields INDEX 3.
  ZTBL_WF_DOCINFO-SPART = fields-value.

* Validate Document Type - No longer required
*  READ TABLE fields INDEX 4.
*  ZTBL_WF_DOCINFO-AR_OBJECT = fields-value.
*  SELECT SINGLE AR_OBJECT INTO ZTBL_WF_DOCINFO-AR_OBJECT FROM TOADV WHERE AR_OBJECT = ZTBL_WF_DOCINFO-AR_OBJECT.
*  IF sy-subrc <> 0.
*    CLEAR error.
*    error-errortab   = 'ZTBL_WF_DOCINFO'.
*    error-errorfield = 'AR_OBJECT' .
*    error-msgty      = 'E'.
*    error-msgid      = '00'.
*    error-msgno      = '058'.
*    error-msgv1      = ZTBL_WF_DOCINFO-AR_OBJECT.
*    error-msgv2      = SPACE.
*    error-msgv3      = SPACE.
*    error-msgv4      = 'TOADV'.
*    exit.
*  ENDIF.

ENDFORM.

Edited by: wanderer5 on Jul 12, 2010 5:00 PM