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

at line

Former Member
0 Likes
723

Hi,

can we select multiple records at a time and do some operations bsed on them (just like at selection screen event) .If it is si what is the exact procedure for that.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
686

you can make an ALV report and add check box. Then you can use call back function to program your code

Hi,

can we select multiple records at a time and do some operations bsed on them (just like at selection screen event) .If it is si what is the exact procedure for that.

4 REPLIES 4
Read only

Former Member
0 Likes
687

you can make an ALV report and add check box. Then you can use call back function to program your code

Read only

Former Member
0 Likes
686

hi sandeep

you want for alv control....

if yes then just

1) define SEL (without any data type in your output table) .

2) While preparing layout option update work area with below lines of code .

wa_LAYOUT-box_fieldname = 'SEL'.

3) For reading from output table :-

read TABLE i_output INTO wa_output with key SEL = 'X' .

it will work.

Reward points.

Regards,

Pranav

Read only

prasanth_kasturi
Active Contributor
0 Likes
686

hi

you can do using check boxes,

you can display these on next screen

below is the code

create a gui status with one button with fct code DISPLAY and enable the back button when usin the below code.

REPORT zp_interactive3 NO STANDARD PAGE HEADING LINE-COUNT 45(5) LINE-SIZE 180.

TABLES : kna1.

TYPES : BEGIN OF ty_kna1,

kunnr LIKE kna1-kunnr,

name1 LIKE kna1-name1,

land1 LIKE kna1-land1,

checkbox TYPE checkbox,

END OF ty_kna1.

TYPES : BEGIN OF ty1_kna1,

kunnr LIKE kna1-kunnr,

name1 LIKE kna1-name1,

land1 LIKE kna1-land1,

END OF ty1_kna1.

DATA : it_kna1 TYPE TABLE OF ty_kna1,

wa_kna1 TYPE ty_kna1,

it1_kna1 TYPE TABLE OF ty1_kna1,

wa1_kna1 TYPE ty1_kna1.

DATA : v_lin TYPE i,

v_sel TYPE sy-lisel,

v_kunnr LIKE kna1-kunnr.

SELECT-OPTIONS : s_kunnr FOR kna1-kunnr DEFAULT 1000 TO 1002.

START-OF-SELECTION.

SET PF-STATUS 'STATUS'.

SELECT kunnr name1 land1

FROM kna1

INTO CORRESPONDING FIELDS OF TABLE it_kna1

WHERE kunnr IN s_kunnr.

LOOP AT it_kna1 INTO wa_kna1.

WRITE :/01 sy-vline,

5 wa_kna1-kunnr,

18 sy-vline,

20 wa_kna1-name1,

46 sy-vline,

50 wa_kna1-land1,

55 sy-vline,

58 wa_kna1-checkbox AS CHECKBOX,

63 sy-vline.

HIDE wa_kna1.

ENDLOOP.

WRITE :/1(63) sy-uline.

AT USER-COMMAND.

CASE sy-ucomm.

WHEN 'DISPLAY'.

LOOP AT it_kna1 INTO wa_kna1.

refresh it1_kna1.

V_LIN = SY-TABIX + 3.

READ LINE V_LIN line VALUE INTO V_SEL.

IF V_SEL+57(1) = 'X'.

wa1_kna1-kunnr = V_SEL+4(10).

wa1_kna1-name1 = V_SEL+19(35).

wa1_kna1-land1 = v_sel+49(3).

APPEND wa1_kna1 to it1_kna1.

CLEAR wa1_kna1.

LOOP AT it1_kna1 into wa1_kna1.

WRITE :/01 sy-vline,

5 wa1_kna1-kunnr,

18 sy-vline,

20 wa1_kna1-name1,

46 sy-vline,

50 wa1_kna1-land1,

55 sy-vline.

WRITE :/1(55) sy-uline.

ENDLOOP.

ENDIF.

ENDLOOP.

ENDCASE.

TOP-OF-PAGE.

WRITE :/1(63) sy-uline.

WRITE :/01 sy-vline,

02 'CUSTOMER NUM',

18 sy-vline,

24 'NAME',

46 sy-vline,

47 'COUNTRY',

55 sy-vline,

56 'CHOOSE',

63 sy-vline.

WRITE :/1(63) sy-uline.

TOP-OF-PAGE DURING LINE-SELECTION.

WRITE :/1(55) sy-uline.

WRITE :/01 sy-vline,

02 'CUSTOMER NUM',

18 sy-vline,

24 'NAME',

46 sy-vline,

47 'COUNTRY',

55 sy-vline.

WRITE :/1(55) sy-uline.

regards

prasanth

Read only

Former Member
0 Likes
686

Hi,

You can select multiple records at a time in the list by providing check boxes infront of each record then by selecting the check boxes and pressing any button or key we can do specific operation.

I am sending one program as referance.

&----


*& Report YH1059_030403 *

*& *

&----


  • Program Name:To display and perform different arithmetic operations *

  • Creation: 19/02/2008 *

  • SAP Name : YH1059_030403. *

  • *

  • Author : Anomitro Guha Type: 1 *

*_____________________________________________________________________ *

*& Description: This Program is used to display and perform different *

*arithmetic operations (interactive report) *

*_____________________________________________________________________ *

*This Program is used to display and perform different arithmetic *

*operations (interactive report) . *

*& *

&----


REPORT yh1059_030403 .

***********************************************************************

  • Data declaration *

***********************************************************************

DATA:

w_checkbox TYPE c. " Checkbox

DATA :

BEGIN OF fs_spfli,

carrid TYPE spfli-carrid, " Airline code

connid TYPE spfli-connid, " Connection Id

airpfrom TYPE spfli-airpfrom, " Airport From

airpto TYPE spfli-airpto, " Airport To,

deptime TYPE spfli-deptime, " Departure Time

arrtime TYPE spfli-arrtime, " Arival time

mark TYPE c,

END OF fs_spfli.

DATA:

BEGIN OF fs_sflight,

carrid TYPE spfli-carrid, " Airline code

connid TYPE spfli-connid, " Connection Id

fldate TYPE sflight-fldate, " Flight Date

seatsmax TYPE sflight-seatsmax, " Maximum Seats

seatsocc TYPE sflight-seatsocc, " Seats Occupied

END OF fs_sflight.

DATA:

t_spfli LIKE TABLE OF fs_spfli,

t_sflight LIKE TABLE OF fs_sflight,

t_sflight2 LIKE TABLE OF fs_sflight.

DATA:

w_lines TYPE i,

w_check1 TYPE c VALUE 'x',

w_mark TYPE c VALUE '*',

w_check2 TYPE c.

***********************************************************************

  • START-OF-SELECTION *

***********************************************************************

START-OF-SELECTION.

  • Perform to retrive the data of spfli

PERFORM get_spfli_data.

  • Perform to display the data of spfli

PERFORM display_flight_data.

SET PF-STATUS 'SEL'.

***********************************************************************

  • AT LINE-SELECTION. *

***********************************************************************

AT LINE-SELECTION.

  • PERFORM display_sflight_inf.

AT USER-COMMAND.

CASE sy-ucomm.

WHEN 'SELECTALL'.

  • Perform is used to select all the checkboxes.

PERFORM select_all.

WHEN 'DESELECT'.

  • Perform is used to select all the checkboxes.

PERFORM deselect_all.

WHEN 'DETAIL'.

  • Perform is used to display all the selected field.

PERFORM display_selected_data.

ENDCASE.

*AT PF05.

  • IF sy-ucomm EQ 'F2'.

  • PERFORM display_selected_data.

  • ENDIF.

*

&----


*& Form get_spfli_data *

&----


  • Retrieving Data From Spfli *

----


FORM get_spfli_data .

SELECT carrid " Carrid

connid " Connid

airpfrom " Airport from

airpto " Airport to

deptime " Departure time

arrtime " Arrival time

FROM spfli

INTO TABLE t_spfli.

IF sy-subrc NE 0.

MESSAGE 'No Records Found' TYPE 'E'.

ENDIF.

ENDFORM. " get_spfli_data

&----


*& Form display_flight_data

&----


  • Displaying data of spfli table

----


FORM display_flight_data .

LOOP AT t_spfli INTO fs_spfli.

WRITE: /3 w_checkbox AS CHECKBOX,

6 fs_spfli-carrid,

11 fs_spfli-connid,

19 fs_spfli-airpfrom,

26 fs_spfli-airpto,

38 fs_spfli-deptime,

49 fs_spfli-arrtime,

59 fs_spfli-mark.

ENDLOOP.

ENDFORM. " display_flight_data

&----


*& Form display_selected_data

&----


*Displaying corresponding data of sflight table

----


FORM display_selected_data .

DESCRIBE TABLE t_spfli LINES w_lines.

DO w_lines TIMES.

READ LINE sy-index FIELD VALUE w_checkbox INTO w_checkbox

fs_spfli-carrid INTO fs_spfli-carrid

fs_spfli-connid INTO fs_spfli-connid.

IF w_checkbox = 'X' .

SELECT carrid " Airline code

connid " Connection Id

fldate " Flight Date

seatsmax " Maximum Seats

seatsocc " Seats Occupied

FROM sflight

INTO TABLE t_sflight

WHERE carrid EQ fs_spfli-carrid

AND connid EQ fs_spfli-connid .

MODIFY LINE sy-index FIELD VALUE fs_spfli-mark FROM w_mark.

MODIFY LINE sy-lilli FIELD VALUE w_checkbox FROM w_checkbox

FIELD FORMAT w_checkbox INPUT OFF.

LOOP AT t_sflight INTO fs_sflight.

WRITE : / fs_sflight-carrid,

fs_sflight-connid,

fs_sflight-fldate ,

fs_sflight-seatsmax,

fs_sflight-seatsocc.

ENDLOOP. " LOOP AT t_sflight

CLEAR w_checkbox.

ENDIF.

ENDDO.

ENDFORM. " display_selected_data

**&----


**

**& Form select_all

**&----


**

    • Selecting all check boxes

**----


FORM select_all .

DESCRIBE TABLE t_spfli LINES w_lines.

DO w_lines TIMES.

READ LINE sy-index FIELD VALUE w_checkbox INTO w_checkbox.

IF w_checkbox = ' '.

MODIFY LINE sy-index FIELD VALUE w_checkbox FROM w_check1.

ENDIF. " IF w_checkbox

ENDDO. " DO w_lines

ENDFORM. " select_all

**&----


**

**& Form deselect_all

**&----


**

    • Deselecting all check boxes

**----


FORM deselect_all .

DESCRIBE TABLE t_spfli LINES w_lines.

DO w_lines TIMES.

READ LINE sy-index FIELD VALUE w_checkbox INTO w_checkbox.

IF w_checkbox = 'x'.

MODIFY LINE sy-index FIELD VALUE w_checkbox FROM w_check2.

ENDIF. " IF w_checkbox

ENDDO. " DO w_lines

ENDFORM. " deselect_all

Reward some Points.

Regards,

Anomitro