Dear All,
I am new to ABAP and I am trying to : DELETE, INSERT, SAVE a line (with data) from Table Control to Ztable.
N-B: I already posted my problem here but some1 deleted it. I request the moderator to allow this post to exist till it is correctly replied.
I tried a lot through internet sources, but I am unable to capture the line and delete it. So do let me learn here.
So I have:
Ztable: ZLT_Auftrag1 (Fields A1, A2, A3, A4, P1, P2, P3,)
ZLT_Kunde (Fields: K1, K2)
Relation b/w above two Ztables: A3 = K2
I need to pull data from ZLT_auftrag1 into Table Control when ZLT_kunde input/Output field on the Screen is NOT INITIAL.
How can I do this. Please help me out where I am missing something.
The Codes are as below:
FLOW LOGIC Screen:
PROCESS BEFORE OUTPUT.
LOOP At it_auftrag into ZLT_AUFTRAG1 with CONTROL tctrl1
cursor tctrl1-current_line.
ENDLOOP.
MODULE STATUS_9000.
*
PROCESS AFTER INPUT.
LOOP AT it_auftrag.
ENDLOOP.
Module user_cmd_9000 At EXIT-COMMAND.
MODULE USER_COMMAND_9000.
Mod. Pool Screen Code:
TABLES: ZLT_Kunde, ZLT_Auftrag1,
CONTROLS : tctrl1 type TABLEVIEW USING SCREEN '9000'.
TYPES: Begin Of TY_Auftrag.
TYPES: Sel TYPE Char1, "For row selection
A1 TYPE ZLT_Auftrag1-A1,
A2 TYPE ZLT_Auftrag1-A2,
A3 TYPE ZLT_Auftrag1-A3,
A4 TYPE ZLT_Auftrag1-A4.
TYPES: END OF TY_Auftrag.
DATA: it_auftrag TYPE STANDARD TABLE OF TY_AUFTRAG with header line,
wa_auftrag TYPE ZLT_AUFTRAG1.
module STATUS_9000 output.
SET PF-STATUS 'ZSTATUS01'
Describe Table it_auftrag lines tctrl1-lines. "TO add Scroll Bar to Table Control1.
endmodule. " STATUS_9000 OUTPUT
module USER_COMMAND_9000 input.
CASE sy-ucomm.
****************************************************************************
*To Populate Data into Kunde through Pushbuttons
****************************************************************************
When 'OK_GETK'.
IF ZLT_Kunde-K1 is NOT INITIAL.
SELECT SINGLE *
FROM ZLT_Kunde
Where K1 = ZLT_KUNDE-K1.
IF ZLT_Kunde-K1 is NOT initial. " This popultes data in the Table Control.
Select A1 A2 A3 A4
From ZLT_Auftrag1
INTO Corresponding fields of TABLE it_auftrag
Where A3 = ZLT_Kunde-K2.
ENDIF.
ELSE.
MESSAGE S000(8i) With 'Enter Kunde Name'.
ENDIF.
When 'OK_SAVEK'.
Modify ZLT_Kunde.
IF sy-subrc = 0.
MESSAGE s000(8i) With 'Data Saved'.
ENDIF.
When 'OK_DELETEK'.
IF ZLT_KUNDE-K1 is NOT INITIAL.
DELETE
FROM ZLT_KUNDE
Where K1 = ZLT_KUNDE-K1.
IF sy-subrc = 0.
MESSAGE S000(8i) With 'Data deleted'.
ENDIF.
ENDIF.
*****************************************************************************
*To Populate Data from ZLT_Auftrag to Table Control with Pushbuttons
*****************************************************************************
When 'OK_SAVEA'.
Modify ZLT_Auftrag1 from wa_auftrag .
IF sy-subrc = 0. ==> Here sy-subrc = 0 but ZLT_auftrag1 is not updated. Also the entered data from
the table control line disappears as soon as I hit the Save button.
MESSAGE s000(8i) With 'Data Saved'.
ENDIF.
When 'OK_DELETEA'.
=====> How and what to do here I am not getting any idea.
When 'INSERT'.
======> How to insert a line new line in table control
When 'OK_EXIT'.
Leave Program.
When 'OK_CLEAR'.
Clear : ZLT_KUNDE, ZLT_AUFTRAG1, it_auftrag. ===> Also how to clear contents of the tctcrl1 with the help of 'Ok_Clear' button
ENDCASE.
endmodule. " USER_COMMAND_9000 INPUT
Can any help me out.
Regards
Deepika