Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8944

Dynamic Selection Screen with Select Options/range

$
0
0

Hi Every One,

 

 

I am new to abap and need help with this.

 

 

I am trying to a do a dynamic search help with select options in a selection screen. My requirement is = displaying vbap-posnr ('item no') based on the first field vbak-vbeln (sales order).

 

 

if i input sales-order-low without sales-order-high, I should get item values belonging to only sales-order-low and viceversa.

 

 

Similarly, if I give a range in select-options, all the items belonging to that sales order should be displayed.

 

 

Below is the code that I have given, but it does not give any values. Need help with this code to achive my requirementt.

 

 

 

 

 

 

tables: vbak, vbap.

 

 

 

 

TYPES: BEGIN OF ty_vbap,

       vbeln type vbak-vbeln,

       posnr type vbap-posnr

       END OF ty_vbap.

*--------------------------------------------------------------*

*Data Declaration

*--------------------------------------------------------------*

DATA: gwa_posnr      TYPE ty_vbap,

      gt_posnr       TYPE TABLE OF ty_vbap.

DATA: gt_return      TYPE TABLE OF ddshretval,

      gwa_return     TYPE ddshretval.

DATA: gwa_dynpfields TYPE dynpread,

      gt_dynpfields  TYPE TABLE OF dynpread.

DATA: gv_vbeln       TYPE vbak-vbeln.

*--------------------------------------------------------------*

*Selection-Screen

*--------------------------------------------------------------*

SELECT-OPTIONS: SLS_OR TYPE VBAK-VBELN.

PARAMETERS: ITEM_NO TYPE VBAP-POSNR.

 

 

*--------------------------------------------------------------*

*Selection-Screen on Value-Request

*--------------------------------------------------------------*

AT SELECTION-SCREEN ON VALUE-REQUEST FORITEM_NO.

 

 

  REFRESH gt_dynpfields.

 

 

  gwa_dynpfields-fieldname = 'SLS_OR-LOW'.

  APPEND gwa_dynpfields TO gt_dynpfields.

 

 

*Get plant value on the selection screen

  CALL FUNCTION 'DYNP_VALUES_READ'

    EXPORTING

      dyname               = sy-repid

      dynumb               = sy-dynnr

    TABLES

      dynpfields           = gt_dynpfields

    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.

 

 

  READ TABLE gt_dynpfields INTO gwa_dynpfields

         WITH KEY fieldname = 'SLS_OR-LOW'.

  IF sy-subrc = 0.

    gv_VBELN = gwa_dynpfields-fieldvalue.

  ENDIF.

 

 

*Get values from the database based on plant

  SELECT a~VBELN

         b~POSNR

        

         INTO TABLE gt_POSNR

         FROM VBAK AS a

         INNER JOIN VBAP AS b

         ON a~VBELN = b~VBELN

         WHERE B~POSNR = GV_VBELN.

         

 

 

  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

    EXPORTING

      retfield        = 'POSNR'

      value_org       = 'S'

      DYNPROFIELD = 'SLS_OR-LOW'

    TABLES

      value_tab       = gt_POSNR

      return_tab      = gt_return

    EXCEPTIONS

      parameter_error = 1

      no_values_found = 2

      OTHERS          = 3.

 

 

  READ TABLE gt_return INTO gwa_return INDEX 1.

  IF sy-subrc = 0.

    ITEM_NO = gwa_return-fieldval.

  ENDIF.


Viewing all articles
Browse latest Browse all 8944

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>