2021 Oct 24 8:23 PM
table: z625_user
Screen input field: WA_USER-Username
pushbutton: DEL
Hi all, I am trying to make it so the user can enter a username into a text field that was brought into Layout (called wa_user-username) and press a pushbutton to delete the row from the z625_user table that shares that username in its "Username" field. I am new to this and am having lots of trouble with the logic, this is what I have:
when 'DEL'.
select * from z625_user into wa_user where username = wa_user-username.
endselect.
delete it_user where username = wa_user-username.
table: z625_user
Screen input field: WA_USER-Username
pushbutton: DEL
Hi all, I am trying to make it so the user can enter a username into a text field that was brought into Layout (called wa_user-username) and press a pushbutton to delete the row from the z625_user table that shares that username in its "Username" field. I am new to this and am having lots of trouble with the logic, this is what I have:
when 'DEL'.
select * from z625_user into wa_user where username = wa_user-username.
endselect.
delete it_user where username = wa_user-username.
2021 Oct 24 8:24 PM
Thank you for visiting SAP Community to get answers to your questions. Since you're asking a question here for the first time, I recommend that you familiarize yourself with Community Q&A , as it provides tips for preparing questions that draw responses from our members.
For example, you can:
- outline what steps you took to find answers (and why they weren't helpful)
- share screenshots of what you've seen/done
- make sure you've applied the appropriate tags
- use a more descriptive subject line.
The more details you provide, the more likely it is that members will be able to respond. Feel free to also take our Q&A tutorial Q&A tutorial
Should you wish, you can revise your question by selecting Actions, then Edit.
By adding a picture to your Profile you encourage readers to respond.
2021 Oct 24 9:09 PM
2021 Oct 25 6:48 AM
Your code seems to delete from an internal table, not from a database table,
But see
BR
Horst
2021 Oct 25 10:32 AM
Thank you, could you elaborate on <condition>?
I have tried:
delete from z625_user where username = wa_user-username.
But nothing gets deleted. wa_user-username is the value from the screen that is intended used to identify the row for deletion. What could I be doing wrong if the entered Username matches perfectly with a record's Username field and it doesn't get deleted?
2021 Oct 25 11:18 AM
in debug, did you check the value of SY-SUBRC after the statement DELETE ... ?
2021 Oct 25 3:08 PM
<condition> = any condition behind the where
If nothing gets deleted, either the line doesn't even exist (see Frederic remark about checking sy-subrc by debug) or you check before the commit happens or something rollbacks the deletion before an eventual commit.
Also, be careful with lower case and upper case.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |