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: 

Function module screens

Former Member
0 Kudos

Hello experts,

I have a function module which can call 4 screens (via CALL SCREEN statement). Each one of the screens has some fields. The user passes to the FM the list of fields, which he wants to make editable. The problem is, that I need to dynamically check which fields are on which screens and call only the desired one(s).

For example:

screen 1 contains fields f1, f2, f3

screen 2 contains fields f4, f5, f6

screen 3 contains fields f7, f8. f9

User wants to make fields f1 and f4 editable. So I need to call screens 1 and 2.

I cannot do this on PBO - I can't just use LOOP AT SCREEN, because I don't know which screens I will need. I have to check this first and then show only the desired screens.

So my questions - where (in which tables) can I find:

1. information about the assignment between screen and Function module?

2. assignment between screen and screen elements?

1 ACCEPTED SOLUTION

raymond_giuseppi
Active Contributor
0 Kudos

You could do that in PBO. Suggestion : call the three screens in sequence and in the PBO of each screen, during the LOOP AT SCREEN, set the requested fields input-able, and memorize that a field was set for input, at the end of the LOOP, if no field was set use a SUPPRESS DIALOG that triggers PAI and go for next screen.

FUNCTION z_xxxx.
*"----------------------------------------------------------------------
*"*"Lokale Schnittstelle:
*"  IMPORTING
*"     REFERENCE(SO_FIELDS) TYPE  RSPARAMS_TT
*"----------------------------------------------------------------------

  CALL SCREEN 100.
  CALL SCREEN 101.
  CALL SCREEN 102.

ENDFUNCTION.

*----------------------------------------------------------------------*
*  MODULE COMMON_PBO OUTPUT
*----------------------------------------------------------------------*
MODULE common_pbo OUTPUT.
  perfom set_attributes.
ENDMODULE.                    "COMMON_PBO

*&---------------------------------------------------------------------*
*&      Form  SET_ATTRIBUTES
*&---------------------------------------------------------------------*
FORM set_attributes.
  DATA field_found TYPE c LENGTH 1.
  CLEAR field_found.
  LOOP AT SCREEN.
    CHECK screen-group1 = 'INP'. 
    READ TABLE so_fields WITH KEY low = screen-name.
    IF sy-subrc EQ 0.
      screen-input = 1.
      field_found = c_x.
    ELSE.
      screen_input = 0.
    ENDIF.
    MODIFY SCREEN.
  ENDLOOP.
  IF field_found IS INITIAL.
    SUPPRESS DIALOG.
  ENDIF.
ENDFORM.                    "SET_ATTRIBUTES

Regards,

Raymond

3 REPLIES 3

YayatiEkbote
Contributor
0 Kudos

Use this - EXPORT f1 f2 f3 TO MEMORY ID 'ID'. From the function module.

And use - IMPORT f1 f2 f3 FROM MEMORY ID 'ID' in the PBO of whichever screen u want to use.

Hope this helps.

Regards,

Yayati

0 Kudos

The problem is, that I don't know (during FM runtime) which fields are on which screens. I have to check this first and then call appropriate screens.

I need the SAP table in which the realtionship between FM and screen is stored.

@UPADTE:

I have found the tables, that I have been looking for:

1. Table which contains relationship between function module and screens is D020S (well between function group and screen to be exact).

2. Table with screen elements for particualr screen (relationship function group-screen-screen element) is D021T.

Edited by: piotrzym on Jul 21, 2011 7:37 AM

raymond_giuseppi
Active Contributor
0 Kudos

You could do that in PBO. Suggestion : call the three screens in sequence and in the PBO of each screen, during the LOOP AT SCREEN, set the requested fields input-able, and memorize that a field was set for input, at the end of the LOOP, if no field was set use a SUPPRESS DIALOG that triggers PAI and go for next screen.

FUNCTION z_xxxx.
*"----------------------------------------------------------------------
*"*"Lokale Schnittstelle:
*"  IMPORTING
*"     REFERENCE(SO_FIELDS) TYPE  RSPARAMS_TT
*"----------------------------------------------------------------------

  CALL SCREEN 100.
  CALL SCREEN 101.
  CALL SCREEN 102.

ENDFUNCTION.

*----------------------------------------------------------------------*
*  MODULE COMMON_PBO OUTPUT
*----------------------------------------------------------------------*
MODULE common_pbo OUTPUT.
  perfom set_attributes.
ENDMODULE.                    "COMMON_PBO

*&---------------------------------------------------------------------*
*&      Form  SET_ATTRIBUTES
*&---------------------------------------------------------------------*
FORM set_attributes.
  DATA field_found TYPE c LENGTH 1.
  CLEAR field_found.
  LOOP AT SCREEN.
    CHECK screen-group1 = 'INP'. 
    READ TABLE so_fields WITH KEY low = screen-name.
    IF sy-subrc EQ 0.
      screen-input = 1.
      field_found = c_x.
    ELSE.
      screen_input = 0.
    ENDIF.
    MODIFY SCREEN.
  ENDLOOP.
  IF field_found IS INITIAL.
    SUPPRESS DIALOG.
  ENDIF.
ENDFORM.                    "SET_ATTRIBUTES

Regards,

Raymond