Month: April 2013

Home / 2013 / April (Page 2)

Variant Configuration – Copying Sales Order Line Items

Special thanks to my Padawan, Dennis Mayo, he showed this me cool trick.  However, I had to do a little more research on it first.  It turns out, you could need some OSS notes applied for this to work.  So, before I go into some possible fixes, first let me tell you the good stuff about copying sales order line items with a configuration.

If you ever need a copy of a configuration within the same order, you can simple go into VA02, and use the menu Sales Document -> Create w/Reference.  Now, in my ignorance, I didn’t realize you could do within the sales document.  I thought it was only to create a new document.  So simple change the tab to order, if your system is like mine, it will even default your order in.  Now, magically, you have a second line that is identical to the first, with it’s own changeable configuration.  This is great for quoting when a customer might just be asking for minor variations of a configuration to see the see the difference in price =)

Now for the gotcha’s…  first and foremost, if you don’t have OSS Notes 738671 & 903495 applied in your system, you will need them.  This change appears to impact quite a few different system versions, so make sure those are applied (or the support packs that contain them).  Also, refer to OSS Note 814547 for the explanation of the configuration that applies to this change.  The short story is that in the copy control for the sales order line item, the item category must be set as blank or “A”, if you want the configuration to be changeable.  In the other choices, the configuration is directly linked to the original, and can only be changed from the original.

So there you go…  Thanks Dennis.

Web Dynpro – Creating a Radio Button

Well, I’m stilling hanging out in Web Dynpro land.  I found a new enhancement that Rapier 1.0 really needed.  So here I am again.  This time I had to focus on creating a radio button, because I wanted a customer to be able to select either an existing customer, or create a new one.  IN my brain, a radio button was a nice easy solution…  right???  As always, things are more complicated than I expected.  ha ha ha.  Well, here’s how it works.

You’ll need a context element that will hold the texts for the radio buttons.  This will dynamically determine the number of radio buttons displayed.  To make it work, you’ll need a node and an attribute.  The attribute should just be a string.  Be sure to add a supply function to the node.  This is how the texts will get populated.  See below for the code.

In the layout, create yourself a new element.  I used the RadioButtonGroupByIndex element.  I had a very defined set of values (for this example, 2) so that made life nice an easy.  Inside the element, you need to set a few things…  First, ColCount, this is the number of columns that will be used to display the radiobutton.  Second, texts…  this is a table that contains the texts.  Use the context node you created above.  Third, you’ll want an action for on select.  This will determine what happens when you select a radio button.

Now for some code.  First, you’ll need to populate the radio button text.  In the supply function you assigned in the context node, add something like the following code.

data : it type table of if_v_rp_user_create=>element_cust_method,
wa like line of it.
DATA lo_nd_app TYPE REF TO if_wd_context_node.

wa-text = ‘radio 1’.
append wa to it.
wa-text = ‘radio 2’.
append wa to it.
node->bind_table( it ).

So, those are the basic…

ABAP: Eliminating Errors by using exception ERROR_MESSAGE

I have to thank Jeremy Meier for this post.  I have to confess, I’m pretty excited to have my first guest post, so I just wanted to preface his post with a hearty thank you 🙂  The exception ERROR_MESSAGE is a technique I was unfamiliar with until Jer sent this to me.

I discovered this for one of our developers today – he was getting errors in using a standard SAP function module to get material requirements data from an MD04 function module for a report he was writing.  The code was calling a standard message when it hit a rare error check in the code”

if xyz <> abc.
MESSAGE ID ‘123’ TYPE ‘E’ NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.

As this is used in MD04, it’s meant to throw the message to the screen – but when he tried to embed this function module in his Z-Report and ran it on a specific material number it caused an error to occur on the expected automated file download to excel to fail.

After looking for the right TRY-CATCH statement – which wouldn’t actully work because there was no “exception” or dump – the solution after digging a bit was to include the exception ERROR_MESSAGE to his function module call, even though it wasn’t a “defined exception” on the function header:

CALL FUNCTION ‘XYZ’
EXPORTING
VALUE1 = VARIABLE1
IMPORTING
VALUE2 = VARIABLE2
EXCEPTIONS
EXCEPTION_A = 1
EXCEPTION_B = 2
ERROR_MESSAGE = 3.

This action trapped the message and saved it to the SYST table where a standard FM can then be used to extract it if necessary, if the function module returns with sy-subrc=3:

if sy-subrc = 3.
CALL FUNCTION ‘BALW_BAPIRETURN_GET2’
EXPORTING
type  = sy-msgty
cl    = sy-msgid
number = sy-msgno
par1  = sy-msgv1
par2  = sy-msgv2
par3  = sy-msgv3
par4  = sy-msgv4
IMPORTING
return = return.
endif.

Realistically, anytime your using SAP function modules that are part of transactions, developers should try to us this to suppress the error messages and return them on their terms.

Web Dynpro – Dynamically Setting the Theme

I had to do some digging to figure this one out.  I have to give all of the credit to the link I found below.  This is geared toward a Non-Portal application,  Like my Rapier application.  It gives some great pointers on dynamically setting the theme within a web dynpro application.

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/7015b1f9-535c-2910-c8b7-e681fe75aaf8?QuickLink=index&overridelayout=true&8053063684070

Here’s the quick details.

1.  In your application, add a parameter RUN.  You can use Type String, C or whatever you want.  This is just a flag.  I also added the WDFORCEEXTERNALSTYLESHEET = X.  I’ll be honest, I’m not sure if I need this or not.  From what I’ve read, this is required if you’re using the portal.  I’m not using the portal, but it works if I set this parameter, so I left it.

2.  Now, go to your main window.

3.  Add an outbound plug of type EXIT.  Be sure to give it a parameter of URL.  If you read my or used my post on the logoff button, you already have this =)

4.  Add an inbound plug (or use the default plug).  You need a startup plug is the only key here.  Now double click on it to go into the code.

5.  Once in the code, add the parameter of Run here.  and add the following code (or a variation of it).

  CALL METHOD CL_WD_UTILITIES=>CONSTRUCT_WD_URL
EXPORTING
APPLICATION_NAME = ‘XXX’ “Your web dynpro applicaiton name
IMPORTING
OUT_ABSOLUTE_URL = lv_e_url.

if run is INITIAL.
CONCATENATE lv_e_url
‘?sap-ep-themeroot=/SAP/PUBLIC/BC/UR/NW5/THEMES/SAP_HIGHCONT’
‘&run=N’ INTO lv_e_url.
wd_this->fire_logoff_exit_plg( url = lv_e_url ).
endif.

Here’s what happens.  The first time you log into the application, it works like normal, but run is initial.  so it leaves the current application, and re-runs it with the additional parameters of you set above.

Now I did run into some strange behavior.  I kept getting a dump because of parameter run.  I implemented OSS Note: 946490, still no luck.  I finally just entered a value into the RUN parameter in the application, and then blanked it out.  Then it finally worked.  Not sure what the deal was, but hope it helps you out.

Thanks for reading and I hope this helps…

Basis – Getting Support Packs

Well, I had to move back into the world of Basis again.  SAP sent out a message a couple months ago basically saying you have to implement a bunch of OSS notes, or move your system up to a certain support pack level.  Well, needless to say, I’m way behind on support pack for my systems anyways.  This is partly intentional and partly just a lack of time.  The intentional part helps keep me accessible no matter what version of SAP support packs my potential customers have.  Well, since I have to contractually do this, it was a good opportunity to update my systems.  This posts talks about my challenges of getting support packs for my SAP system.

Well, support packs, in theory, are very easy to implement.  Transaction SPAM does everything for you.  Well, the challenge for me came in to get the actual support packs to implement.  As it turns out, anything after a certain date can only be acquired using Solution Manager (there’s a way around this that I found).  Now my problem is that I have a solution manager system, but it’s not really connected to anything.  I’ve used SOLMAN purely to get the access codes for system installation.  Now I know that SAP keeps hyping up SOLMAN, but to be honest for my purposes it has no value add.  So I went through and started to manually download all of the support packs I needed.

Even the download was tougher than I expected.  I dug around service.sap.com until I finally found the support “stack” table of contents to find out what packages are required.  Initially, I did it the hard way of downloading the packs I thought I needed, tried to implement, and found out it had more pre-requisites.  Well, I finally found everything I needed, but in my SAP Download manager, it showed everything under needing approval.

Well, I can only guess that if I had a fully functioning SOLMAN, I could do this, but instead, I went out and posted an OSS message to approve the packs.  Be sure to set the area as:  SV-SMG-MAI-APR  As it turns out, SAP will quickly approve these and let you just download them (Thank goodness for that…).  I did make a very brief effort to get the SOLMAN component working to allow me to do it from there, but I had no success, and no time to investigate it.

Anyway, I wanted to pass along these little tidbits.  My EHP4 system is still running after 36 hours, so who knows how long it will take to finish, but it’s rolling =)  Thanks for reading.

 

Field Service Web Application – Help Please =)

This is going to become my center piece for Renovation.  So, I again have a question for my audience…  what features would you want to see in a field engineering application.  Please keep in mind, the initial release will not be a mobile app.  That comes next… first I need to design all of the features.  If your organization has on-site or field service, I could really use your input.  What features would you need?  what would you like to have?  and would could I offer that would make it a no brainer for your organization to purchase?

Now some of the obvious things I plan to include will be a worklist for the field engineer.  It will show all the service orders, notifications, tasks etc assigned to the engineer.  It will provide the option to show the details of each item on the list.  This will be configurable based on business need.

It will also include the ability to enter time and material to each order.  Enter in measurement documents for pieces of equipment.

So what would you like to see?  I appreciate your help and I look forward to providing a new application to help you out.

Rapier is now in ABAP Web Dynpro!!!

Well, this might not seem like a big deal to many, this is huge for me.  Rapier started as dream of mine almost 6 years ago.  That dream started this crazy adventure that I’ve been blogging about to all of you.  Well, my dream hit a new level that now includes ABAP Web Dynpro.

Well, Rapier was originally written in BSP, and little did I know that by the time I finished learning and writing my first real application, the technology would no longer be supported.  As a consequence of that, I found that my application that I spent so much time and effort on, only worked in a few browsers because SAP stopped updating browser support for BSP.

This made Web Dynpro my mission.  Not only did I need to learn Web Dynpro for Rapier, I have a lot of plans for my current applications to all be visible on the web…  and of course, my newest baby that I’m about to start…  my field service application.

Now, Rapier will work on Safari, Internet Explorer and Google Chrome.  Also, if your support packages are up to date, it will work on Firefox (this browser for some reason is tough to keep current with).  But Safari was a big win for me.  I’m currently testing it on the IPad to see how it work.  Wish me luck, and I’ll be sure to keep you posted.  Thanks as always for you Support…

 

Web Dynpro – Adding an Icon in a Dynamic Table Column

Here was another fun task I wanted my new ABAP Web Dynpro to be able to add an icon in a dynamic table column.  Again, I expected this to be easy…  well, not as much as I figured, so I thought it might be something you could use.  (and I’m looking for some fun things to write about).

 *** again, start with getting the reference to the table, and then getting all the columns
l_table ?= view->get_element( ID = ‘TB_XXX’ ).
lt_cols = l_table->get_columns( ).
LOOP AT lt_cols into wa_cols.
*** in this example, I want column DOC_ICON to show an icon, rather than text.
IF lv_col_fld = ‘DOC_ICON’.
*** for the correct column, you need to assign an image, rather than the standard text.  In this ***example, I just needed to tell it what to bind for the value (remember, I had this value already,
***so I just need to assign the correct context node.
lv_image = cl_wd_image=>new_image( bind_source = ‘XXX.DOC_ICON’ ).
*** this is the magic.  Telling it what cell editor to use what sets it as text vs. an Image.
Wa_cols->set_table_cell_editor( LV_IMAGE ).
ENDIF.
ENDLOOP.

And that’s the magic…  Hope this can make your life easier…  Because like the catchphrase goes, I learn things the hard way, so you don’t have to.