Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Surprising error in validating screen fields

Former Member
0 Likes
677

Hi all,

My selection-screen contains 2 fields.One is date field P_DATE(MM/YYYY format) and another is select-option for customer.I am validating P_DATE at at selection-screen event.When ever I am logging into my QTP(Quality server) for the first time or one time and giving wrong date format and press enter, It is raising error message but immediately if i modify it to correct date format and press enter means it is executing the program instead of cursor getting placed at Customer field(second field).This is happening only once or twice but not everytime.

I hope u all understood.If not pls let me know.Could any one resolve this.

Thanks,

Balaji

4 REPLIES 4
Read only

Former Member
0 Likes
606

Hi balaj,

do you have

START-OF-SELECTION.

...

END-OF-SELECTION.

If yes, can you show your report.

Regards, Dieter

Read only

Former Member
0 Likes
606

TABLES : SSCRFIELDS

Before you wite the code for the report check for SY-UCOMM = 'ONLI'.

CHECK SSCRFIELDS-UCOMM = 'ONLI'.

*then only write the code for executing the report

Message was edited by:

chandrasekhar jagarlamudi

Read only

Former Member
0 Likes
606

Hi balaji,

1. Do not use AT SELECTION-SCREEN event.

2. Instead use logic like this.

3. START-OF-SELECTION.

<b> if Date Is Invalid.

Message 'Wrong date format' type 'W'.

LEAVE LIST-PROCESSING.

ENDIF.</b>

*--- normal code

WRITE 😕 'xyz'.

4. Then u won't face any such problem.

5. Important points are :

a) use the message type as W, or I (and not E)

b) Use the command LEAVE LIST-PROCESSING.

regards,

amit m.

Read only

Former Member
0 Likes
606

Hi all,

below is my code.But I didn't place end-of-selection explicitly.Amit may I know why I cant use at selection-screen event,which is for validating screen fields.Very few times only it is executing the program instead of cursor going to second field(customer) after giving correct date value in P_DATE,but not all times.But many times cursor is going to the second field instead of executing the program.

AT SELECTION-SCREEN ON P_DATUM.

VAL_MONTH = SY-DATUM+4(2).

VAL_MONTH1 = SY-DATUM+4(2) + 1.

VAL_YEAR = SY-DATUM(4).

IF VAL_MONTH1 = 13.

VAL_MONTH1 = 01.

ENDIF.

IF VAL_MONTH = 12 AND P_DATUM+4(2) = 01.

VAL_YEAR = SY-DATUM(4) + 1.

ELSE.

VAL_YEAR = SY-DATUM(4).

ENDIF.

IF P_DATUM4(2) <> VAL_MONTH AND P_DATUM4(2) <> VAL_MONTH1.

MESSAGE E073 WITH 'PLEASE ENTER CURRENT OR NEXT MONTH'.

ELSEIF P_DATUM(4) <> VAL_YEAR." AND P_DATUM(4) <> YEAR1.

MESSAGE E073 WITH 'PLEASE ENTER CURRENT OR NEXT MONTH'.

ENDIF.

----


*End of code by Balaji Update2.

----


----


  • TOP OF PAGE

----


TOP-OF-PAGE.

  • Standard SAP Header

PERFORM BATCH-HEADING(RSBTCHH0). "Standard SAP heading

ULINE.

************************************************************************

----


  • Main Process

----


START-OF-SELECTION.

*======================================================================

  • Load page header for printing

PERFORM FILL_HEADER.

SKIP 2.

*=======================================================================

  • Program needs to be run on foreground only

IF SY-BATCH NE 'X'.

MESSAGE E073 WITH 'PROGRAM MUST BE RUN in BACKGROUND MODE!'.

ENDIF.

  • Populate range for billing type 'CE1CATN-FKART' Included in program

PERFORM GET_BILLING_TYPE_RANGE_FKART.

  • Populate range for Document Type include in program

PERFORM GET_RANGES_DOC_TYPE.

  • Populate range for SD item category Excluded from program

PERFORM GET_RANGES_ITEM_CATEGORY_PSTYV.

  • Determine Inclusion Date for all 'Sold-to'

PERFORM SOLD_TO_INCL_DATE.

  • Determine Factor Calculation Period for all 'Sold-to'

PERFORM FACTOR_CALC_PERIOD.

  • Get data from all relevant tables

PERFORM GET_ALL_DATA.

  • Combine table YPDET with YPRH1

PERFORM COMBINE_YPDET_YPRH1.

  • BUILD STOCK PRICE

PERFORM BUILD_STOCK_REBATE_PRICE.

  • Build Invoice Quantity

PERFORM INVOICE_QTY.

  • Build POD Quantity

PERFORM POD_QTY.

*Begin of code by Balaji Update1

  • Get data from MVKE for ZPRI items

PERFORM ZPRI_MVKE.

*End of code by Balaji Update1.

  • Calculate Quantity & Amount Factor

PERFORM QTY_AMOUNT_FACTOR.

  • Summary report

PERFORM SUMMARY_REPORT.

Thanks,

Balaji