2005 Jun 30 3:51 PM
Hello,
in my program I've got a string variable <b>a</b> that either holds the name of a class or of a function module. Besides there is a variable <b>b</b> that tells me whether <b>a</b> is the name of a class or a function module.
Now I would like to open a new sapgui window that either shows the class named by <b>a</b> in the class builder or the function module namend by <b>a</b> in the function builder depending on the value of <b>b</b>.
I experimented with sap's cl_wb_startup and cl_wb_request but calling the start method of cl_wb_startup gives an error stating that I've got no permission to access transaction wb_new_window.
Question is now if there is another way to open the desired sapgui window or if my experiments went into the right direction but I need to get the required transaction permission.
Thanks in advance and best ergards,
Patrick Baer
2005 Jun 30 4:19 PM
Definitely not the best way, but a solution none the less.
report zrich_0003 .
data: bdcdata like bdcdata occurs 0 with header line.
data: messtab like bdcmsgcoll occurs 0 with header line.
parameters: p_fmname(50) type c,
p_clname(50) type c.
start-of-selection.
perform call_transaction.
************************************************************************
* Form CALL_TRANSACTION.
************************************************************************
form call_transaction..
data: session_name(30) type c.
data: tcode type sy-tcode.
clear bdcdata. refresh bdcdata.
clear messtab. refresh messtab.
clear: session_name.
concatenate sy-uname sy-datum sy-uzeit into session_name.
if p_fmname <> space.
tcode = 'SE37'.
perform bdc_dynpro using 'SAPMS38L' '1009'.
perform bdc_field using 'BDC_CURSOR'
'RS38L-NAME'.
perform bdc_field using 'BDC_OKCODE'
'=SHOW'.
perform bdc_field using 'RS38L-NAME'
p_fmname.
elseif p_clname <> space.
tcode = 'SE24'.
perform bdc_dynpro using 'SAPLSEOD' '1000'.
perform bdc_field using 'BDC_CURSOR'
'SEOCLASS-CLSNAME'.
perform bdc_field using 'BDC_OKCODE'
'=CIDI'.
perform bdc_field using 'SEOCLASS-CLSNAME'
p_clname.
endif.
* Call the transaction in another session
call function 'ABAP4_CALL_TRANSACTION'
starting new task session_name
destination 'NONE'
exporting
tcode = tcode
mode_val = 'E'
update_val = 'S'
tables
using_tab = bdcdata
mess_tab = messtab
exceptions
call_transaction_denied = 1
tcode_invalid = 2
others = 3.
endform.
*----------------------------------------------------------------------*
* Start new screen *
*----------------------------------------------------------------------*
form bdc_dynpro using program dynpro.
clear bdcdata.
bdcdata-program = program.
bdcdata-dynpro = dynpro.
bdcdata-dynbegin = 'X'.
append bdcdata.
endform.
*----------------------------------------------------------------------*
* Insert field *
*----------------------------------------------------------------------*
form bdc_field using fnam fval.
clear bdcdata.
bdcdata-fnam = fnam.
bdcdata-fval = fval.
append bdcdata.
endform.
Regards,
Rich Heilman
2005 Jul 01 8:13 AM
Thanks Rich !
Definitely a solution. I would still like to try and find a more elegant solution.
Any other suggestions ?
Regards,
Patrick
2005 Jul 01 1:29 PM
Here is another way, but user will have to hit the display button to go in the fm/class.
report zrich_0001 .
parameters: p_fmname(50) type c,
p_clname(50) type c.
start-of-selection.
perform call_transaction.
************************************************************************
* Form CALL_TRANSACTION.
************************************************************************
form call_transaction..
data: session_name(30) type c.
data: tcode type sy-tcode.
data: parms type table of rfc_spagpa with header line.
clear: session_name.
concatenate sy-uname sy-datum sy-uzeit into session_name.
if p_fmname <> space.
tcode = 'SE37'.
parms-parid = 'LIB'.
parms-parval = p_fmname.
append parms.
elseif p_clname <> space.
tcode = 'SE24'.
parms-parid = 'CLASS'.
parms-parval = p_clname.
append parms.
endif.
* Call the transaction in another session
call function 'ABAP4_CALL_TRANSACTION'
starting new task session_name
destination 'NONE'
exporting
tcode = tcode
skip_screen = 'X'
tables
spagpa_tab = parms
exceptions
call_transaction_denied = 1
tcode_invalid = 2
others = 3.
endform.
Regards,
Rich Heilman
2005 Jul 01 1:43 PM
Hi Rich,
thanks again, this one already looks more streamlined than the first version.
I am currently working on another solution:
the function module WB_REQUEST_NEW_WINDOW does the job already but I encounter a really strange behaviour:
The function builder or class builder (depending on which kind of object I want do display) is correctly opened and in the title bar I can see that the correct object is shown.
The strange thing is: below the SAPGUI menu button bar where the main screen of the function builder / class builder should display, I see an alv grid that I display somewhere else in my application I have not the slightest idea where this comes from !!
Trying to solve this issue nevertheless and will call back if I succeed.
Regards,
Patrick