Update the field VSTAT of table NAST
Hi,
I need change the value of field VSTAT of table NAST in a program for the document don´t print.
How update the table NAST with the new value VSTAT?
Thanks.
OK. 10 points.
Similar Messages
-
How to update the field ZLSPR of table BSEG
HI Friends,
Can anyone tell me how to update the field ZLSPR of table BSEG? I've a 700 line abap program and I should include some logic in this program to make an entry into BSEG-ZLSPR. Is there any FM/BAPI available? Is BDC a healthy approach?. My team lead do not want me to use UPDATE statement....please help.
Thanks in advans,
Varsha.Hi,
Hi ,
You will need to group that radiobuttons so that SAP knows they are linked together. To do this using the grahical layout editor simply select all the radiobuttons and then right click on them, Now choose define group. Once you have done this you should not need any of the "clear" or "='X'" statements SAP should control it all for you.
hope this helps
Reward if found helpfull...
Venkoji Babu. -
Bapi or function module to update rstgr field in bseg table
what is the bapi or function module used to update the fields in bseg table particularly "rstgr" field?
Hi,
Use Bapi
BAPI_ACC_DOCUMENT_POST
Regards,
Prashant -
How to deactivate the fields in a table control of a standard screen
Hi,
I have an requirement to deactivate the fields in a table control of a standard screen in ME22n transaction.I am using a BADI "ME_PROCESS_PO" and in item mathod i am looping at screen for the screen field name in the table control.But it is not working. Can anyone give me the possible solution . Thanx in advance.
With Regards,
Ajit.>
Vivek Joshi wrote:
> Hello Router ,
> I do not want to set the focus , I want to get focus . User can click on any cell in the table and then press a button in the toolbar . Now in the event handler of the button i want to under which column User has set the focus .
> I hope , I am clear now .
> Thanks for your help
> Regards
> Vivek
An yet you keep getting suggestions of how to set the focus. I looked through the API documentation and I don't see anything that would suggest you can request to see where the current focus is. Perhaps someone might still come along with a solution, but my hopes wouldn't be too high at this point. I can pass the requirement onto Product Definition, as the use case does seem interesting. Perhaps it is something we have even considered in the past.
But for now, there might be a better way to solve your problem. It will probably mean redesign the interaction. What exactly are your requirements? Do you need to be able to get the data in a particular cell of table when a button is clicked? Just throwing out some ideas here, but maybe just use the lead selection to select the row, but then have a button choice to choose the action associated with the column you want. A hack for sure - but it might work. Also it doesn't help you right now, but in the near future update to NetWeaver 7.0, WDA does have a onColSelect event for the table. -
How to remove numeric value in the fields of a table
Environment: SQL Server 2008R2
Tools: MSMS
Code:
a. Table Definition
USE [DLPT_CMS1_RESTORE]
CREATE TABLE [dbo].[Mocha]
[id] [int] IDENTITY(80,1) NOT NULL,
[Login_ID] [char](10) NULL,
[PE4] [varchar](8000) NULL,
[PE9] [varchar](8000) NULL,
[PE11] [varchar](8000) NULL,
[PE15] [varchar](8000) NULL,
[PE17] [varchar](8000) NULL,
[PE20] [varchar](8000) NULL,
[PE22] [varchar](8000) NULL,
[PE25] [varchar](8000) NULL,
[PE28] [varchar](8000) NULL,
[PE29] [varchar](8000) NULL,
[PE27] [varchar](8000) NULL
b. data
Insert into Mocha (Login_ID,[PE4],[PE9] ,[PE11],[PE15],[PE17],[PE20],[PE22],[PE25],[PE28], [PE29],[PE27])
Values (293595,293595,293737,293737,293737,293737,293737,293737,'I dont think 12 week program is hard',293737,293737,'antiinflamatory- this helps to fight free radicals and ward off disease.')
Insert into Mocha (Login_ID,[PE4],[PE9] ,[PE11],[PE15],[PE17],[PE20],[PE22],[PE25],[PE28], [PE29],[PE27])
Values (293841,293841,293841,293841,'293841 I feel that the product should be more holistic'
,'293841 I would like for the customer support to give more immediate feedback'
,'293841 Fends off alzeimer disease and dementia. It has been proven to destroy the amaloid plaques that are believed to be a cause of dementia and memory loss',
293841,293841,293841,293841,293841,293841)
Challenge:
1. Delete / Remove login_ids from a string found in one or more of the fields in Mocha table
Example: the following string contains login_id '293841 I would like for the customer support to give more immediate feedback' , remove the login_id in the narrative field which could be PE4, PE22. or PE28
2. Count the response or narrative field for each column after the deletion is completed
My script and still working progress
SELECT * FROM MOCHA
WHERE ISNUMERIC(PE4) = 1 and [PE4] like '%[0-9]%'
Thanks for the supportI added a new data which shows inaccurate results using your last updated code. The mistake appears in the 3rd row culomn name PE25 is null but counts it as 1
CREATE TABLE [dbo].[Mocha]
[id] [int] IDENTITY(80,1) NOT NULL,
[Login_ID] [char](10) NULL,
[PE4] [varchar](8000) NULL,
[PE9] [varchar](8000) NULL,
[PE11] [varchar](8000) NULL,
[PE15] [varchar](8000) NULL,
[PE17] [varchar](8000) NULL,
[PE20] [varchar](8000) NULL,
[PE22] [varchar](8000) NULL,
[PE25] [varchar](8000) NULL,
[PE28] [varchar](8000) NULL,
[PE29] [varchar](8000) NULL,
[PE27] [varchar](8000) NULL
Insert into Mocha (Login_ID,[PE4],[PE9] ,[PE11],[PE15],[PE17],[PE20],[PE22],[PE25],[PE28], [PE29],[PE27])
Values (293737,293737,293737,293737,NULL,293737,NULL,293737,'I dont think 12 week program is hard',293737,293737,'antiinflamatory- this helps to fight free radicals and ward off disease.')
Insert into Mocha (Login_ID,[PE4],[PE9] ,[PE11],
[PE15],[PE17]
,[PE20],[PE22],[PE25],[PE28], [PE29],[PE27])
Values (293841,293841,293841,293841
,'293841 I feel that the product should be more holistic'
,'%%293841%% I would like for the customer support to give more immediate feedback'
,'%%293841%% Fends off alzeimer disease and dementia. It has been proven to destroy the amaloid plaques that are believed to be a cause of dementia and memory loss'
,293841,NULL,NULL,293841,293841)
Insert into Mocha (Login_ID,[PE4],[PE9] ,[PE11],[PE15],[PE17],[PE20],[PE22],[PE25],[PE28], [PE29],[PE27])
Values (293735,'293735 my name',NULL,NULL,NULL,NULL,NULL,NULL,'%%293735%%I dont think',293735,293735,'this helps to fight free radicals and ward off disease')
select
Replace(Replace(PE4,RTRIM(Cast(Login_ID as varchar(10))), ''),'%','') PE4
,Replace(Replace(PE9,RTRIM(Cast(Login_ID as varchar(10))), ''),'%','') PE9
,Replace(Replace(PE11,RTRIM(Cast(Login_ID as varchar(10))), ''),'%','') PE11
,Replace(Replace([PE15],RTRIM(Cast(Login_ID as varchar(10))), ''),'%','') PE15
,Replace(Replace(PE17,RTRIM(Cast(Login_ID as varchar(10))), ''),'%','')PE17
,Replace(Replace(PE20,RTRIM(Cast(Login_ID as varchar(10))), ''),'%','') PE20
,Replace(Replace(PE22,RTRIM(Cast(Login_ID as varchar(10))), ''),'%','') PE22
,Replace(Replace(PE22,RTRIM(Cast(Login_ID as varchar(10))), ''),'%','') PE25
,Replace(Replace(PE28,RTRIM(Cast(Login_ID as varchar(10))), ''),'%','') PE28
,Replace(Replace(PE22,RTRIM(Cast(Login_ID as varchar(10))), ''),'%','') PE29
,(case when len(PE4)-Len(Replace(PE4,RTRIM(Cast(Login_ID as varchar(10))), ''))=0 or [pe4] is null or Replace(PE4,RTRIM(Cast(Login_ID as varchar(10))), '') ='' Then 0 Else 1 End) cntP4
,(case when len(PE9)-Len(Replace(PE9,RTRIM(Cast(Login_ID as varchar(10))), ''))=0 or [pe9] is null or Replace(PE9,RTRIM(Cast(Login_ID as varchar(10))), '') ='' Then 0 Else 1 End) cntP9
,(case when len(PE9)-Len(Replace(PE11,RTRIM(Cast(Login_ID as varchar(10))), ''))=0 or [pe11] is null or Replace(PE11,RTRIM(Cast(Login_ID as varchar(10))), '') ='' Then 0 Else 1 End) cntP11
,(case when len(PE15)-Len(Replace(PE15,RTRIM(Cast(Login_ID as varchar(10))), ''))=0 or [pe15] is null or Replace(PE15,RTRIM(Cast(Login_ID as varchar(10))), '') ='' Then 0 Else 1 End) cntP15
,(case when len(PE17)-Len(Replace(PE17,RTRIM(Cast(Login_ID as varchar(10))), ''))=0 or [pe17] is null or Replace(PE17,RTRIM(Cast(Login_ID as varchar(10))), '') ='' Then 0 Else 1 End) cntP17
,(case when len(PE20)-Len(Replace(PE20,RTRIM(Cast(Login_ID as varchar(10))), ''))=0 or [pe20] is null or Replace(PE20,RTRIM(Cast(Login_ID as varchar(10))), '') ='' Then 0 Else 1 End) cntP20
,(case when len(PE22)-Len(Replace(PE22,RTRIM(Cast(Login_ID as varchar(10))), ''))=0 or [pe22] is null or Replace(PE22,RTRIM(Cast(Login_ID as varchar(10))), '') ='' Then 0 Else 1 End) cntP22
,(case when len(PE25)-Len(Replace(PE25,RTRIM(Cast(Login_ID as varchar(10))), ''))=0 or [pe25] is null or Replace(PE25,RTRIM(Cast(Login_ID as varchar(10))), '') ='' Then 0 Else 1 End) cntP25
,(case when len(PE28)-Len(Replace(PE28,RTRIM(Cast(Login_ID as varchar(10))), ''))=0 or [pe28] is null or Replace(PE28,RTRIM(Cast(Login_ID as varchar(10))), '') =''Then 0 Else 1 End) cntP28
,(case when len(PE29)-Len(Replace(PE29,RTRIM(Cast(Login_ID as varchar(10))), ''))=0 or [pe29] is null or Replace(PE29,RTRIM(Cast(Login_ID as varchar(10))), '') =''Then 0 Else 1 End) cntP29
from mocha -
DYNP_VALUES_UPDATE not Updating the Field on my Dynpro
Hi.
I want to create a dynpro where two fields are. Field 1 allows the user to enter a customer number, field two shall come up with a number that is calculated somehow. The calculation can last up to 20 seconds, so I dont want to make the user waite for this number.. .he shall be able to work with the rest of the dynpro.
Therefore I called the function that does the calcuiation like that:
MODULE user_command_0100 INPUT.
DATA: lv_guid_16 TYPE guid_16.
IF kna1-kunnr IS NOT INITIAL AND kna1-kunnr <> gv_kunnr
CALL FUNCTION 'GUID_CREATE'
IMPORTING
ev_guid_16 = lv_guid_16.
gv_taskid = lv_guid_16+8(8).
CALL FUNCTION 'YDETERMINE_DEPOTDISTANCE'
STARTING NEW TASK gv_taskid
PERFORMING receive_depent ON END OF TASK
EXPORTING
i_kunnr = kna1-kunnr.
ENDIF.
ENDMODULE.
The next piece of code shall get the returning value if the function wants to return its results.
FORM receive_depent USING i_task TYPE clike.
TABLES: d020s.
DATA: dyname LIKE d020s-prog,
dynumb LIKE d020s-dnum.
DATA: BEGIN OF dynpfields OCCURS 1.
INCLUDE STRUCTURE dynpread.
DATA: END OF dynpfields.
IF i_task = gv_taskid.
RECEIVE RESULTS FROM FUNCTION 'YDETERMINE_DEPOTDISTANCE'
IMPORTING
e_depent = kna1-yydepent
e_accuracy = gv_accuracy.
MOVE 'KNA1-YYDEPENT' TO dynpfields-fieldname.
MOVE kna1-yydepent TO dynpfields-fieldvalue.
APPEND dynpfields.
dyname = sy-cprog.
dynumb = '0100'.
CALL FUNCTION 'DYNP_VALUES_UPDATE'
EXPORTING
dyname = dyname
dynumb = dynumb
TABLES
dynpfields = dynpfields
EXCEPTIONS
invalid_abapworkarea = 01
invalid_dynprofield = 02
invalid_dynproname = 03
invalid_dynpronummer = 04
invalid_request = 05
no_fielddescription = 06
undefind_error = 07.
ASSERT sy-subrc = 0.
ENDIF.
Problem is: The DYNP_VALUES_UPDATE does not update the field on my dynpro at all. If I hit enter another time, then the field is provided by the value as another PBO will be processed. What is my mistake here?
Regards
Manfred
Edited by: Rob Burbank on Oct 29, 2010 12:07 PMHi Manfred,
Replace all the DYNP_VALUES_UPDATE-related content by the following statement:
SET USER-COMMAND 'xxx'.
While DYNP_VALUES_UPDATE does update the fields, a roundtrip is not triggered so the content of the fields will not be refreshed. The SET USER-COMMAND does that.
Hope this helps you!
Cheers, Roel -
Get Error while update the User defined row table through DSK Code
Hi experts,
I have got an error while updating the user row defined table.
Error is - "Invalid row"
I have created one master table "@CBF_FARM " and Child table "@CBF_FAR1"
First i inserted 5 record in the child table so in my my child table there are 5 Line id (1,2,3,4,5 one for each row).
after that i delete 2 rows (3rd & 4th row) from child table now in my child table there are 3 rows( Line id 1, 2, 5). Please See attachment.
Now i am updating the last record of child table through Code (Line id is 5) from other form, then i got error invalid row.
Following Code used for updating the user defined child table.
SAPbobsCOM.GeneralService oGeneralService1 = null;
SAPbobsCOM.GeneralData oGeneralData1 = null;
SAPbobsCOM.GeneralDataParams oGeneralParams1 = null;
SAPbobsCOM.CompanyService sCmp1 = null;
SAPbobsCOM.GeneralData oChild1 = null;
SAPbobsCOM.GeneralDataCollection oChildren1 = null;
sCmp1 = clsAddOn.LDNA_Company.GetCompanyService();
oGeneralService1 = sCmp1.GetGeneralService("CBF_FARM");
// Get UDO record
oGeneralParams1 = ((SAPbobsCOM.GeneralDataParams)(oGeneralService1.GetDataInterface(SAPbobsCOM.GeneralServiceDataInterfaces.gsGeneralDataParams)));
oGeneralParams1.SetProperty("Code", oForm.Items.Item("edtFarmCd").Specific.Value);
oGeneralData1 = oGeneralService1.GetByParams(oGeneralParams1);
// Add lines on UDO Child Table
oChildren1 = oGeneralData1.Child("CBF_FAR1");
// Create data for rows in the child table
SAPbouiCOM.Item oItem = oForm.Items.Item("cmbShed");
oCombo = oItem.Specific;
string ShedCode = oCombo.Selected.Value;
ldna_Rec = clsAddOn.LDNA_Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
string strQuery1 = "select LineId from [@CBF_FAR1] where U_ShedCd = " + ShedCode;
ldna_Rec.DoQuery(strQuery1);
oChild1 = oChildren1.Item(ldna_Rec.Fields.Item("LineId").Value - 1);
oChild1.SetProperty("U_Status", "Ready For Schedule");
//Update the UDO Record
oGeneralService1.Update(oGeneralData1);
Please Help me it is an urgent requirement,
-Regards
Vikashi.
Error is - "Invalid row"
Now i am updating the last record of child table through Code (Line id is 5) from other form, then i got error invalid row.
As per my knowledge
What i understood is you have 5 lines and you are going to be update 5th line
am i correct..
while u are updating the line in child table
you have to consider like this..
line number u have to update like
1 0
2 1
3 2
4 3
5 4
which means in child table treat
line 1 as 0
line 2 as 1
line 5 as 4
If you want to update the line 5 u have to mention 4 th line -
Ideal way to update a field in a table
Hi All,
We need to update a field in a table which have some 8 million records.
The value of the field needs to be updated in all the above mentioned records.
Now, we have an input file with all the primary key fields and the field to be updated.
Can any one suggest the ideal way to update the field.
1. Updating the database for each record.
Loop at itab.
Update .
Endloop.
2. Updating the database with a set of 100 records.
We are planning to schedule the job in the background.
Thanks for your help.
Regards,
KrishnaHi,
be very carefull with the update, ´cause you can damage 8 million records !!
You better use instruction Update for this:
update mytable set field = value where conditions.
Try to use all key fields in the conditions and never use something like
update mytable set: field1 = value1
field2 = value2
field3 = value3 where conditions.
The loop in your case 1 is not absolutely necessary, ´cause you update a whole bunch of records at once with the conditions in Update.
Test the changes in the development system before you do it in production -
I need to update an Oracle 8i database. I need to update 2 fields in 1 table with about 2,000 rows of data.
Right now the date is stored in an Excell file in columns A and B.
I need Something like:
Update Table1
set field1 with value from A:1,
set field2 with value from B:1
repeated with A:2,B:2 and so onI believe you could use sql loader to get your excel file in but here is a way I cheat to do it.
I save the excel file as a comma deliminated file (I think it is .csv)
then I open it up and copy and paste it into the following. (the part that says paste flat file here)
this is assuming 8i supports model clause I'm unsure on that point.
create or replace view view_xl_file_to_table as
select * from
with t as (select
--- copy paste your flat file here
' Bob,Jones,12345,Employee
Fred,Thebes,32,Manager
John,Smith,12,Employee
Karl,Cane,432,Employee
George,Johnson,54,Manager
' flat_text_file from dual
select flat_text_file text_file_turned_into_row,
substr(flat_text_file, 1, instr(flat_text_file,',',1,1)-1) col1, -- get text up to the first comma
substr(flat_text_file, instr(flat_text_file,',',1,1)+1, instr(flat_text_file,',',1,2) - instr(flat_text_file,',',1,1)-1 ) col2, --2nd comma
substr(flat_text_file, instr(flat_text_file,',',1,2)+1, instr(flat_text_file,',',1,3) - instr(flat_text_file,',',1,2)-1 ) col3, --3rd
substr(flat_text_file, instr(flat_text_file,',',1,3)+1, instr(flat_text_file,',',1,4) - instr(flat_text_file,',',1,3)-1 ) col4,
substr(flat_text_file, instr(flat_text_file,',',1,4)+1, instr(flat_text_file,',',1,5) - instr(flat_text_file,',',1,4)-1 ) col5,
substr(flat_text_file, instr(flat_text_file,',',1,5)+1, instr(flat_text_file,',',1,6) - instr(flat_text_file,',',1,5)-1 ) col6,
substr(flat_text_file, instr(flat_text_file,',',1,6)+1, instr(flat_text_file,',',1,7) - instr(flat_text_file,',',1,6)-1 ) col7
from t
-- first turn the carriage return into seperate rows
model return updated rows
dimension by (0 d)
measures (flat_text_file, 0 position_of_return ) -- the position of return is where the next carriage return is
rules iterate(1000) until position_of_return[iteration_number+1] = 0
position_of_return[iteration_number + 1] = instr(flat_text_file[0],chr(10),1,iteration_number + 1), -- find the next carriage return
-- get the text between the previous carriage return and the next and make it a row
flat_text_file[iteration_number + 1] = replace(substr( flat_text_file[0],
position_of_return[iteration_number],
position_of_return[iteration_number + 1] - position_of_return[iteration_number]
),chr(10))||','
)now I have a view and I could anything I want with it and I just drop it when I'm done.
Edited by: pollywog on Apr 19, 2010 7:57 AM -
FM / BAPI to update STEUC field in marc Table basing on material and plant
Hi,
I need to to update STEUC field in marc Table basing on material and plant. please suggest FM / BAPI.
Thanks.
raviraj.Hi
Try this BAPI function module:
" BAPI_MATERIAL_MAINTAINDATA_RT "
Data: LS_HEADDATA TYPE BAPIE1MATHEAD,
LS_RETURN TYPE BAPIRETURN1,
LT_PLANT TYPE TABLE OF BAPIE1MARCRT, LS_PLANT TYPE BAPIE1MARCRT,
LS_PLANTX TYPE BAPIE1MARCRTX, LT_PLANTX TYPE TABLE OF BAPIE1MARCRTX.
CALL FUNCTION 'BAPI_MATERIAL_MAINTAINDATA_RT'
EXPORTING
HEADDATA = LS_HEADDATA
IMPORTING
RETURN = LS_RETURN
TABLES
PLANTDATA = LT_PLANT
PLANTDATAX = LT_PLANTX.
Check the PLANTDATA in the above fm in which pass your ''STEUC'' to BAPIE1MARCRT-CTRL_CODE......
Hope this works..... -
Hi experts,
i want to update a field in BSEG table (field name is BUPLA).
Using UPDATE statement i am going to update the bseg table.
I know only update statement.
This my immediate requirement.
please give me suggesstion.Hi,
If you want to update the existing table record or field.. it is always advisable to use MODIFY statement instead of UPDATE.
syntax:
fetch the BSEG data to internal table IT_BSEG and do you modificaltions.
Loop at it_bseg.
it_bseg- XYZ = 'ABC'.
it_bseg-UVW = '123'.
modify it_bseg transporting XYZ UVW .
endloop.
MODIFY BSEG FROM TABLE IT_BSEG (here it_bseg is the internal table)
COMMITWORK.
Modify always check in the database whether the record exists or not if it is there it will modify the existing one.. otherwise create a new record.... in Update statement.. there is always a chance of creating a new record.. instead of updating the existing one... -
Updating LIFSK field of VBAK table
Hi,
I have a workarea of type VBAK.
The workarea has field VBELN and LIFSK populated.
I want to Update the field LIFSK of database table VBAK.
I assume, using statement "UPDATE" would have some implications while changing master table VBAK.
Hence i want to know if there any function module or BAPI is available to do this?
Regards
Nishant
Message was edited by: Nishant Guptahi,
check this sample...
REPORT Z_SALES_ORDER_CHANGE
NO STANDARD PAGE HEADING
LINE-SIZE 132
LINE-COUNT 65(0)
MESSAGE-ID ZZ.
TABLES: VBAP.
DATA:
V_FILEIN(90) TYPE C,
V_RECIN TYPE I,
V_RECVBAP TYPE I,
V_RECORDER TYPE I,
V_VBELN LIKE VBAP-VBELN,
ORDERHEADERINX LIKE BAPISDH1X.
DATA: BEGIN OF I_ORDERS OCCURS 0,
VBELN LIKE VBAK-VBELN,
POSNR LIKE VBAP-POSNR,
BRGEW(18) TYPE C,
VOLUM(18) TYPE C,
END OF I_ORDERS.
DATA: BEGIN OF I_OUTPUT OCCURS 0,
VBELN LIKE VBAK-VBELN,
POSNR LIKE VBAP-POSNR,
* GEWEI LIKE VBAP-GEWEI,
BRGEW LIKE VBAP-BRGEW,
VOLUM LIKE VBAP-VOLUM,
CKWGT TYPE C,
CKVOL TYPE C,
END OF I_OUTPUT.
DATA: BEGIN OF ORDERITEMIN OCCURS 0.
INCLUDE STRUCTURE BAPISDITM.
DATA: END OF ORDERITEMIN.
DATA: BEGIN OF ORDERITEMINX OCCURS 0.
INCLUDE STRUCTURE BAPISDITMX.
DATA: END OF ORDERITEMINX.
DATA: BEGIN OF RETURN OCCURS 0.
INCLUDE STRUCTURE BAPIRET2.
DATA: END OF RETURN.
DATA: BEGIN OF BAPIRETURN OCCURS 0.
INCLUDE STRUCTURE BAPIRET2.
DATA: END OF BAPIRETURN.
PARAMETERS:
P_PATH(45) TYPE C DEFAULT '/usr/users/ftpsapom/' LOWER CASE,
P_FNAME(32) TYPE C DEFAULT '/sweetjo.txt' LOWER CASE.
START-OF-SELECTION.
* CONCATENATE PATH AND FILE NAME INTO ONE VARIABLE
CONCATENATE P_PATH P_FNAME INTO V_FILEIN.
* OPEN DATASET
IF V_FILEIN IS INITIAL.
MESSAGE E002 WITH 'FILE' V_FILEIN 'DOES NOT CONTAIN ANY DATA!'.
ELSE.
OPEN DATASET V_FILEIN
FOR INPUT
IN TEXT MODE.
IF SY-SUBRC = 0.
* READ DATASET
DO.
READ DATASET V_FILEIN INTO I_ORDERS.
IF SY-SUBRC = 0.
APPEND I_ORDERS.
ELSE.
EXIT.
ENDIF.
ENDDO.
* CLOSE DATASET
CLOSE DATASET V_FILEIN.
IF SY-SUBRC <> 0.
MESSAGE E002 WITH 'ERROR - CLOSING' V_FILEIN.
ENDIF.
ELSE.
MESSAGE E002 WITH 'ERROR - COULD NOT OPEN' V_FILEIN.
ENDIF.
ENDIF.
* SORT AND REMOVE DUPLICATES FROM I_ORDERS
SORT I_ORDERS BY VBELN POSNR.
DELETE ADJACENT DUPLICATES FROM I_ORDERS.
* POPULATE I_OUTPUT
LOOP AT I_ORDERS.
SHIFT I_ORDERS-POSNR LEFT DELETING LEADING SPACE.
CONCATENATE '0' I_ORDERS-POSNR INTO I_ORDERS-POSNR.
SELECT SINGLE BRGEW VOLUM
FROM VBAP
INTO (VBAP-BRGEW, VBAP-VOLUM)
WHERE VBELN = I_ORDERS-VBELN
AND POSNR = I_ORDERS-POSNR.
IF SY-SUBRC = 0.
IF VBAP-BRGEW = 0.
I_OUTPUT-CKWGT = 'X'.
ENDIF.
IF VBAP-VOLUM = 0.
I_OUTPUT-CKVOL = 'X'.
ENDIF.
I_OUTPUT-VBELN = I_ORDERS-VBELN.
I_OUTPUT-POSNR = I_ORDERS-POSNR.
* I_OUTPUT-GEWEI = 'ST'.
I_OUTPUT-BRGEW = I_ORDERS-BRGEW.
I_OUTPUT-VOLUM = I_ORDERS-VOLUM.
APPEND I_OUTPUT.
CLEAR: I_OUTPUT.
ENDIF.
V_RECIN = V_RECIN + 1.
ENDLOOP.
* POPULATE BAPI DATA AND RUN BAPI
CLEAR: ORDERHEADERINX, ORDERITEMIN, ORDERITEMINX,
RETURN, BAPIRETURN.
REFRESH: ORDERITEMIN, ORDERITEMINX, RETURN, BAPIRETURN.
ORDERHEADERINX-UPDATEFLAG = 'U'.
LOOP AT I_OUTPUT WHERE CKWGT = 'X' OR CKVOL = 'X'.
V_RECVBAP = V_RECVBAP + 1.
IF I_OUTPUT-VBELN <> V_VBELN AND SY-TABIX <> 1.
V_RECORDER = V_RECORDER + 1.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
SALESDOCUMENT = V_VBELN
ORDER_HEADER_INX = ORDERHEADERINX
TABLES
RETURN = RETURN
ORDER_ITEM_IN = ORDERITEMIN
ORDER_ITEM_INX = ORDERITEMINX.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'
IMPORTING
RETURN = BAPIRETURN.
* WRITE OUT RETURN
LOOP AT RETURN.
WRITE: / RETURN.
ENDLOOP.
WRITE: / BAPIRETURN.
SKIP.
CLEAR: ORDERITEMIN, ORDERITEMINX,
RETURN, BAPIRETURN.
REFRESH: ORDERITEMIN, ORDERITEMINX, RETURN, BAPIRETURN.
ENDIF.
ORDERITEMIN-ITM_NUMBER = I_OUTPUT-POSNR.
* ORDERITEMIN-UNTOF_WGHT = I_OUTPUT-GEWEI.
IF NOT I_OUTPUT-CKWGT IS INITIAL.
ORDERITEMIN-GROSS_WGHT = I_OUTPUT-BRGEW.
ORDERITEMINX-GROSS_WGHT = 'X'.
ENDIF.
IF NOT I_OUTPUT-CKVOL IS INITIAL.
ORDERITEMIN-VOLUME = I_OUTPUT-VOLUM.
ORDERITEMINX-VOLUME = 'X'.
ENDIF.
APPEND ORDERITEMIN.
ORDERITEMINX-ITM_NUMBER = I_OUTPUT-POSNR.
* ORDERITEMINX-UNTOF_WGHT = 'X'.
ORDERITEMINX-UPDATEFLAG = 'U'.
APPEND ORDERITEMINX.
V_VBELN = I_OUTPUT-VBELN.
ENDLOOP.
* RUN BAPI ON LAST ORDER
IF NOT ORDERITEMIN IS INITIAL.
V_RECORDER = V_RECORDER + 1.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
SALESDOCUMENT = V_VBELN
ORDER_HEADER_INX = ORDERHEADERINX
TABLES
RETURN = RETURN
ORDER_ITEM_IN = ORDERITEMIN
ORDER_ITEM_INX = ORDERITEMINX.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'
IMPORTING
RETURN = BAPIRETURN.
* WRITE OUT RETURN
LOOP AT RETURN.
WRITE: / RETURN.
ENDLOOP.
WRITE: / BAPIRETURN.
SKIP.
ENDIF.
* WRITE OUT RECORD COUNT FROM FILE
WRITE: / 'RECORD COUNT FROM FILE ', V_RECIN.
SKIP.
* WRITE OUT RECORD COUNT FROM FILE
WRITE: / 'RECORD COUNT OF LINES TO CHANGE ', V_RECVBAP.
SKIP.
* WRITE OUT RECORD COUNT FROM FILE
WRITE: / 'RECORD COUNT OF ORDERS TO CHANGE ', V_RECORDER.
SKIP.
* TOP OF PAGE
TOP-OF-PAGE.
WRITE:/1(5) TEXT-H01, 6(8) SY-DATUM MM/DD/YY,
100(8) TEXT-H02, 126(8) SY-PAGNO.
WRITE:/1(5) TEXT-H03, 6(8) SY-UZEIT USING EDIT MASK '__:__:__',
20(77) TEXT-H04,
100(8) TEXT-H05, 108(25) SY-REPID.
WRITE:/1(6) TEXT-H06, 8(12) SY-UNAME,
20(4) TEXT-H07, 25(32) SY-HOST,
100(13) TEXT-H08, 121(8) SY-SYSID,
129 '/', 130(3) SY-MANDT.
ULINE.
SKIP.
here i am changing the items, but in your case it is simple.
only thing you need to pass is
VALUE(SALESDOCUMENT) LIKE BAPIVBELN-VBELN
*" VALUE(ORDER_HEADER_IN) LIKE BAPISDH1 STRUCTURE BAPISDH1
*" OPTIONAL
*" VALUE(ORDER_HEADER_INX) LIKE BAPISDH1X STRUCTURE BAPISDH1X
first one is sales order, sencond is ORDER_HEADER_IN-del_block , and third one is ORDER_HEADER_INX -updflag = 'U' and relevant field for lifsk = 'X' .
try this and get back if you have any doubts.
Regards
vijay -
hi,
i am trying to update a field in a table.
i need to eliminate the first character in the following field. how would i do that? isn't there a TRIM function?
srdial (field name)
12001202307
12001207581
12001570282
12001570281
after running the function the following should appear..
srdial (field name)
2001202307
2001207581
2001570282
2001570281
how would i do this?
thanks,
markLTRIM? Search for it in the Oracle documentation at available at http://tahiti.oracle.com/
-- CJ -
Updating EAN11 field in mara table through BAPI_MATERIAL_SAVEDATA
Hi,
I want to update EAN11 field in mara table through BAPI_MATERIAL_SAVEDATA could anybody please guide me how to achieve.
it would be great if is there any sample code for the same.
ThanksPlease give the following fields in the lwa_uom structure as well
lwa_uom -ALT_UNIT
lwa_uom -NUMERATOR
lwa_uom -DENOMINATR
DATA: lwa_uom TYPE BAPI_MARM,
lwa_uomx TYPE BAPI_MARMX.
DATA: lt_uomx TYPE STANDARD TABLE OF BAPI_MARM,
lt_uomx TYPE STANDARD TABLE OF BAPI_MARMX.
lwa_uom-ean_upc = '123456' " enter the value here
lwa_uom-ean_cat = 'abcd'.
append lwa_uom to lt_uom.
lwa_uomx-ean_upc = 'X'.
lwa_uomx-ean_cat = 'X'.
append lwa_uomx to lt_uomx.
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
EXPORTING
unitsofmeasure = lt_uom
unitsofmeasurex = lt_uomx.
Edited by: Rahul Babukuttan on Dec 21, 2011 4:23 PM -
Updating VTEXT field in VBSK table
hi All,
Is there any SAP provided BAPI or FM present which will help in updating the field VTEXT in VBSK table. In my program i have Group(Key field in VBSK table). This is required urgently, please help if you had done similar things.
Thanks in advance,
Shyam.Hello Govardhan-
As your requirement says to modify only one field in kna1.I dont think bapi is necessary for this just try the below code.
Data:i_kna1 type table of kn1,
w_kna1 type kna1.
select ...... from kna1 into table i_kna1
where kunnr EQ 'XYZ'.
loop at i_kna1 into w_kna1.
w_kna1-loevm = 'X'.
modify kna1 from w_kna1.
endloop.
Cheers,
~Srini....
Maybe you are looking for
-
How do I set the songs from itunes on my iphone 4s as ringtones? I shouldn't have to purchase ringtones when I have a whole music library on my iphone to choose from and songs that I have already purchased! I should not have to rebuy music!! If anyon
-
Why can't I get it to work?
I recently established a paid @mac.com account. I entered a user name and password & did the rest of the required things. A week or so later it occurred to me that I should add the address to my email section (Entourage). Once I had gone through the
-
Stylus support in wireless toolkit
Hello people, I'm doin a project which involves creating a drawing pad on which a user can draw..How can i do with Sun Java Wireless Toolkit??..any classes for stylus??..or any mouse events/classes??..or any other means?? Thanx in advance
-
Hi ! I need your helps and views regarding Profit and Loss Template. In SAP B1 2007B we have P n L which will have Sales Accounts and Expense Acc (Cost of Goods Sold Acc's ). I want a P n L like, it should show Opening Balance of Inventory for the Pe
-
Hi, Need some help with Adobe contribute. A web site was built using Contribute CS4 on the Windows platform a little while ago. I need to know if the project files for this website can be imported & managed on a Mac version of Contribute? Any help is