How to call methods at selection screen?
Hi all,
I am developing a program in object oriented abap.
i have defined a class and implementated, and we have to instantiate the class in start of selection.
now the problem is how to call a method at selection screen event.
i want to validate the inputs entered by users. so can i create a static method which can be called without instantiating a class?
please guide me
thanks
Hello Mr A,
Define the method as a Static Method and that will solve your problem. Static methods can be called directly and does not need the class to be instantiated before it can be called.
Data: my_class type ref to zcl_report_utilities.
At Selection-Screen.
Call Method zcl_report_utilities=>check_selections
exporting
iv_repnm = sy-cprog
importing
et_messages = lt_msgs.
Start-Of-Selection.
Create Object my_class
exporting
im_pernr = ls_e1plogi-objid
im_begda = c_lowdate
im_endda = c_hidate.
Call Method my_class->read_infotypes
exporting
im_infty = c_org_assn
changing
et_infty = it_infty.
Here you can see how the method check_selections is called before the class zcl_report_utilities is instantiated. The best part about the Static Methods is if you are writing the class in the Class Library (SE24), any other programs can call them directly (if they need to) without needing to instantiating the entire class before the call.
Also note the difference in syntax when calling the static method check_selections to when calling the Instance method read_infotypes.
Hope this solves your issue and please do not forget to reward points.
Cheers,
Sougata.
p.s. if you are defining your class locally (program specific) then use Class-Methods to define a static method.
Edited by: Sougata Chatterjee on May 1, 2008 9:53 AM
Similar Messages
-
How to run the variable exit without calling the variable selection screen?
Hi all
I have a query with 2 variables 0P_PRQUA (Previous Calendar Quarter (SAP Exit)) and ZCCDAT02.
ZCCDAT02 is a Key Date variable that is derived based on the last day of the quarter that is entered in 0P_PRQUA. The exit code works correctly when calling up the variable screen and ZCCDAT02 is derived properly.
The problem is that 0P_PRQUA is set to "Can be changed in query navigation". So if the user changes the value of the quarter the exit is not triggered and the value of ZCCDAT02 does not change.
Is it possible to trigger the exit or is there another way to do it? Ideas would be appreciated. I am trying to create a Web Template with a Dropbox box for the Quarter.
Query is written in BW 3.X.
Regards
ChamiHi guys
Just to restate the requirement. I want the user to be able to change the value of the variable, WITHOUT calling the variable selection screen.
I want the user to be able to change the value of the quarter by using a dropdown box from within the web template. Once that is selected I want the value of ZCCDAT02 to be derived from the new value of the quarter.
Regards
Chami -
How i can show the selection screen input field in the top of page in alv
hi ,
how i can show the selection screen input field in the top of page in alv grid output.
tell me the processHi,
excample from my program:
FORM topof_page.
DATA: l_it_header TYPE TABLE OF slis_listheader WITH HEADER LINE,
l_info LIKE l_it_header-info.
DATA: l_it_textpool TYPE TABLE OF textpool WITH HEADER LINE.
DATA: l_key LIKE l_it_textpool-key.
READ TEXTPOOL c_repid INTO l_it_textpool LANGUAGE sy-langu.
DEFINE m_selinfo.
if not &1 is initial.
clear l_it_header.
l_it_header-typ = 'S'.
l_key = '&1'.
translate l_key to upper case.
read table l_it_textpool with key key = l_key.
if sy-subrc = 0.
shift l_it_textpool-entry left deleting leading space.
l_it_header-key = l_it_textpool-entry .
endif.
loop at &1.
case &1-option.
when 'EQ'
or 'BT'
or 'CP'.
write &1-low to l_it_header-info.
when others.
write &1-low to l_it_header-info.
concatenate &1-option
l_it_header-info
into l_it_header-info
separated by space.
endcase.
if not &1-high is initial.
write &1-high to l_info left-justified.
concatenate l_it_header-info
l_info
into l_it_header-info
separated by space.
endif.
if &1-sign = 'E'.
concatenate ']'
l_it_header-info
into l_it_header-info.
endif.
append l_it_header.
clear: l_it_header-key,
l_it_header-info.
endloop.
endif.
END-OF-DEFINITION.
m_selinfo: s_trmdat,
s_trmext,
s_trmint,
s_fkdat,
s_delno,
s_vbeln,
s_deact,
s_kdmat.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = l_it_header[].
ENDFORM.
I hope, this will help you.
Regards
Nicole -
How to can we do selection-screen modification for LDB?
Hi All,
I have custom field in my selection-screen of LDB PNP.
Can you people please let me know how can I put the selection-screen modificaiton For ex:
i have created
parameters a as checbox.
select-options: p_btrtl for p0001-btrtl no-intervals.
now If the check box is selected then p_btrtl we can enter values or esle If check box is not selected then p_btrtl will be grayed out, ( I.e. SCREEN-INPUT = 0)
This is simple from ABAP without LDB. But with LDB can we achieve?????????????
Satish
Edited by: Satish Vasireddy on Jun 23, 2010 4:05 PMyou can use the following logic for the additional selection validation. I have done by using PNP LDB. Ex : I have done for one of the field in IT0377.
SELECT-OPTIONS: s_bplan FOR p0377-bplan.
*& Form check_selection_0377
This subroutine is used to check the selection screen
FORM check_selection_0377.
LOOP AT p0377 WHERE pltyp IN s_bplan
AND levl1 IN s_lti
AND begda LE pn-endda
AND endda GE pn-begda.
CALL FUNCTION 'HR_CHECK_AUTHORITY_INFTY'
EXPORTING
tclas = 'A'
pernr = pernr-pernr
infty = p0377-infty
subty = p0377-subty
begda = pn-begda
endda = pn-endda
level = 'R'
EXCEPTIONS
no_authorization = 1
internal_error = 2
OTHERS = 3.
IF NOT sy-subrc IS INITIAL.
DELETE p0377.
ENDIF.
ENDLOOP.
selection not found and no value selected
IF sy-subrc NE 0.
READ TABLE s_bplan.
IF sy-subrc EQ 0.
REJECT.
ENDIF.
READ TABLE s_lti.
IF sy-subrc EQ 0.
REJECT.
ENDIF.
ENDIF.
ENDFORM. " check_selection_0377
Regards,
Preetham -
How do I add a selection screen parameter to get a application server file
Hi All..
Can you please suggest how can we add a selection screen parameter to get a application server file ?
Thanx in Advance...
Regards,
Deepak<b>Parameter def :</b>
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 02(30) text-005 FOR FIELD p_xlfil.
PARAMETERS: p_xlfil LIKE rlgrap-filename OBLIGATORY.
SELECTION-SCREEN END OF LINE.
<b>Browse</b>
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_xlfil.
PERFORM ws_get_filename USING p_xlfil.
FORM ws_get_filename USING p_xlfil.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
def_path = 'C:'
mask = ',Excel,*.xls,All,*.*.'(100)
mode = 'O'
title = 'Title'(101)
IMPORTING
filename = p_xlfil
EXCEPTIONS
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
OTHERS = 5.
IF sy-subrc NE 0.
CLEAR p_xlfil.
ENDIF.
ENDFORM. " WS_GET_FILENAME
Regards
<b>Oops i did not read "application server"</b>
Use FM F4_FILENAME_SERVER and not F4_FILENAME/WS_GET_FILENAME.
Message was edited by:
Raymond Giuseppi -
How to define our own selection screen for logical database in abap-hr?
Hi Friends,
Can u please help me
How to define your own selection screens for logical database.
we use to do like(goto->attributes-HRReportcatagerious ).but How to desin using customer table like t599c, t599f and how to add to my logical database?
Thanks in advance
charancheck out this online help
http://help.sap.com/saphelp_erp2004/helpdata/en/9f/dba65c35c111d1829f0000e829fbfe/frameset.htm
Regards
Raja -
How to create a variant selection screen
Hi experts,
Can you tell me " How to create a variant selection screen ".
Please it's urgent.........
Thanks
BasuHi ,
Goto your selection screen
Make entries in the fileds od the selection screen
press save button, it will ask you for the mane of the Variant
Give the name of the Variant and save it
Variant is now created for the selection screen.
Reward if useful.
Regards,
Shilpi -
How to create a new selection screen IN LOGICAL DATABASE PNPCE
how to create a new selection screen LDBS PNPCE
Hello Ankit,
Do you want to create a new selection screen in LDB PNPCE, or do you want to create a new selection screen in one of your reports using LDB PNPCE?
For later (which is more common), you can use HR Report Category.
Hope this helps.
Best Regards,
Biraju Rajyaguru -
How to Call Methods in Ecatt?
Hello Gurus,
I dont find CALLMETHOD or CALLSTATIC commands in Ecatt. I am using R/3 4.7 version of SAP.
My question also is how to call methods. I have a scenario where my test script execution depends on the return type of method. Say if the return type of method is A only then I should run the script else the script should not be executed.
Your help in this regard is highly appreciated.
Regards,
GS.>
Get Started wrote:
> Hello Gurus,
>
> I dont find CALLMETHOD or CALLSTATIC commands in Ecatt. I am using R/3 4.7 version of SAP.
>
> My question also is how to call methods. I have a scenario where my test script execution depends on the return type of method. Say if the return type of method is A only then I should run the script else the script should not be executed.
>
> Your help in this regard is highly appreciated.
>
> Regards,
> GS.
Hi GS,
Please use the command "CallMethod" and it is available with latest SAP version.
You have to provide the Object Instance Parameter and Instance Method.
Regards,
SSN. -
How can i declare a selection screen in a DP program with transaction code.
hi friends,
How can i declare a selection screen in a DP program with transaction code. What are the events and flow logic..Search in SCN/Google for Module-pool programming basics.
-
How to create a new selection screen LDBS PNPCE
how to create a new selection screen LDBS PNPCE
Hello Ankit,
Do you want to create a new selection screen in LDB PNPCE, or do you want to create a new selection screen in one of your reports using LDB PNPCE?
For later (which is more common), you can use HR Report Category.
Hope this helps.
Best Regards,
Biraju Rajyaguru -
How to make Label in selection screen?
Hi friends.. can anybody explain how to make labels in selection screens and how to split the selection screen vertically? plz.. Thanks in advance
Arun kumar,
Check this program. you can put labels like this.
REPORT ZVENKAT_TEST1.
SELECTION-SCREEN BEGIN OF BLOCK block.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(15) text1.
SELECTION-SCREEN POSITION 17.
PARAMETERS :p_pernr type pa0001-pernr.
SELECTION-SCREEN POSITION 26.
SELECTION-SCREEN COMMENT 27(30) text2.
SELECTION-SCREEN end OF LINE.
SELECTION-SCREEN end OF BLOCK block .
at SELECTION-SCREEN OUTPUT.
text1 = 'Personal number'.
SELECT SINGLE ename FROM pa0001 INTO text2 WHERE pernr = p_pernr.
Regards,
Venkat.O -
How to restrict user at selection screen while executing in background mode
hi all,
how to restrict user at selection screen while executing in background mode
Regards
DeepakHi,
We can get the Program whether this is running in background or not then we need to use SY-BATCH, if the SY-BATCH is set to X then the program is running in Background,
so in the INITIALIZATION event, you can use this SY-BATCH and check the User names, and give the error messsage which you want to restrict
Regards
Sudheer -
How to show message on selection screen status bar if alv is empty.
Hi,
Can anyone tell me how to show message on selection screen status bar when our final internal table or alv is empty .
i am getting message on alv status bar, where no data is in alv but i want to stop it to selection screen and show message there only.
Regards,
RanuHi,
After populating the final internal table do this check,
if it_final [] is initial.
message 'No data available' TYPE 'S' DISPLAY LIKE 'E'.
exit.
endif.
This will be displayed in the selection screen itself
Regards,
Vikranth -
How to call method of Component A in Component B
Hi Friends,
I want to use Method A of Component A in Component B. Can some one tell me how to call method A on action of a button in component B.
Regards
SankarHi,
DATA lo_cmp_usage TYPE REF TO if_wd_component_usage.
lo_cmp_usage = wd_this->wd_cpuse_method( ).
IF lo_cmp_usage->has_active_component( ) IS INITIAL.
lo_cmp_usage->create_component( ).
ENDIF.
DATA lo_interfacecontroller TYPE REF TO yiwci_sg_method .
lo_interfacecontroller = wd_this->wd_cpifc_method( ).
lo_interfacecontroller->execute_method(
i was able to do the above process successfully but how to bind data to the node of component 2.
In the component 1 : method A i defiend to get records upto 25 rows. now i tried using same method . but how to bind data using this method
Regards
sankar
Maybe you are looking for
-
Materialized view in Oracle 9i/10g SE?
Hi All, Can we define MV's in standard edition of oracle9i & 10g database? If yes, are there any limitations on creation of MV's in Standard edition compare to Enterprise edition like Query rewrite, creation of log tables etc? As per link : http://ww
-
Restoring Windows XP on Qosmio G20
Hi all, I have problems with my Qosmio running slow and I suspect some virus or Trojan. So I have decided to restore my system but my surprise is that I cannot find a cd of windows restoration. Is that possible? I only have a CD that says QosmioPlaye
-
hi i have put all setter methods .what is happening. i am using a jsp which is wokring fine while inputting values.i am displaying same jsp for secondtime by putting all input fields disabled where commandbuton not working.pl help shilpa
-
HOW CAN I RESET THE PASSCODE ON IPOD?
-
Sales order and billling document link
Is there any standard T-code which shows the Billing document number and the corresponding Sales order no?