cancel
Showing results for 
Search instead for 
Did you mean: 

How to insert the data from Web Dyn Pro

Former Member
0 Kudos

Hi.

I want Insert the data from Web Dyn Pro Applications to SAP Data Base Tables.

How it is possible.

Suppose i have Three Fields in the Layout.

I have Insert Button.

When i press INSERT Button then what i entered data in those 3 fields. That data is stored in the Data Base Tables and i want display the message like 'Record is Inserted'.

How it is possible. Explain about this with an Screen Shorts. If possible.

Thank You.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Kirshna,

You just need to read the context carrying user-entered values.

And modify the database table with the context.

See the code below


  DATA node TYPE REF TO if_wd_context_node.
  DATA context_element TYPE REF TO if_wd_context_element.

* navigate from <CONTEXT> to <NODE> via lead selection
  node = wd_context->get_child_node( name = wd_this->nodename ).


* get element via lead selection
  context element = node->get_element(  ).

* @TODO handle not set lead selection
  IF context element IS NOT INITIAL.

    DATA i_table TYPE STANDARD TABLE OF <database _table>.

    node->get_static_attributes_table(
    IMPORTING
      table = i_table ).

    MODIFY <database_table> FROM TABLE i_table.

After this u can show the success message using the Code Wizard.

Please revert back with issues

Regards,

Sumit Oberoi

Answers (1)

Answers (1)

former_member342104
Participant
0 Kudos

DATA : INPUT1 TYPE STRING,

INPUT2 TYPE STRING,

INPUT3 TYPE STRING.

DATA ITAB_DETAIL TYPE STANDARD TABLE OF ZTABLENAME

DATA WA_ITAB TYPE ZTABLENAME

DATA : DETAIL TYPE REF TO IF_WD_CONTEXT_NODE.

DETAIL = WD_CONTEXT->GET_CHILD_NODE( 'NODENAME' ).

DETAIL->GET_ATTRIBUTE( EXPORTING NAME = 'INPUTFIELDATTRIBUTENAME1'

IMPORTING VALUE = INPUT1 ).

DETAIL->GET_ATTRIBUTE( EXPORTING NAME = 'INPUTFIELDATTRIBUTENAME2'

IMPORTING VALUE = INPUT2 ).

DETAIL->GET_ATTRIBUTE( EXPORTING NAME = 'INPUTFIELDATTRIBUTENAME3'

IMPORTING VALUE = INPUT3 ).

WA_ITAB-FIELD1 = INPUT1.

WA_ITAB-FIELD2 = INPUT2.

WA_ITAB-FIELD3 = INPUT3.

APPEND WA_ITAB TO ITAB_DETAILl.

if wa_itab is not initial.

insert into ZTABLE values wa_itab.

if sy-subrc = 0.

msg = 'Record Updated'.

l_current_controller ?= wd_this->wd_get_api( ).

call method l_current_controller->get_message_manager

receiving

message_manager = l_message_manager.

call method l_message_manager->report_success

exporting

message_text = msg

  • PARAMS =

  • MSG_USER_DATA =

.

exit.

endif.

endif.