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

how can we perform validations in dialogue programs

Former Member
0 Likes
1,611

Hi all,

1.How can we perform validations in dialogue programming?

2. how can we create internal table at runtime. any command is there if possible give example?

3. if we give top-of-page after end-of-selection event. will it trigger ?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,573

1. Validations are done in the PBO of the screen

2. For creating an internal table at run time use <b>DYNAMIC</b> internal table concept.

3. Yes those Commands will trigger.

Hi all,

1.How can we perform validations in dialogue programming?

2. how can we create internal table at runtime. any command is there if possible give example?

3. if we give top-of-page after end-of-selection event. will it trigger ?

10 REPLIES 10
Read only

Former Member
0 Likes
1,573

Hi,

you can perform validations using module check. they are done in the PAI event of the screen when the user clicks and check the entry if it is valid.

CHAIN.

FIELD F1 F2 MODULE CHECK.

Inside the module CHECK do the validations.

ENDCHAIN.

Regards,

Aswin

Read only

Former Member
0 Likes
1,574

1. Validations are done in the PBO of the screen

2. For creating an internal table at run time use <b>DYNAMIC</b> internal table concept.

3. Yes those Commands will trigger.

Read only

0 Likes
1,573

<b>answer1---</b>You cannot perform input checks in PAI modules of programs until you have transported the contents of the input fields to the ABAP program. You can then use logical expressions to check the values that the user entered.

Checking Single Fields

If you send a warning or error message from a module <mod> that you called using a FIELD statement as follows:

FIELD <f> MODULE <mod>.

the corresponding input field on the current screen (and only this field) is made ready for input again, allowing the user to enter a new value. If the field is only checked once, the PAI processing continues directly after the FIELD statement, and the preceding modules are not called again.

Checking a Set of Fields

If you send a warning or error message from a module <mod> that you called using a FIELD statement as follows:

CHAIN.

FIELD: <f1>, <f 2>,...

MODULE <mod1>.

FIELD: <g1>, <g 2>,...

MODULE <mod2>.

...

ENDCHAIN.

all of the fields on the screen that belong to the processing chain (all of the fields listed in the field statements) are made ready for input again. Other fields are not ready for input. Whenever the MODULE statement appears within a processing chain, even if there is only one FIELD attached to it, all of the fields in the chain (not only the affected field) are made ready for input again, allowing the user to enter new values. If the fields in the processing chain are only checked once, the PAI processing continues directly after the FIELD statement, and the preceding modules are not called again.

<b>

answer 2--</b>

Take a look at this thread

<b>answer3-</b>

Yes both Commands will trigger

Read only

Former Member
0 Likes
1,573

hii

This top of page event will trigger in END OF SELECTION provided that you have your first write statement here or newpage .

chk this code

end-of-selection.

TOP-OF-PAGE
Write: / ‘this is top of page event.’
Write : / 10 ‘carrid’, 20 ‘connid’, 30 ‘fldate’.

.

ENDLOOP.

also go thru this link

REGARDS

Naresh

Read only

Former Member
0 Likes
1,573

Hi,

Check This link

<b>DIALOG Programming</b>

http://help.sap.com/saphelp_webas630/helpdata/en/9f/db9cdc35c111d1829f0000e829fbfe/content.htm

http://www.sapdevelopment.co.uk/dialog/dialoghome.htm

http://www.sap-img.com/

http://help.sap.com/saphelp_46c/helpdata/en/08/bef2dadb5311d1ad10080009b0fb56/content.htm

http://www.sapgenie.com/links/abap.htm

<b>Dynamic Internal table -weblog in sdn</b>

/people/subramanian.venkateswaran2/blog/2004/11/19/dynamic-internal-table

<b>Events</b>

Yes Event will trigger

one event marks the end of another event

Mark Helpfull Answers

Regards

Read only

Former Member
0 Likes
1,573

Hai Sateesh

For Dynamic Internal Tables

You can put a check depending on your condition you can pass the table parameters to the FM..Ex:-If condition1 is true. Perform gui_upload tables ITAB1.elseif condition2 is true. Perform gui_upload tables ITAB2.endif.Form gui_upload tables ITAB structure ....CALL FUNCTION 'GUI_UPLOAD' EXPORTING FILENAME = LDF_FILENAME3 FILETYPE = LDF_TYPE1 HAS_FIELD_SEPARATOR = 'X' TABLES DATA_TAB = ITAB EXCEPTIONS FILE_OPEN_ERROR = 1 FILE_READ_ERROR = 2 NO_BATCH = 3 GUI_REFUSE_FILETRANSFER = 4 INVALID_TYPE = 5 NO_AUTHORITY = 6 UNKNOWN_ERROR = 7 BAD_DATA_FORMAT = 8 HEADER_NOT_ALLOWED = 9 SEPARATOR_NOT_ALLOWED = 10 HEADER_TOO_LONG = 11 UNKNOWN_DP_ERROR = 12 ACCESS_DENIED = 13 DP_OUT_OF_MEMORY = 14 DISK_FULL = 15 DP_TIMEOUT = 16 OTHERS = 17 . IF SY-SUBRC <> 0. MESSAGE E506 WITH 'UPLOAD' 'SY-SUBRC=' SY-SUBRC SPACE. ENDIF.Endform.

For Report Events Sequence

This is the order of execution in Classical/Interactive Report Events

Classical Reports

Reports which are properly formatted (header, footer, page numbers etc.,) with the help of one or more external events like top-of-page,end-of-page etc., are called as CLASSICAL REPORTS.

Standard list.

Output of Report program is nothing but Standard list. It consists of one continuous page of 60,000 lines.

To restrict number of lines per page.

Report Zxxxxx line-count 25.

OR

Report Zxxxxx line-count 25(3).

( In this case 3 lines are reserved for footer)

To restrict Output width.

Report Zxxxx line-size 125.

To suppress standard page heading.

Report Zxxxx no standard page heading

Above all at a time:

Report Zxxxx line-count 25(3)

line-size 125

no standard page heading.

Screen Events List Events

Initialization. Start-of-selection

At selection-screen. Top-of-page.

At selection-screen on <field>. End-of-page.

End-of-selection.

We can initialize the selection-screen with calculated default values under this event.

Initialization.

s_date-high = sy-datum.

s_date-low = sy-datum - 15.

Append s_date.

We can validate all the inputs on selection screen fields under this event.

At selection-screen.

If s_carrid-low is initial or

s_connid-low is initial or

s_date is initial.

< ... code for validation... >.

Endif.

We can validate a particular field input on selection screen under this event.

At selection-screen on s_carrid.

If s_carrid-low < > ‘LH’.

<… code for validation…>

Endif.

If any of the other event comes before

‘Select…Endselect.’ statements, then to break

that event, we require this S-O-S event.

Start-of-selection.

Select * from ……

…………

Endselect.

If we need some portion of the output (like

column headings) to appear in all the pages,

then we use this event.

Top-of-page.

Write:/ ‘Carrier’,10 ‘Connection’ 20 ‘Date’.

If there is no external output statement before

‘Top-of-page’ event, then this event will not

work.

Once the cursor reaches the last line of the

page, automatically this event will be triggered.

Report Zxxx line-count 25(3).

In this case line numbers 23, 24 and 25 are

reserved for footer.

Once the cursor reaches 23rd line, this event

will be triggered.

End-of-page.

Write:/ sy-uline(75).

Write:/ ‘This is end of page:’,sy-pagno.

Write:/ sy-uline(75).

This event is used for concluding part of List.

End-of-selection.

Write:/ ‘This is end of the Report’.

Interactive Report

A simple report or even a classical report displays a clustered list with all the requested output at one go.

What ever it is displayed, it is final. That means, the user can not interact with with that list.

A simple report or even a classical report displays a clustered list with all the requested output at one go.

What ever it is displayed, it is final. That means, the user can not interact with with that list.

In the interactive reports, we can create as many as 21 lists.

The first list is called ‘Basic list’ and all the successive lists are called ‘Secondary lists’. Each list is again an interactive.

The Basic list is not deleted when secondary list is created.

A secondary list may either overlay the basic list or appear in an additional dialog window on the same screen.

The system variable associated with list number is ‘SY-LSIND’.

For basic list SY-LSIND = 0 and for secondary lists, SY-LSIND varies from 1 to 20.

User can interact with the list by the following ways.

Double clicking or single click and pressing F2 (function key) or single click with ‘hotspot on’.

OR

Selecting from menu bar or from application tool bar.

All the events used in classical reports can be used in Basic List.

The event ‘End-of-page’ can be used in Secondary Lists also.(the other six events can not be used in secondary lists)

You can not place ‘select-options’ in secondary lists.

The following additional events are

applicable to secondary lists.

Top-of-page during line-selection.

At line-selection.

At user-command.

When you double click on any field in the basic list, you will be navigating to secondary list with detailed information pertaining to clicked field.

As such we need to store the clicked field information at some variable.

‘Hide’ temporarily stores the content of clicked field for later use.

The default title of the out put is the text what we enter during creation of program.

This title can be changed using:

SET TITLEBAR ‘AAA’.

GUI status includes:

Menu bar

Application tool bar and

Activating standard tool bar

GUI status can be created using

SET PF-STATUS ‘BBB’.

You can have 8 menus ( out of which, 2 menus are reserved for ‘System’ and ‘Help’).

Each menu can have 15 menu items.

Each menu item can have 3 levels of submenus.

You can create 35 items in application tool bar.

Thanks & regards

Sreenivasulu P

Read only

Former Member
0 Likes
1,573

Hi,

1. For the first question refer the links :

http://www.sapdevelopment.co.uk/dialog/dialoghome.htm

http://help.sap.com/saphelp_webas630/helpdata/en/9f/db9cdc35c111d1829f0000e829fbfe/content.htm

http://www.sap-img.com/

http://help.sap.com/saphelp_46c/helpdata/en/08/bef2dadb5311d1ad10080009b0fb56/content.htm

http://www.sapgenie.com/links/abap.htm

http://help.sap.com/saphelp_nw04/helpdata/en/c9/5472fc787f11d194c90000e8353423/frameset.htm

http://www.sapdevelopment.co.uk/dialog/dialoghome.htm

http://help.sap.com

http://www.sapgenie.com/abap/example_code.htm

http://help.sap.com/saphelp_47x200/helpdata/en/52/670ba2439b11d1896f0000e8322d00/frameset.htm

http://www.allsaplinks.com/dialog_programming.html

http://www.sapbrain.com/TUTORIALS/default.html

http://www.sappoint.com/abap/spmp.pdf

2. For the second question refer this.

REPORT ZDSAP . 

DATA: d_ref TYPE REF TO data, 
d_ref2 TYPE REF TO data , 
i_alv_cat TYPE TABLE OF lvc_s_fcat, 
ls_alv_cat LIKE LINE OF i_alv_cat. 


TYPES tabname LIKE dcobjdef-name . 
parameter: p_tablen type tabname. 

data: begin of itab occurs 0. 
INCLUDE STRUCTURE dntab. 
data: end of itab. 


FIELD-SYMBOLS : <F_FS> TYPE table, 
<F_FS1> TYPE TABLE, 
<F_FS2> TYPE ANY, 
<F_FS3> TYPE TABLE. 

REFRESH itab. 
CALL FUNCTION 'NAMETAB_GET' 
EXPORTING 
langu = sy-langu 
tabname = p_tablen 
TABLES 
nametab = itab 

EXCEPTIONS 
no_texts_found = 1. 
LOOP AT itab . 
ls_alv_cat-fieldname = itab-fieldname. 
ls_alv_cat-ref_table = p_tablen. 
ls_alv_cat-ref_field = itab-fieldname. 
APPEND ls_alv_cat TO i_alv_cat. 
ENDLOOP. 
* internal table build 
CALL METHOD cl_alv_table_create=>create_dynamic_table 
EXPORTING it_fieldcatalog = i_alv_cat 
IMPORTING ep_table = d_ref . 
ASSIGN d_ref->* TO <F_FS>. 

SELECT * FROM (p_tablen) INTO CORRESPONDING FIELDS OF TABLE <F_FS>. 


LOOP AT <F_FS> ASSIGNING <F_FS2>. 
*your code goes here. 
ENDLOOP.

<b>Reward points if it helps.</b>

Read only

rahulkavuri
Active Contributor
0 Likes
1,573

1. Validation indialog programming shud be define in the PBO of the second screen

2. Internal tables at runtime can be created using Dynamic Internal Tables

3. Yes it will trigger

1. PROCESS BEFORE OUTPUT.

  • MODULE STATUS_0100.

*

MODULE GET_DATA.

FORM VALIDATION.

IF S_LIFNR IS NOT INITIAL.

SELECT SINGLE LIFNR FROM LFA1 INTO IT_LFA1 WHERE LIFNR IN S_LIFNR.

IF SY-SUBRC <> 0.

MESSAGE I000 WITH 'THIS IS NOT A VALID VENDOR NUMBER'.

STOP.

ELSE.

IF S_BUKRS IS NOT INITIAL.

SELECT SINGLE BUKRS FROM LFB1 INTO IT_LFB1-BUKRS WHERE BUKRS IN

S_BUKRS.

IF SY-SUBRC <> 0.

MESSAGE I000 WITH 'THIS IS NOT A VALID COMPANY CODE'.

STOP.

ENDIF.

ENDIF.

ENDIF.

ENDIF.

CLEAR IT_LFA1.

CLEAR IT_LFB1.

ENDFORM.

3.END-OF-SELECTION.

PERFORM DISPLAY_DETAILS.

TOP-OF-PAGE.

WRITE:/ 'check the value'.

Read only

Former Member
0 Likes
1,573

Hi,

check these demo's for validations...

<b>demo_dynpro_at_exit_command

demo_dynpro_on_condition

demo_dynpro_automatic_checks

demo_dynpro_value_select

demo_dynpro_field_chain</b>

2. create the fieldcat using fm LVC_FIELDCATALOG_MERGE, and then pass the fieldcat to this method to create the dynamic table.

CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
EXPORTING
IT_FIELDCATALOG = T_FIELDCAT1
IMPORTING
EP_TABLE = R_DYN_TABLE
EXCEPTIONS
GENERATE_SUBPOOL_DIR_FULL = 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.

3. yes it will trigger.

Regards

vijay

Read only

Former Member
0 Likes
1,573

Helpful answers from all, thanks to all