cancel
Showing results for 
Search instead for 
Did you mean: 

Create/Change/Delete for material

Former Member
0 Kudos

Hi Experts.

I have to create an application is which i have to create new material, change existing SAP materials & delete sap existing materials.

I am not sure which approach is good:-

1. 1 view for create / change / delete

2. saperate view for create change & delete.

If i go with the first case how do to perform it (how to use create view as change & delete view) I created a view for create materials. For change & delete i created a search view which gives a list of SAP existing materials based on selection criteria. Now how to pass selected materials data to the create view so that i can see it in edit mode (in Create view) if user presses change. or how to display the selected material data in display mode (in create view) for deletion.

If i go with the 2nd option then also how to pass Selected material from the search to change & delete view.

Not sure where do i have to create context methods etc for such functionalities.

Regards,

Nik

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

hi,

If you want to display records, Then you can use select query to have all records in internal table and finally bind it to a Table.

If you want to create records, then you can have all the req fields in layout and when user fills it and submit then you can save the same in DB Table.

If you want to delete records, then you can select the records, delete it and finally update the DB Table.

Former Member
0 Kudos

hi Nikhil ,

u need to create the context in the component controller . The context created in this way wud be global and thus accessible across several views .

regards,

amit

Former Member
0 Kudos

Thanks Amit & Saurabh.

Can you tell me how can i display SAP existing materials data if i use only 1 create view which is used to create materials. At initial its haveing input fields. Now i want to see data in create view for the seleted material.

Regards,

Nik

Former Member
0 Kudos

Could you please elaborate more.

Do you want to have a screen for creating data ?

or Do you want to display all data in Table and from table select one data ?

Former Member
0 Kudos

hi Nikhil ,

though I wud recommend u go with the second approach , but still if u want to go with 1st option and want

to see ur elements in edit and dispaly mode depending on condition ,

bind ur input fields and/or other UI elements to a context attribute of type WDY_BOOLEAN for this.

NOw in the method "ONaction event " , u set the input fields to ' '



  DATA lo_nd_cn_input TYPE REF TO if_wd_context_node.
  DATA lo_el_cn_input TYPE REF TO if_wd_context_element.
  DATA ls_cn_input TYPE wd_this->element_cn_input.
  DATA lv_ca_gddb LIKE ls_cn_input-ca_gddb.
* navigate from <CONTEXT> to <CN_INPUT> via lead selection
  lo_nd_cn_input = wd_context->get_child_node( name = wd_this->wdctx_cn_input ).
 
* get element via lead selection
  lo_el_cn_input = lo_nd_cn_input->get_element(  ).
 
* get single attribute
  lo_el_cn_input->set_attribute(
    EXPORTING
      name =  `CA_GDDB`
    IMPORTING
      value = ' ').

here ca_gddb is ur context attribute under the node cn_input. U cn read the attribute using code wizard by pressing CNTRL + F7
and selcting the radio button read context att/node


 u can enable ur fields , so tht user cn change it accordingly, by setting variable to 'X'


* get single attribute
  lo_el_cn_input->set_attribute(
    EXPORTING
      name =  `CA_GDDB`
    IMPORTING
      value = ' X').

by making the attribute value 'X'

regards,

amit

Edited by: amit saini on Oct 14, 2009 12:12 PM

Former Member
0 Kudos

hi

Can you tell me how can i display SAP existing materials data if i use only 1 create view

which is used to create materials. At initial its haveing input fields.

Now i want to see data in create view for the seleted material.

do u mean , u have the records in ur data base table and u want ur records to be listed down in a drop down , in ur create view

if so , u can use dropdown by index ..

if u wish to use drop down by index , thn proceed like this :

1 declare a context node of cardinality 0..n

2 declare attribute of type string under it . The attribute name should be exactly the same as that in database table '

eg if u want to poulate values for a field ' SYS' from table , than giv the attribute name as 'SYS' in context attribute

3 declare internal table of type standard table

4 populate internal table with values

5 take the refernce of the node , u have created

6 bind it with the internal table

the dropdown by index wud nw contain app values

cn u pls explain more about ur requirement ?

Edited by: amit saini on Oct 14, 2009 12:29 PM

Former Member
0 Kudos

Hi Saurabh/Amit,

The scenarion in my case is as below:-

I have to create materials in SAP using online application.

It also have an approval process.

For creation i created a create view. Now user can also change existing sap material. For this i created a search view where he can search based on the criteria.

On that list user can select a material & click on change button, which should open the material in the edit mode of create view(or a new view as u suggested) with all the material related date. If he clickes on that line it whould open the customer in display mode in the create view (or a new view as u suggested) with change button. If he select a line & click on delete, it should open it in display view with delete buton there too to delete sap existing customer.

I will try as you guys suggested. If you can suggest something more that will be a great help.

Regards,

Nik

Former Member
0 Kudos

Hi Nikhil,

First try to find out the differences in SAPGUI for both the create and change.If the fields and all are different then go for different views otherwise have a same view and enable/disable the fields based on CREATE/CHANGE.

Regards,

Lekha.

Former Member
0 Kudos

Hi ,

in ur search view

1 on click of Change , naviagte to ur EDIT view

2 on click of Delete , naviagte to ur DELETE view

3 u can use inbound and outbound plugs for the same , if u dont know how to use them refer sm tutorials on SDN

or refer this online help

http://help.sap.com/saphelp_nw70/helpdata/EN/b1/6ffc40c5e8ef6fe10000000a1550b0/content.htm

4 make all ur context in ur component controller

5 u can access Attributes created under ATTRIBUTE TAB in comp controller by wd_comp_controller->attr1( )

and in view by wd_this->attr1( )

Former Member
0 Kudos

hi,

I would suggest you to start working on this and in case of issues revert back.

How to pass values to different views , this has been explained.

so no issues would be there.

Former Member
0 Kudos

solved

Former Member
0 Kudos

To pass the values between two or more views, make use of Component Controller.

In the Attributes Tab of component controller , create an Attribute of Table type.

whenever you want to pass values to Second view, set it in Attributes of Comp controller :

wd_comp_controller->Att1 = <Value to be passed.>

Now , in the second view, you can fetch/read the value :

data : itab type sflight.

itab = wd_comp_controller->Att1.

1. In your case, you can go for Separate Views for Create , Change , Delete.

2. For the data that needs to be send / displayed, create a Context Node with all attributes as you want in layout.

3. Map the Context node of Component controller with all the three Views.

4. Now you can set/read data in all the three views using Code Wizard (control _ + F7)

5. Whenever you want to delete a particular record , then delete it from this node only.

6. So finally this node will have your updated data.

<Make Context node in Component controller and Map it with all the three Views.>

Edited by: Saurav Mago on Oct 14, 2009 3:32 PM