Application Development 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: 

How to delete,update and modify for custom table from radio button?

former_member601753
Discoverer
0 Kudos

REPORT ZDEMO12.
tables : zabhi1.
type-pools : truxs,slis.

* Selection screen

PARAMETERS : p_file type rlgrap-filename DEFAULT 'c:\users\abhishek.jagtap\downloads\export_vbap.TXT'.
PARAMETERS: p_update RADIOBUTTON GROUP g1 DEFAULT 'X',
p_delete RADIOBUTTON GROUP g1,
p_modify RADIOBUTTON GROUP g1.
*parameters :
types : begin of ty_zabhi1,
vbeln type zabhi1-vbeln,
posnr type zabhi1-posnr,
matnr type zabhi1-matnr,
matkl type zabhi1-matkl,
makt type zabhi1-makt,
pstyv type zabhi1-pstyv,
kunnr type zabhi1-kunnr,
land1 type zabhi1-land1,
name1 TYPE zabhi1-name1,
ort01 type zabhi1-ort01,
end of ty_zabhi1.

data : it_zabhi1 type STANDARD TABLE OF ty_zabhi1,
wa_zabhi1 type ty_zabhi1,
wa_zabhi type zabhi1
.

data : it_type TYPE truxs_t_text_data.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
* PROGRAM_NAME = SYST-REPID
* DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = 'P_FILE'
* STATIC = ' '
* MASK = ' '
* FILEOPERATION = 'R'
* PATH =
CHANGING
file_name = p_file.

* LOCATION_FLAG = 'P'
* EXCEPTIONS
* MASK_TOO_LONG = 1
* OTHERS = 2
.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.

START-OF-SELECTION.
* Uploading the data in the file into internal table

CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
* I_FIELD_SEPERATOR =
I_LINE_HEADER = 'X'
i_tab_raw_data = it_type
I_FILENAME = p_file
tables
i_tab_converted_data = it_zabhi1[]
EXCEPTIONS
CONVERSION_FAILED = 1
OTHERS = 2
.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.

end-of-SELECTION.



* Uploading the data into the database table

loop at it_zabhi1 into wa_zabhi1.
wa_zabhi-vbeln = wa_zabhi1-vbeln.
wa_zabhi-posnr = wa_zabhi1-posnr.
wa_zabhi-matnr = wa_zabhi1-matnr.
wa_zabhi-matkl = wa_zabhi1-matkl.
wa_zabhi-makt = wa_zabhi1-makt.
wa_zabhi-pstyv = wa_zabhi1-pstyv.
wa_zabhi-kunnr = wa_zabhi1-kunnr.
wa_zabhi-land1 = wa_zabhi1-land1.
wa_zabhi-name1 = wa_zabhi1-name1.
wa_zabhi-ort01 = wa_zabhi1-ort01.
MODIFY zabhi1 FROM wa_zabhi.
Clear : wa_zabhi , wa_zabhi1.
endloop.



LOOP AT it_zabhi1 INTO wa_zabhi1.
write / wa_zabhi1.
ENDLOOP.

3 REPLIES 3

matt
Active Contributor

Is there a question here?

Sandra_Rossi
Active Contributor
0 Kudos

Probably your question is: what ABAP statement should correspond to the UPDATE radio button, what ABAP statement should correspond to the DELETE radio button, and what ABAP statement should correspond to the MODIFY radio button.

Answer : UPDATE, DELETE, MODIFY (respectively)

former_member596005
Participant

What you want to delete or modify or update and on what criteria you want to perform these actions ? moreover radio buttons on your selection screen wont make sense to perform those operations unless you have to select the data and perform those actions .

i can suggest following steps based on my knowledge.

1) first upload your data to your database through excel file.

2) create one module pool program and do your modify,update and delete operations.

Regards ,

Jagadeesh Varma