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 updating dynpro fields with DYNP_UPDATE_FIELDS

brad_landry2
Active Contributor
0 Likes
9,020

Hi everybody,

I am working on a user-exit for EH&S safety measures.

If the user select a priority, start/end dates should autofill.

I have read dynpro values with DYNP_VALUES_READ.

However, when I return the modified table with DYNP_UPDATE_FIELDS, the fields are not populated. That's what I got with parameter REQUEST = 'A'.

If I use nothing or 'B' as a request parameter, the fields are updated but I get an annoying popup asking for an ok code. Even if I click ok it won't disapears.

I did not have success with DYNP_VALUES_UPDATE too.

Anyone knows why I got this problem?

Thank you!

Brad

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,522

DYNP_VALUES_UPDATE should work. Can you post your code where you call this?

7 REPLIES 7
Read only

Former Member
0 Likes
3,523

DYNP_VALUES_UPDATE should work. Can you post your code where you call this?

Read only

Former Member
0 Likes
3,522

declare the internal table like below:

DATA: i_fieldvalues TYPE dynpread OCCURS 0 WITH HEADER LINE.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR field.

PERFORM Display_contion_types.

FORM Display_contion_types.

  • Search help for Condition Type

PERFORM Display_contion_types.

Update screen fields like below:

  • Update Screen Field.

CLEAR i_fieldvalues[].

MOVE: 'V_TEXT' TO i_fieldvalues-fieldname .

WRITE i_t685-vtext TO i_fieldvalues-fieldvalue .

APPEND i_fieldvalues.

CALL FUNCTION 'DYNP_VALUES_UPDATE'

EXPORTING

dyname = sy-cprog

dynumb = sy-dynnr

TABLES

dynpfields = i_fieldvalues.

endif

regards,

karthik

Read only

0 Likes
3,522

Hi guys,

thanks for the help.

Karthikeyan :

I will look at your code this morning.

Here is my code (very simple).



          CALL FUNCTION 'DYNP_VALUES_READ'
            EXPORTING
              DYNAME                               = 'SAPLCBIH_AC03_TC1'
              DYNUMB                               = '8010'
              TRANSLATE_TO_UPPER                   = 'X'
              REQUEST                              = 'A'
*             PERFORM_CONVERSION_EXITS             = ' '
*             PERFORM_INPUT_CONVERSION             = ' '
*             DETERMINE_LOOP_INDEX                 = ' '
*             START_SEARCH_IN_CURRENT_SCREEN       = ' '
*             START_SEARCH_IN_MAIN_SCREEN          = ' '
*             START_SEARCH_IN_STACKED_SCREEN       = ' '
*             START_SEARCH_ON_SCR_STACKPOS         = ' '
*             SEARCH_OWN_SUBSCREENS_FIRST          = ' '
*             SEARCHPATH_OF_SUBSCREEN_AREAS        = ' '
            TABLES
              DYNPFIELDS                           = dynpfield
*           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
*             DOUBLE_CONVERSION                    = 9
*             STEPL_NOT_FOUND                      = 10
*             OTHERS                               = 11
                    .
          IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.



          LOOP AT dynpfield INTO ligne_dynpfield.
            IF ligne_dynpfield-FIELDNAME = 'CCIHS_ACHIOT-PSTDAT'.
              ligne_dynpfield-FIELDVALUE = '09.08.2007'.
              ligne_dynpfield-STEPL = '0'.
            ENDIF.
            IF ligne_dynpfield-FIELDNAME = 'CCIHS_ACHIOT-PSTTIME'.
              ligne_dynpfield-FIELDVALUE = '10:53:44'.
              ligne_dynpfield-STEPL = '0'.
            ENDIF.
            IF ligne_dynpfield-FIELDNAME = 'CCIHS_ACHIOT-PENDDAT'.
              ligne_dynpfield-FIELDVALUE = '10.08.2007'.
              ligne_dynpfield-STEPL = '0'.
            ENDIF.
            IF ligne_dynpfield-FIELDNAME = 'CCIHS_ACHIOT-PENDTIME'.
              ligne_dynpfield-FIELDVALUE = '10:55:44'.
              ligne_dynpfield-STEPL = '0'.
            ENDIF.
            INSERT ligne_dynpfield INTO TABLE dynpfield2.
          ENDLOOP.

          CALL FUNCTION 'DYNP_UPDATE_FIELDS'
            EXPORTING
              DYNAME                               = 'SAPLCBIH_AC03_TC1'
              DYNUMB                               = '8010'
              REQUEST                              = 'A'
*             START_SEARCH_IN_CURRENT_SCREEN       = ' '
*             START_SEARCH_IN_MAIN_SCREEN          = ' '
*             START_SEARCH_IN_STACKED_SCREEN       = ' '
*             START_SEARCH_ON_SCR_STACKPOS         = ' '
*             SEARCH_OWN_SUBSCREENS_FIRST          = ' '
*             SEARCHPATH_OF_SUBSCREEN_AREAS        = ' '
            TABLES
              DYNPFIELDS                           = dynpfield2
           "EXCEPTIONS
             "INVALID_ABAPWORKAREA                 = 1
             "INVALID_DYNPROFIELD                  = 2
             "INVALID_DYNPRONAME                   = 3
             "INVALID_DYNPRONUMMER                 = 4
             "INVALID_REQUEST                      = 5
             "NO_FIELDDESCRIPTION                  = 6
             "UNDEFIND_ERROR                       = 7
             "OTHERS                               = 8
                    .
          IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.

Read only

0 Likes
3,522

Hi guys,

I did not have more success.

Brad

Read only

0 Likes
3,522

Hi guys,

a consultant told us that I can't update the dynpro fields this way, because it is a subscreen.

The synthax was good.

Thank you for the help.

I will post a work-around if any.

Brad

Read only

0 Likes
3,522

Hi everyone,

here is the solution we got :



 it_date = '(SAPLCBIH_AC03_TC1)lg_iotab[]'.
      ASSIGN (it_date) TO <fs_lg_iotab>.

      DATA:wa_lgiotab TYPE ccihs_achiot.

LOOP AT <fs_lg_iotab> INTO wa_lgiotab.

              IF wa_lgiotab-acid    = l_action_wa-head-acid.
                wa_lgiotab-pstdat   = date_du_debut.
                wa_lgiotab-psttime  = heure_debut.
                wa_lgiotab-penddat  = date_de_fin.
                wa_lgiotab-pendtime = heure_fin.

                MODIFY <fs_lg_iotab> FROM wa_lgiotab.

              ENDIF.

ENDLOOP.

Read only

0 Likes
3,522

Brad.

Can you send me the code of your alternative for mine:

REFRESH dynpfields.

CLEAR dynpfields.

dynpfields-fieldname = 'P0006-ORT01'. "Screen field name

dynpfields-fieldvalue = t5pcp-locp. "New value

dynpfields-stepl = sy-index. "Step loop for table controls

APPEND dynpfields.

CALL FUNCTION 'DYNP_VALUES_UPDATE'

EXPORTING

dyname = 'ZHRECRAI'

dynumb = '9400'

TABLES

dynpfields = dynpfields[]

exceptions

invalid_abapworkarea = 01

invalid_dynprofield = 02

invalid_dynproname = 03

invalid_dynpronummer = 04

invalid_request = 05

no_fielddescription = 06

undefind_error = 07.

IF sy-subrc <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Many thanks!

Joao