Variant Configuration – Set_Default

If you’ve ever had to use the SET_DEFAULT statement in variant configuration, you grasp just how cryptic the syntax can be.  That’s why I wanted to point out this little trick that you might not yet be aware of.  You can replace the SET_DEFAULT syntax with a nice little operator.  Take a look below to see for yourself.

Example of the old way to set a default:
TABLE TEST( INPUT1 = INPUT1,
OUTPUT1 = $SELF.CHAR ),
$SET_DEFAULT( $SELF, OUTPUT1, $SELF.CHAR)

With this:
TABLE TEST( INPUT1 = INPUT1,
OUTPUT1 ?= $SELF.OUTPUT1 )

It doesn’t have to be used in a table, but can be most anywhere you use the = statement.  So in my opinion, why would you ever use the cryptic SET_DEFAULT statement again =)

 

Variant Configuration – IS Invisible

Hello everyone, it’s funny, I’ve been doing a lot more Variant Configuration work lately, and it reminds me of all the fun tricks I’ve either heard about or have used in the past.  The most recent one I was reminded of was the new IS INVISIBLE syntax.  So, as a reminder:

Old method:  $SELF.SCREEN_DEP_INVISIBLE = ‘CHAR1’

Cool new Way:$SELF.CHAR1 IS INVISIBLE

Now, either method you still need a reference characteristic that is attached to SCREEN_DEP-INVISIBLE.

Benefits include no persistent data storage, where used checking, and syntax checking of characteristic name.  Why does this matter?  for example, the biggest issue with the old method in my mind is that you have to enter the characteristic into quotes?  this means, it’s just a text string, and if you spell it wrong, you don’t get an error, it just doesn’t work.  Using the IS INVISIBLE, it will give you a syntax error if you enter in the wrong name.  The same goes for conducting a where used of a characteristic, in the event you tried to rename it or remove it.  the IS INVISIBLE syntax will show you it’s been used there.

It’s also much cleaner.  Anyway, hope you enjoyed this tidbit.

 

Happy Independence Day

Just a quick wish to you for a safe and happy fourth of July.  I also hope you stop to remember exactly why we celebrate this holiday.  Our founding fathers worked very hard to provide us the freedom and liberty they so desperately wanted, yet didn’t have.  Now today, every day we lose more of that liberty and more of those freedoms in the name of “security”, “political correctness” or “entitlements”.

Today, remember all the things you love to do and be grateful that a couple hundred years ago, our founding fathers earned that for us.  And be vigilant, because Ben Franklin said it best:

“Those who would give up essential Liberty, to purchase a little temporary Safety, deserve neither Liberty nor Safety”

 

Variant Configuration – SSC Eclipse Editor

Well, I wanted to pass on my most recent and valuable discovery about the SSC Eclipse Editor.  That is prototyping a new model is so much easier in this editor.  Now, the VC purest in me still knows that at the end of the day, the VC rules must still be adhered to, and best practices in modeling don’t change.  But here’s the value of the SSC Eclipse Editor.

If you model like I do, you work best by just jumping in and starting to put things together.  Well, this is great up to the point of enter in master/transactional data.  If you know SAP, you know that deleting things, renaming things, or going in a whole new direction is a royal PITA once you create a sales orders or production orders, etc.  because at that point, you have to jump through a lot of hoops to do some renaming…

The SSC Eclipse Editor is not locked into the same issues.  Because it’s text based, you put everything together, do your initial testing, and if you don’t like the way something is working… or more commonly, you find out new information half way through your model, you can quickly adapt, change names, restructure tables etc.  With very little pain.

Now don’t get me wrong, you’ll still have these pains because at some point you need to connect the SSC Model to either ECC or CRM, once that happens, you’ll be back to the same pain, but when you prototype the model, it sure is nice (for me) to have that flexibility to change my design on the fly without a lot of headaches (in fact, something a simple find and replace everywhere gets me where I need to be).  This is certainly not possible in the standard ECC Variant Configuration…  Food for thought…

Thanks for reading,

 

ABAP – How to Spool SD Output Documents

Well, this is a continuation of my post from yesterday, so if you missed it, I talked about using the ABAP Web Dynpro Download element to display documents on your web application.  What I talked about yesterday was completely based on having a spool job to convert.  So…  today I’ll talk about how you can Spool SD Output Documents again and again, and easily retrieve them.

SUBMIT RSNAST00
WITH S_KAPPL = i_kappl
WITH S_OBJKY = i_objky
WITH S_KSCHL = i_kschl
WITH P_AGAIN = ‘X’
WITH P_SUFF2 = lv_suff2
AND RETURN.

You might already be familiar with the program RSNAST00, but who knew you could use it for this (I didn’t…  =>  ).  You’ll notice, it’s a pretty simple program.  You give the Output type, the document key, and you can even using define a special key field (SUFF2) that makes it easier to retrieve.

After you run the program, simply go to table TSP01 and enter in the enough criteria to pull out the spool. Then you simply assign this to a context element, and link it to your download element.  And by doing this it will give you another popup window in your favorite web browser showing your output.

Now for my shameless plug.  I’ve done this all in Rapier now (it’ll be released in version 2 this fall), but thanks to this technique, I’ve been able to output Order Confirmations, invoices, etc…  directly onto the customer website, so they pull their own documents anytime they want.  If you’re interested in seeing this in action, let me know and I’ll be happy to setup a demo to show you.  Rapier 2.0 is gonna be really cool.  I’ve been putting a lot of hours into this recently, so you’ll want to check it out.  And, remember, if you’re in the market and you buy now, you get the charter customer price, and the ability to influence functionality that will be officially released this fall.    Ok… commercial over… =)

Thanks for reading,

ABAP – Using Web Dynpro Download Element

One of my recent adventures was find a way to pull documents out of SAP, and display them within my web application.  This turned out to be rather challenging, but I learned some neat tricks about ABAP Web Dynpro along the way.  The Web Dynpro Download Element is one of my new favorites, once I figured out how I could use it.

Let’s set the stage.  You have a document withing SAP that you want to display to your web user.  The Web Dynpro Download Element works perfectly for this…  provided you can feed it the proper data.  What I figured out is that in order to make this work, you need to get your document into an XSTRING format.  I think this is a RAW string or something like that, but it’s not important.  What is important is how do you get it into the XSTRING format.  One of the cool tricks I found online was using the following function module:

CONVERT_OTFSPOOLJOB_2_PDF

This function will convert a spool job into the XSTRING format you need to output it.  Now, getting things into the spool can be another headache, so tomorrow I’ll talk about how to get your standard SD documents into the spool again so you can read them out of the Web Dynpro Download Element.

Thanks for reading,

 

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
INTO TABLE lt_sh
UP TO 200 ROWS
WHERE VBELN = GV_VBELN.

” 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
CALL FUNCTION ‘F4IF_INT_TABLE_VALUE_REQUEST’
EXPORTING
retfield        = ‘POSNR’
dynpprog        = sy-repid
dynpnr          = sy-dynnr
dynprofield     = ‘VBAP-POSNR’
value_org       = ‘S’
TABLES
value_tab       = lt_sh
dynpfld_mapping = lt_map
EXCEPTIONS
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’
exporting
dyname               = SY-REPID
dynumb               = sy-dynnr
tables
dynpfields           = dynpfields
exceptions
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:

PROCESS ON VALUE-REQUEST.
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.

CALL FUNCTION ‘F4IF_INT_TABLE_VALUE_REQUEST’
EXPORTING
retfield        = ‘KEY’
window_title    = WA_CSTICS-ATNAM
dynpprog        = sy-repid
dynpnr          = ‘0100’
dynprofield     = ‘FIELD_W_DROPDOWN’
value_org       = ‘S’
TABLES
value_tab       = lt_val
EXCEPTIONS
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.
CALL FUNCTION ‘PROC_CHAR_HELPVALUES_GET’
EXPORTING
pppi_char                    = lv_pppi_char
TABLES
helpvalues                   = lt_helpvalues
values_for_field             = lt_values_for_field
EXCEPTIONS
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.

 

Posts navigation

1 2 3 74 75 76 77 78 79 80 97 98 99
Scroll to top