Duplicate records in input structure of model node
Hi,
Following is the way, I am assigning data to a model node:
//Clearing the model input node
for (int i = wdContext.nodeInsppointdata().size(); i > 0; i--)
wdContext.nodeInsppointdata().removeElement(wdContext.nodeInsppointdata().getElementAt(i - 1));
//Creating element of the input model node
IPrivateResultsView.IInsppointdataElement eleInspPointData;
//START A
Bapi2045L4 objBapi2045L4_1 = new Bapi2045L4(); //Instance of the input structure type
//Populating data
eleInspPointData = wdContext.nodeInsppointdata().createInsppointdataElement(objBapi2045L4_1);
wdContext.nodeInsppointdata().addElement(eleInspPointData);
eleInspPointData.setInsplot(wdContext.currentContextElement().getInspectionLotNumber());
eleInspPointData.setInspoper("0101");
//Inspection_Validate_Input is the model node. Adding instance to main node
wdContext.currentInspection_Validate_InputElement().modelObject().addInsppointdata(objBapi2045L4_1);
//STOP A
//Now executing the RFC
Above code seems to be fine. Works very well for the first time. But, when the user clicks on the same button for the second time, I can see duplicate records getting passed to RFC [Debugged using external breakpoint]. When I am sending 4 records, I can see there are total of 6 records. The number keeps increasing when clicked on the button.
I am adding multiple records to input model node using the code from START A to STOP A. Does the code look fine? Why do I see multiple records?
Thanks,
Sham
Issue solved.
After executing RFC, I used following code to clear the input model node:
try
wdContext.current<yourBAPI>_InputElement().modelObject().get<yourinputnode>().clear();
catch (Exception e1)
Similar Messages
-
How can I create a model node in SAP Records Management
Product: SAP Records Management
Hi,
I would like to create a model node in a record tree.
I found in the function modul BAPI_RECORD_ADDELEMENT no entry for the creation of a model node. Only the instance and the structure node can create by this function modul.
So, does anyone know a solution to create a model note?
Regards,
Thomas FanningerHi Thomas,
it is not possible with the BAPI due to the piece of coding:
case myElementType.
when glob_const_elem_type_instance.
myRecordElement->Type_Set( if_srm_sp_record_element=>type_instance ).
myRecordInstanceElement ?= myRecordElement.
loop at element_sp_poid into myElementSpPoidWa.
mySpPoidWa-id = myElementSpPoidWa-name.
mySpPoidWa-value = myElementSpPoidWa-value.
insert mySpPoidWa into table myElementSpPoidTab.
endloop.
myElementSpsId = sps_id.
myElementPoid = myClientService->poid_get_instance( im_rms_id = myRmsId
im_sps_id = myElementSpsId im_sp_poid = myElementSpPoidTab ).
myService->check_sp_connection( myElementPoid ).
myRecordInstanceElement->poid_set( myElementPoid ).
when glob_const_elem_type_folder.
myRecordElement->Type_Set( if_srm_sp_record_element=>type_folder ).
when others.
perform set_error using '852' return.
return.
endcase.
But you can do that by using directly the Records API. How to use this is demonstrated in the report 'SRM_RECORD_API_HOWTO'. Search there for the subroutine 'fillrecordelement'. There a record element for insert is created and its type is set. You can set the type there to 'IF_SRM_SP_RECORD_ELEMENT~TYPE_MODEL'. Of course your POID then may not be an instance POID.
Best regards,
Thomas -
Copy values from model node to another model node with different structure
Hi,
I am getting detils from RFC1 and update some of the data into another RFC2.
the first RFC1 having the strucutre
context
NodeName
nodel
arrtibutes
the second RFC2 having the different strucutre
context
NodeName1
| nodel2
| arrtibutes2
| arrtibutes3
| nodel5
| arrtibutes4
| arrtibutes5
I need to copy the values from first one to second one.
Both are different structures.
Can any one tel me how to do it.
Thanks
RaviHi,
Create 1 custom controllers for each Model.
1.Cust COntroller1:
Node one.
->Attr1(type:String)
->Attr2(type:long)
2.Cust COntroller2
Node one.
->Attr1(type:String)
->Attr2(type:long)
Through the component controller only u can send the data by mapping.
In component controller:
Node one.
->Attr1(type:String)
->Attr2(type:long)
Step1:Map the elements from custControler1.
Before mapping make sure that u have data in CustController Context=>value node.
(Note:cust controler node s model node means copy the elements to value node using copyservice)
step2:Go to cust controller2 goto value node and map it.
if ur nt getting,Plz let me knw,
Thanxs,
Lavanya.G -
Need help to read model node input field attribute present in view - first time developer.
Hello Experts,
I am new to CRM Web UI development.
Presently, I am trying to develop a Guided Activity Page having 2 views.
First view has the field Business Partner Number, I have added model Node BuilHeader and the attribute BP_NUMBER while creation of the view.
The Second View consists of 2 fields from the Model Node BuilHeader, namely First Name and Last Name.
The requirement is to enter the BP Number on the first screen then click on the NEXT button from the Guided Activity buttons, on navigating to the Second View, the Names should auto-populate.
I have Created both views and the GP page, the GP navigation is also happening. Initially the fields were showing Not Bound text in value, so I commented the line in GET_I and GET methods to enable the field and remove the Not Bound text. I have created a custom controller with BuilHeader
I have tried doing this but facing the below problems :
1) When I enter the BP number on the first view and press Enter, the value disappears. How to solve this ?
2) Does clicking on the NEXT button on the GP Navigation trigger a Server Roundtrip ?
3) How to read the context node value of BP Number entered on the first view and populate the Name fields on the second view.
Please help.........you can take reference from from below code as in above case we use BuilHeaderAdvancedSearch search object, to get current entity.
data: query TYPE REF TO cl_crm_bol_dquery_service,.
query ?= me->typed_context->BuilHeaderAdvancedSearch->collection_wrapper->get_current( ).
Do not remove code from getter setter of fields , it will not clear.
Check with http://scn.sap.com/thread/3391203 , for basic understanding of UI.
Regards,
Harish Kumar -
How to bindi a UI element to 2 model nodes different in the same view
I want to know how I can bind a set of inputfields, in a form view, to 2 different model nodes ?
<u>example:</u>
Im working with 2 adaptional RFC, both working, in my Custom Context.
Ztest_Search
Ztest_Update
In my ResultView I have 2 Model nodes (one for each RFC) I show a set of inputfields in a form view, binded to the Ztest_Search_output of Ztest_Search. This works.
now I want to update the changes, but I can't find the ways of binding the same inputfields to my other Model node (Ztest_Update) in the context of ResultView.
Note: If I create a duplicate set of inputfields , one for Ztest_Search binded to the Ztest_Update_output and the other to the Ztest_Update_Input Works. But I wanna avoid this duplicated set of inputfields.
ThxRodrigo,
If I understood correctly, your problem is to get the data from the input fields which are bound to a
model node, Ztest_Search_output and set it to the model node of another RFC, Ztest_Update.
This can be done by getting the suitable values from the model attributes of Ztest_Search_output
and setting it to Ztest_Update.
<b>/**
* valueOne, valueTwo are the name of the model
* attributes that are bound to the Input fields.
*/</b>
String firstValue = wdContext.currentZtest_Search_outputElement
().get<valueOne>;
String secondValue = wdContext.currentZtest_Search_outputElement
().get<valueTwo>;
Ztest_Update_Input update = new Ztest_Update_Input();
wdContext.nodeZtest_Update_Input().bind(update);
<b>/*
*<b>Zstructure is the structure of the model node under
*Ztest_Update_Input to which the values have to be
*updated.</b>
*/</b>
ZStructure structure = new ZStruture();
structure.setValueOne(valueOne);
structure.setValueTwo(valueTwo);
update.addZStructure(structure);
try
update.execute();
catch (Exception ex)
wdComponentAPI.getMessageManager().reportException(ex.getMessage(), false);
wdContext.nodeZtest_Update_Output().invalidate();
Bala -
How to set value to Model Node of cardinality 0..N
hi
I am looking for a way to set value to a model node of cardinality 0..N
i imported a WSDL into my applicaion , which has the following Node Structure.
Context
--- ModelNode_Request
---ModelNode2_Input
---ModleNode3_Roles [ cardinality 0..n singleton 1..1]
****Model_Attribute RoleID <<<<<<<<<<<<
****Model_Attribute SysID <<<<<<<<<<<<
---ModelNode_Response
i tried with the below code but effort went in vain.
i tried following ways to set the value but , i get Nullpointer expection error.
wdContext.nodeRequest__SubmitRequest().nodeRequestDetails().nodeRoles().
currentRolesElement().setRoleId("BASIC");
wdContext.nodeRequest__SubmitRequest().nodeRequestDetails().nodeRoles().
currentRolesElement().setSysId("R3_220");
i aslo looked into the forum https://www.sdn.sap.com/irj/scn/thread?messageID=2035342 but couldnt find any solid solution.
It would be great if some one can throw some snippets on the same.
Thanks
Edited by: RR on Dec 22, 2008 5:48 PMHi RR,
As far as i know u can set model nodes and values nodes are different. whats shown in the link is for values node. u should do differently for model node..
Since this is a model node...u first need to create an object of the node type. then create an arraylist for that and then add values..
try this..
// Create an object for structures in the node to be used
Yweb_Po_Items objPOItems = null; // where Yweb_Po_Items is the structure of the node...
// Create an abstractlist for structures in the RFC node to be used, if u are planning to give single or multiple rows (in node/table) as input to the RFC
AbstractList POObjAbsList = new Yweb_Po_Items.Yweb_Po_Items_List();
objPOItems = new Yweb_Po_Items();
// /set first set of values
objPOItems.setColumn1(u201Cabcu201D); // here hard codede for example
objPOItems.setColumn2(u201Cabcfghu201D);
// add the object to the abstract list
POObjAbsList.add(objPOItems);
// /set second set of values
objPOItems.setColumn1(u201Cnewabcu201D);
objPOItems.setColumn2(u201Cnewabcfghu201D);
// add the object to the abstract list again
POObjAbsList.add(objPOItems); // now u got 2 records
// now set the abstractlist to the node in the RFC
objGoodsReceiptPO.setPo_Items_In(POObjAbsList);
Hope this information is useful...
Thanks
Md. Yusuf -
Stop processing the duplicate record values
Hi Experts,
I have a requirement that i need do not process the duplicate values from the file place in FTP.
Scenerio is File->PI->RFC.
For ex:
Source Data:
Name,Emp_id,DOB,Designation,Location,Joining_Date,Time_Stamp
Moni,654654,11-09-1980,Developer,TN,20-02-2008,24-03-2014:3.38pm
Shiva,654612,21-02-1982,Developer,TN,15-08-2009,24-03-2014:3.38pm
Venkat,654655,19-01-1983,Developer,TN,28-10-2010,24-03-2014:3.38pm
Moni,654654,11-09-1980,Developer,TN,20-02-2008,24-03-2014:9.38pm
If next time the same record comes like Moni,654654,11-09-1980,Developer,TN,20-02-2008,24-03-2014:9.38pm,no need to process this record values.
How to stop processing the duplicate record.Kindly share some ideas to achieve this requirement by using PI 7.1.
Best Regards,
Monikandan.Hi ,
Here is one of the clean sol:
1)Using FCC read record by record by giving end separator as newline in FCC.
Reading a delimeter separated file whose columns may jumble
2)Use two mapping in one operation mapping .
1st Mapping :
Sourcefield()-->sort(ascending)-->splitbyvalue(valuechange)-->eachvalue-->collapsecontext-->udf-->
splitbyvalue(eachvalue)-->map to all target fields
Keep context of source field to top node to come all values in single array
for(int i=0;i<input.length;i++){
String temp[] = input[i].split(",");
if(temp.length == 7)
Name.addValue(temp[0]) ;
Emp_id.addValue(temp[1]) ;
DOB.addValue(temp[2]) ;
Designation.addValue(temp[3]) ;
Location.addValue(temp[4]) ;
Joining_Date.addValue(temp[5]) ;
Time_Stamp.addValue(temp[6]) ;
else{throw new StreamTransformationException("field missing in col "+i)}// up to you
Mapping 2:Actual file structure to RFC
Regards
Venkat -
How to populate a Value Attribute of a Value Node inside Model Node
Hello
I have my context like this.
Context
.. - ModelNode
.... - Model Attr1
.... - Model Attr2
.... - Model Attr3
.... - Model Attr4
.... - Value Node
...... |
...... - Value Attr1
Model Node is of Cardinality 0..N
Value Node is of Cardinality 1..1
I want to create multiple records in my Model Node and one record for every Model Node in Value Node.
How to do this?
All good suggestions are welcome.
Regards,
ShubhamHi Shubham,
With your context structure the code will be
for(int i = wdContext.nodeModelNode().size()-1 ; i>=0 ; i--)
IPublic<comp name>.IModelNodeElement ele = wdContext.nodeModelNode().getModelNodeElementAt(i);
IPublic<comp name>.IValNodeElement valEle = wdContext.nodeModelNode().nodeValNode().createValNodeElement();
valele.setValAttr("");
ele.nodeValNode().addElement( valEle);
Your val node should be non singleton (singleton property = false)
Regards,
Jaydeep -
Problem in mapping model node with cardinality
Hi,
I have a requirement where the RFC which is being called has cradinality 0..n.
I imported the RFC model in a different DC and then added the model to public part.
Then, I used that model in the second dc.
Now, I did context mapping with the component controlller by dragging the model context to the
component controller. The view is also mapped with the component controller.
The RFC has input field BUS_PART_NO which is a 12 character input field.
I passed String in it.
There is no error while I build the DC. But while I run the application, the input field is coming Read Only.
I can't changed the component controller to 1..n or 1...1.
I think I need to create a context node and attribute in the view or component controller and then programmatically add this
to the model node.
Please send some SDN links and urls.
Regards
Neha SinghHi Neha,
Please create the custom context node/attribute same structure as RFC model node. then populate the data using below following code :
- get the size of the RFC model node which you want to populate in the costom node like
int xxx = wdContext.node<XXX node>().size;
- Create onject for custom node like
I<Custyom Name>Element element = null;
- then use for loop for fetching data from Model node and populate in custom node
for(int i =0; i<xxx; i++)
element = wdContext.create<Custyom Name>();
element.set<Attribute Name>(wdContext.node<XXX>().get<XXX>ElementAt(i).get<>Attribute name for model())
wdContext.<Custyom Name>().addElement(element);
It will populate in your custom node from model node.
Hope it will helps you.
Regards
Arun -
Hello,
I am trying to call a RFC from my WebDynpro application.
The RFC has a mandatory input structure called PERSDATA.
I am using the following test code to call the RFC:
IWDMessageManager manager = wdComponentAPI.getMessageManager();
try{
wdContext.nodeZ_Portal_Get_Timesheet_Input().bind(new Z_Portal_Get_Timesheet_Input());
wdContext.currentZ_Portal_Get_Timesheet_InputElement().setKeydate(new Date(105,9,27));
wdContext.nodePersdata().bind(new Cats_Its_Persdata());
wdContext.currentPersdataElement().setPernr("00003000");
wdContext.currentZ_Portal_Get_Timesheet_InputElement().modelObject().execute();
wdContext.nodeOutput().invalidate();
} catch(WDDynamicRFCExecuteException ce) {
manager.reportException(ce.getMessage(), false);
When I run this code I get the errormessage:
<b>Mandatory parameter PERSDATA of method Z_PORTAL_GET_TIMESHEET missing.</b>
When I display the input structure in my view (in a table) it displays one row with pernr set to 00003000 (so it seems to me that the input structure is ok).
What am I doing wrong here?Hallo Johan,
your mistake is based on the fakt, that you did not correctly aggregate your model object graph. Instead you operated on the context itself. The context only references the model objects within the model object graph. Relations between context nodes and context node elements are not automatcally mirrored within the model object graph. Principally you have to aggregate your model object graph first (independant from the contex) and afterwards you can reference the executable model class within the toplevel context node element.
I assume, that your code should look like this:
IWDMessageManager manager = wdComponentAPI.getMessageManager();
try {
// Aggregate model object graph
Z_Portal_Get_Timesheet_Input timeSheetInput =
new Z_Portal_Get_Timesheet_Input();
timeSheetInput.setKeydate(new Date(105, 9, 27));
Cats_Its_Persdata persData = new Cats_Its_Persdata();
persData.setPernr("00003000");
timeSheetInput.setPersdata(persData);
// Bind executable model object to context node 'Z_Portal_Get_Timesheet_Input'
wdContext.nodeZ_Portal_Get_Timesheet_Input().bind(timeSheetInput);
// Execute model object
wdContext
.currentZ_Portal_Get_Timesheet_InputElement()
.modelObject()
.execute();
// Invalidate output node so that the context-to-model-object-references will be updated
wdContext.nodeOutput().invalidate();
} catch (WDDynamicRFCExecuteException ce) {
manager.reportException(ce.getMessage(), false);
Also have a look at my related answer within the forum thread Executing model : deep structure in importing parameter of RFC which deals with the same issue.
Regards, Bertram
Regards, Bertram -
Problems in Instantiating the Model Node
Hi All,
I Have a problem with creating the instance of a Model Node which needs an urgent solution, This is the Scenario:
I Have created a WebDynpro Project using NetWeaver CE Environment and Java EE 5.0 where i am using an Adaptive WebService Model. I have successfully created the model using the WSDL files and have also added to the Controller,
But when I try to create an Instance of the Request Node in my controller ie after writing this line:
Request_MI_Nwce007_AS_SOAPReq objReq = null;
objReq = new Request_MI_Nwce007_AS_SOAPReq();
This is the Request Structure from the WSDL - Request_MI_Nwce007_AS_SOAPReq
it gives me an Error saying The constructor Request_MI_Nwce007_AS_SOAPReq() is undefined.
Please let me know the exact problem and also the way to overcome this problem.
Its Quite URGENT!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Points Rewarded for helpful answers.
Regards,
Poojith MVHi Poojitha,
If your imported Webservice has any structure like this Request_MI_Nwce007_AS_SOAPReq_Input then instantiate the input structure.
else
Try instantiating along with the package name, for example if your package name is: com.sdn then try this:
"com.sdn.*Request_MI_Nwce007_AS_SOAPReq objReq = null;
objReq = new com.sdn.Request_MI_Nwce007_AS_SOAPReq();
Hope this solves your problem.
Thanks n Regards,
Jhansi Miryala -
Setting max length of the field when using Context Model Node
I have created a model using Import Adaptive Web Service model option (a web service was a wrapper around SAP BAPI function module).
There were no dictionary types created in the Local dictionary as a result of import.
I have mapped the context of the controller to the model node.
One of the fields in the model is name CUSTOMER_NUMBER type string;
Corresponding element in the wsdl of the web service is
<xsd:element name="CUSTOMER_NUMBER" type="tns:char10" />
I have created a view with the input filed mapped to the CUSTOMER_NUMBER field of the model node.
When I type more than 10 chars into the field and hit the search button, I get a com.sap.dictionary.runtime.Ddcheck exception that the length of the field should be less than 10 chars.
How can I set the max length of the field in design time to prevent runtime exception?
Thanks,
JuliaThank you for your reply.
Java trim function will trim the white spaces only, not the characters.
I can code check length functionality before calling execute function (the function that call the web service).
I can also create a dictionary structure based on the model structure; create a context value node based on the dictionary structure and use WDCopyService API to move the data between value node and model node.
I was looking for the best practice...
When importing model based on Adaptive RFC, the dictionary structures are imported together with the model. This does not happen for Adaptive web service - hence there is a need to add coding for simple checks.
Julia -
Unable to set Data in MODEL NODE ??????
Hello All,
I have created a Web Dynpro application which makes RFC or BAPI calls.
I need to <b>pass data to the BAPI as input parameter, but am failing to do so.</b>
The Context structure for the model node is as follow -
Level1 - Z_Mm_XXX_Input
Level2 - Output_Repo
Level3 - T_Plants_Selected_Repo of structure type "Werks"
and supplying function "T_Plants_Selected"
This contains the model attribute as Werks.
Now i need to send this Werks attribute and pass it to the BAPI
I have written the following piece of code -
Z_Mm_XXX_Input zbapi_ip =
new Z_Mm_XXX_Input();
com.xxx.Werks plants_sel = new com.xxx.Werks();
plants_sel.setWerks("4522");
zbapi_ip.addT_Plants_Selected(plants_sel);
wdContext.nodeZ_Mm_Cmet_Report_Contrctr_Cse4_Input().bind(zbapi_ip);
The attributes for the model node Z_MM_XXX_input node is -.
cardinality - 0..1
selection - 0..1
singleton - true
The attributes for the model node Output_Repo node is -
cardinality - 0..1
selection - 0..1
singleton - true
The attributes for the model node T_Plants_Selected_Repo node is -
cardinality - 0..n
selection - 0..1
singleton - true
Still am not able to pass data to the model node.
Am really confused what could be the probable mistake.
Please let me know what have i missed out.
Thanks in advance,
Samtahi,
i've the same problem,
i can't set my input data to the BAPI.
i've you the solution ?
thanks
PS here is a part of my code
public void executeBapi_Wd_Tut_Listuser_R3_Input( )
//@@begin executeBapi_Wd_Tut_Listuser_R3_Input()
try {
Bapi_Wd_Tut_Listuser_R3_Input input =
new Bapi_Wd_Tut_Listuser_R3_Input();
Zuname nom_start = new Zuname();
Zuname nom_end = new Zuname();
nom_start.setUname("P*"); //hard coded for the moment...
nom_end.setUname("Q*");
input.setUname(nom_start);
input.setUname_End(nom_end);
wdContext.nodeBapi_Wd_Tut_Listuser_R3_Input().bind(input);
wdContext
.currentBapi_Wd_Tut_Listuser_R3_InputElement()
.modelObject()
.execute();
// Synchronise the data in the context with the data in the model
wdContext.nodeOutput().invalidate(); -
Hello Friends,
we have an issue with the Duplicate records in to DSO let me enplain the senarion
The Heder and Details data is loaded to saperate DSO's
and these 2 DSO's data shuld get merged in the third one,
the Key fields in
DSO 1 : DWRECID, 0AC_DOC_NO
DSO 2 : DWRECID , DWPOSNR
DSO 3 will fetch data from these the above 2
Key Fields are : ]
DWTSLO,
DWRECID,
DWEDAT ,
AC_DOC_NO
DWPOSNR,
0CUSTOMER
Now the data shuld be merge in to a single record in the 3 rd dso
DSO 1 do not have the DWPOSNR object in its data fields also.
we even have start routine data from DSO 1 to populate some values in the result fields from dso2 ,
Please provide if you have any inputs to merge the data record wise.
and also give me all the posibilites or options we have to over write " apart from mappings " the data ,Hi,
You should go for creating an Infoset instead of creating third DSO.
In that DSO provide the Keys of DSOs and the Common records with those keys will be merged in that Infoset.
Hope It Helps.
Regards
Praeon -
How to find out duplicate record contained in a flat file
Hi Experts,
For my project I have written a program for flat file upload.
Requirement 1
In the flat file there may be some duplicate record like:
Field1 Field2
11 test1
11 test2
12 test3
13 test4
Field1 is primary key.
Can you please let me know how I can find out the duplicate record.
Requirement 2
The flat file contains the header row as shown above
Field1 Field2
How our program can skip this record and start reading / inserting records from row no 2 ie
11 test1
onwards.
Thanks
S
FORM upload1.
DATA : wf_title TYPE string,
lt_filetab TYPE filetable,
l_separator TYPE char01,
l_action TYPE i,
l_count TYPE i,
ls_filetab TYPE file_table,
wf_delemt TYPE rollname,
wa_fieldcat TYPE lvc_s_fcat,
tb_fieldcat TYPE lvc_t_fcat,
rows_read TYPE i,
p_error TYPE char01,
l_file TYPE string.
DATA: wf_object(30) TYPE c,
wf_tablnm TYPE rsdchkview.
wf_object = 'myprogram'.
DATA i TYPE i.
DATA:
lr_mdmt TYPE REF TO cl_rsdmd_mdmt,
lr_mdmtr TYPE REF TO cl_rsdmd_mdmtr,
lt_idocstate TYPE rsarr_t_idocstate,
lv_subrc TYPE sysubrc.
TYPES : BEGIN OF test_struc,
/bic/myprogram TYPE /bic/oimyprogram,
txtmd TYPE rstxtmd,
END OF test_struc.
DATA : tb_assum TYPE TABLE OF /bic/pmyprogram.
DATA: wa_ztext TYPE /bic/tmyprogram,
myprogram_temp TYPE ziott_assum,
wa_myprogram TYPE /bic/pmyprogram.
DATA : test_upload TYPE STANDARD TABLE OF test_struc,
wa2 TYPE test_struc.
DATA : wa_test_upload TYPE test_struc,
ztable_data TYPE TABLE OF /bic/pmyprogram,
ztable_text TYPE TABLE OF /bic/tmyprogram,
wa_upld_text TYPE /bic/tmyprogram,
wa_upld_data TYPE /bic/pmyprogram,
t_assum TYPE ziott_assum.
DATA : wa1 LIKE test_upload.
wf_title = text-026.
CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
window_title = wf_title
default_extension = 'txt'
file_filter = 'Tab delimited Text Files (*.txt)'
CHANGING
file_table = lt_filetab
rc = l_count
user_action = l_action
EXCEPTIONS
file_open_dialog_failed = 1
cntl_error = 2
OTHERS = 3. "#EC NOTEXT
IF sy-subrc 0.
EXIT.
ENDIF.
LOOP AT lt_filetab INTO ls_filetab.
l_file = ls_filetab.
ENDLOOP.
CHECK l_action = 0.
IF l_file IS INITIAL.
EXIT.
ENDIF.
l_separator = 'X'.
wa_fieldcat-fieldname = 'test'.
wa_fieldcat-dd_roll = wf_delemt.
APPEND wa_fieldcat TO tb_fieldcat.
CALL FUNCTION 'MESSAGES_INITIALIZE'.
CLEAR wa_test_upload.
Upload file from front-end (PC)
File format is tab-delimited ASCII
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = l_file
has_field_separator = l_separator
TABLES
data_tab = i_mara
data_tab = test_upload
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17.
IF sy-subrc 0.
EXIT.
ELSE.
CALL FUNCTION 'MESSAGES_INITIALIZE'.
IF test_upload IS NOT INITIAL.
DESCRIBE TABLE test_upload LINES rows_read.
CLEAR : wa_test_upload,wa_upld_data.
LOOP AT test_upload INTO wa_test_upload.
CLEAR : p_error.
rows_read = sy-tabix.
IF wa_test_upload-/bic/myprogram IS INITIAL.
p_error = 'X'.
MESSAGE s153 WITH wa_test_upload-/bic/myprogram sy-tabix.
CONTINUE.
ELSE.
TRANSLATE wa_test_upload-/bic/myprogram TO UPPER CASE.
wa_upld_text-txtmd = wa_test_upload-txtmd.
wa_upld_text-txtsh = wa_test_upload-txtmd.
wa_upld_text-langu = sy-langu.
wa_upld_data-chrt_accts = 'xyz1'.
wa_upld_data-co_area = '12'.
wa_upld_data-/bic/zxyzbcsg = 'Iy'.
wa_upld_data-objvers = 'A'.
wa_upld_data-changed = 'I'.
wa_upld_data-/bic/zass_mdl = 'rrr'.
wa_upld_data-/bic/zass_typ = 'I'.
wa_upld_data-/bic/zdriver = 'yyy'.
wa_upld_text-langu = sy-langu.
MOVE-CORRESPONDING wa_test_upload TO wa_upld_data.
MOVE-CORRESPONDING wa_test_upload TO wa_upld_text.
APPEND wa_upld_data TO ztable_data.
APPEND wa_upld_text TO ztable_text.
ENDIF.
ENDLOOP.
DELETE ADJACENT DUPLICATES FROM ztable_data.
DELETE ADJACENT DUPLICATES FROM ztable_text.
IF ztable_data IS NOT INITIAL.
CALL METHOD cl_rsdmd_mdmt=>factory
EXPORTING
i_chabasnm = 'myprogram'
IMPORTING
e_r_mdmt = lr_mdmt
EXCEPTIONS
invalid_iobjnm = 1
OTHERS = 2.
CALL FUNCTION 'MESSAGES_INITIALIZE'.
**Lock the Infoobject to update
CALL FUNCTION 'RSDG_IOBJ_ENQUEUE'
EXPORTING
i_objnm = wf_object
i_scope = '1'
i_msgty = rs_c_error
EXCEPTIONS
foreign_lock = 1
sys_failure = 2.
IF sy-subrc = 1.
MESSAGE i107(zddd_rr) WITH wf_object sy-msgv2.
EXIT.
ELSEIF sy-subrc = 2.
MESSAGE i108(zddd_rr) WITH wf_object.
EXIT.
ENDIF.
*****Update Master Table
IF ztable_data IS NOT INITIAL.
CALL FUNCTION 'RSDMD_WRITE_ATTRIBUTES_TEXTS'
EXPORTING
i_iobjnm = 'myprogram'
i_tabclass = 'M'
I_T_ATTR = lt_attr
TABLES
i_t_table = ztable_data
EXCEPTIONS
attribute_name_error = 1
iobj_not_found = 2
generate_program_error = 3
OTHERS = 4.
IF sy-subrc 0.
CALL FUNCTION 'MESSAGE_STORE'
EXPORTING
arbgb = 'zddd_rr'
msgty = 'E'
txtnr = '054'
msgv1 = text-033
EXCEPTIONS
OTHERS = 3.
MESSAGE e054(zddd_rr) WITH 'myprogram'.
ELSE.
CALL FUNCTION 'MESSAGE_STORE'
EXPORTING
arbgb = 'zddd_rr'
msgty = 'S'
txtnr = '053'
msgv1 = text-033
EXCEPTIONS
OTHERS = 3.
ENDIF.
*endif.
*****update Text Table
IF ztable_text IS NOT INITIAL.
CALL FUNCTION 'RSDMD_WRITE_ATTRIBUTES_TEXTS'
EXPORTING
i_iobjnm = 'myprogram'
i_tabclass = 'T'
TABLES
i_t_table = ztable_text
EXCEPTIONS
attribute_name_error = 1
iobj_not_found = 2
generate_program_error = 3
OTHERS = 4.
IF sy-subrc 0.
CALL FUNCTION 'MESSAGE_STORE'
EXPORTING
arbgb = 'zddd_rr'
msgty = 'E'
txtnr = '055'
msgv1 = text-033
EXCEPTIONS
OTHERS = 3.
ENDIF.
ENDIF.
ELSE.
MESSAGE s178(zddd_rr).
ENDIF.
ENDIF.
COMMIT WORK.
CALL FUNCTION 'RSD_CHKTAB_GET_FOR_CHA_BAS'
EXPORTING
i_chabasnm = 'myprogram'
IMPORTING
e_chktab = wf_tablnm
EXCEPTIONS
name_error = 1.
IF sy-subrc 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
****Release locks on Infoobject
CALL FUNCTION 'RSDG_IOBJ_DEQUEUE'
EXPORTING
i_objnm = 'myprogram'
i_scope = '1'.
ENDIF.
ENDIF.
PERFORM data_selection .
PERFORM update_alv_grid_display.
CALL FUNCTION 'MESSAGES_SHOW'.
ENDFORM.Can you please let me know how I can find out the duplicate record.
you need to split the records from flat file structure into your internal table ans use a delete ADJACENT duplicates comparing fields
split flat_str into wa_f1 wa_f2 wa_f2 at tab_space.
Maybe you are looking for
-
How to use a custom KeyManager in nonblocking SSLSocketChannel
In our existing project I had to replace the nonblocking SocketChannel by nonblocking SSLSocketChannel. My implementation of the nonblocking SSLSocketChannel hides all the SSL stuff and can be used like a SocketChannel in the whole project you just h
-
I bookmarked a website and wanted to print it. It is about a book. Somehow firefox crashed, and recovered. Now i want to print the the last 8 pages but it prints EVERYTHING AGAIN. I tried copying and pasting, didn't work. I really hope you can help m
-
How do I manually recreate the site definition (.ste) for an existing site?
My iMac hard drive recently failed and had to be replaced. Though I had backed up my web site files, I don't have a backup of the site's Site Management (*.ste) file. Thus, I'm unable to manage this site in Dreamweaver (reinstalled on the new hard dr
-
Find screen number for enhancement.
How to identify screen number for a particular standard SAP transaction for enhancement. Suppose I want to enhance any screen of any transaction how to search/identify customer screen number and enhance them, I want to add some fields or tab or anyth
-
We use JSF with ADF BC and want to enable unicode support. We changed the varchar2 columns to nvarchar2 and updated entities to this datatype, but national data are stored as question marks. As a test, I want to store the Cyrillic character "Й" (\u04