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

call screen using function Module

Former Member
0 Likes
5,322

I am trying to create a function group and a function module to be able to call the screen from a function module
I have done the following steps:
1- create a function group
2- create a screen '800'
3- create a PBO initial module in the screen to pick the data and status.
4- creat a PAI commend module in the screen.
5- create a function module and in this FM just wrote

 call screen 800.


6- Now in the the program that should call this screen/FM I have wrote

start of  selection.

call function 'ZFM'

the problem is when I'm executing the FM or the program the system shows a screen with no data or status????

could some tell me what is still missing me?

Best Regards

Jenie

9 REPLIES 9
Read only

Muthu_raja
Active Participant
0 Likes
3,164

Hi Jennifer,

Kindly attach PBO code as well.

Read only

Former Member
0 Likes
3,164

Hi Muthu,

My PBO coding look like below :

PROCESS BEFORE OUTPUT.
 MODULE STATUS_800.
 MODULE in_800 OUTPUT.

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


 MODULE in_800 OUTPUT.
    PERFORM   get_data.

    PERFORM   create_object.

    PERFORM   display_data.
ENDMODULE.   

FORM create_object.
  CREATE OBJECT g_cont
    EXPORTING
      container_name = 'SCREEN'.
  CREATE OBJECT go_grid
    EXPORTING

      i_parent = g_cont .
ENDFORM.                    " CREATE_OB

FORM display_data .



DATA    lo_variant TYPE disvariant.

DATA    ls_layout     TYPE lvc_s_layo.

DATA    lt_fieldcat   TYPE STANDARD TABLE OF lvc_s_fcat.
DATA    lo_variant TYPE disvariant.

DATA    lt_fieldcat   TYPE STANDARD TABLE OF lvc_s_fcat.

lo_variant-report = sy-repid.

  CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'

    EXPORTING
      i_structure_name       = 'MARA'
    CHANGING
      ct_fieldcat            = lt_fieldcat
    EXCEPTIONS
      inconsistent_interface = 1
      program_error          = 2
      OTHERS                 = 3.
  CALL METHOD go_grid->set_table_for_first_display
    EXPORTING
      is_variant                    = lo_variant
      i_save                        = 'A'
      is_layout                     = ls_layout
    CHANGING
      it_outtab                     = gt_mara
      it_fieldcatalog               = lt_fieldcat

    EXCEPTIONS

      invalid_parameter_combination = 1

      program_error                 = 2

      too_many_lines                = 3

      OTHERS                        = 4.

  IF sy-subrc <> 0.

    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

  ENDIF.

ENDFORM.                    " DISPLAY_DATA

FORM get_data .

  Data lt_mara TYPE STANDARD TABLE OF mara.

  DATA ls_mara TYPE mara.

select * from mara into TABLE gt_mara UP TO 100 ROWS.

ENDFORM.         

in the FM i have wrote

Function ZFM_TEST

call Screen 800.

ENDFUNCTION

in the program...

start of selection
call function 'ZFM_TEST'.

but I still not able to pass the screen to the FM as either the status or the PBO are working???

your pieces of advice are highly appreciated 🙂

Jenie

Read only

0 Likes
3,164

Hi Jenifer,

Thanks for sharing the code. I would suggest you to display some simple data to the screen and check it is working. If it is displaying the data then please start work with above code. Also, try to debug line by line which will help to find out where the issue is.

Thanks a lot !!!..

~ MR

Read only

0 Likes
3,164

Hi Jennifer,

Lots of doubts.

1) The FM called from the program is different. Use the Name properly.

2) Why you have used call screen 400 inside the FM? Are you working on 800 or 400 Screen ?

3) Now where is the issue exactly? In the program or in the FM ? How you will pass the screen to the FM? Could you elaborate it more ?

~ MR

Read only

TMSingh_SAP
Participant
0 Likes
3,164

Hi Jenifer,

in the factory call method, please check if the internal table - <lt_call_prp_show>. is populated or not.

Share the debug screen ..to know what exactly is coming here.

Thanks,

Mohan

Read only

Former Member
0 Likes
3,164

Hi Muthu,
I have changed my code to make it easier to figure out the concept of the FM, please take a look at what I have wrote I think I losing the connection between the Function group and the FM.

Best Regards

Read only

Former Member
0 Likes
3,164

Hi mohan,
Thanks for your input.

I have debugged the code in a separated program and it is working smoothly...but how can I debug a code which has been written in a function group, is this possible ?.... as I can debug till calling the screen 800 in the FM and then SAP call the screen 800 directly without going inside it.

Best Regards

Jenie

Read only

Former Member
0 Likes
3,164

Hi, Muthu,

this is just typing mistakes and I have corrected them,

the problem is in the FM because when I execute it no screen will be called ...

I mean by passing that I have already worte everything in FG and the just call screen 800 in the FM to call what I wrote but it is not working.

Regards

Jenie

Read only

DoanManhQuynh
Active Contributor
0 Likes
3,164

Sorry I have to ask there are 2 things you dont listed:

1. did you create gui status?

2. did you create screen contaner SCREEN.

because all your code working as expected.