2010 Sep 29 2:33 PM
Dear All
I have written my program using table control , how do i write code to insert my own button for insert new line in between the captured data in the table control. I'm not using wizard table control.
I have written code to delete one line but its deleting and adding the same line again on the table control.
i have searched on forum and didn't get the answer. Your assistance is appreciated.
Regards
William
2010 Sep 29 2:38 PM
>
> I have written code to delete one line but its deleting and adding the same line again on the table control.
>
Can you post your code, there must be some mistake.
Also you can debug any standard transaction(example add new field in SE11 ztable)
to know how it works during add new line.
Dear All
I have written my program using table control , how do i write code to insert my own button for insert new line in between the captured data in the table control. I'm not using wizard table control.
I have written code to delete one line but its deleting and adding the same line again on the table control.
i have searched on forum and didn't get the answer. Your assistance is appreciated.
Regards
William
2010 Sep 29 2:38 PM
>
> I have written code to delete one line but its deleting and adding the same line again on the table control.
>
Can you post your code, there must be some mistake.
Also you can debug any standard transaction(example add new field in SE11 ztable)
to know how it works during add new line.
2010 Sep 29 2:46 PM
here is my code
PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.
loop at itBOQlinesLT with control TAB_BOQ.
endloop.
MODULE Take.
PROCESS AFTER INPUT.
loop at itBOQlinesLT.
MODULE Deletelines.
MODULE modify_lines.
MODULE TAB_BOQ_MARK.
endloop.
MODULE USER_COMMAND_0100E AT EXIT-COMMAND.
MODULE USER_COMMAND_0100.
if code = 'DEL'.
loop at itBOQlinesLT WHERE SEL = 'X'.
Setting the flag to make the table control in editable mode after
deleting the selected line
flg = 'Y'.
Confirmation of delete
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
TITLEBAR = 'Confirm'
text_question = 'Are you sure to delete this record from the database?'
TEXT_BUTTON_1 = 'Yes'(001)
TEXT_BUTTON_2 = 'No'(002)
IMPORTING
ANSWER = lv_answer.
if lv_answer eq '1'.
Updating the database table from the internal table
UPDATE ZBOQlines FROM TABLE itBOQlinesLT.
Deleting the selected row from the internal table
DELETE itBOQlinesLT WHERE SEL = 'X'.
Deleting the selected row from the database table
DELETE FROM ZBOQlines WHERE SEL = 'X'.
ENDIF.
endloop.
if sy-subrc = 0.
MESSAGE i000(fb) WITH 'Deleted Successfully'.
endif.
ENDIF.
but on inserting a new line i dont know how to do that in a table control.
Regards
William
2010 Sep 29 4:02 PM
Hi,
First delete the row from internal table and then update database table from your internal table...
u are trying to delete the selected row frm database where sel = X
but i think Sel Field is only in ITAB not in DB....
2010 Sep 29 4:43 PM
Hi,
Use the work area to delete the selected row instead of SEL= 'X'.
DELETE FROM ZBOQlines WHERE field1 = itBOQlines-field1.
This should solve the problem i guess.
To insert the line into the table control just get the index you want to insert and use
INSERT itBOQlines INDEX lv_index.
Regards
Kranthi
2010 Sep 29 5:11 PM
Hi
Im using table control without wizard to enter data as its first point of entry and this data is not yet saved in the tables its still on the table control and user has to insert new row or delete before saving the data in the tables.
Regards
William
2010 Sep 29 6:05 PM
Hi,
In PAI, use the below modify statement so that all the values in table control will be updated to internal table.
When user press save just use Modify statement to update the database from internal table.
Loop at itBOQlines.
MODIFY itBOQlines
FROM itBOQlines
INDEX tb_ctrl-current_line.
Endloop.
On Save,
Modify ZBOQlines from table itBOQLines.
Regards,
Kranthi
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |