Unable to Update data in Ztable (dbase) through Table Control.
Hi Experts.
I am able to pull dta from Ztable into table control and also able to insert a new line and delete a row from table control. But after trying a lot I am unbale to pass the same from Table control to Ztable.
Any ideas. Seems like here Update of Ztable needs some different treatment.
PLZ LOOK into the code in red only. rest are for reference.
The code on the Flow Logic Screen:
PROCESS BEFORE OUTPUT.
module init_100.
LOOP At it_auftrag1 with CONTROL tctrl1 cursor tctrl1-current_line.
ENDLOOP.
PROCESS AFTER INPUT.
LOOP AT it_auftrag1.
Module modify_it_auftrag1.
ENDLOOP.
MODULE fcode_100.
MODULE USER_COMMAND_9000.
The code on main Screen (Mod. Pool Screen ) follows:
PROGRAM SAPMZDEMO_MPOOL_06.
TABLES: ZLT_Auftrag1, ZLT_Kunde.
DATA: fcode2(4), fcode(4). "OK_Code.
CONTROLS : tctrl1 type TABLEVIEW USING SCREEN '9000'.
DATA: col TYPE cxtab_column.
DATA: demo_cprop, demo_tprop.
DATA: Begin Of it_Auftrag1 occurs 20,
marked.
include structure ZLT_auftrag1.
DATA: END OF it_Auftrag1.
DATA: linno TYPE i.
DATA: fld(20).
DATA: off TYPE i.
module fcode_100 input.
endmodule. " fcode_100 INPUT
module modify_it_auftrag1 input.
modify it_Auftrag1 index tctrl1-current_line.
endmodule. " modify_it_auftrag1 INPUT
module init_100 output.
set pf-status 'ZSTATUS01'.
Describe Table it_auftrag1 lines tctrl1-lines. "TO add Scroll Bar to Table Control1
UPDATE ZLT_Auftrag1 From it_auftrag1.
endmodule. " init_100 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.
Select *
From ZLT_Auftrag1
INTO Corresponding fields of TABLE it_auftrag1
Where A3 = ZLT_Kunde-K2.
ENDIF.
ELSE.
MESSAGE S000(8i) With 'Enter Kunde Name'.
ENDIF.
when 'DELL'.
* remove marked lines
delete it_auftrag1.
loop at it_auftrag1 where marked = 'X'.
UPDATE ZLT_Auftrag1 From it_auftrag1.
endloop.
if sy-subrc <> 0.
get cursor field fld line linno offset off.
set cursor field fld line linno offset off.
if fld cp 'IT_auftrag1*' and sy-subrc = 0.
linno = linno + tctrl1-top_line - 1.
delete it_auftrag1 index linno.
tctrl1-lines = tctrl1-lines - 1.
endif.
endif.
When 'INSL'.
* insert line above cursor position
get cursor field fld line linno offset off.
set cursor field fld line linno offset off.
if fld cp 'IT_auftrag1*' and sy-subrc = 0.
if linno >= 1.
linno = linno + tctrl1-top_line - 1.
clear it_auftrag1.
insert it_auftrag1 index linno.
tctrl1-lines = tctrl1-lines + 1.
else.
clear it_auftrag1.
append it_auftrag1.
tctrl1-lines = tctrl1-lines + 1.
endif.
endif.
When 'SAVE'.
loop at it_auftrag1 where marked = 'X'.
* Modify it_Auftrag1.
Modify ZLT_Auftrag1 From it_Auftrag1.
Endloop.
IF sy-subrc = 0.
MESSAGE s000(8i) With 'Data Saved'.
ENDIF.
When 'BACK'.
Leave Program.
When 'OK_CLEAR'.
Clear : ZLT_KUNDE, ZLT_AUFTRAG1, it_auftrag1.
ENDCASE.
endmodule. " USER_COMMAND_9000 INPUT
Looking forward for your advice,
Regards
Chandan
Hi Venkat,
Thanks again. I will try ur suggestion too. In the meanwhile I did the following changes in the code:
Purpose: After data is getting pulled from dbase table (ZLT_Auftrag1) into internal table it_auftrag1 then and just after I press the button delete ( i.e. When the user command starts: When 'DELL' )
then I delete all the contents reflecting in it_auftrag1 from ZLT_Auftrag1, Now the Ztable is empty but it_auftrag1 holds all values. futher when loop starts then the Marked line gets deleted. Now at this stage the it_Auftrag1 contains all data of ZLT_auftrag1 except the line that I want to delete. If I am able to MODIFY the ZLT_auftrag1 from it_Auftrag1 at this stage then ZLT_Auftrag1 will again be populated with all those data except the line that I want to delete.
Here goes the code that I modified ( ref the code in my 1st post in red to compare)
WHEN 'DELL'.
* remove marked lines
* If it_Auftrag1-Marked = 'X'.
DELETE from ZLT_Auftrag1 where A3 = ZLT_kunde-K2.
* ENDIF.
IF sy-subrc = 0.
loop at it_auftrag1 where marked = 'X'.
DELETE it_auftrag1.
* INSERT ZLT_Auftrag1 From TABLE it_auftrag1 accepting duplicate keys.
* UPDATE ZLt_auftrag1 from TABLE it_auftrag1.
* MODIFY ZLT_Auftrag1 From TABLE it_auftrag1.
endloop.
* INSERT ZLT_Auftrag1 From TABLE it_auftrag1.
* UPDATE ZLt_auftrag1 from TABLE it_auftrag1.
* MODIFY ZLT_Auftrag1 From TABLE it_auftrag1.
* If sy-subrc = 0.
* MESSAGE S000(8i) With 'Data Deleted from Database'.
* ENDIF.
ENDIF.
MODIFY ZLT_Auftrag1 from it_Auftrag1. ==> This modification doesn't works.
If sy-subrc = 0.
MESSAGE S000(8i) With 'Data Deleted from Database'.
ENDIF.
if sy-subrc <> 0.
get cursor field fld line linno offset off.
set cursor field fld line linno offset off.
if fld cp 'IT_auftrag1*' and sy-subrc = 0.
linno = linno + tctrl1-top_line - 1.
delete it_auftrag1 index linno.
tctrl1-lines = tctrl1-lines - 1.
endif.
endif.
Looking forward for your suggestions.
Regards
Chandan
Similar Messages
-
Regarding updating data into ztable
hi all,
When i am updating data into ztable .
Old record is deleted and new record is created
What will be the problem.
Please suggest.
Regards
RamiHi,
pz use ur syntax this way.
UPDATE zo9_user_status
SET sub_date = sy-datum
sub_time = sy-uzeit
status = g_wa_outtab-status
WHERE representative = g_wa_outtab-representative AND
selection_id = g_wa_outtab-selection_id AND
sub_date = g_wa_outtab-sub_date AND
sub_time = g_wa_outtab-sub_time AND
superior = g_wa_outtab-superior.
IF sy-subrc EQ 0.
COMMIT WORK.
l_error = 'X1'.
ELSE.
l_error = 'X2'.
CLEAR l_error.
ROLLBACK WORK.
ENDIF.
hope this helps.
thanx. -
How can i update data in okc_k_items and csi_item_instances tables?
by EBS .
Thanks.For csi_item_instances table, you can use the following API:
CSI_ITEM_INSTANCE_PUB.UPDATE_ITEM_INSTANCE
For okc_k_items, try using the following API:
OKC_CONTRACT_ITEM_PUB.UPDATE_CONTRACT_ITEM
Hope this helps! -
How to show data through table control
Hi Experts,
I have created an table control through wizard using table EKKO.
I have to populate one internal table( type ekko ), and then show it in output through table control.
Please advise, how to do that and in where i have to write the codes.
I will reward points for every suggestion
Thanks in advance.
regardshi saubrab,
This is kiran kumar.G.I am sending some sample code to populate data into table control check it once.
i will give input in 100 screen. and display table control in 200 screen.check it once once ..ok....
SE38 :(CODE)
*& Module pool YMODULEPOOL_TABLECONTROL1 *
*& DEVELOPER : KIRAN KUMAR.G *
*& PURPOSE : TABLE CONTROL DEMO *
*& CREATION DT : 17/12/2007 *
*& T.CODE : YMODTABLECONTROL1 *
*& REQUEST : ERPK900035 *
PROGRAM ymodulepool_tablecontrol1.
Tables
TABLES: yvbap, "Sales Document: Item Data
vbak. "Sales Document: Header Data
Controls
CONTROLS: my_table TYPE TABLEVIEW USING SCREEN 200.
Global Variables
DATA: gv_lines TYPE i,
gv_lines1 type i,
gv_temp type i,
gv_flag(20) TYPE c VALUE 'DISP',
gv_mode1 TYPE c,
gv_mode TYPE c VALUE 'C'. " C: Change, D :Display
Internal Table
DATA: BEGIN OF gt_item OCCURS 0,
vbeln LIKE vbap-vbeln, "Sales Document Number
posnr LIKE vbap-posnr, "Sales Document Item
matnr LIKE vbap-matnr, "Material Number
matkl LIKE vbap-matkl, "Material Group
arktx LIKE vbap-arktx, "Short Text for Sales Order Item
cflag, "Deletion Indicator
END OF gt_item.
*& Module STATUS_0100 OUTPUT
text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'ZTABLECONTROL' OF PROGRAM 'YMODULEPOOL_TABLECONTROL'.
SET TITLEBAR 'xxx'.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
text
MODULE user_command_0100 INPUT.
CASE sy-ucomm.
WHEN 'DISP'.
SELECT single vbeln
erdat
angdt
bnddt
FROM vbak
INTO (vbak-vbeln,vbak-erdat,
vbak-angdt,vbak-bnddt)
WHERE vbeln = vbak-vbeln.
IF sy-subrc EQ 0.
*Fetch the table control data and place them in Internal Table
SELECT vbeln
posnr
matnr
matkl
arktx
FROM yvbap
INTO TABLE gt_item
WHERE vbeln = vbak-vbeln.
IF sy-subrc EQ 0.
*NO OF line in the Internal Table
DESCRIBE TABLE gt_item LINES gv_lines.
my_table-lines = gv_lines + 20.
ENDIF.
ENDIF.
*Call Screen 200.
SET SCREEN 200.
WHEN 'EXIT' OR 'BACK' OR 'CANCEL'.
*Exit from the Program
CALL TRANSACTION 'SESSION_MANAGER'.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
module STATUS_0200 output.
SET PF-STATUS 'ZTABLECONTROL1'.
endmodule. " STATUS_0200 OUTPU
*& Module copy_data OUTPUT
text
module copy_data output.
*Fetch the current line data from the Table control
read table gt_item index my_table-current_line.
if sy-subrc eq 0.
*Populating data into screen fields
gt_item-vbeln = gt_item-vbeln.
gt_item-posnr = gt_item-posnr.
gt_item-matnr = gt_item-matnr.
gt_item-matkl = gt_item-matkl.
gt_item-arktx = gt_item-arktx.
endif.
SE51:CODE (SCREEN 100)
PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.
PROCESS AFTER INPUT.
MODULE USER_COMMAND_0100.
SE51 :CODE (SCREEN 200)
PROCESS BEFORE OUTPUT.
MODULE STATUS_0200.
loop at gt_item with control my_table cursor my_table-current_line.
module copy_data.
endloop.
PROCESS AFTER INPUT.
loop at gt_item.
MODULE USER_COMMAND_0200.
endloop.
HAVE A NICE DAY..
Award points if helpful,kiran kumar.G -
I'm new to VS. I have run the following code. It does not produce any error, and it does not add or update data to my Access database table.
dbUpdate("UPDATE prgSettings SET varValue='test' WHERE varSetting='test'")
Function dbUpdate(ByVal _SQLupdate As String) As String
Dim OleConn As New OleDbConnection(My.Settings.DatabaseConnectionString.ToString)
Dim oleComm As OleDbCommand
Dim returnValue As Object
Dim sqlstring As String = _SQLupdate.ToString
Try
OleConn.Open()
MsgBox(OleConn.State.ToString)
oleComm = New OleDbCommand(sqlstring, OleConn)
returnValue = oleComm.ExecuteNonQuery()
Catch ex As Exception
' Error occurred while trying to execute reader
' send error message to console (change below line to customize error handling)
Console.WriteLine(ex.Message)
Return 0
End Try
MsgBox(returnValue)
Return returnValue
End Function
Any suggestions will be appreciated.
Thanks.You code looks pretty good, at a quick glance. Maybe you can simplify things a bit.
For Insert, please see these samples.
http://www.java2s.com/Code/CSharp/Database-ADO.net/Insert.htm
For Update, please see these samples.
http://www.java2s.com/Code/CSharp/Database-ADO.net/Update.htm
Knowledge is the only thing that I can give you, and still retain, and we are both better off for it.
Best to keep samples here to VB.NET
Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. -
Unable to load data / NullReferenceException only on certain tables when deployed
I have a LightSwitch app that works fine when being debugged locally. But it has a strange issue when deployed as a Cloud Service to Azure. I have two Silverlight grid controls on the page which display a red x and give the error, "Unable to load data.
Please check your network connection and try loading again."
Several other queries are running on this page and correctly pull data from other tables in the database. The queries that run correctly are tied to label or text box controls.
The queries that fail, return an HTTP Status code 500 (Internal error). If I try and pass the query to a constructor as an IVisualCollection,
and I wrap the call in a Try block,
the Inner Exception is "Object reference not set to an instance of an object." So, a Null Reference Exception. Checking for null before the constructor call and popping up a message box if the query was null as a means of debugging yielded nothing. I
create these helpers all over. Only two are causing an issue and only when deployed. In addition, running the query in the Management Portal also completes fine.
Try
'Check for nulls
If (Me.qQuoteByFirm Is Nothing) Then
Me.ShowMessageBox("qQuoteByFirm", "Error", MessageBoxOption.Ok)
End If
If (Me.qQuoteByFirm.Screen Is Nothing) Then
Me.ShowMessageBox("Screen", "Error", MessageBoxOption.Ok)
End If
If (New ModalWindowHelper(Me.qQuoteByFirm, "mwAddQuote", "Quote") Is Nothing) Then
Me.ShowMessageBox("Modal", "Error", MessageBoxOption.Ok)
End If
'Create helper
Me.HelperAddQuote = New ModalWindowHelper(Me.qQuoteByFirm, "mwAddQuote", "Quote")
Catch ex As Exception
Dim err As String = ""
For Each item In ex.Data
err = err & item.ToString()
Next
err = err & ex.InnerException.ToString() & vbCrLf & _
ex.Message.ToString() & vbCrLf & _
ex.StackTrace
Me.ShowMessageBox(err, "Error", MessageBoxOption.Ok)
End Try
'Constructor
Public Sub New(ByVal visualCollection As IVisualCollection, _
ByVal dialogName As String, _
Optional entityName As String = "")
_collection = visualCollection
_dialogName = dialogName
_entityName = If(entityName <> "", entityName, _collection.Details.GetModel.ElementType.Name)
_screen = _collection.Screen
End Sub
The actual construction of the queries does not seem to matter. I've tried several variations along with requesting the entire table. Same result. However, this only occurs on two specific tables. Grid controls displaying other tables on other screens work
properly.
Here's the weird part. If I comment out the call to the constructor, I can gain access to the gird control and add data to it even through the red box remains. If I refresh the grid control, the data disappears as if it wasn't saved or isn't there. But inspecting
the table in SQL Azure Management Portal shows that the data was properly populated in the table.
The app and the database are clearly connected and able to communicate fine. So why when reading from these two tables (but not writing to) are my grid controls throwing exceptions? Why does this only happen when deployed? What other techniques can I use to
get more information?I am not very familiar with Lightswtich. But 500 is a server side error. Do you manually code the server side, or does Lightswitch automatically generates the server side code? If you manually coded, then please try to catch exceptions in
your server side code. If the code is automatically generated, you may want to consult a Lightswitch forum on how to troubleshooting such issues. What's more, when you refresh the grid, what code are invoked? Try to check that piece of code and see if there're
any problems, such as you reload the grid with empty data. -
BADI for MIGO update - Data not getting saved in table sometimes
Hi,
This is regarding automatic update of material document number to our Z Table for Gate entry in MM.
Steps for Generating GR throu2019 MIGO:-
1) the user has to key in the gate entry number and plant,
2) then after giving i/p values the user has to click the save button,
3) MIGO number is generated by the system which is updated in gate entry header table.
For updating the MIGO number BADI is used . But some time the system is not updating the GR number in gate entry header table.
Can we use COMMIT WORK statement in BADI? Hope its not advisable to use it.
What else can we do if data is not getting stored in table while updating throu2019 BADI?
Inside the Method : IF_EX_MB_MIGO_BADI~POST_DOCUMENT the below code is written,
Instead Of Updating The Gate Entry Item Table Now
Update The Gate Entry Header Table. Update The
Value Of The Field MBLNR With Current Document Number
Generated Updating the header table ZMM_GATE_ENTRY
SELECT SINGLE *
FROM ZMM_GATE_ENTRY
INTO WA_ZMM_GATE_ENTRY
WHERE GATEENTRYNO EQ GS_EXDATA_HEADER-GATEENTRYNO
AND WERKS EQ GS_EXDATA_HEADER-WERKS
AND GYEAR EQ GS_EXDATA_HEADER-ENTRY_DATE+0(4).
Check To Ensure That Once A Gate Entry Number
Is Associated With A GR It Cannot Be Reused
IF WA_ZMM_GATE_ENTRY-GR_NUMBER IS INITIAL.
WA_ZMM_GATE_ENTRY-REFERENCE = GS_EXDATA_HEADER-REFERENCE.
WA_ZMM_GATE_ENTRY-REFWERKS = GS_EXDATA_HEADER-WERKS.
WA_ZMM_GATE_ENTRY-GR_NUMBER = IS_MKPF-MBLNR.
WA_ZMM_GATE_ENTRY-GR_YEAR = IS_MKPF-MJAHR.
MODIFY ZMM_GATE_ENTRY FROM WA_ZMM_GATE_ENTRY .u201Dupdating the workarea
u201CThe above modify stmt updates data sometimes and does not updates the data sometimes
ELSE.
MESSAGE E901(ZMM) WITH GS_EXDATA_HEADER-GATEENTRYNO WA_ZMM_GATE_ENTRY-GR_NUMBER.
ENDIF.
Plz suggest some soln?
Regards,
P.S.ChitraHi,
This is regarding automatic update of material document number to our Z Table for Gate entry in MM.
Steps for Generating GR throu2019 MIGO:-
1) the user has to key in the gate entry number and plant,
2) then after giving i/p values the user has to click the save button,
3) MIGO number is generated by the system which is updated in gate entry header table.
For updating the MIGO number BADI is used . But some time the system is not updating the GR number in gate entry header table.
Can we use COMMIT WORK statement in BADI? Hope its not advisable to use it.
What else can we do if data is not getting stored in table while updating throu2019 BADI?
Inside the Method : IF_EX_MB_MIGO_BADI~POST_DOCUMENT the below code is written,
MODIFY ZMM_GATE_ENTRY FROM WA_ZMM_GATE_ENTRY .u201Dupdating the workarea
u201CThe above modify stmt in code updates data sometimes and does not updates the data sometimes
Moderator message: duplicate post locked.
Edited by: Thomas Zloch on Aug 10, 2010 11:33 AM -
Insert into ztable through table control
hai
i have taken the table control in the screen painter .
n i have enter the data in table control
now i like to append the dat into table
plz helpme need the codeRefer the link -
Update internal table data from table control
Transfer data from table control to internal table
Regards,
Amit
Reward all helpful replies. -
Updating custom table through table control in module pool
Hi
I am entering a data in the module pool screen in a table control . The functionality is that whatever i enter in a row gets updated in a custom table in the database with the same values . My problem is that when i enter some values and press the save button on the module pool screen , the data gets updated on the table but gets invisible from the module pool screen . The user wants the data to be displayed even after it has been saved ..if anyone can help on this ...
thankshi,
Check whether u have activated the report and screen. -
Update database table through table control
Dear friends
i have to update entered data in table control to data base table please suggest some modification in my coding for the same
following is my coding
report zrb_ins_data.
data wa_tmp_rebset type zrb_hed.
data wa_tmp_rebset1 type zrebate_items.
types:begin of st_hdr,
bukrs type zrb_hed-bukrs,
sch_typ type zrb_hed-sch_typ,
sch_desc type zrb_hed-sch_desc,
sch_no type zrb_hed-sch_no,
vtweg type zrb_hed-vtweg,
vkorg type zrb_hed-vkorg,
vkbur type zrb_hed-vkbur,
vkgrp type zrb_hed-vkgrp,
spart type zrb_hed-spart,
regio type zrb_hed-regio,
ort02 type zrb_hed-ort02,
ort01 type zrb_hed-ort01,
kunnr type zrb_hed-kunnr,
konzs type zrb_hed-konzs,
matkl type zrb_hed-matkl,
matnr type zrb_hed-matnr,
lifsk type zrb_hed-lifsk,
shtyp type zrb_hed-shtyp,
from_date type zrb_hed-from_date,
to_date type zrb_hed-to_date,
hkont type zrb_hed-hkont,
aufnr type zrb_hed-aufnr,
end of st_hdr.
types : begin of st_itm,
item_id type zrebate_items-sch_no,
sch_no type zrebate_items-sch_no,
from_dat type zrebate_items-from_dat,
to_dat type zrebate_items-to_dat,
type type zrebate_items-type,
qty_per_rate type zrebate_items-qty_per_rate,
key1 type zrebate_items-key1,
curr_com type zrebate_items-curr_com,
key2 type zrebate_items-key2,
qty_per_rate1 type zrebate_items-qty_per_rate1,
curr_com1 type zrebate_items-curr_com1,
end of st_itm.
data:it_hdr type table of st_hdr with header line,
wa_hdr type st_hdr,
it_itm type table of st_itm with header line,
wa_itm type st_itm.
controls ztbl type tableview using screen 1000.
*CALL SCREEN 1000.
*& Module STATUS_1000 OUTPUT
text
module status_1000 output.
set pf-status 'SYMBOL'.
set titlebar 'xxx'.
endmodule. " STATUS_1000 OUTPUT
*& Module USER_COMMAND_1000 INPUT
text
*module USER_COMMAND_1000 input.
*& Module get_data OUTPUT
text
*& Module user_command_1000 INPUT
text
module user_command_1000 input.
case sy-ucomm.
when 'EXEC'.
perform get_data.
endcase.
endmodule
*& Form GET_DATA
text
--> p1 text
<-- p2 text
form get_data .
move-corresponding wa_hdr to wa_tmp_rebset.
modify zrb_hed from wa_tmp_rebset.
move-corresponding wa_itm to wa_tmp_rebset1.
wa_tmp_rebset1-item_id = 'TS1234'.
wa_tmp_rebset1-sch_no = wa_hdr-sch_no.
wa_tmp_rebset1-from_dat = wa_itm-from_dat.
wa_tmp_rebset1-to_dat = wa_itm-to_dat.
append wa_itm to it_itm.
modify zrebate_items from wa_tmp_rebset1.
endform.hi,
Refer to this link...you'll get the idea..
how to update dbtab from table control?
Re: How to update a DB from a table control.
Edited by: avinash kodarapu on Dec 27, 2008 12:36 PM -
Uploading data from flat file to table control
HI All,
I want to upload data to OVKK tcode using BDC. For this I wrote Z program as shown below:
REPORT ZSD_BDC_OVKK_UPLOAD
NO STANDARD PAGE HEADING LINE-SIZE 255.
*INCLUDE bdcrecx1.
DATA : BEGIN OF T_DUMMY OCCURS 0,
VAR(100) TYPE C,
END OF T_DUMMY.
DATA: BEGIN OF ITAB OCCURS 0,
KALSM(10) TYPE C,
* KARTV(10) TYPE C,
VKORG(4) TYPE C,
VTWEG(2) TYPE C,
SPART(2) TYPE C,
KALVG(1) TYPE C,
KALKS(1) TYPE C,
KALSM(6) TYPE C,
KARTV(4) TYPE C,
END OF ITAB.
DATA : IT_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE,
IT_BDCMSGCOLL LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
DATA : v_filename TYPE string.
PARAMETER : filename LIKE rlgrap-filename OBLIGATORY.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR filename.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
field_name = filename
CHANGING
file_name = filename.
START-OF-SELECTION.
v_filename = filename.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = v_filename
filetype = 'ASC'
has_field_separator = 'X'
TABLES
data_tab = T_DUMMY.
LOOP AT T_DUMMY.
ITAB-VKORG = T_DUMMY-VAR+0(4).
ITAB-VTWEG = T_DUMMY-VAR+5(2).
ITAB-SPART = T_DUMMY-VAR+8(2).
ITAB-KALVG = T_DUMMY-VAR+11(1).
ITAB-KALKS = T_DUMMY-VAR+13(1).
ITAB-KALSM = T_DUMMY-VAR+15(6).
ITAB-KARTV = T_DUMMY-VAR+22(4).
APPEND ITAB.
ENDLOOP.
DATA: FNAM(20) TYPE C,
IDX TYPE C.
MOVE 1 TO IDX.
LOOP AT ITAB.
REFRESH IT_BDCDATA.
PERFORM bdc_dynpro USING 'SAPML080Z' '0100'.
PERFORM bdc_field USING 'BDC_CURSOR'
'V_T683V-KALSM(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=NEWL'.
PERFORM bdc_dynpro USING 'SAPML080Z' '0100'.
PERFORM bdc_field USING 'BDC_CURSOR'
'V_T683V-VKORG(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=SAVE'.
CONCATENATE 'V_T683V-KALSM(' IDX ')' INTO FNAM.
PERFORM bdc_field USING FNAM
itab-kalsm.
CONCATENATE 'V_T683V-KARTV(' IDX ')' INTO FNAM.
PERFORM bdc_field USING FNAM
itab-kartv.
CONCATENATE 'V_T683V-VKORG(' IDX ')' INTO FNAM.
PERFORM bdc_field USING FNAM
itab-vkorg.
CONCATENATE 'V_T683V-VTWEG(' IDX ')' INTO FNAM.
PERFORM bdc_field USING FNAM
itab-vtweg.
CONCATENATE 'V_T683V-SPART(' IDX ')' INTO FNAM.
PERFORM bdc_field USING FNAM
itab-spart.
CONCATENATE 'V_T683V-KALVG(' IDX ')' INTO FNAM.
PERFORM bdc_field USING FNAM
itab-kalvg.
CONCATENATE 'V_T683V-KALKS(' IDX ')' INTO FNAM.
PERFORM bdc_field USING FNAM
itab-kalks.
PERFORM bdc_dynpro USING 'SAPLSTRD' '0300'.
PERFORM bdc_field USING 'BDC_CURSOR'
'KO008-TRKORR'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=LOCK'.
PERFORM bdc_field USING 'KO008-TRKORR'
'D47K919377'.
PERFORM bdc_field USING 'BDC_CURSOR'
'V_T683V-VKORG(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'BDC_CURSOR'
'V_T683V-VKORG(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=SAVE'.
CALL TRANSACTION 'OVKK' USING IT_BDCDATA
MODE 'A'
UPDATE 'S'
MESSAGES INTO IT_BDCMSGCOLL.
IDX = IDX + 1 .
endloop.
FORM BDC_DYNPRO USING PROG SCR.
CLEAR IT_BDCDATA.
IT_BDCDATA-PROGRAM = PROG.
IT_BDCDATA-DYNPRO = SCR.
IT_BDCDATA-DYNBEGIN = 'X'.
APPEND IT_BDCDATA.
ENDFORM.
FORM BDC_FIELD USING FNAM FVAL.
CLEAR IT_BDCDATA.
IT_BDCDATA-FNAM = FNAM.
IT_BDCDATA-FVAL = FVAL.
APPEND IT_BDCDATA.
ENDFORM.
I checked in debugging mode and found that data is passed to internal table but its not uploading data to OVKK, there no data is displayed.
Please tell me solution for this.....
regards,
ravindra.Hi,
Look at the following link you will find some good example of Table control.
http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm
Here you need to take care to which line of table control you are populating the data.
Make sure to take care of page down in table control.
*********Try Call Transaction in MODE 'N'.
Check your OK_CODE once again.
Try to give BACk also after saving.
The Table control is mainly used to update no.of line items at one shot. No need to come BACK for each and every record.
Try to do recording in SHDB once again and see the changes closely.
Thanks.
If this helps you reward with points.
Message was edited by: KDeepak
Message was edited by: KDeepak -
ME51N update MPN Material field in the table control
Hi Gurus,
My requirement is to update the field MPN Material in the table control of tcode ME51N as soon as i enter the material this field should get updated.
Please give me suggestions.
Regards,
Milindplease see the link ...in this the datefields also included in the table control of the
Screen program .... how the fields are populated in the table using wizard ..
<a href="http://">http://www.sapdevelopment.co.uk/dialog/tabcontrol/tc_basic.htm</a>
reward points if it is usefull ....
Girish -
How to display a table data on Screen having a Table control
Hi ,
I am new to ABAP.I would like to display a table data (Eg: ZDemo) on a screen at run time.I have defined a Table control in screen. Now I want to populate data from ZDemo to table control.How can I do that?Please help moving forward in this regard.Hi Gayatri,
After creating table control do the following steps.
1. In the flow logic section write the following code:
PROCESS BEFORE OUTPUT.
MODULE STATUS_0200.
LOOP AT I_LIKP WITH CONTROL LIKP_DATA CURSOR LIKP_DATA-CURRENT_LINE.
MODULE ASSIGN_DATA.
ENDLOOP.
PROCESS AFTER INPUT.
MODULE USER_COMMAND_0200.
LOOP AT I_LIKP.
ENDLOOP.
I_LIKP is the internal table which is used to display table data in the table control.
2. In Process Before Output, in the module STATUS_0200 write the following code:
DESCRIBE TABLE I_LIKP LINES FILL.
LIKP_DATA-LINES = FILL.
In Process After Input, in the module USER_COMMAND_0200 write the following code:
CASE SY-UCOMM.
WHEN 'LIPS'.
READ TABLE I_LIKP WITH KEY MARK = 'X'.
SELECT VBELN
POSNR
WERKS
LGORT
FROM LIPS
INTO TABLE I_LIPS
WHERE VBELN = I_LIKP-VBELN.
IF SY-SUBRC = 0.
CALL SCREEN 200.
ENDIF.
WHEN 'BACK'.
SET SCREEN 200.
ENDCASE.
In Process Before Output and in the module ASSIGN_DATA which is there inside the loop write the following code:
MOVE-CORRESPONDING I_LIKP TO LIKP.
So, Totally your flow logic code should be like this.
TABLES: LIKP, LIPS.
DATA: BEGIN OF I_LIKP OCCURS 0,
VBELN LIKE LIKP-VBELN,
ERNAM LIKE LIKP-ERNAM,
ERZET LIKE LIKP-ERZET,
ERDAT LIKE LIKP-ERDAT,
MARK TYPE C VALUE 'X',
END OF I_LIKP,
BEGIN OF I_LIPS OCCURS 0,
VBELN LIKE LIPS-VBELN,
POSNR LIKE LIPS-POSNR,
WERKS LIKE LIPS-WERKS,
LGORT LIKE LIPS-LGORT,
END OF I_LIPS,
FILL TYPE I.
CONTROLS: LIKP_DATA TYPE TABLEVIEW USING SCREEN 200,
LIPS_DATA TYPE TABLEVIEW USING SCREEN 300.
DATA: COLS LIKE LINE OF LIKP_DATA-COLS.
*& Module USER_COMMAND_0100 INPUT
text
MODULE USER_COMMAND_0100 INPUT.
CASE SY-UCOMM.
WHEN 'LIKP'.
SELECT VBELN
ERNAM
ERZET
ERDAT
FROM LIKP
INTO TABLE I_LIKP
WHERE VBELN = LIKP-VBELN.
IF I_LIKP[] IS INITIAL.
CALL SCREEN 200.
ENDIF.
WHEN 'EXIT'.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Module assign_data OUTPUT
text
MODULE ASSIGN_DATA OUTPUT.
MOVE-CORRESPONDING I_LIKP TO LIKP.
ENDMODULE. " assign_data OUTPUT
*& Module STATUS_0200 OUTPUT
text
MODULE STATUS_0200 OUTPUT.
DESCRIBE TABLE I_LIKP LINES FILL.
LIKP_DATA-LINES = FILL.
ENDMODULE. " STATUS_0200 OUTPUT
*& Module USER_COMMAND_0200 INPUT
text
MODULE USER_COMMAND_0200 INPUT.
CASE SY-UCOMM.
WHEN 'LIPS'.
READ TABLE I_LIKP WITH KEY MARK = 'X'.
SELECT VBELN
POSNR
WERKS
LGORT
FROM LIPS
INTO TABLE I_LIPS
WHERE VBELN = I_LIKP-VBELN.
IF SY-SUBRC = 0.
CALL SCREEN 200.
ENDIF.
WHEN 'BACK'.
SET SCREEN 200.
ENDCASE.
ENDMODULE. " USER_COMMAND_0200 INPUT
Save and Activate the program along with the screen in which you have included table control.
Hope this will help you.
Regards
Haritha. -
How to update data in the database through ALV grid
Hi All,
I diplayed an ALV grid with five fields in a classical report. I have already set the fieldcat for one field as wa_fcat_edit = 'X'. I am able to edit(modify) the data in that field. But I want to update the data into the database which is modified by me in that field. Can I update the data using BDC or any other procedure?
This is an urgent require ment for me. Please help me ASAP.
Thanks & Regards,
Ramesh.Hi
Please go through the link.
Link: [http://www.****************/Tutorials/ALV/Edit/demo.htm]
regards
ravisankar -
Problem in updating Data for infotype P0009 through BADI
Hi,
we are facing a problem while trying to update value of Date field for infotype P0009 through PA30.
we have tried to update by using BADI hrpad00infty, we are providing value in new_innnn structure of method
AFTER_INPUT, but the value is not getting updated for that PARNR.
Can anyone help me regarding the same?Hi
HRPAD00INFTY BADI methods don't allow to modify any values of the current record being processed, but there's a possible wworkaround accessing memory fields using field-symbols:
method IF_EX_HRPAD00INFTY~AFTER_INPUT.
FIELD-SYMBOLS: <fs> type p0009.
assign ('(MP000900)P0009') TO <FS>.
if sy-subrc eq 0.
<FS>-YOURFIELD = YOUR_VALUE.
endif.
endmethod.
Maybe you are looking for
-
Import pdf as rastered image into a c++ application
Hi Everyone, I am developing a commercial application which processes rastered images. Additionally to bitmap formats like BMP and TIFF the application has to be able to load and process PDF-files. The PDFs only contain one page. To make it harder, s
-
Show Places in Gallery or iweb? any way to do it?
I have been playing with places for a while and have put some photographs up on my gallery. The photos are all geo tagged and the location shows up in Long/Lat when you click the info button on the photos but, there does not appear to be anyway to lo
-
dear all one of my method in a session bean(WebSphere) runs very fine when called from ejb but gives error when the same code is written and directly called in jsp file. actually this method saves data in DB2.the method uses a helper class and the fi
-
Upgrading Memory, advice needed
I'm gonna upgrade the RAM on my PowerBook 12' GHz 1, I'm currently debating between two card, however I don't know what the difference is, hence I need some help!!! Which of these two memory cards is better? Why? 1.0 GB RAM PC 2700/PC2100 333 MHZ/ 26
-
Adding additional contraints on a query.
I have a normal datablock containing a 'description' field. I'd like to run a query on the same block but using an 'in description' parameter. Is it possible to change the default query for the block to something else containing this extra parameter?