2008 Feb 09 6:08 AM
Hi Experts
I tried the following coding, but its not working, pls suggest me what could be the reason.
DATA message_wa TYPE vbap.
message_wa-vbeln = '1'.
message_wa-posnr = '10'.
message_wa-ERDAT = '04.07.2006'.
MODIFY vbap FROM message_wa.
Regards
Rajaram
2008 Feb 09 7:00 AM
Hi,
try like this.........
DATA wa_vbap TYPE vbap.
wa_vbap-vbeln = '0000000001'.
wa_vbap-posnr = '000010'.
wa_vbap-erdat = '20060704'.
MODIFY vbap FROM wa_vbap.
IF sy-subrc is initial.
message 'Record updated' type 'S'.
endif.Cheers,
jose.
Hi Experts
I tried the following coding, but its not working, pls suggest me what could be the reason.
DATA message_wa TYPE vbap.
message_wa-vbeln = '1'.
message_wa-posnr = '10'.
message_wa-ERDAT = '04.07.2006'.
MODIFY vbap FROM message_wa.
Regards
Rajaram
2008 Feb 09 7:00 AM
Hi,
try like this.........
DATA wa_vbap TYPE vbap.
wa_vbap-vbeln = '0000000001'.
wa_vbap-posnr = '000010'.
wa_vbap-erdat = '20060704'.
MODIFY vbap FROM wa_vbap.
IF sy-subrc is initial.
message 'Record updated' type 'S'.
endif.Cheers,
jose.
2008 Feb 09 7:14 AM
Hi Jose
Thank you very much, Now Its working fine yar, can we change all the fields in table including primary key as following this procedure.
pls advise me.
2008 Feb 09 7:20 AM
Hi,
All fields except key fields(key is used to identify a reccord right)...............
u can insert a record with a new key.......
Cheers,
jose.
2008 Feb 09 7:23 AM
Ok thank you,
how to insert/delete a new record, pls provide me code.
Regards
Rajaram
2008 Feb 09 7:38 AM
Hi,
DELETE FROM vbap WHERE vbeln = '0000000001' AND posnr = '000010'.OR
DATA wa_vbap TYPE vbap.
wa_vbap-vbeln = '0000000001'.
wa_vbap-posnr = '000010'.
DELETE vbap FROM wa_vbap.OR
DATA it_vbap TYPE STANDARD TABLE OF vbap WITH HEADER LINE.
it_vbap-vbeln = '0000000001'.
it_vbap-posnr = '000010'.
APPEND it_vbap.
it_vbap-vbeln = '0000000001'.
it_vbap-posnr = '000020'.
APPEND it_vbap.
DELETE vbap FROM TABLE it_vbap.
2008 Feb 09 7:04 AM
Hi Rajaram,
Please check this sample code to change the values in VBAP.
&----
*& Report ZFORMS_TEST *
*& *
&----
*& *
*& *
&----
REPORT ZFORMS_TEST .
DATA message_wa TYPE vbap.
data : begin of it_vbap occurs 0.
include structure VBAP.
data : end of it_vbap.
parameters : p_vbeln like vbap-vbeln.
start-of-selection.
clear it_vbap.
select * from vbap
into table it_vbap where vbeln = p_vbeln
and posnr = '10'.
clear it_vbap.
read table it_vbap index 1.
move '20060202' to it_vbap-erdat.
modify it_vbap index 1.
CALL FUNCTION 'DB_UPDATE_TABLE'
EXPORTING
TABLENAME = 'VBAP'
IMPORTING
SQLCODE =
TABLES
INTTAB = it_vbap
EXCEPTIONS
DB_ERROR = 1
NOT_FOUND = 2
WRONG_PARAM = 3
INTERNAL_ERROR = 4
OTHERS = 5
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
else.
write : 'Database updated successfully'.
ENDIF.
Please reward points if useful.
2008 Feb 09 7:32 AM
Hi Raja
For normal ztable, you can use
delete db from table itab.
Here itab should be a internal table and contain the data to be deleted.
or
delete from db where condition.
update db from table itab.
Regards
Pavan
| User | Count |
|---|---|
| 6 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |