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

Problem in reading screen fields from FM DYNP_VALUES_READ

Former Member
0 Likes
3,586

Hi Friends,

I have developed module pool program and in my module pool program I am using two subcscreens, one is for entry for mateiral/plant, and other is for list of stocks entered in first sub-screen.

Question is I am using DYNP_VALUES_READ FM for reading subscreen value to validate what user has entered. But it is giving right value at first time Function module execution, at the second time it is not updating screen values and showing old data and I can not validate with current screen value.

So Folks Can you suggest me right way to get sub-screen data anytime in my main screen.

If I have to use any other Function module then pls. tell me.

Thanks you !!

PPATEL

1 ACCEPTED SOLUTION
Read only

venkat_o
Active Contributor
0 Likes
1,858

Hello Patel,

<li>Befor you build DYNPFIELDS table with fields, Clear the internal table.

<li>DYNP_VALUES_READ - read dynpro fields values using this FM

<li>DYNP_VALUES_UPDATE - update dynpro fields using this FM

Thanks

Venkat.O

Hi Friends,

I have developed module pool program and in my module pool program I am using two subcscreens, one is for entry for mateiral/plant, and other is for list of stocks entered in first sub-screen.

Question is I am using DYNP_VALUES_READ FM for reading subscreen value to validate what user has entered. But it is giving right value at first time Function module execution, at the second time it is not updating screen values and showing old data and I can not validate with current screen value.

So Folks Can you suggest me right way to get sub-screen data anytime in my main screen.

If I have to use any other Function module then pls. tell me.

Thanks you !!

PPATEL

6 REPLIES 6
Read only

venkat_o
Active Contributor
0 Likes
1,859

Hello Patel,

<li>Befor you build DYNPFIELDS table with fields, Clear the internal table.

<li>DYNP_VALUES_READ - read dynpro fields values using this FM

<li>DYNP_VALUES_UPDATE - update dynpro fields using this FM

Thanks

Venkat.O

Read only

Former Member
0 Likes
1,858

Hi Venkat,

Thanks for reply.

I am doing same thing here, I am reading dynpro fields from FM DYNP_VALUES_READ and updating it from UPDATE FM.

But want to know when to use which Function module.

My requirement is read dynpro of subscreen in PAI event, as and when User interpret something.

It is giving right value at first but when I am clicking second time then in that PAI event it is not giving updated values, still gives old dynpro values. So why it is not updating into table.

Thanks again for help.

Priyank

Read only

venkat_o
Active Contributor
0 Likes
1,858

Hi Priyank,

Can you please post the code, I will go through ..

Venkat.O

Read only

Former Member
0 Likes
1,858

Hey Venki,

I can send you code here but can not send you screens, so just giving overview here,

Main screen -> inside that two subscreens,

-> one is for data entry

-> another is for data retrival

Main screen has PAI and PBO event.

Both sub screen has PAI and PBO event.

Data entry screen(Subscreen 1) has following code for PBO and PAI event

PBO event

refresh XDYNPREAD.

clear XDYNPREAD.

MOVE 'LFA1-LIFNR' TO XDYNPREAD-FIELDNAME.
  APPEND XDYNPREAD.

  LOC_REPID = SY-REPID.
  LOC_DYNNR = '0107'. " Subscreen 

  CALL FUNCTION 'DYNP_VALUES_READ'
       EXPORTING
            DYNAME               = LOC_REPID
            DYNUMB               = LOC_DYNNR
       TABLES
            DYNPFIELDS           = XDYNPREAD
       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.

  CALL FUNCTION 'DYNP_VALUES_UPDATE'
       EXPORTING
            DYNAME               =  LOC_REPID
            DYNUMB               =  LOC_DYNNR
       TABLES
            DYNPFIELDS           =  XDYNPREAD
       EXCEPTIONS
            OTHERS               = 4.

And in PAI event


Reading value from DYNPRO passing to table

refresh XDYNPREAD.
clear XDYNPREAD.

  MOVE 'LFA1-LIFNR' TO XDYNPREAD-FIELDNAME.
  APPEND XDYNPREAD.

  LOC_REPID = SY-REPID.
  LOC_DYNNR = '0107'.

  CALL FUNCTION 'DYNP_VALUES_READ'
       EXPORTING
            DYNAME               = LOC_REPID
            DYNUMB               = LOC_DYNNR
       TABLES
            DYNPFIELDS           = XDYNPREAD
       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.

* Update with Zrequest.
   loop at XDYNPREAD.
    if XDYNPREAD-FIELDNAME = LFA1-LIFNR'.

         CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
           EXPORTING
             INPUT              = XDYNPREAD-FIELDVALUE
          IMPORTING
            OUTPUT             = LFA1-LIFNR.
  endloop.

So here no issue I am getting updated value each time.

Problem is in main screen PAI event when I am processing it for data retrieval from subscreen 2, I am reading from suscreen 1 that if user has changed somethign and whatever data came in second screen are with same input or not.

So at first it is giving right values from screen 1(Sub screen 1), when I am changing some values in that screen again checking in main screen checking logic for updated values from screen1 with FM DYNP_VALUES_READ, it is giving old data not with latest update.

It is somehow confusing but I tried to explain you.

Thanks

PPatel

Edited by: PPATEL on Jun 20, 2009 8:45 PM

Edited by: PPATEL on Jun 20, 2009 8:47 PM

Read only

Former Member
0 Likes
1,858

Hi PPatel,

You are using two sybscreen in ur module Pool Program.

Say for Example if you are reading the value of Screen field from Screen number

100 then pass that screen number and Program name in ur function.

Also check it are you clearing the internal table before you are fetching data for second

time. Do all this thing in debugging mode.

Regards,

Vipul

Read only

0 Likes
1,858

I figure it out on my way and now it is updating at every stage and my validation is working.

Thanks you all folks for your reply.