banner ads

Autofill selection screen parameter base on values entered in other selection screen parameter.



                       Please click on below link to watch  full video on this topic. 

                                 https://www.youtube.com/watch?v=Plroq9amlTo
      
   

     Here is sample code, you can copy and pasted in your ABAP editor in order to understand this part clearly or you can refer this code to implement your own logic.


                   first screen.




  



REPORT ZTEST_DEMO_AUTOFILL.


Include ZTEST_DEMO_AUTOFILL_Sel.

INCLUDE ztest_demo_autofill_fill_daf01.

at SELECTION-SCREEN OUTPUT.

at SELECTION-SCREEN on VALUE-REQUEST FOR p_budat.

 PERFORM fill_Date_and_autofill.




Inside Include ZTEST_DEMO_AUTOFILL_Sel  write below code..

SELECTION-SCREEN BEGIN OF BLOCK b1.

  PARAMETERS p_budat TYPE budat,
               p_monat TYPE monat,
               p_year  TYPE char04.

  SELECTION-SCREEN END OF BLOCK b1.






Inside  PERFORM fill_Date_and_autofill. write below code.

FORM fill_date_and_autofill .

  DATA lt_dynfield TYPE STANDARD TABLE OF dynpread,
                ls_dynfield TYPE dynpread.

  CALL FUNCTION 'F4_DATE'
    IMPORTING
      select_date                  p_budat
    EXCEPTIONS
      calendar_buffer_not_loadable 1
      date_after_range             2
      date_before_range            3
      date_invalid                 4
      factory_calendar_not_found   5
      holiday_calendar_not_found   6
      parameter_conflict           7
      OTHERS                       8.
  IF sy-subrc <> 0.
* Implement suitable error handling here
  ENDIF.

  ls_dynfield-fieldname 'P_MONAT'.
  ls_dynfield-fieldvalue p_budat+4(2).
  APPEND ls_dynfield TO lt_dynfield.
  CLEAR ls_dynfield.

  ls_dynfield-fieldname 'P_YEAR'.
  ls_dynfield-fieldvalue p_budat+0(4).
  APPEND ls_dynfield TO lt_dynfield.
  CLEAR ls_dynfield.



  CALL FUNCTION 'DYNP_VALUES_UPDATE'
    EXPORTING
      dyname               sy-repid
      dynumb               sy-dynnr
    TABLES
      dynpfields           lt_dynfield
    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.
* Implement suitable error handling here
  ENDIF.

ENDFORM.



Output









No comments