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: 

error in create dropdown in enhancement screen?

former_member625844
Participant
0 Kudos
280

I'm modifing a screen enhancement of CO01 production order create. I added a field zpro of type C(1). First as a plain input field and it worked. Then I converted it to dropdown and it not working in: 1.The selected value not catched .2. If I press enter on the dropdown, it always go to PBO and add more options to it. Do I need to add some code in PAI?Any help? Thx.

The code in PBO is like below:

 
MODULE set_pro OUTPUT.
* SET PF-STATUS 'xxxxxxxx'.
  DATA: i_val  TYPE vrm_values,
        wa_val TYPE vrm_value.
  wa_val-key = 1.
  wa_val-text = ' '.
  APPEND wa_val TO i_val.
  wa_val-key = 2.
  wa_val-text = 'Y'.
  APPEND wa_val TO i_val.
  wa_val-key = 3.
  wa_val-text = 'N'.
  APPEND wa_val TO i_val.
  CALL FUNCTION 'VRM_SET_VALUES'
    EXPORTING
      id     = 'COCI_AUFK-ZPRO'
      values = i_val
*                      EXCEPTIONS
*     ID_ILLEGAL_NAME       = 1
*     OTHERS = 2
    .
  IF sy-subrc <> 0.
* Implement suitable error handling here
  ENDIF.  
ENDMODULE.

I fixed issue 2 with a clear clause. But how do I deal with issue1?

1 ACCEPTED SOLUTION

mimanchi
Explorer
239

hi.

The field KEY is of type char instead of a number

thanks。

  DATA: i_val  TYPE vrm_values,
        wa_val TYPE vrm_value.


  wa_val-key = '1'.
  wa_val-text = ''.
  APPEND wa_val TO i_val.
  wa_val-key = '2'.
  wa_val-text = 'Y'.
  APPEND wa_val TO i_val.
  wa_val-key = '3'.
  wa_val-text = 'N'.
  APPEND wa_val TO i_val.

  CALL FUNCTION 'VRM_SET_VALUES'
    EXPORTING
      id              = 'ZPRO'
      values          = i_val
    EXCEPTIONS
      id_illegal_name = 1
      OTHERS          = 2.
2 REPLIES 2

mimanchi
Explorer
240

hi.

The field KEY is of type char instead of a number

thanks。

  DATA: i_val  TYPE vrm_values,
        wa_val TYPE vrm_value.


  wa_val-key = '1'.
  wa_val-text = ''.
  APPEND wa_val TO i_val.
  wa_val-key = '2'.
  wa_val-text = 'Y'.
  APPEND wa_val TO i_val.
  wa_val-key = '3'.
  wa_val-text = 'N'.
  APPEND wa_val TO i_val.

  CALL FUNCTION 'VRM_SET_VALUES'
    EXPORTING
      id              = 'ZPRO'
      values          = i_val
    EXCEPTIONS
      id_illegal_name = 1
      OTHERS          = 2.

0 Kudos
239

For question 2, you should either implement PBO in FORM or define i_val as a global variable,and check if the variable is empty