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: 

Not able to pass data from main screen to subscreen using screen exit

amber_garg
Active Participant
0 Kudos
843

Hi all,

For Transaction BC425_01 , I am able to create screen exit as such. Till now I have tried just adding a LABEL CAPTION to the subscreen which is provided for screen exit. I m successful in doing that. But now what i want is to access data from the standard program ie the FLIGHT MAX SEAT and FLIGHT OCC SEAT in my subscreen.I have gone through most of the documents but I am not able to do that.

Some of the documents tell me to add a gloabal variable in TOP include and then use it in subscreen, But the TOP INCLUDE given for SAP STD CODE cannot be modified then what is the way to transfer data. I tried declaring the variable in FUNCTION EXIT but its not accessible from subscreen PBO (which should not happen also).

Thank You

1 ACCEPTED SOLUTION

Sandra_Rossi
Active Contributor
0 Kudos
279

Hi,

all standard LX....TOP should include ZX...TOP (initially do not exist) that you can then create by double-clicking and put all your global data objects inside.

Sandra

18 REPLIES 18

Sandra_Rossi
Active Contributor
0 Kudos
280

Hi,

all standard LX....TOP should include ZX...TOP (initially do not exist) that you can then create by double-clicking and put all your global data objects inside.

Sandra

0 Kudos
279

In Program SAPBC425_FLIGHT01(from which i m using screen exit) I can see INCLUDE BC425_FLIGHT01TOP. Now as u said I should double click on it and create a include Z...TOP where i can create those global variables. But when i double click , since it is a standard include , I am not allowed to add or modify it. Then how can i create my own include inside it.

THANKS

0 Kudos
279

well it seems I'm out of context then. By "screen exit" we usually refer to either CMOD transaction (it's what I was talking about) or BAdI, but it seems you're talking of something else. Is BC425_01 a transaction of 7.0ehp2 or 7.20? I don't have it in my 7.0 release.

0 Kudos
279

Oh I never thought u are talking about CMOD transaction. Just now I saw in CMOD, Yes there is an include as u mentioned.I will just try it and get back to you.

THANKS

0 Kudos
279

Just a bit of confusion for me. Whatever I write in this include will be valid throught my subscreen PBO and PAI , right?. But how to bring data from standard screen to this variable. For eg. in original sap standard screen, they have fields for SEATSMAX and SEATSOCC. I want to use these values in my subscreen.

I am using ECC 6.0 .Not sure how to find out NETWEAVER version.

THANKS

0 Kudos
279

Hi

Yes, what you write in the ZX...TOP include, is seen by what you write for your subscreen, because they all belong to the X... function group (same program, so global declarations are seen everywhere).

Screen exits are accompanied by customer exits (function modules EXIT_SAPL... available in CMOD also) that are used to transfer data from standard screens to subscreens, and vice versa. The customer exits are called during the PBO and the PAI.

Sandra

PS: ECC 6 is built over Netweaver 7.0.

0 Kudos
279

Thanks for your reply.

Actually the customer exit (function exit) which you have mentioned , I have already used it by Creating a new variable there n storing the standard screen vales SEATSMAX and SEATSOCC. But now how to use this variable in my INCLUDE of subscreen.If i directly try to use this variable name , obviously it wont be able to link and give error. So how to get a link to variables in FUNCTION EXIT in TOPINCLUDE of custom subscreen

THANKS

0 Kudos
279

Your subscreen must be in the same function group X... So you can access the global variables defined in LX...TOP.

obviously it wont be able to link and give error

I don't understand that. I would say "it is able to access the global variable, obviously, as everything is in the same function group".

Did you create something outside function group X... ?

Sandra

Edited by: Sandra Rossi, 2 minutes later : DON'T FORGET to activate ALL includes of the function group together

0 Kudos
279

Yes , my subscreen is in the same function group X... , which i accessed through CMOD. I have no doubt in that My subscreen will be able to access variables mentioned in the TOPINCLUDE (Z) . But my question is inside TOPINCLUDE(Z) how will I access the variables declared in EXIT FUNCTION. Even though both the EXIT function and TOPINCLUDE are in the same X function group but still since the variable which i have used in EXIT function they are local to that EXIT function so how can they be accessed anywhere outside the EXIT function. I tried also but its giving error saying that variable is not defined

THANKS

0 Kudos
279

Hi

There isn't that program in my system but I can suppose how the screen-exit works

You should have a function-group where all exit are defined, that means:

A) A function exit to move the data from main (scrreen) program to the screen-exit

B) the screen-exit

C) A function exit to return the data from the screen-exit to the main (screen) program

The function exit A should be placed in the PBO of the main screen

The function exit C should be placed in the PAI of the main screen

The screen-exit should be called in the main screen just as subscreen, so the main screen could be arranged as following:

PROCESS PAI

   MODULE <move data to screen-exit>
   
   CALL SUBSCREEN <subarea> INCLUDING <program exit> <screen exit>.

PROCESS PBO,
   
   CALL SUBSCREEN <subarea>.
   
   MODULE <move data to main screen>.

Now this is based on all objects of the same function group can see (and use) the global data defined in the TOP-include of the function-group.

So if you define a variable in the TOP-INCLUDE you need to fill it in the function-exit A (i.e the function to get the data from main screen) and you can display it in your screen-exit.

After changing it you can transfer the value of your global data in the function B.

That mean you can get only the data of main screen those are managed in the interfaces of the function-exit.

Max

0 Kudos
279

inside TOPINCLUDE(Z) how will I access the variables declared in EXIT FUNCTION

Why do you want to do that? A TOP include is for declaring data objects (TYPES, DATA, CONSTANTS), not to write executable code.

the variable which i have used in EXIT function they are local to that EXIT function so how can they be accessed anywhere outside the EXIT function. I tried also but its giving error saying that variable is not defined

you transfer the parameters to the global variables you have defined in the TOP include.

When you activate, activate all parts of the function group.

Please provide the names (for instance subscreen is SAPLX??? 0355, include ZX???U03), to avoid any misunderstanding.

Sandra

0 Kudos
279

Thanks Sandra and MAX.

I did as u said MAX , ie first declaring the variable in TOP INCLUDE and then using it in function exit for calculation value and then again using it in PBO.

ITS working perfectly as i wanted to.

Just one doubt MAX , in your example you have shown FUNC EXIT A(for transferring data from exit to subscreen) and C(for transferring data from subscreen to exit). So actually both A and C are one and same Func EXIT or different? because In my CMOD I am able to see only 1 FUNC exit which i have used to bring data from exit to subscreen. I guess the same func exit can be used for doing things other way round??

THANKS to both of you again

0 Kudos
279

Hi

The function-exit should be different not the same, but this is not the law.

I mean SAP usually allows to change the data managed by the interface of the function-exit:

the function-exit gets data from main program should have IMPORTING parameters only and of course the function-exit returns data to main program should have EXPORTING parameters only, also you need to considere those function should have different purposesso they can't be the same......theoretically of course, it depends on what SAP wants to allow to do.

A very typical screen-exit is in the enhancement MM06E005 (for purchase order): here you can see how a screen-exit is generally arranged,

Max

0 Kudos
279

But in my case there is only one function exit so that does that mean I am not allowed to transfer data from subscreen back to main screen(ideally) ?

0 Kudos
279

Yes

I think so....if there isn't any exit in PAI it can mean SAP doesn't allow to return changed data to main program.

Max

0 Kudos
279
process before output.

  module status_0200.

  module lock_data.

  module data_for_subscreen.

  call customer-subscreen sub including 'SAPLXBC425G01' '0500'.

process after input.

  module cancel_exit at exit-command.

  module save_ok_code.

  call customer-subscreen sub.

  module user_command_0200.

This is the code given in standard screen.

0 Kudos
279

Hi

You should check the code included in the module user_command_0200 perhaps there is a exit there.

Anyway you need to considere the screen-exit is to manage fields aren't managed in the standard program

These fields can be two distinct kinds:

- A field belonging to a standard table (i.e. or a standard field or a custom field appended to the standard table): that means the values assigned to these fields have to be stored in the standard table;

The standard program has just the processes to store the data in the standard table so it needs to transfer these values from exit to main program in order to save them automatically

- A field belonging to custom table: in this situation the process for saving the data has to be implemented in the same exit, so it doesn't need to transfer the data to the main program.

Probably in your case (just an exercise) it doesn't need to export the data from the user-exit

Max

0 Kudos
279

you can always pass data bak 2 variables in top include which are static and global