2012 Jan 24 8:07 AM
Hi UI-Experts,
I'm kind of new to the "old" dynpro programming and am triing to create a UI dynamically. My UI consists of several Containers which are encapsulated in each other (using splitting containers aso). Within one of these containers, I need an Input Field and a PushButton. Unfortunately I can't find any suitable subclasses of CL_GUI_CONTROL. It seems, that creation of simple UI Controls is not possible within ABAP dynpro - and I guess I'm wrong here - so I decided to create several Subscreens and load them dynamically instead. Unfortunately, I can't find any answer on how to load a Subscreen into a gui container which is created at runtime. Can anyone help me on this?
Thanks a lot for your help,
Max
2012 Jan 27 9:13 AM
try this it will help u to create dynamic input
REPORT ZSAMPLE_DYNAMIC_INPUT.
Data : lv_date like sy-datum.
Lv_date = sy-datum.
Write : / lv_date.
PARAMETERS dbtab TYPE tabname DEFAULT 'SPFLI'.
TYPE-POOLS rsds.
DATA tadir_wa TYPE tadir.
DATA selid TYPE rsdynsel-selid.
DATA field_tab TYPE TABLE OF rsdsfields.
DATA table_tab TYPE TABLE OF rsdstabs.
DATA table LIKE LINE OF table_tab.
DATA cond_tab TYPE rsds_twhere.
DATA cond LIKE LINE OF cond_tab.
DATA dref TYPE REF TO data.
DATA alv TYPE REF TO cl_salv_table.
FIELD-SYMBOLS <table> TYPE STANDARD TABLE.
SELECT SINGLE *
FROM tadir
INTO tadir_wa
WHERE pgmid = 'R3TR' AND
object = 'TABL' AND
obj_name = dbtab.
IF sy-subrc <> 0.
MESSAGE 'Database not found' TYPE 'I' DISPLAY LIKE 'E'.
LEAVE PROGRAM.
ENDIF.
table-prim_tab = dbtab.
APPEND table TO table_tab.
CALL FUNCTION 'FREE_SELECTIONS_INIT'
EXPORTING
kind = 'T'
IMPORTING
selection_id = selid
TABLES
tables_tab = table_tab
EXCEPTIONS
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE 'Error in initialization' TYPE 'I' DISPLAY LIKE 'E'.
LEAVE PROGRAM.
ENDIF.
CALL FUNCTION 'FREE_SELECTIONS_DIALOG'
EXPORTING
selection_id = selid
title = 'Free Selection'
as_window = ' '
IMPORTING
where_clauses = cond_tab
TABLES
fields_tab = field_tab
EXCEPTIONS
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE 'No free selection created' TYPE 'I'.
LEAVE PROGRAM.
ENDIF.
READ TABLE cond_tab WITH KEY tablename = dbtab INTO cond.
IF sy-subrc <> 0.
MESSAGE 'Error in condition' TYPE 'I' DISPLAY LIKE 'E'.
LEAVE PROGRAM.
ENDIF.
CREATE DATA dref TYPE TABLE OF (dbtab).
ASSIGN dref->* TO <table>.
TRY.
SELECT *
FROM (dbtab)
INTO TABLE <table>
WHERE (cond-where_tab).
CATCH cx_sy_dynamic_osql_error.
MESSAGE 'Error in dynamic Open SQL' TYPE 'I' DISPLAY LIKE 'E'.
LEAVE PROGRAM.
ENDTRY.
TRY.
cl_salv_table=>factory(
IMPORTING r_salv_table = alv
CHANGING t_table = <table> ).
alv->display( ).
CATCH cx_salv_msg.
MESSAGE 'Error in ALV display' TYPE 'I' DISPLAY LIKE 'E'.
ENDTRY.
2012 Jan 27 9:39 AM