General Discussion Abap Tips


Published on

ABAP tips from teched community day

Published in: Technology
  • Be the first to comment

General Discussion Abap Tips

  1. 1. General ABAP Discussion Tips and Tricks Michelle Crapo [email_address]
  2. 2. Who is this person? <ul><li>Michelle Crapo </li></ul><ul><li>Perrigo – produce over the counter pharmaceuticals. (Rx) </li></ul><ul><li>1998 Started in SAP </li></ul><ul><li>Titles varied by the year: Programmer/ Analyst, Sr. Project Manager, Business Analyst </li></ul><ul><li>I enjoy riding horses. I have 2 horses, 2 miniatures and one pony. </li></ul>
  3. 3. Expectations
  4. 4. Tips – ZMD_CONSTANT <ul><li>ZMD_CONSTANT contains: </li></ul><ul><ul><li>MANDT </li></ul></ul><ul><ul><li>Program or name </li></ul></ul><ul><ul><li>Subroutine – usually empty </li></ul></ul><ul><ul><li>Statement - plant </li></ul></ul><ul><ul><li>Generic count as part of the key </li></ul></ul><ul><ul><li>Sign – I or E </li></ul></ul><ul><ul><li>Option – EQ, BT </li></ul></ul><ul><ul><li>FIELD LOW - Value </li></ul></ul><ul><ul><li>Field High – Value or empty </li></ul></ul><ul><li>Used </li></ul><ul><ul><li>All over in custom code </li></ul></ul>
  5. 5. Pros/Cons ZMD_CONSTANT <ul><li>Value – Pros </li></ul><ul><ul><li>One Place to find all changes. IE A new material group is added. That material group should work the same in all programs. Normally all programs would be searched for similar constants. In ZMD_CONSTANT there is only one place to change it. </li></ul></ul><ul><ul><li>No programming change required. </li></ul></ul><ul><ul><li>User can not “mess it up”. </li></ul></ul><ul><li>Drawbacks – Cons </li></ul><ul><ul><li>It has be transported. </li></ul></ul><ul><ul><li>Custom table. </li></ul></ul><ul><ul><li>Multiple entries for the same thing with the program field. </li></ul></ul>
  6. 6. ZMD_CONSTANT at work <ul><li>Demo </li></ul><ul><li>ZMCSIMPLE </li></ul><ul><li>ZMD_CONSTANT document </li></ul><ul><li>ZMD_CONSTANT Example </li></ul>
  7. 7. Tip - Change Documents <ul><li>Transaction SCDO. </li></ul><ul><li>Generated code for audit trails. </li></ul><ul><li>Easy to add to custom code, all the code has been written. </li></ul>
  8. 8. Pros and Cons Change Documents <ul><li>Pro </li></ul><ul><ul><li>Programming for change is done for you. </li></ul></ul><ul><ul><li>SCU3 can be used to display changes. </li></ul></ul><ul><li>Cons </li></ul><ul><ul><li>Not all data elements have the change document checked. </li></ul></ul><ul><ul><li>Change data uses CDHDR, and CDPOS </li></ul></ul>
  9. 9. Demo Change documents <ul><li>DEMO </li></ul><ul><li>ZSPN, ZSPINSTR </li></ul><ul><li>Example of Change documents </li></ul>
  10. 10. Tips - Search Helps <ul><li>Quick and easy way to provide for searching tables – custom screens or adding to the SAP search help. </li></ul>
  11. 11. Pros and Cons Search Help <ul><li>Pros </li></ul><ul><ul><li>Ease of use </li></ul></ul><ul><ul><li>No programming </li></ul></ul><ul><li>Cons </li></ul><ul><ul><li>More custom objects on system. </li></ul></ul><ul><ul><li>Parameter IDs become important. </li></ul></ul>
  12. 12. Search Help Demo <ul><li>Demo </li></ul><ul><li>ZM_RID1, ZID_INIT </li></ul><ul><li>Search Help Example </li></ul>
  13. 13. ALV Grid <ul><li>Used instead of list reports. It contains functionality that will help users – help themselves. Sub-total, sort, total.. </li></ul><ul><li>It is like excel. That makes it very easy to learn, and use. </li></ul>
  14. 14. Pros and Cons ALV Grid <ul><li>Pros </li></ul><ul><ul><li>Like Excel </li></ul></ul><ul><ul><li>Easy to code </li></ul></ul><ul><ul><li>User friendly </li></ul></ul><ul><li>Cons </li></ul><ul><ul><li>None that I know of??? </li></ul></ul>
  15. 15. Demo <ul><li>Link to ALV grid document </li></ul><ul><li>Layout </li></ul><ul><li>User-command </li></ul><ul><li>ZQM0050 – Object </li></ul><ul><li>ZPP0102 </li></ul>
  16. 16. Misc. <ul><li>Enqueue </li></ul><ul><li>Dequeue </li></ul><ul><li>Table Maintenance generator </li></ul><ul><li>Custom Transaction </li></ul><ul><li>Read/loop/if/exit/endloop vs. loop where </li></ul>
  17. 17. Suggestions by the crowd! <ul><li>Notes: </li></ul><ul><li>For non-dumps - SM37 - Set the breakpoints for a scheduled job, then run JDBG to restart from first loop for a canceled job </li></ul><ul><li>Triggering debug while on a pop-up screen.  </li></ul><ul><li>Create a file on the desktop. &quot;SAP Debug.txt&quot;. The contents of the file contains four lines of text: </li></ul><ul><li>[FUNCTION] Command=/H Title=Debugger Type=SystemCommand </li></ul><ul><li>Drag and drop this on the GUI; it's as if you had typed /H. </li></ul><ul><li>Thank you Jeffrey Hopwood for that one. </li></ul>
  18. 18. Suggestions by the crowd – cont. <ul><li>  ABAP Docs is from the monthly SDN.  Here's the link: </li></ul><ul><li>  To avoid modification of SAP code - use field symbols in your user exit.   Then you can point to any field in the SAP program.   Please note!  User exits can be called from many places, if that field is not in the other programs, it will cause them to short-dump. </li></ul><ul><li>  MM01/MM02 - when recording a BDC - go to the first view and then move to the others.  This is a good trick for any screen similiar to MM01 or MM02 that does not have a BAPI. </li></ul><ul><li>SE11 - generate table maintenance for a table.  Utilities -> table maintenance generator, you can change the table in SM30.  To limit so that only that table can be maintained.  Create a parameter transaction. </li></ul><ul><li>Name of screen - Update  value X </li></ul><ul><li>Name of screen - viewname value - your table name. </li></ul><ul><li>transaction SM30 - skip first screen. </li></ul>
  19. 19. Suggestions by the crowd – Cont. <ul><li>You can use these routines to parse any input file, to see if your field definitions in the record layout match the data, or to print a subset of fields from an input file (e.g. list just the vendor number or employee number, etc).  The p_any_rec values above can literally  be changed to any structured record definition.  I mostly use this when working on new interfaces, or when diagnosing a problem with an interface file. From Gordon Tobias </li></ul><ul><li>Program for Parsing </li></ul>