cancel
Showing results for 
Search instead for 
Did you mean: 

Hi, I would Like to print the data on "At Selection Screen". Is it possible?

Please find below my code and suggest some alternate methods. Just I want to get the data from User via Parameter field and print the data on same screen when user clicking the push button. this needs to repeat as user pressed the push button.

The loop which i used in start of selection also needs to be printed on same screen.(Below that push button).

tables SSCRFIELDS.
types: begin of OWN_TAB,
NUMBER type I,
end of OWN_TAB.
data: INT_TAB type table of OWN_TAB,
WA type OWN_TAB.
data com type c value','.
selection-screen begin of block B2 with frame title TEXT-004.
parameters: GETVALUE type char20.
selection-screen end of block B2.
selection-screen begin of block B1 with frame title TEXT-001.
selection-screen pushbutton 33(15) TEXT-002 user-command CLI1.
selection-screen end of block B1.
parameters P_DISP type CHAR20.

at selection-screen.
case SSCRFIELDS-UCOMM.
when 'CLI1'.
if getvalue is initial.
message w009(ZOO_MSG).
else.
WA-NUMBER = GETVALUE.
append WA to INT_TAB.
clear GETVALUE.
ENDIF.
endcase.

start-of-selection.
sort INT_TAB ascending by NUMBER.
loop at INT_TAB into WA.
write:/ WA-NUMBER.
endloop.

Thanks!

Krishna.

View Entire Topic
0 Kudos

Hi Sandra,

I tried Docking container. it is printing the internal table on same selection screen. can we print the same on using push button on same screen ?

if yes, please suggest. Below is my code.

tables: VBAK, VBAP,sscrfields.
CLASS lcl_report DEFINITION.
*
PUBLIC SECTION.
types: begin of VBAKO,
VBELN type VBAK-VBELN,
ERNAM type VBAK-ERNAM,
VKORG type VBAK-VKORG,
VTWEG type VBAK-VTWEG,
SPART type VBAK-SPART,
MATNR type VBAP-MATNR,
end of VBAKO.

data: INTTAB1 type table of VBAKO, WA1 type VBAKO.
DATA: t_data TYPE STANDARD TABLE OF VBAKO, " Output dat
r_carrid TYPE RANGE OF VBAK-VBELN. " Select Option

METHODS:
get_data,
*
generate_output.

ENDCLASS.


DATA: lo_report TYPE REF TO lcl_report.

selection-screen begin of block B1 with frame title TEXT-001.

selection-screen pushbutton 33(15) TEXT-002 user-command CLI.

parameters : S1 radiobutton group G1 default 'X' user-command CMD,
R1 radiobutton group G1,
R2 radiobutton group G1.
select-options: MATNR for VBAK-VBELN modif id AA,
S_ERDAT for VBAK-ERDAT modif id AA,
VBELN for VBAP-VBELN modif id BB,
MATNO for VBAP-MATNR modif id BB.
parameters: S_ERNAM type VBAK-ERNAM modif id CC matchcode object
ZOO_CREATOR,
S_VKORG type VBAK-VKORG modif id AA,
S_SPART type VBAK-SPART modif id AA,
S_VTWEG type VBAK-VTWEG modif id AA,
S_WERKS type VBAP-MATNR modif id BB.

selection-screen end of block B1.
INITIALIZATION.
CREATE OBJECT lo_report.
* generate output
lo_report->generate_output( ).

START-OF-SELECTION.
* Get data

lo_report->r_carrid = MATNR[].
lo_report->get_data( ).


CLASS lcl_report IMPLEMENTATION.
*
METHOD get_data.
select vbak~vbeln vbak~ernam vbak~vkorg vbak~vtweg vbak~spart
vbap~matnr from vbak inner join vbap
on ( vbak~vbeln = vbap~vbeln )
into CORRESPONDING FIELDS OF table me->t_data where vbak~vbeln in
matnr .
* and
* vbak~erdat in s_erdat and vbap~vbeln in vbeln.
EXPORT data = me->t_data TO MEMORY ID sy-cprog.
*
ENDMETHOD.

METHOD generate_output.
*
* local data
DATA: lo_dock TYPE REF TO cl_gui_docking_container,
lo_cont TYPE REF TO cl_gui_container,
lo_alv TYPE REF TO cl_salv_table.
*
* import output table from the memory and free afterwards
IMPORT data = me->t_data FROM MEMORY ID sy-cprog.
FREE MEMORY ID sy-cprog.
*
* Only if there is some data
CHECK me->t_data IS NOT INITIAL.
*
* Create a docking control at bottom
CHECK lo_dock IS INITIAL.
CREATE OBJECT lo_dock
EXPORTING
repid = sy-cprog
dynnr = sy-dynnr
ratio = 80
side = cl_gui_docking_container=>dock_at_bottom
name = 'DOCK_CONT'.
IF sy-subrc <> 0.
MESSAGE 'Error in the Docking control' TYPE 'S'.
ENDIF.
*
* Create a SALV for output
CHECK lo_alv IS INITIAL.
TRY.
* Narrow Casting: To initialize custom container from
* docking container
lo_cont ?= lo_dock.

* SALV Table Display on the Docking container
CALL METHOD cl_salv_table=>factory
EXPORTING
list_display = if_salv_c_bool_sap=>false
r_container = lo_cont
container_name = 'DOCK_CONT'
IMPORTING
r_salv_table = lo_alv
CHANGING
t_table = me->t_data.
CATCH cx_salv_msg .
ENDTRY.
*
* Pf status
DATA: lo_functions TYPE REF TO cl_salv_functions_list.
lo_functions = lo_alv->get_functions( ).
lo_functions->set_default( abap_true ).
*
* output display
lo_alv->display( ).
*
ENDMETHOD. "generate_output
*

ENDCLASS.

Sandra_Rossi
Active Contributor
0 Kudos

If you want to remain on the selection screen, why did you use START-OF-SELECTION ? I thought you had understood that you must do it inside AT SELECTION-SCREEN ?

You must instantiate the controls once (better in AT SELECTION-SCREEN OUTPUT, instead of INITIALIZATION).

After the button is pressed, simply use lo_alv->refresh( ) to reload the ALV with the content of the internal table.

0 Kudos

Thanks for letting me know. I tried as you suggested, but its showing run time error. Could you please insert your code to above program.

Thanks!

Sandra_Rossi
Active Contributor
0 Kudos

If you have a short dump, then you must first read what it says, read the ABAP documentation, and search the forum for answers. If you don't find anything, then you must explain what you tried, and attach the whole short dump.

If you want assistance, please provide your attempt with code inside your AT SELECTION-SCREEN OUTPUT.