Skip to Content
0
Former Member
Jun 08, 2009 at 11:48 AM

Error which validating selection screen data in subroutine

29 Views

Hi,this is my code

selection-screen begin of block b_selection with frame title text-001.
SELECT-OPTIONS: s_belnr for  rbkp-belnr,                                         "Invoice number
                s_gjahr for rbkp-gjahr NO-EXTENSION NO INTERVALS,               "Fiscal year
                s_stat  for  rbkp-rbstat OBLIGATORY NO-EXTENSION DEFAULT c_status, "Invoice status
                s_blart for rbkp-blart OBLIGATORY DEFAULT c_doc_type,              "Document type
                s_lifnr for rbkp-lifnr.                                          "Vendor

selection-screen end of block b_selection.
at selection-screen.
select belnr gjahr from rbkp into table i_inv_data
                       where belnr  IN s_belnr
                       and   gjahr  IN s_gjahr
                       and   blart  IN s_blart
                       and   rbstat IN s_stat.
                       and   lifnr  IN s_lifnr.

  if i_inv_data[] is initial.
  message e000 with 'No record matching the search criteria'(001).
  endif.

This is working fine...now when I try to modularise it, it is nt working

selection-screen begin of block b_selection with frame title text-001.
SELECT-OPTIONS: s_belnr for  rbkp-belnr,                                         "Invoice number
                s_gjahr for rbkp-gjahr NO-EXTENSION NO INTERVALS,               "Fiscal year
                s_stat  for  rbkp-rbstat OBLIGATORY NO-EXTENSION DEFAULT c_status, "Invoice status
                s_blart for rbkp-blart OBLIGATORY DEFAULT c_doc_type,              "Document type
                s_lifnr for rbkp-lifnr.                                          "Vendor

selection-screen end of block b_selection.

at selection-screen.
perform sub_validate_data.

FORM SUB_VALIDATE_DATA.
select belnr gjahr from rbkp into table i_inv_data
                       where belnr  IN s_belnr
                       and   gjahr  IN s_gjahr
                       and   blart  IN s_blart
                       and   rbstat IN s_stat.
                       and   lifnr  IN s_lifnr.

  if i_inv_data[] is initial.
  message e000 with 'No record matching the search criteria'(001).
  endif.

*
ENDFORM.                    " SUB_VALIDATE_DATA

the error which I m getting is ' IN s_belnr should be followd by an internal table'Please tell how can I modularize this code and put the checking part in subroutine