Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Field validations

Hi all,

I want to differentiate between events 'At selection-screen' and 'At selection-screen on <field>'.

I am attaching a file here. In that I have used event 'At selection-screen on s_vbeln'. But the field s_ebeln  is also getting validated.

I think only that s_vbeln should be validated as we are specifically mentioning it. But why s_ebeln is getting validated in the process.

Your help is appreciated.

Regards,

larry.

Former Member
Former Member replied

Hi Larry,

If you want to validate only s_vbeln then, under event At Selection-screen on s_vbeln you should keep only part of code which is validating the sales order number under the event At Selection-screen on s_vbeln.

In your code both sales order validation and purchase order validation are happening under the same event AT SELECTION-SCREEN ON S_VBELN.

You can write something like this

AT SELECTION-SCREEN ON S_EBELN.

SELECT SINGLE EBELN FROM EKKO INTO V_EBELN WHERE EBELN IN S_EBELN.

  IF SY-SUBRC <> 0.

    MESSAGE 'PO DOES NOT EXIST' TYPE 'I'.

  ELSE.

    MESSAGE 'PO EXISTS' TYPE 'I'.

  ENDIF.

AT SELECTION-SCREEN ON S_VBELN.

SELECT SINGLE VBELN FROM VBAK INTO V_VBELN WHERE VBELN IN S_VBELN.

  IF SY-SUBRC <> 0.

    MESSAGE 'SALES ORDER DOES NOT EXIST' TYPE 'I'.

  ELSE.

    MESSAGE 'SALES ORDER EXISTS' TYPE 'I'.

  ENDIF.

coming to the differences between At selection-screen' and 'At selection-screen on <field>...

Please check the below link

Selection Screen Events in ABAP - ABAP Development - SCN Wiki

Rewrad if helpful.


Regards,

Vasu Gunuputi.

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question