Sunday, December 19, 2010
REPORT zvenkat_head MESSAGE-ID zmsg .
*&---------------------------------------------------------------------*
" Declaration part
*&---------------------------------------------------------------------*
TYPES:
BEGIN OF t_t001w,
werks       TYPE t001w-werks,
name1       TYPE t001w-name1,
END OF t_t001w,
t_return_tab  TYPE ddshretval.
DATA:
w_t001w      TYPE t_t001w,
w_return_tab TYPE t_return_tab.
DATA:
i_t001w      TYPE STANDARD TABLE OF t_t001w,
i_return_tab TYPE STANDARD TABLE OF t_return_tab.
*&---------------------------------------------------------------------*
"SELECTION-SCREEN
*&---------------------------------------------------------------------*

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
PARAMETERS :p_werks TYPE t001w-werks,
p_name1 TYPE t001w-name1.
SELECTION-SCREEN END OF BLOCK b1.

*&---------------------------------------------------------------------*
" AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_werks
*&---------------------------------------------------------------------*
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_werks.
PERFORM f4_help_for_palant.

*&---------------------------------------------------------------------*
*&      Form  f4_help_for_palant
*&---------------------------------------------------------------------*
FORM f4_help_for_palant.

DATA:
w_dynpfields TYPE dynpread,
i_dynpfields LIKE STANDARD TABLE OF dynpread.

IF i_t001w[] IS INITIAL.
SELECT werks name1
FROM t001w
INTO TABLE i_t001w.
ENDIF.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
*   DDIC_STRUCTURE         = ' '
retfield               = 'WERKS'
*   PVALKEY                = ' '
dynpprog               = sy-repid
dynpnr                 = sy-dynnr
dynprofield            = 'P_WERKS'
*   STEPL                  = 0
*   WINDOW_TITLE           =
*   VALUE                  = ' '
value_org              = 'S'
*   MULTIPLE_CHOICE        = ' '
*   DISPLAY                = ' '
*   CALLBACK_PROGRAM       = ' '
*   CALLBACK_FORM          = ' '
*   MARK_TAB               =
* IMPORTING
*   USER_RESET             =
TABLES
value_tab              = i_t001w
*   FIELD_TAB              =
return_tab             = i_return_tab
*   DYNPFLD_MAPPING        =
* EXCEPTIONS
*   PARAMETER_ERROR        = 1
*   NO_VALUES_FOUND        = 2
*   OTHERS                 = 3
.
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 TABLE i_return_tab INTO w_return_tab INDEX 1.
p_werks = w_return_tab-fieldval.
READ TABLE i_t001w INTO w_t001w WITH KEY werks = p_werks.
IF sy-subrc = 0.

w_dynpfields-fieldname    = 'P_NAME1'.
w_dynpfields-fieldvalue   = w_t001w-name1.
APPEND w_dynpfields TO i_dynpfields.
CLEAR w_dynpfields.

CALL FUNCTION 'DYNP_VALUES_UPDATE'
EXPORTING
dyname               = sy-repid
dynumb               = sy-dynnr
TABLES
dynpfields           = i_dynpfields
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.
ENDIF.
ENDFORM.                    " f4_help_for_palant 

0 comments:

Post a Comment

Your useful comments, suggestions are appreciated.Your comments are moderated.

Followers

Contact Form

Name

Email *

Message *

Web Dynpro ABAP Book

An SAP Consultant

Follow US


Want to Contribute ?

If you are interested in writing about the new stuff you learn everyday while working, please write to the.sap.consultants@gmail.com.

Click on Contribution for more details.