Skip to Content
author's profile photo Former Member
Former Member

Functions and User Commands

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.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Nov 18, 2005 at 12:52 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      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.

  • author's profile photo Former Member
    Former Member
    Posted on Nov 18, 2005 at 02:47 AM

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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 18, 2005 at 04:20 AM

    Hi,

    AT line-selection is an event for interactive reporting .

    That is why it is not working in your fM

    Regards

    Beena

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 18, 2005 at 07:04 AM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Nov 18, 2005 at 07:54 AM

    Hi,

    AT LINE-SELECTION wont get triggered inside the FM.

    Thanks,

    Abdul

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      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

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.