2014年4月29日 星期二

How to read Report selection screen field values before PAI field transport

Function: DYNP_VALUES_READ

How to got the field value when you still in selection screen manipulating, example code as below:
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vbeln.
*--- Update P_VSTEL
  dyfields-fieldname 'P_VSTEL'.
  APPEND dyfields.
  CALL FUNCTION 'DYNP_VALUES_READ'
    EXPORTING
      dyname     sy-cprog
      dynumb     sy-dynnr
    TABLES
      dynpfields dyfields.
  READ TABLE dyfields INDEX 1.

  IF dyfields-fieldvalue IS INITIAL.
    MESSAGE i899 WITH 'Please enter Shipping Point first!'.
    EXIT.
  ELSE.
    CLEARgr_vstel,  gr_vstel[],
           gt_lipov,  gt_lipov[],
           gt_dn,     gt_dn[].
    gr_vstel-sign   'I'.
    gr_vstel-option 'EQ'.
    gr_vstel-low    dyfields-fieldvalue.
    APPEND gr_vstel.
  ENDIF.