Month: June 2013

Home / 2013 / June

ABAP – Using a Dropdown to Populate Multiple Fields

Now, since I’ve been on a roll talking about the VALUE-REQUEST and some of the fun tricks I’ve been discovering.  Today, I’m going to give you some sample code to populate multiple values with a single dropdown.  Often, when I create a screen, I’m using some combination like sales order & line item, material & plant, etc…  so I wanted to know how I could use a single dropdown to populate multiple fields.  Here you go.  This is for VBELN & POSNR.  Now, keep in mind, I used the trick from yesterday to get the sales order number (if it’s populated) so that the pull down will work smarter.

SELECT vbeln posnr
FROM vbap

” Set return fields

” Order
CLEAR ls_map.
ls_map-fldname = ‘F0001’.        ” Set that field 1
ls_map-dyfldname = ‘GV_VBELN’.
APPEND ls_map TO lt_map.
” Item
CLEAR ls_map.
ls_map-fldname = ‘F0002’.        ” Set that field 2
ls_map-dyfldname = ‘GV_POSNR’.
APPEND ls_map TO lt_map.

” Call Search Help Popup Function
retfield        = ‘POSNR’
dynpprog        = sy-repid
dynpnr          = sy-dynnr
dynprofield     = ‘VBAP-POSNR’
value_org       = ‘S’
value_tab       = lt_sh
dynpfld_mapping = lt_map
parameter_error = 1
no_values_found = 2
OTHERS          = 3.

That’s all there is to it.  You’ll still need to review my previous posts: dropdown list for characteristic values and dropdown list along with reading a dynpro value to pull it all together, but it should give you all the tricks you’ll ever need to use the VALUE-REQUEST.  I hope this makes sense on how you can use a dropdown to populate multiple fields.  Thanks for reading.

ABAP – Reading Dynpro Value

This latest trick I discovered when creating my pull down lists.  If you’re curious, check out my previous posts dropdown list for characteristic values and dropdown list.  It turns out reading dynpro value isn’t as easy as I thought.  I expected I could just read the variable into my module…  but I guess the variable doesn’t have a value yet at that point.  So I needed this function for reading a dynpro value.

  wa_dynpfields-fieldname = ‘GV_VBELN’.
append wa_dynpfields to dynpfields.
call function ‘DYNP_VALUES_READ’
dyname               = SY-REPID
dynumb               = sy-dynnr
dynpfields           = dynpfields
invalid_abapworkarea = 1
invalid_dynprofield  = 2
invalid_dynproname   = 3
invalid_dynpronummer = 4
invalid_request      = 5
no_fielddescription  = 6
invalid_parameter    = 7
undefind_error       = 8
double_conversion    = 9
stepl_not_found      = 10
others               = 11.

Again, this is a simple task, but if you don’t know how to get the information, it’s pretty tough to use it.  So there it is, a simple function to pull in a dynpro value from the screen in order to use it in the VALUE-REQUEST statement.  Thanks for reading.


ABAP – Dropdown List

Well, yesterday I mentioned that I’m building a screen, and I wanted to have a nice dropdown list for characteristic values.  So I was able to get a table of the characteristics and values, but now I need to do something to get it into a nice dropdown list.  Here’s how I did it.  This little function module takes the field, and you give it a table (value_tab) which holds the key and the description.  Then it pulls up a nice looking popup window.

So, the first step happens in your screen designer (TXN: SE51).  In the PAI section, you need to add a statement to the bottom:

field WA_CSTICS-VAL MODULE drop_cstic_val.

In this statement, WA_CSTICS-VAL is the field I needed a dropdown list for.  Then I just needed a module to load the stuff.  That was drop_cstic_val.  In that module, I just used the function I talked about yesterday in my post on dropdown list for characteristic values. Then I called this function to generate the dropdown list popup.

retfield        = ‘KEY’
window_title    = WA_CSTICS-ATNAM
dynpprog        = sy-repid
dynpnr          = ‘0100’
dynprofield     = ‘FIELD_W_DROPDOWN’
value_org       = ‘S’
value_tab       = lt_val
parameter_error = 1
no_values_found = 2
OTHERS          = 3.

And that’s all there is to creating the dropdown list popup.  Thanks for reading.  I have some more tricks related to this…  but you’ll have to wait till tomorrow =)

ABAP – Dropdown List for characteristic values

Here’s a fun little tidbit.  I was building a new screen, and I needed to add a pull down (you’ll see more of this in some future posts. )  I wanted to a build a dropdown list for characteristic values from a VC configuration.  Well, I needed to start simple, first I wanted an easy way to get all the characteristic values and their descriptions.  I found this line little function module that does just that.  It’s not exciting, but it sure is convenient.

lv_pppi_char = WA_CSTICS-ATNAM.
pppi_char                    = lv_pppi_char
helpvalues                   = lt_helpvalues
values_for_field             = lt_values_for_field
characteristic_not_valid     = 1
values_can_not_be_determined = 2
no_authority                 = 3
OTHERS                       = 4.

And that’s the first step I needed to accomplish to build my dropdown list for characteristic values.  Tomorrow I’ll talk about how to do nice popup box for the dropdown list.

Thanks for reading.


Variant Configuration – SSC find_or_create to instantiate automatically

As you’ve probably noticed, I’ve been spending a lot of time with the SSC and trying to create my first major model.  Needless to say, I keep learning new tricks, so I don’t want to lose them.  Today I want to talk about using the find_or_create statement to perform automatic instantiation for a material or a class.

find_or_create ((300) CLASS_NAME,
CHAR1 = 1;
CHAR2 = ’48’ )

find_or_create ((material)(300)(nr=material_number) )

You can see that there are 2 distinct approaches.  The first is instantiating a class, the second a material.  Let’s start with the class, just like in any constraint based syntax, the find_or_create statement requires a class type (normally, 300), followed by the class name.  Now, to keep things fun, you can add the with statement, and it will pass values automatically to the instance.  Often, you will use an ADT (abstract data type) to signify who the parent is (notice CHAR_PARENT) listed above.  You can pass as many or as few values as needed.

The second version is the easiest…  combining the (material) and (nr=material_number), and bingo… you’ve instantiated a material (with no classification).

Now, if you’re familiar with the advanced mode modeling, the find_or_create statement appears to replace the has_part statement (at least I couldn’t make that syntax work in the SCC editor).

Now, here’s a tip with some power.

Variant Configuration – SSC Restricting characteristic domain using a variant table

I know…  the title was long winded, but there are just so many variations that I needed all those key words to make sure you know what the hell I’m talking about =)  Restricting characteristic domain in the SSC is of course a great trick, and if you can use a variant table, that makes it even more powerful.  So I wanted to talk about restricting characteristic domain inside of the SSC Eclipse editor.

So, this again, all starts with a constraint net, and a constraint.  The net I’ve already talked about in my post SSC Syntax of Constraints.

So here is a sample of a constraint that restricts characteristic domain using a variant table.

constraint RSTR_STUFF_CSTR {
name “Restrict Cstic Values”
?S is_a (300)CLASS_NAME
table STUFF_TYPE (
DATA1_QTY = ?S.domain DATA1_QTY,
DATA2_QTY = ?S.domain DATA2_QTY
?S.domain DATA1_QTY,
?S.domain DATA2_QTY

Now, I’m sure you’ll notice that using constraints is the same as in the original ERP modeling environment for Variant Configuration.  The big addition is in the domain statement.  Now, one of the tricks to remember is that you don’t appear to be able to use the domain and straight assignment within the same constraint (I tried, and couldn’t make it work.  so if there’s a way, let me know).  In this example, I have 2 characteristics, and I want to restrict them against each other using the table STUFF_TYPE.  everything is normal, except the domain statement.  Also, be sure to include the domain statement in the inferences as well, and you’ll be good to go.  Another thing I’ve used all the time in standard ERP, moved to the new world of the SSC.  Don’t worry…  I’m sure I’ll be covering more enhanced behavior as I figure out exactly how to use it.

Thanks for coming along on my journey,


Variant Configuration – SSC Creating a variant table using variantTable

Well, if you’re anything like me, variant tables are a staple of your model.  So, being able to add variant tables into your SSC model is obviously a requirement.  While the entry of them is substantially easier then entering them into CU60, it still comes with some hassles, mostly just understanding the syntax.  So I thought I’d share the basics with you today on the variantTable statement.  First, here’s a sample of a variantTable statement:

variantTable MOTOR_TYPE {
name “Motor Type”
RPM_QTY primary,
“1000”, “2”,   “50”;
“2000”, “4”,   “100”;
“3000”, “4”,  “400”;

So, when you see it like this, it’s pretty straightforward.
The characteristics are either key fields (primary is the key word used in SSC) or just straight values.  Enter in all the cstics that you need for columns.
The next piece is the rows.  You need data in your table.  I’ve shown 3 rows, with 3 columns, but obviously, you can do more 🙂  The big thing to notice is that each value has double quotes (“) around it, then you follow it up with a comma (,) to show that you’re moving to the next column, and finally use a semi-colon (;) to show it’s the end of the row.

And that’s all there is to it.  The variantTable is extremely handy, and now you know how to enter one into the SSC.  Hope it helps you out.  In a future post, I’ll talk about using the table in a constraint.  Thanks for learning with me =)


Variant Configuration – SSC Type_of Statement

In my recent experiments with Eclipse and the SSC, I’ve discovered the Type_of statement.  Maybe this existed in the standard advanced modeling, but since it’s all new to me, I wanted to make sure that I capture what this means and how it can be used.

constraint RACK_MTLS {
name “Add Materials to the Rack”
?C is_a (300)CLASS_NAME

Now the thing with the type_of statement is that it allows you to instantiate a material.  So for example, I was playing with a configurable material, call it a rack.  Now the rack has some components that are required for part of the system, but they are contained at the rack level.  Well, the component could have multiple iterations.  So I add the type_of statement above, and now from the rack, I have the ability to instantiate material_name.  material_name can be configurable, or just a component you want to add to the system multiple times.  The next thing I plan to tackle is how to automatically add it to the configuration based on some rules.  In the meantime, type_of is another trick I’ll keep in my back pocket.

Thanks for learning with me,


Website – Test your contact page

Well, I just learned a valuable lesson (the hard way as always).  I recently got a voicemail from a perspective customer trying to get in touch with me.  She mentioned that she had sent us an email from the contact page, but I never got it.  Needless to say, that was weird…  so the first thing I did was go the contact page and send myself a message…  strangely enough, it never came through.  So I went to the webpage configuration…  and found that the email that was set up didn’t exist.  UGH!!!  so now I sit and question how many leads did I miss out on???

Anyway, learn from me, test all of the methods on your website that can be used to contact you.   contact pages, phone numbers, etc…

Service Management – Equipment Hierarchy

Today I’m heading back into the Service Management realm.  I wanted to talk about something that is relatively simple, yet immensely cumbersome in practice.  That’s right, the equipment hierarchy.  When I say the equipment hierarchy, it may also be known as the equipment structure.  It is the process of linking serial numbers/equipment records into a structure or hierarchy.  The principal is very simple, and I’m going to walk through the process.  After the process, I’ll explain what makes it all so cumbersome (if you haven’t already experienced the pain).

If you go into any equipment record and go to the structure

in the bottom portion, you’ll find the button:  blog-02 to structure the hierarchy.


On this screen, you simply enter in each equipment record that belongs at this “level”.


Now you can see that a structure exists.  If any of the equipment records in this list had their own equipment hierarchy, you’d see the Sb-Eq box checked.

Now at the top of the page, you’ll see the button:  blog-05  and it will bring up the entire structure report.


My example was pretty simple, but it would also show functional locations, and would show the entire explosion.  So, pretty easy, right?

now, the problem comes into maintaining this.  Up to this point, I’m not aware of any automated way to capture the hierarchy.  Say for example, have a production order with the top level material being serialized, and you use several other serialized components to assemble it.  You must now manually create that structure (now make it worse, and say it’s a production order for 50, you have to repeat the process 50 times).  The issue becomes complicated because you may issue 50 serialized components to make 10 finished goods.  Which 5 items went into which finished product???  Without a high amount of diligence, it becomes highly manual and extremely difficult to maintain automatically.  I’ll be talking more in the future about some methods to begin capturing this information.

Thanks for reading,