ABAP – Finding Field and Type

Well, it occurred to me.  I have a new intern, and he knows nothing about SAP or ABAP.  So I’m having to go back to the beginning to try to get him in the swing of things.  So, I thought I’d start throwing some of the things I’m teaching him out here.  Who knows?  maybe it’s useful to some of you out there too 🙂  Today I’m going back to the very basics.  Finding field and type from a screen.

For this example, I’m using transaction IW41

blog03-01

Highlight the field you want information on.

blog03-02

Press the technical details button.

blog03-03

This magical screen gives you quite a bit of information.  Typically, Field Name and Data Type are the most valuable.  Occasionally, you can even get the Table name.  In a future post, I’ll talk about digging further when this screen only gives you a structure (which happens quite often).

Thanks for reading,

ABAP Web Dynpro – ALV Table Columns

Ok…  now I finally got to the really important stuff for me.  I have a configuration table that tells how columns are available, and how they sequenced by default.  So obviously, if I’m going to use the ALV simple table versus the “standard” Table Class, I need to control the ALV Table Columns, this includes sequence, visibility and column header text.

So, again, I’m doing all of this in the WDDOINIT method, since it’s a one time read.  Here’s how you can do it yourself.

  data lo_cmp_usage type ref to if_wd_component_usage.
DATA lo_INTERFACECONTROLLER TYPE REF TO IWCI_SALV_WD_TABLE .
DATA lv_value TYPE ref to cl_salv_wd_config_table.

*** instantiate the component
lo_cmp_usage =   wd_this->wd_cpuse_alv_comp( ).
if lo_cmp_usage->has_active_component( ) is initial.
lo_cmp_usage->create_component( ).
endif.
lo_INTERFACECONTROLLER =   wd_this->wd_cpifc_alv_comp( ).
*** get the ALV table
lv_value = lo_interfacecontroller->get_model( ).

** first, get all of the columns from the table.
lt_cols = lv_value->if_salv_wd_column_settings~get_columns( ).
READ TABLE lt_cols INTO ls_cols with key ID = <TABLE FIELD NAME>.
*** For visibility, you the following values
*      WHen ‘VISIBLE’
lv_vis = ’02’.
*     when ‘INVISIBLE’.
lv_vis = ’01’.
ls_cols-r_column->set_visible( lv_vis ).

*** set the sequence of the columns
lv_seq = lv_sequence.
ls_cols-r_column->set_position( lv_seq ).

*** Set the header text and tooltip
ls_col_hdr = ls_cols-r_column->get_header( ).
lv_col_text = lv_text.
ls_col_hdr->set_text( lv_col_text ).
ls_col_hdr->set_tooltip( lv_col_text ).

Of course, you can loop through and find your values from anywhere.  The important thing to notice is that it’s pretty simple.  Especially in comparison to the process I was using that had to delete a column and re-add it in order to sequence it properly.  This is a lot less involved.  So far, I haven’t found anything that I do that would force me away from the ALV Table.  I guess I’ll see what happens, but I may start converting my SM Portal to the ALV Tables.  The processing time doesn’t seem bad, so if you happen to know why the “standard” vs SALV table is preferable, I’d love to hear from you.

As always, Thanks for reading,

ABAP Web Dynpro – ALV Table Settings

Well, the next phase of my journey was the ABAP Web Dynpro ALV Table Settings.  I wanted to control things like the number of rows to display, what buttons should be available etc…

So after a little more research, I found that is pretty easy to do too.

Again we go to the WDDOINIT and add the follow code (or something like it ).

  data lo_cmp_usage type ref to if_wd_component_usage.
DATA lo_INTERFACECONTROLLER TYPE REF TO IWCI_SALV_WD_TABLE .
DATA lv_value TYPE ref to cl_salv_wd_config_table.

*** instantiate the component
lo_cmp_usage =   wd_this->wd_cpuse_alv_comp( ).
if lo_cmp_usage->has_active_component( ) is initial.
lo_cmp_usage->create_component( ).
endif.
lo_INTERFACECONTROLLER =   wd_this->wd_cpifc_alv_comp( ).
*** get the ALV table
lv_value = lo_interfacecontroller->get_model( ).

*** Set Table Buttons and attributes
lv_value->IF_SALV_WD_TABLE_SETTINGS~SET_SCROLLABLE_COL_COUNT( value = 10 ).
lv_value->IF_SALV_WD_STD_FUNCTIONS~SET_EXPORT_ALLOWED( value = abap_false ).
lv_value->IF_SALV_WD_STD_FUNCTIONS~SET_PDF_ALLOWED( value = abap_false ).

this particular example turns off the print button (PDF Allowed), turns off the Export button (Export_Allowed), and sets the scrollable column count = 10.  Just because my particular table could be 100 columns wide.  So I want it to render nicely, and 10 is a pretty good number of columns.  In addition, I’m leaving the settings button available, so a user can make his own settings if he doesn’t like my default.  I really like this ALV stuff 🙂

Alright, back to it.  Thanks for reading,

ABAP Web Dynpro – ALV Table Button

Well, after my last post, I realized, this is cool.  Now it’s time to make it better.  So the first objective is to add an ALV table button for refresh.  It turns out, it’s pretty easy to accomplish this.  Here’s what you need to do.

So, go into your WDDOINIT and add the following code (or some variation).

*** initial ALV table
data lo_cmp_usage type ref to if_wd_component_usage.
DATA lo_INTERFACECONTROLLER TYPE REF TO IWCI_SALV_WD_TABLE .
DATA lv_value TYPE ref to cl_salv_wd_config_table.
DATA: lr_btui_refresh TYPE REF TO cl_salv_wd_fe_button.
DATA: lr_bt_refresh TYPE REF TO cl_salv_wd_function.

*** instantiate the component
lo_cmp_usage =   wd_this->wd_cpuse_alv_comp( ).
if lo_cmp_usage->has_active_component( ) is initial.
lo_cmp_usage->create_component( ).
endif.
lo_INTERFACECONTROLLER =   wd_this->wd_cpifc_alv_comp( ).
*** get the ALV table
lv_value = lo_interfacecontroller->get_model( ).
*** create the button object
create OBJECT lr_btui_refresh.
*** set icon
lr_btui_refresh->set_image_source( ‘ICON_REFRESH’ ).
lr_bt_refresh = lv_value->if_salv_wd_function_settings~create_function( ID = ‘BT_REFRESH’ ).
lr_bt_refresh->set_editor( lr_btui_refresh ).

Now you can also add text to the button instead of just the image source.  If you drill into the cl_salv_wd_fe_button class to see the methods available.

I’ll have more tomorrow as I keep learning.  Thanks for reading,

Web Dynpro – The ALV Table

Well, with all the work that I did for my Customer SM Portal, I thought I knew what I was doing with the ABAP Web Dynpro, especially around tables and dynamically changing them.  I recently started working on a new application that is more scaled back.  One of the requirements is to have the same sort of functionality as an ALV Table in the ABAP.  So we want to have the filter, sorting, and flexibility to play with your layout and settings.  Well, I started to look at the current tables I’d been using, and realized I had to implement each of those functions myself.  Well, that looked like a rather big task to undertake, so I went to my buddy, the internet and looked up Web Dynpro ALV Table and quickly found that SAP was nice enough to provide a way to implement the ALV Table.  Of course, it meant another change to the way I was doing things… but hey, I learned something new.

First of all, thanks that Sankar.  If you like to see exactly how to do this in video format, check out this like.  Sankar does a great job in demonstrating exactly how to code this stuff.  My only problem is that sometimes it was hard to read the code and class names (which is why I’m going to cover this in text form). https://www.youtube.com/user/sankar1bhatta?feature=watch

So, let me walk you through the steps of how to create an ALV Table.  The first step is to add a new Web Dynpro Component. blog01-01

So, go to your top level, and add a Used Web Dynpro Component.  You can name the Component Use whatever you like, the component itself is SALV_WD_TABLE.  This is the magic that will allow you to use all of the ALV functions. I’m not going to cover this in depth, but the next step will be to add a context node + attributes that will be the structure for the table you want to create.  Be sure to create this in the componentcontroller, and not directly in a particular view. This next part was new to me.  I believe it’s called external component mapping.  So let me walk you through this next part.

blog01-02

First, drill down into the component usuages until you find the ALV component you defined above (mine is ALV_COMP).  Next, you need to drag your context (table you want to create in ALV) from the right side, over to the Data node on the left side above.  You have now linked that table structure to the ALV components. Finally, we need to add this to the layout so you can actually see the table.  So, go to your layout and add a ViewContainerUIElement.  Wherever you place this is where your table will come in. We have one final step, and then you’re ready to test.

blog01-03

So, go to your window, and find the VCUI element that you just created, and drill down and then right click to Embed View.

blog01-04

Select the Table interface, and you’re ready to go.  Just fire up your application.  In some future posts, I’ll discuss how you can customize this, but for many applications, this might be enough.

Thanks for reading,

Basis – Upgrading the Kernel from 700 to 720

Well, I’m trying to venture into the mobile world, but as always, there are technical challenges I just never quite expect.  🙂  Today’s challenge is that the NetWeaver Gateway won’t work with the 700 Kernel.  So I had to look into upgrading kernel from 700 to 720.  I owe all of my success to someone I found on SDN.

http://scn.sap.com/community/netweaver-administrator/blog/2013/05/22/upgrading-sap-kernel-from-release-700-to-sap-kernel-720rel-720ext

As expected, it’s a little more complicated than just installing a new kernel, so check this post out if need help doing this.  I now have a system to the latest 720 kernel.  But be warned, it takes a lot longer to boot the system up with the new kernel.  I’m hoping that may only be the first time.  Guess I’ll see the next time I need to take the system down.

Thanks for reading,

 

Variant Configuration – ESTO issue

Well, of course, I talk about something one day, and then find a rather large “gotcha” the next.  Not quite Murphy’s Law…  but it’s similar.  ha ha ha.  Yesterday I talked about the cool new ESTO process, and today I found out something that kind of sucks.  In order for the ESTO process to properly handle sales order costing, you must recreate your variant BOM in the originating plant.

Let me explain further.  Let’s say that Plant A takes the order, and points to plant B to create the production order, fulfill the demand and then send it over to plant A to finally go back to the customer.  This part works just fine, but sales order costing is NOT smart enough to look at the cost of the part in plant B.  It looks at plant A, and uses that cost.

As a modeler, that means that now the configurable BOM in Plant B, must be replicated in plant A (with the exception of setting the materials in the BOM to be costing relevant only).  This then allows sales order costing to explode the VC BOM in plant A, to come up with the cost that will be incurred in plant B.  While this isn’t the end of the world, it does increase your maintenance.  What I’m not sure about is if the routing must also be replicated (I’m assuming it would).

If anyone can comment on this, I’d love to hear about it.  If not…  be aware of this when you start to implement ESTO.

Thanks for reading,

 

Variant Configuration – the new ESTO process

Now, the current project I’m on is my first exposure to this process, so maybe I’m just behind the curve, but if you happen to know more about this, please let me know.  The process I’m talking about is ESTO.  Now, this is very similar to the original STO (Stock Transfer Order) which is a process for moving stock between facilities.  It can work similar to a purchase order between plants, with a lot less paperwork.  Now, ESTO is a way that you can do with a configurable material.

So, envision this.  Your facility in Europe takes an order for a variant configuration material.  Through the magic of special procurement keys, you can now send that planned/product order demand to any other plant of your choosing.  Now, I’ve been doing this a while, so this functionality is pretty cool.  I’ve always had to tell customers if you want to do something like this, you have to use material variants.

The magic with ESTO is that it will transfer your configuration to the building plant, so that it can use it’s configurable BOM’s and routing to produce the machine, and then allow it to be shipped to the plant that originated the demand.

While I haven’t been closely involved in the testing of this process it does have me curious.  Again.  if you have any feedback on this process, or things to consider, I’d love to hear them.

As always, thanks for reading.

Basis – Running Standard Jobs through SM36

Well, one of my systems was suddenly experiencing some strange behavior, so like normal, I just rolled it back, and implemented my transports.  But it occurred to me, it’s likely there are some simple things I can do to prevent this from happening in the first place.  So here’s what I found, and I hope this will help 🙂

1.  If you run SM36, then press the standard jobs, and then press press default scheduling, it will schedule a whole bunch of standard reorg jobs, that probably would be helpful for me 🙂

2.  Deleting the Short dumps out of ST22, can be helpful too.  simply go to ST22, and use the menu goto->reorganize.  Then just accept the selections.

So enjoy these little tricks, and if i find anymore, you know I’ll post them out here 🙂

Thanks for reading,

Posts navigation

1 2 3 65 66 67 68 69 70 71 97 98 99
Scroll to top