Application Development 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: 

Functions and User Commands

Former Member
0 Kudos

Hi,

I have a function which prints out a list, on pf-status screen I have defined 'PICK' , and used F2.

But it does not seem to go the command AT LINE-SELECTION.

It seems easier with reports than functions, what am I doing wrong?

FUNCTION zfs_spool_history.

*"----


""Local interface:

*" IMPORTING

*" REFERENCE(ID_LIST) TYPE SP01R_ID_LIST OPTIONAL

*"----


DATA: wa_tsp02 TYPE tsp02,

check_box(1) TYPE c.

DATA: l_date LIKE sy-datum,

l_time LIKE sy-uzeit,

pjdest TYPE rspopname.

DATA: colour_code(3) TYPE c VALUE '0'.

SET PF-STATUS 'SPOOLPF'.

  • SELECT * FROM tsp02 INTO wa_tsp02

  • FOR ALL ENTRIES IN id_list

  • WHERE pjident = id_list-id.

  • ENDSELECT.

WRITE: /(84) sy-uline.

FORMAT INTENSIFIED ON COLOR COL_HEADING.

WRITE:/01 sy-vline, 04'Spool no.' , 14 sy-vline,

15'OutpReqNo', 26 sy-vline,

'Date', 39 sy-vline,

'Time', 50 sy-vline,

'ODev', 57 sy-vline,

'Format', 76 sy-vline,

'Status', 84 sy-vline.

WRITE: /(84) sy-uline.

SELECT * FROM tsp02 INTO wa_tsp02.

  • FOR ALL ENTRIES IN id_list

  • WHERE pjident = id_list-id.

WRITE: /01 sy-vline.

FORMAT COLOR COL_KEY.

FORMAT INTENSIFIED ON.

mypjident = wa_tsp02-pjident.

REPLACE ',' IN mypjident WITH ''.

WRITE:02 check_box AS CHECKBOX.

WRITE AT (10) mypjident RIGHT-JUSTIFIED.

WRITE AT 14 sy-vline.

HIDE mypjident.

WRITE AT (9) wa_tsp02-pjnummer CENTERED.

WRITE sy-vline.

IF colour_code = '0'.

FORMAT INTENSIFIED OFF COLOR COL_NORMAL.

colour_code = '1'.

ELSE.

FORMAT INTENSIFIED ON COLOR COL_NORMAL.

colour_code = '0'.

ENDIF.

MOVE wa_tsp02-pjcreatime(8) TO l_date.

MOVE wa_tsp02-pjcreatime+8(6) TO l_time.

MOVE wa_tsp02-pjdest(4) TO pjdest.

WRITE: l_date, sy-vline.

WRITE: l_time, sy-vline.

WRITE pjdest.

WRITE AT 57 sy-vline.

WRITE: wa_tsp02-pjpaper, sy-vline.

WRITE: wa_tsp02-pjstatus, 84 sy-vline.

ENDSELECT.

WRITE: /(84) sy-uline.

ENDFUNCTION.

form display_spool_document.

write 'Item picked '.

endform.

AT LINE-SELECTION.

PERFORM display_spool_document.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi u cannot use the statement at line-selection in a function module since its an event in a report.

better change ur logic accordinly topush the data to the internal table and then call theis FM in the report and get access to this Internal table and display the contents as per ur choice.

satish

8 REPLIES 8

Former Member
0 Kudos

'At line selection' is a report event. With function module it will not work. If you want to use such functionality then write Report.

Former Member
0 Kudos

Hi,

AT line-selection is an event for interactive reporting .

That is why it is not working in your fM

Regards

Beena

Former Member
0 Kudos

Hi sims,

1. In FM, we cannot use write statement

to directly show data on screen.

2. Can u let us know, how u have attempted

to display using write statement.

I mean is it using a new screen (using the screen editor)

and calling that screen?

or some other technique ?

Regards,

AmitM.

abdul_hakim
Active Contributor
0 Kudos

Hi,

AT LINE-SELECTION wont get triggered inside the FM.

Thanks,

Abdul

0 Kudos

Hi,

It needs to be in a function as it get called from a report, which I have written. What events do get called from a function? I basically have Icons, which I want to ewpons to and line selection?

0 Kudos

Hi Sims,

When execute the function module results will be displayed in function module workarea.(On screen).

If you check the system status you can see datails

displyed on SE37 transaction screen.

Coming to your requirement, in the fucntion module

get data and process data and finally you pass to one itab. When you are calling that function module in your program take data from the itab and now you can play around and do whatever you want.

Hope this will help you.

Thanks & Regards,

Siri.

kindly reward points if it is useful.

Message was edited by: Srilatha T

Former Member
0 Kudos

Hi u cannot use the statement at line-selection in a function module since its an event in a report.

better change ur logic accordinly topush the data to the internal table and then call theis FM in the report and get access to this Internal table and display the contents as per ur choice.

satish

0 Kudos

HI,

I managed to solve the problem of events in functions myself, sample code below for refernce purposes, Screen 500 is just a dummy screen, the pf-status have been defined.

FUNCTION ZJUNK1.

CALL SCREEN 500.

endfunction.

MODULE create_list OUTPUT.

LEAVE TO LIST-PROCESSING AND RETURN TO SCREEN 0.

SET PF-STATUS 'SCREEN_600'.

TABLES demo_conn.

  • Global Data

DATA: wa_spfli TYPE spfli.

SELECT carrid connid cityfrom cityto

FROM spfli

INTO (wa_spfli-carrid, wa_spfli-connid,

wa_spfli-cityfrom, wa_spfli-cityto).

WRITE: / wa_spfli-carrid, wa_spfli-connid,

wa_spfli-cityfrom, wa_spfli-cityto.

ENDSELECT.

LEAVE SCREEN.

ENDMODULE. "create_list OUTPUT

AT USER-COMMAND.

CASE sy-ucomm.

WHEN 'TEST'.

WRITE 'TESTER'.

WHEN 'CHOOSE'.

write 'PICK'.

ENDCASE.

AT LINE-SELECTION.

WRITE 'fdfdfdgdgfdgd*****'.

TOP-OF-PAGE.

WRITE text-001 COLOR COL_HEADING.

ULINE.