cancel
Showing results for 
Search instead for 
Did you mean: 

.Net connector, VB.net problem...Please help.

Former Member
0 Kudos

Hi all,

I have a problem when i call BAPI_SALESORDER_GETSTATUS. I created proxy field for salesdoc number, BAPIRETURN and BAPISDSTATTable which are the output parameters of that function. I inserted the textbox and in the text property i selected sapproxy.salesdoc. In the proxy, BAPI_SALESORDER_GETSTATUS parameter properties i selected repective proxy fields for the dafault value. Inserted a Datagrid and in the datasource selected sapproxy.bapisdstattable-proxy field. Under the button click event i input "sapproxy.bapi_salesorder_getstatus()". Then i build the project input the valid salesdoc number but it doesnt bring any data in datagrid. I tried using the same thing with RFC_CUSTOMER_GET method it works well. It fetches all the data. But i dont know why BAPI method doesnt work. Can anybody help me out. I am in a big trouble. Have to submit this project in school and its worth 20% of the grade.

Thanks in advance.

Dipal Patel

Accepted Solutions (0)

Answers (8)

Answers (8)

Former Member
0 Kudos

Hi,

Let me explain what i m trying to do. The sales order creation requires to input values in order_schedules_in.req_qty. Coz if this is not filled the quantity field is empty when i used getstatus to retrieve the sales order data. So rite now just to fill in one field i.e req_qty i have to include data grid. I just wanna assign values to it directly in coding like sapproxy.order-schedules_in.req_qty but if it was the structure it was simple but this is table type so i cant do this sapproxy.order-schedules_in.req_qty='10'. So is there any way way round this???

Dipal Patel

reiner_hille-doering
Active Contributor
0 Kudos

In Windows Forms designer, select your proxy. In property grid select the "order_schedules_in" and click on the "..." icon. In the Collection Editor click "Add" once to add a line. On the right hand side you can set defaults for the fields of the structure. Click Ok.

Later, you can programatically change the entry:

sapproxy.order-schedules_in(0).req_qty='10'

Former Member
0 Kudos

Hi Reiner,

You mentioned earlier in this thread that i can set the DataGrid style for my Windows Form. I have been trying to play around with the DataGrid in the ASP.Net Web form. It seems different somehow and how do i go around setting values for column width, etc etc?

Thanks

reiner_hille-doering
Active Contributor
0 Kudos

ASP.NET DataGrid does (unfortunately) work completely different than Windows Forms DataGrid: While Windows Forms DataGrid allows showing multiple tables with navigation between relation and so forth, ASP.NET DataGrid allways shows only one Table type. Therefore the ASP.NET DataGrid doesn't need the TableStyle feature - especially no MapingName.

On the other hand formatting an ASP.NET DataGrid is really easy: It has a Columns Collection and two nice editors "Auto Format..." and "Property Builder..." that you reach on the context menu. The property Builder allows you to create a BoundColumn for each DataSource' property. Turn the "Create Columns automatically at run time" off, else you would see the columns twice.

In the "Format"-Tab of the Dialog your can set Width, colour, and other styles for each Column.

Former Member
0 Kudos

Thanks will try it out..

Former Member
0 Kudos

Hi there,

Customizing the datagrid works with table types like order_partner. But i have to customize the order_hearder_in which is of structure type. How can i go about doing this. I tried but without any luck.

Dipal Patel

reiner_hille-doering
Active Contributor
0 Kudos

> Customizing the datagrid works with table types like

> order_partner. But i have to customize the

> order_hearder_in which is of structure type. How can

> i go about doing this. I tried but without any luck.

Yes, you cannot use a structure as datasource for a DataGrid. You have to use some simple controls like TextBox and bind them to fields of the structure. As I already wrote before, you cannot use the designer for this, but you need to write some code lines that add the Binding.

Former Member
0 Kudos

Hi,

Thanks you solved the datagrid problem. But assigning valued to Order_header_INX fields doesnt work directly like sapproxy.order_header_inx. no fields appears but methods and attributes does. I have noted that structure shows the field when i do like above but this doesnt work with table. Can you find this out?

Dipal Patel

reiner_hille-doering
Active Contributor
0 Kudos

> Thanks you solved the datagrid problem. But assigning

> valued to Order_header_INX fields doesnt work

> directly like sapproxy.order_header_inx. no fields

> appears but methods and attributes does. I have noted

> that structure shows the field when i do like above

> but this doesnt work with table. Can you find this

> out?

??? Sorry, but I don't understand your question.

Former Member
0 Kudos

Hi,

I was able to create sales order. But the last answer you gave i did not understand well. But rite now i am stuck with controls. Order_header_in , order_items_in i dont wanna included all the fields in the datagrid. Is there any way to customize that? Also if i dont wanna bind order_hearder_INX table instead i just wanna pass value like sapproxy11.order_header_inx.doc_type ="X" how can i do this. Would appreciate your help.

Dipal Patel

reiner_hille-doering
Active Contributor
0 Kudos

> I was able to create sales order. But the last answer

> you gave i did not understand well. But rite now i am

The last answer was about databinding simple controls (like textboxes) to fields of a structure (like order_header) that you have as a proxy field.

> stuck with controls. Order_header_in , order_items_in

> i dont wanna included all the fields in the datagrid.

> Is there any way to customize that? Also if i dont

Sure, this is a feature of Windows Forms datagrid:

- Go to "TableStyles" property and click on "...".

- Click add to create a DataGridTableStyle1.

- Set it's MappingName property to name of the table class, e.g. for the datagrid displaying the orders, to "BAPISDITMTable" (without quotes). Note that the dropdown on this property usually shows garbage.

- Add GridColumnStyles for each column you want. Set the mapping name accordingly. Here the dropdown usually works well.

> wanna bind order_hearder_INX table instead i just

> wanna pass value like

> sapproxy11.order_header_inx.doc_type ="X" how can i

> do this. Would appreciate your help.

Just write this as code.

Former Member
0 Kudos

Hi Reiner Hille-Doering,

One question for you. I was trynna add just the controls textbox to bind the specific field in the orderheaderin - doc_type. I cannot select that in the data binding and i tried to hard code it in but it doesnt work either. Can you guide me on this? I wanna create sales order using the minimum fields required to create sales order. So its there any way where i can bind the specific fields of structure as for tables i can expand and select wateva i wanna select. Also i m waiting for previous topic replied too. But thanks for the patch it worked. I think you should ask for my resume to give me a job. Just kidding.

Dipal Patel

reiner_hille-doering
Active Contributor
0 Kudos

Unfortunately I can't help you in the question what parameters are required to get the expected result from a specific BAPI. This would be question for somebody experienced with Application Development.

About your other question: Unfortunately Windows Forms Designer doesn't support simple databinding with non-list objects, even if .NET itself supports it.

But programmmatically it works: I added the following line outside of InitializeComponent:

Me.TextBox2.DataBindings.Add(New System.Windows.Forms.Binding("Text", Me.SalesOrder1.OrderHeader, "Name"))

OderHeader is a Proxy field of Type "BAPISDHD1". Note that the property to bind MUST NOT be "Nothing". So I defined a DefautValue for the Name field of the BAPISDHD1 structure in SAPWSDL designer, e.g. "".

Former Member
0 Kudos

Hi Reiner Hille-Doering,

Thanks a lot for the detailed help. But i was able to do it before you sent me as the problem was i was not supplying 0'z in salesorder no. But using BOR was something new i learned from you. Now one half of the project is done i.e the getstatus thing. Now i m stuck at creating salesorder. Can you tell me the detailed step as you did for getstatus. I wanna do it through adding proxy fields as not so comfortable with BOR thing. Till now i created three proxy fields for order_header_in, order_items_in and Order_partner_in. I set these proxy fields as default value to the createfromdat2 function parameters. Then i went to formview and added datagrid and selected datasource = partners proxy field. Added a text box and tried to bind and once i click to select the proxy.doctype field in text it shows "Property accessor 'Campaign' on object 'application.BAPISDITMTable' threw the following exception:'Object does not match target type.'" I did not know whats the problem here. Morever, i just wanna create sales order using minimum fields so can you explain me as you did earlier. Also suggest what controls would work best. Would be very greatfull to you. I know i am asing too much, but i aint able to get much luck going on my way.

Dipal Patel

reiner_hille-doering
Active Contributor
0 Kudos

I check it and recognised that the exception "Object does not match target type." is a bug in NCo 2.0. Interestingly nobody did find it before. I have sent you a patch by EMail.

Former Member
0 Kudos

Hi Reiner Hille-Doering,

WoW, i feel good about me. I found something that nobody else did, if not something creating new but discovering something thats wrong. Hehe... But I really really appreciate the help u've been giving me. Thanks for all. But still can you tell me the controlls to be used and the minimum fields i should supply. I read the sap note for mandatory fields and when i try to create an salesorder in SAPGUI through Bapi_createdatfrom2 i fill in all the mandatory fields still it say data not complete. Also if you can answer my previous posting questions other then the bug as its solved now.

Dipal Patel

Former Member
0 Kudos

Hi Dipal,

Can you explain how you got the problem with the BAPI not recognizing all the parameters though you passed all the values.

I am having a similar problem. I am passing all the values to an RFC that inturn calls the BAPI BAPI_INCOMINGINVOICE_PARK, but the return table still says " enter mantatory column PO_NUMBER".

Thanks

reiner_hille-doering
Active Contributor
0 Kudos

Tip: Turn on Abap-Debugging and look in the ABAP-Debugger how the parameter reached the system.

Former Member
0 Kudos

Many thanks,

Reiner Hille-Doering

Its really helped, thats was the mistake i was doing it. Also would like to know this if my sales doc is 50000 then all i have to do is add preceding 0'z making total length 10. Let me know if i am wrong. Morever, now the second step in the project is creation of sales order from bapi_salesorder_createfromdat2. My question is if i make all parameters in salesorder funtions as proxy field and i bind to respective fields or data grid...will it also work as data input. And if you can send me your code i would learn something. Some professional way to go for interfacing.

Thanks alot once again,

Dipal Patel

reiner_hille-doering
Active Contributor
0 Kudos

> Its really helped, thats was the mistake i was doing

> it. Also would like to know this if my sales doc is

> 50000 then all i have to do is add preceding 0'z

> making total length 10. Let me know if i am wrong.

In this case, yes. If you look into ABAP source code of BAPI_SALESORDER_GETSTATUS you will see that the parameter is used as key in a table called "VBAK", column "VBELN". If you look at the table in transaction SE16, you see the values - they just have to exactly match.

> Morever, now the second step in the project is

> creation of sales order from

> bapi_salesorder_createfromdat2. My question is if i

> make all parameters in salesorder funtions as proxy

> field and i bind to respective fields or data

> grid...will it also work as data input. And if you

You can do so. Might be you end up with lots of proxy fields, so it might be better to pass at least some values as parameter. BTW a better start for you is to create a proxy for BOR class "SalesOrder". It will automatically create you a proxy which contains all needed BAPIs with names already nicely renamed and some Proxy Fiels already created for you.

> can send me your code i would learn something. Some

> professional way to go for interfacing.

Instead of posting (because I don't exactly know how this works in SDN) I quickly describe what I did:

- Create new VB Windows Forms app.

- Add SAP Proxy named "SalesOrder.sapwsdl".

- Open Server Explorer BOR node and set Filter for Alphabetical view to "SalesOrder".

- Drag the whole SalesOrder class to .sapwsdl designer.

- Add Proxy Field for status table and set it as Default of the corresponding parameter in GetStatus method.

- Compile

- Drag SalesOrder instance to Windows Form

- Drag ServiceExplorer Application Server Node to create a destination.

- Wire SalesOrder1.Connection to new destination.

- Create a DataGrid and databind to SalesOrder1.Status

- Create an Input fields and databind to SalesOrder1.SalesDocument.

- Set SalesOrder1.SalesDocument in property window to a value other than "Nothing", e.g "0000000000".

- Create a Button with call to SalesOrder1.GetStatus()

reiner_hille-doering
Active Contributor
0 Kudos

I have just tried what you explained and it work for me. Perhaps you have note entered the the Salesdoc number with all leading "0"s. This is a "NUMCHAR" field and you have to enter it exactly as it's used in the DB, e.g. "0000004975". If you can't get it running I could post the finished project code with some hints how I made it.