Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

update transparent table

Former Member
0 Likes
3,043

Hi!

can anyone help me out of the situation.

I have two text box designed on screen

for a module pool program----


say for example userid and username.

now whatever user enters on screen

for the two text box userid and username -


it should hit a customised transparent table

maintained in data dictionary and update the

corresponding field in the table.

now how to write the code in the flow logic.

regards

Amit

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,686

Hi Amit,

you can use 'MODIFY' to update the transparent table.

The MODIFY statement either updates a record or insert a record in database table.

If the key field's value matches with the values you want to enter then it will update that record otherwise it inserts a record in database table.

First:- declare a work area of type of that table

e.g. Transparent table name:-Z_TEST_TAB

then declare a work area like this

data: wa_z_test_tab type z_test_tab.

Second:- Populate the work area

wa_z_test_tab-userid = p_userid. (or Text field in your

screen)

wa_z_test_tab-username = p_username.

Now:- use the modify statement

MODIFY Z_TEST_TAB from wa_z_test_tab.

I hope this will help you.

Please give points if it helps you.

5 REPLIES 5
Read only

Former Member
0 Likes
2,686

Hi,

INSERT INTO <dbtab> VALUES <struct> ACCEPTING DUPLICATE KEYS.
  IF sy-subrc = 0.
    MESSAGE I100(zmsg) WITH
    'Data is uploaded to table <Ztable> successfully.'.
  ELSEIF sy-subrc = 4.
    MESSAGE W100(zmsg) WITH
    'Warning: Duplicate Key Entries!'.
  ELSE.
    MESSAGE E100(zmsg) WITH
    'Data uploading has failed. Please check.'.
  ENDIF.

Regards

Adil

Edited by: Syed Abdul Adil on Jun 26, 2008 2:13 PM

Edited by: Syed Abdul Adil on Jun 26, 2008 2:14 PM

Read only

Former Member
0 Likes
2,686

you can use

INSERT INTO <dbtab> FROM <wa>.

Regards,

Swarup.

Read only

Former Member
0 Likes
2,686

REPORT ZDATEDIFF.

SELECTION-SCREEN BEGIN OF SCREEN 500 AS WINDOW TITLE title.

Parameters: p_name like sy-uname,

p_pas like sy-uname lower case.

SELECTION-SCREEN skip 1.

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN COMMENT 2(70) text-001.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN END OF SCREEN 500.

CALL SELECTION-SCREEN '0500' STARTING AT 10 10 ending at 70 14.

data: wa_user type ztable.

AT SELECTION-SCREEN OUTPUT.

loop at screen.

check screen-name eq 'P_PAS'.

move: 1 to screen-invisible.

modify screen.

endloop.

start-of-selection.

if p_pas = 'venkat'.

wa_user-name = p_name.

wa_user-password = p_pas

insert wa_user to zuser.

endif.

Read only

Former Member
0 Likes
2,687

Hi Amit,

you can use 'MODIFY' to update the transparent table.

The MODIFY statement either updates a record or insert a record in database table.

If the key field's value matches with the values you want to enter then it will update that record otherwise it inserts a record in database table.

First:- declare a work area of type of that table

e.g. Transparent table name:-Z_TEST_TAB

then declare a work area like this

data: wa_z_test_tab type z_test_tab.

Second:- Populate the work area

wa_z_test_tab-userid = p_userid. (or Text field in your

screen)

wa_z_test_tab-username = p_username.

Now:- use the modify statement

MODIFY Z_TEST_TAB from wa_z_test_tab.

I hope this will help you.

Please give points if it helps you.

Read only

Former Member
0 Likes
2,686

thanks ABAPers !!

Tha answers helped a lot.