Você está na página 1de 5

Module Pool - Refresh Screen Fields...

Steven Coolbaugh 47 posts since Dec 19, 2008


Module Pool - Refresh Screen Fields Progmatically Apr 28, 2009 7:46 PM
Hello All!

I have a slightly frustrating problem. I have built a Module Pool application to display shipments and their
underlying deliveries (various information from each).

I have structured the application as follows

An object to store the Data. This object has an internal table of Shipments and an internal table of Deliveries.
The tables are related by TKNUM. When the application needs to display a shipment, it requests the
shipment's information and the underlying deliveries information from the object. The object is structured
to move through the shipments with methods like "GetFirstHeader", "GetPrevHeader", "GetNextHeader",
"GetLastHeader". These return the data for the application to use.

The Deliveries are displayed in a CL_SALV_TABLE, the Shipment information is displayed in textbox type
fields above the table.

The form for display has buttons to trigger the "Move" methods of the data object. This currently will retrieve
the new data from the object, modify the fields and the alv grid and then go back through PBO (I'm assuming
because a button was pressed). This works well. It will bring in the new data and refresh the screen everything
is fine.

I also have a button to print the currently displayed Shipment and Deliveries. This Print is handled through a
SmartForm.

The area that is giving me troubles is my other button. Since the Application can store a range of shipments at
once, I have a "Print All" button. This button moves to the first shipment in the data object,
calls the Print Form, then moves through the rest of the data object calling the Print Form for each Shipment
Displayed. This happens from one button push. The problem I am running into is that the screen does not
refresh when the data changes during this movement through the data objects. I believe this is due to the PBO
module not being triggered yet. My question is, is there a way to refresh the screen progmatically?

I have tried SET USER-COMMAND to move through the data, instead of calling the "GetFirstHeader" and
"GetNextHeader" method directly, but that has some unpredictable behavior (works in debug, not in regular
execution). I have also tried a LEAVE SCREEN statement, as that would trigger the PBO, since the Next
Screen is set to the same screen number, but that kills execution of that block of code at the LEAVE SCREEN
STATEMENT.

Generated by Jive on 2016-01-05+01:00


1
Module Pool - Refresh Screen Fields...

I am including my code from my PAI module that runs this processing, hopefully that will help.

<< unformatable code removed >>

Moderator message - Please go through your code and post only what is relevant to your question.
Edited by: Rob Burbank on Apr 28, 2009 1:44 PM

Steven Coolbaugh 47 posts since Dec 19, 2008


Re: Module Pool - Refresh Screen Fields Progmatically Apr 28, 2009 7:26 PM
Sorry about that, that was weird. I'll try reposting in readable format. Maybe if I split my message and the code.

Steven Coolbaugh 47 posts since Dec 19, 2008


Re: Module Pool - Refresh Screen Fields Progmatically Apr 28, 2009 7:28 PM
Message:

Hello All! I have a slightly frustrating problem. I have built a Module Pool application to display shipments and
their underlying deliveries (various information from each). I have structured the application as follows An
object to store the Data. This object has an internal table of Shipments and an internal table of Deliveries. The
tables are related by TKNUM. When the application needs to display a shipment, it requests the shipment's
information and the underlying deliveries information from the object. The object is structured to move through
the shipments with methods like "GetFirstHeader", "GetPrevHeader", "GetNextHeader", "GetLastHeader".
These return the data for the application to use.

The Deliveries are displayed in a CL_SALV_TABLE, the Shipment information is displayed in textbox type
fields above the table. The form for display has buttons to trigger the "Move" methods of the data object. This
currently will retrieve the new data from the object, modify the fields and the alv grid and then go back through
PBO (I'm assuming because a button was pressed). This works well. It will bring in the new data and refresh
the screen everything is fine.

I also have a button to print the currently displayed Shipment and Deliveries. This Print is handled through a
SmartForm.

The area that is giving me troubles is my other button. Since the Application can store a range of shipments
at once, I have a "Print All" button. This button moves to the first shipment in the data object, calls the Print
Form, then moves through the rest of the data object calling the Print Form for each Shipment Displayed. This
happens from one button push. The problem I am running into is that the screen does not refresh when the
data changes during this movement through the data objects. I believe this is due to the PBO module not being
triggered yet. My question is, is there a way to refresh the screen progmatically?

Generated by Jive on 2016-01-05+01:00


2
Module Pool - Refresh Screen Fields...

I have tried SET USER-COMMAND to move through the data, instead of calling the "GetFirstHeader" and
"GetNextHeader" method directly, but that has some unpredictable behavior (works in debug, not in regular
execution). I have also tried a LEAVE SCREEN statement, as that would trigger the PBO, since the Next
Screen is set to the same screen number, but that kills execution of that block of code at the LEAVE SCREEN
STATEMENT. I am including my code from my PAI module that runs this processing, hopefully that will help.

Steven Coolbaugh 47 posts since Dec 19, 2008


Re: Module Pool - Refresh Screen Fields Progmatically Apr 28, 2009 7:46 PM
<< Unformatable code removed >>

Edited by: Rob Burbank on Apr 28, 2009 1:46 PM

Steven Coolbaugh 47 posts since Dec 19, 2008


Re: Module Pool - Refresh Screen Fields Progmatically Apr 28, 2009 7:31 PM
Apparently it is the code that is the problem.

Steven Coolbaugh 47 posts since Dec 19, 2008


Re: Module Pool - Refresh Screen Fields Progmatically Apr 28, 2009 8:35 PM
MODULE USER_COMMAND_9999 INPUT . CASE OK_CODE . WHEN 'NEXT' . PERFORM Next . PERFORM G

That is the general flow. Hope that helps, if more info is needed, let me know.

Luis Martinez 8 posts since Apr 23, 2008


Re: Module Pool - Refresh Screen Fields Progmatically Apr 29, 2009 12:29 AM
Hello Steven,

There is a Function you can use to Update a Screen Field without going through PBO.

CALL FUNCTION 'DYNP_VALUES_UPDATE' EXPORTING dyname = sy-repid dynumb = sy-

You can check the structure of the table "dynpfields" it receives as a parameter, you just have to send the
name of the fields and the values for them, hope it helps,

Luis.

Steven Coolbaugh 47 posts since Dec 19, 2008


Re: Module Pool - Refresh Screen Fields Progmatically Apr 29, 2009 3:11 PM
This is exactly the kind of solution I was hoping for.

Generated by Jive on 2016-01-05+01:00


3
Module Pool - Refresh Screen Fields...

Thank you,

Jitendra Yadav 15 posts since Oct 1, 2008


Re: Module Pool - Refresh Screen Fields Progmatically Dec 28, 2015 10:44 AM
THe code to read and update the Module pool Screen fields is below:
In this below example we are reading Job field value and updating Job text field on Module pool screen.

DATA: BEGIN OF htab OCCURS 2.


INCLUDE STRUCTURE dynpread.
DATA: END OF htab.
DATA: lv_stell TYPE wplog-objid,

lv_stltx TYPE stltx.


CLEAR htab. REFRESH htab.
MOVE job_field_name TO htab-fieldname.
CLEAR htab-fieldvalue.
APPEND htab.

CALL FUNCTION 'DYNP_VALUES_READ'


EXPORTING
dyname = sy-cprog
dynumb = sy-dynnr
TABLES
dynpfields = htab
EXCEPTIONS
invalid_abapworkarea = 1
invalid_dynprofield = 2
invalid_dynproname = 3
invalid_dynpronummer = 4
invalid_request =5
no_fielddescription = 6
invalid_parameter = 7
undefind_error =8
OTHERS = 9.

IF sy-subrc EQ 0.
READ TABLE htab WITH KEY fieldname = job_field_name.
* Search Position text
CLEAR: lv_stltx, lv_stell.
MOVE htab-fieldvalue TO lv_stell.
SELECT SINGLE stltx FROM t513s INTO lv_stltx

Generated by Jive on 2016-01-05+01:00


4
Module Pool - Refresh Screen Fields...

WHERE sprsl EQ sy-langu


AND stell EQ lv_stell.

Job_text_field_name = lv_stltx.

Generated by Jive on 2016-01-05+01:00


5

Você também pode gostar