Skip to Content
author's profile photo Former Member
Former Member

selection-screen fields validation for dialog

Hello ABAP Gurus

Requirements: this is a report wherein , depending upon the correct select-options , user will pick some field values from table and some will be entered by the user in the next se51 custom screen for creation of a record in a ztable .

the problem is :without validating select-options values , it calls the se51 screen 100.

How to keep the cursor at the selection-screen field until & unless user enters the correct i/p s .if i/p are correct then only it should call screen 100 otherwise remain in the selection screen only .

&----


*& Report ZSD_REP_QUOT_BANK_CREATE *

*& *

&----


*& *

*& *

&----


REPORT ZSD_REP_QUOT_BANK_CREATE NO STANDARD PAGE HEADING LINE-SIZE 255.

TABLES: VBAK,VBAP,VBRK,ZSD_TABL_QOTBANK,MARA,KONV.

DATA: OK_CODE LIKE SY-UCOMM,

SAVE_OK_CODE LIKE SY-UCOMM,

WA_ITAB LIKE ZSD_TABL_QOTBANK,

ANSWER TYPE C,

COPIED ,

STS TYPE N,

EMGRP LIKE MARA-EXTWG,

QTY LIKE ZSD_TABL_QOTBANK-QTY,

UPRICE LIKE ZSD_TABL_QOTBANK-UPRICE,

TOT LIKE ZSD_TABL_QOTBANK-TOT,

INO LIKE VBAP-POSNR.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-000.

SELECT-OPTIONS: S_QTNO FOR ZSD_TABL_QOTBANK-QTNO

NO INTERVALS NO-EXTENSION OBLIGATORY,

S_ITNO FOR ZSD_TABL_QOTBANK-ITNO

NO INTERVALS NO-EXTENSION OBLIGATORY.

  • S_MATNO FOR ZSD_TABL_QOTBANK-MATNO

  • NO INTERVALS NO-EXTENSION. "

SELECTION-SCREEN END OF BLOCK b1.

AT SELECTION-SCREEN.

SELECT SINGLE VBTYP

INTO VBAK-VBTYP

FROM VBAK

WHERE VBELN IN S_QTNO.

IF SY-SUBRC EQ 0 AND VBAK-VBTYP NE 'B'.

MESSAGE I005(ZQOTBANK).

  • SET CURSOR FIELD S_QTNO-LOW.

  • SUBMIT (SY-REPID) VIA SELECTION-SCREEN.

ENDIF.

CLEAR WA_ITAB.

SELECT SINGLE QTNO ITNO

INTO WA_ITAB

FROM ZSD_TABL_QOTBANK

WHERE QTNO IN S_QTNO

AND ITNO IN S_ITNO.

IF SY-SUBRC EQ 0.

MESSAGE I001(ZQOTBANK).

  • SET CURSOR FIELD S_QTNO-LOW.

  • SET CURSOR FIELD S_ITNO-LOW.

  • SUBMIT (SY-REPID) VIA SELECTION-SCREEN.

ENDIF.

*START-OF-SELECTION.

END-OF-SELECTION.

CALL SCREEN 0100.

&----


*& Module STATUS_0100 OUTPUT

&----


  • text

----


MODULE STATUS_0100 OUTPUT.

SET PF-STATUS '0100'.

SET TITLEBAR '0100'.

ZSD_TABL_QOTBANK-QTNO = S_QTNO-LOW.

SELECT SINGLE BUKRS_VF VKORG VTWEG SPART KUNNR ERDAT BNDDT

KNUMV

INTO (ZSD_TABL_QOTBANK-CCODE,

ZSD_TABL_QOTBANK-SORG,

ZSD_TABL_QOTBANK-DISTCHAN,

ZSD_TABL_QOTBANK-DIV,

ZSD_TABL_QOTBANK-CUSTNO,

ZSD_TABL_QOTBANK-QTDAT,

ZSD_TABL_QOTBANK-QTVALDAT,

VBAK-KNUMV)

FROM VBAK

WHERE VBELN IN S_QTNO

AND VBTYP = 'B'.

IF SY-SUBRC EQ 0.

SELECT SINGLE KWMENG POSNR MATNR

INTO (QTY , INO , ZSD_TABL_QOTBANK-MATNO)

FROM VBAP

WHERE VBELN IN S_QTNO.

SELECT SINGLE EXTWG

INTO EMGRP

FROM MARA

WHERE MATNR EQ ZSD_TABL_QOTBANK-MATNO.

ZSD_TABL_QOTBANK-ITNO = INO.

ZSD_TABL_QOTBANK-EMATGRP = EMGRP.

ZSD_TABL_QOTBANK-QTY = QTY.

SELECT SINGLE KBETR

INTO UPRICE

FROM KONV

WHERE KNUMV = VBAK-KNUMV

AND KPOSN = INO

AND KSCHL = 'PR00'.

ENDIF.

ZSD_TABL_QOTBANK-UPRICE = UPRICE.

TOT = QTY * UPRICE .

ZSD_TABL_QOTBANK-TOT = TOT .

CLEAR: QTY, UPRICE, TOT.

QTY = ZSD_TABL_QOTBANK-CGL_QTY.

UPRICE = ZSD_TABL_QOTBANK-CGL_UPRICE .

TOT = QTY * UPRICE .

ZSD_TABL_QOTBANK-CGL_TOT = TOT .

CLEAR: QTY, UPRICE, TOT.

QTY = ZSD_TABL_QOTBANK-BHEL_QTY.

UPRICE = ZSD_TABL_QOTBANK-BHEL_UPRICE .

TOT = QTY * UPRICE .

ZSD_TABL_QOTBANK-BHEL_TOT = TOT .

CLEAR: QTY, UPRICE, TOT.

QTY = ZSD_TABL_QOTBANK-BHEL_QTY.

UPRICE = ZSD_TABL_QOTBANK-BHEL_UPRICE .

TOT = QTY * UPRICE .

ZSD_TABL_QOTBANK-BHEL_TOT = TOT .

CLEAR: QTY, UPRICE, TOT.

QTY = ZSD_TABL_QOTBANK-ALSTOM_QTY.

UPRICE = ZSD_TABL_QOTBANK-ALSTOM_UPRICE .

TOT = QTY * UPRICE .

ZSD_TABL_QOTBANK-ALSTOM_TOT = TOT .

CLEAR: QTY, UPRICE, TOT.

QTY = ZSD_TABL_QOTBANK-SIEMENS_QTY.

UPRICE = ZSD_TABL_QOTBANK-SIEMENS_UPRICE .

TOT = QTY * UPRICE .

ZSD_TABL_QOTBANK-SIEMENS_TOT = TOT .

CLEAR: QTY, UPRICE, TOT.

QTY = ZSD_TABL_QOTBANK-TELK_QTY.

UPRICE = ZSD_TABL_QOTBANK-TELK_UPRICE .

TOT = QTY * UPRICE .

ZSD_TABL_QOTBANK-TELK_TOT = TOT .

CLEAR: QTY, UPRICE, TOT.

QTY = ZSD_TABL_QOTBANK-OTH_QTY.

UPRICE = ZSD_TABL_QOTBANK-OTH_UPRICE .

TOT = QTY * UPRICE .

ZSD_TABL_QOTBANK-OTH_TOT = TOT .

CLEAR: QTY, UPRICE, TOT.

ENDMODULE. " STATUS_0100 OUTPUT

&----


*& Module USER_COMMAND_0100 INPUT

&----


  • text

----


MODULE USER_COMMAND_0100 INPUT.

CASE OK_CODE.

WHEN 'SAVE'.

INSERT ZSD_TABL_QOTBANK.

IF SY-SUBRC EQ 0.

MESSAGE I000(ZQOTBANK).

COMMIT WORK.

CALL SELECTION-SCREEN 1000.

ELSE.

MESSAGE E001(ZQOTBANK).

CALL SELECTION-SCREEN 1000.

ENDIF.

ENDCASE.

ENDMODULE. " USER_COMMAND_0100 INPUT

*& Module EXIT_COMMAND INPUT

&----


  • text

----


MODULE EXIT_COMAND INPUT.

SAVE_OK_CODE = OK_CODE.

CLEAR OK_CODE.

CASE SAVE_OK_CODE.

WHEN 'CANCEL'.

CALL FUNCTION 'POPUP_TO_CONFIRM'

EXPORTING

TITLEBAR = 'Quotation Bank Entry'

TEXT_QUESTION = 'Do you want to Cancel ?'

TEXT_BUTTON_1 = 'Yes'

TEXT_BUTTON_2 = 'No'

DEFAULT_BUTTON = '2'

IMPORTING

ANSWER = ANSWER.

IF ANSWER = '1'.

LEAVE PROGRAM.

ELSE.

  • CALL SELECTION-SCREEN 1000.

ENDIF.

WHEN 'EXIT'.

CALL FUNCTION 'POPUP_TO_CONFIRM'

EXPORTING

TITLEBAR = 'Quotation Bank Entry'

TEXT_QUESTION = 'Do you want to Exit ?'

TEXT_BUTTON_1 = 'Yes'

TEXT_BUTTON_2 = 'No'

DEFAULT_BUTTON = '2'

IMPORTING

ANSWER = ANSWER.

IF ANSWER = '1'.

LEAVE PROGRAM.

ELSE.

  • CALL SELECTION-SCREEN 1000.

ENDIF.

ENDCASE.

ENDMODULE. " EXIT_COMMAND INPUT

Thnx in Advance

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jan 28, 2005 at 05:42 AM

    You should use an Error Message instead of an Information Message.

    Eg: MESSAGE E005(ZQOTBANK).

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 28, 2005 at 05:43 AM

    Put the statement

    CALL SCREEN 100 

    in the event <b>AT SELECTION-SCREEN</b> and NOT in <b>END-OF-SELECTION</b>.

    Regards,

    Subramanian V.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.