• Home
  • About me
  • FALV
  • ALV Grid in the nutshell
    • Basic Information
    • Field catalog
  • Articles
    • Tricks
    • FALV (Fast ALV Grid)
    • ALV Grid in the nutshell
    • Tips
    • How to...
    • For beginners
    • Thoughts
  • By Topic
    • ALV
    • ALV OO
    • SALV
    • GOS
    • Selection screen
    • Purchase Requisitions
    • Purchase Orders
    • Attachments
    • Others
    • Characteristics
    • Sample Programs
    • ZIP
    • OLE
    • Mails
    • Routings
    • EWB
    • Excel
  • Keywords
  • RSS
  • Download
  • Home

Characteristic's own input screen - Part 1 - Convert Values To Float

Details
Łukasz Pęgiel
How to...
31 August 2013
Hits: 10845
Tags: CHAR_VALUE_CHANGE2
Welcome back :-) 
Some time ago I presented how I get data from classifications to reference data variable ( or table). If you feel comfortable with my method then we can go further. I had a task to update some characteristic values from ALV grid, this would be not a problem at all if the characteristics would be defined from the begriming, but they weren't. In that case I couldn't just add needed fields to fieldcatalog and call FM to update characteristics when save button was pressed. I realized I need dynamic structure for ALV which will call standard screen for characteristic update. If this could be done then I could omit carrying about type of characteristics (date, number, char ) and if it is single o multiple type. So I started to dig in SAP, debug standard functions and I was finally able to prepare all needed functions.
 
So firstly what was needed (additionally to previously presented methods):
- method to show standard characteristics update screen with possibility to put there own values at call
- method to copy data from my reference data structure to screen values
- method to copy data from screen (after input) to my reference data structure
- method to copy data from my reference data structure to bapi tables (in order to save it)
- method to save characteristic value
- method to convert values from standard type (date, char, number, currency) to characteristic value (in float)
- method to clear initial line which was appearing when standard screen was called without reference to database values.
 
In this and following parts of this tutorial you'll see all mentioned methods and example of their usage. You can also find the code in attached NUGG file for easier import to your system.
Add a comment
Read more ...

Scan program for authority-check

Details
Łukasz Pęgiel
How to...
13 July 2013
Hits: 17365
Tags: AUTHORITY-CHECK , SCAN ABAP-SOURCE
Some years ago I was asked to create a report to check if in our Z-developments we are using authorization check or not. Of course not in all developments you need to have authorization check as sometimes standard SAP function modules provides proper checks inside them, but in many cases developer should take care about them inside the coding. The code I will provide below will scan program for AUTHORITY-CHECK statement and will collect the parameters of the call of AUTHORITY-CHECK. But one thing you have to have in mind, if developer used separate FM or class to check authorization then this report will not show any authorizations for program as it's looking only in the code of the program and not for the authorization-check inside called FM or classes.
 
Please look through the code or import to your system using nugg file.
Add a comment
Read more ...

Extend allowed runtime of a program

Details
Łukasz Pęgiel
Tricks
25 June 2013
Hits: 14466
Tags: TH_REDISPATCH , COMMIT WORK , EXTEND PROGRAM RUNTIME , SAPGUI_PROGRESS_INDICATOR
When you create a report or transaction that handles a lot of data with multiple selects and functions that are doing some manipulation of the data, or you have to call in this report a function module thousand times and you want to be sure that no matter how long it takes it should be done but your system administrators have put some restrictions for time limit then you have to use one of this methods:
  1. Call commit work whenever you want to reset the counter of running time for your transaction (especially if you haven't done any update into database tables)
  2. If commit work doesn't work or you don't want to use it at the moment then you could use FM TH_REDISPATCH with the check_runtime parameter equal to 0.
  3. You could also you FM SAPGUI_PROGRESS_INDICATOR for the same purpose but keep in mind that showing indicator too often can slower your program.
Both of the methods will make that the counter for application runtime will be reset, but be careful this can make you application run really long. Also if you got one select statement which takes more than maximum runtime for your system then it will not help so you have to prepare your coding to be able to use any of this method, like spliting the selects statements to parts or to select single in the loop.
 

Although it's nice to know this possibility my advice is to not to use it very often as the less time you have for program run the more optimized code you can provide, so it's really something that you use if you do not have other choice and you agreed that with your system admins.

Examples: (run the program and look into SM50 to see the runtime)
Add a comment
Read more ...

Custom selection-screen fields for MD07/MS07

Details
Łukasz Pęgiel
Tips
16 June 2013
Hits: 16100
Tags: MD07 , MS07 , MDC7 , MSC7
You may noticed that standard transaction MD07 and MS07 offers basic filters on selection-screen which allows user to select materials they are responsible for, the problem comes when in your company users wants to be more precise in filtering or when the responsibility is set not only on a base of MRP controller. Fortunately SAP gives us the possibility to call MD07 and MS07 with our own list of materials using dummy transaction codes MDC7 and MSC7. All you need to do is to prepare a table of type MDMWX, export it to memory 'START_MD07' and call dummy t-code. Bellow you can find an example of the report to call MD07/MS07 with own material list where on selection screen you can find for example purchasing group which is not available in standard. You can also find a link to nugg file.
Add a comment
Read more ...

Selection Screen - Part1 - Parameters

Details
Łukasz Pęgiel
For beginners
08 June 2013
Hits: 24722
Tags: VRM_SET_VALUES , LOOP AT SCREEN , PARAMETERS , VIDEO
Today, as a first entry in Beginners part I'd like you to show how to build parameters on selection screen. All this information you can find under F1 help but here you've got visualization of what's written there. Hope it will help to understand this statement. As embed video is my first one then please accept my apologies in case of errors and wrong pronunciations as English is not my native language.
 

 
Add a comment
Read more ...

Call standard F4 search help with customized parameters

Details
Łukasz Pęgiel
How to...
07 June 2013
Hits: 69956
Tags: F4IF_START_VALUE_REQUEST , DDSHIFACE , SAPGUI_SET_FUNCTIONCODE , F4IF_GET_SHLP_DESCR
During creation of selection screen or normal screen for your program you declare some fields and you want to use with them standard search help but with some modification like putting values to one of the search help parameters or making the SHLP parameter readonly then structure DDSHIFACE and FM F4IF_START_VALUE_REQUEST comes with a help. DDSHIFACE as you can see do not has much fields and for us the most interesting will be SHLPFIELD, VALFIELD, VALUE and DISPFIELD. In SHLPFIELD we will store the name of the SHLP parameter (names you can check in SE11), VALFIELD if filled will tell FM that value of this SHLP parameter should be returned to the user (value isn't important in our case so i'll put 'X' ). VALUE if filled set the value of SHLP parameter before showing the results of F4 call so we can directly restrict searched range with some data. Finally DISPFIELD if set makes the parameter on SHLP display only .
 
 
Add a comment
Read more ...

Endless loop in BADI ME_PROCESS_PO_CUST

Details
Łukasz Pęgiel
Tips
07 June 2013
Hits: 46498
Tags: MEPO151 , ME_PROCESS_PO_CUST , IF_PURCHASE_ORDER_ITEM_MM~SET_CONDITIONS
If you have to adjust conditions for your purchase order line and if during the use of method if_purchase_order_item_mm~set_conditions in BADI ME_PROCESS_PO_CUST you receive an error MEPO151 "Data from Business Add-In ME_PROCESS_PO_CUST not adopted" then after you check SAP notes for that error and none of them help then you may try with solution which you can find bellow. The endless loop appears because set_conditions method force re-check of the item. To avoid running set_conditions more than once in one check of the item I used abap memory to store data about each line that was check. I've created simple structure with ebelp and "set" fields on a base which I know if I had to run setting of conditions or not.  Maybe it's not the nicest solution but it works quite well :)
The form which you can find bellow you have to run at the end of processing of method process_item of ME_PROCESS_PO_CUST to be sure that other form will not force SAP to re-check the item again.
Add a comment
Read more ...

How to select proper configuration entry

Details
Łukasz Pęgiel
Tips
31 May 2013
Hits: 6049
Tags: CL_ABAP_STRUCTDESCR , CL_ABAP_ELEMDESCR , GET_DDIC_FIELD_LIST , DESCRIBE_BY_NAME
When you will want to create a customization table for your program but you want to do it that way that you want to have many key fields and some of them can be empty which would mean that this is valid for all entries then you have to do some little coding to handle it as you just cannot check only if key fields are same as in your checked structure. There is a way to do it and the method described can be used in all programing languages. I will show you two ways - static and dynamic.
In static one I will hard code key field names in the code which makes that you have to rewrite the code each time you change the structure of your configuration table. 
Dynamic way when done once then doesn't have to be redesign as I will use cl_abap_elemdescr and cl_abap_structdescr to get key fields. 
 
Ok, firstly we need to create our configuration table in dictionary using SE11. As sample I will create table only with two key fields on a base whom I will check the configuration.
 
Add a comment
Read more ...

Copy routing (create on a base of existing one)

Details
Łukasz Pęgiel
Tricks
26 May 2013
Hits: 14050
Tags: CP_CC_S_LOAD_COMPLEX_BY_TSK , CP_CC_S_COPY_BY_TSK , CP_CC_S_SAVE
In article Delete Routing - piece of cake I've shown you how to use FM from CEWB transaction to delete routings. If you go through all FM that are inside function groups of CEWB then you'll see that there is a lot of possibilities there. For example creation of a new routing, you can do it step by step or create a routing on a base of existing one. Today I'll show how to copy existing routing to new one with usage of FM CP_CC_S_LOAD_COMPLEX_BY_TSK to load source routing to memory , CP_CC_S_COPY_BY_TSK to copy areas we want and CP_CC_S_SAVE to save new routing to database. In my example I will copy completely source routing to target but in any case you can also omit some of the areas and create them after save (like material allocation or components assignment ).
Add a comment
Read more ...

Classifications - Part 4 - example of use

Details
Łukasz Pęgiel
How to...
26 May 2013
Hits: 7851
Tags: GET_OBJECTS_OF_CLASS , CL_ABAP_STRUCTDESCR
As I promised I will show how to use the methods we've prepared in previous parts of this tread. I will write simple program that calls the method get_objects_of_class and then loops through the results of it. But before I'll prepare program I need to have classification with some characteristics and an object to which I will add classification. So lets start with CL01 to create our test classification. I'll name it ECM_CLASS1, and I'll add one characteristic for each data type so NUM, CURR, CHAR, DATE and TIME.
 
 
Then I'll classify change number in CC02 for two change numbers available there (of course we can do it for how many objects we want) .
Add a comment
Read more ...

Classifications - Part 3 - get all objects assigned to class

Details
Łukasz Pęgiel
How to...
18 May 2013
Hits: 13177
Tags: CLAF_OBJECTS_OF_CLASS
In previous article ( Classifications - Part 2 - Get Object Details ) I've created a method to get characteristics values for an object to our dynamic structure, in this part I will show how to use this method and FM CLAF_OBJECTS_OF_CLASS  to get the characteristics values for all of objects that are classified by given class. I will firstly read all assignments to the class, then I will loop through all returned objects and I will get all characteristics values to dynamic structure.
 
Importing:

i_class type klah-class -> class number
i_classtype type klah-klart -> class type
i_key_date type sy-datum  default sy-datum -> key date for classification

Exporting:

value( et_objects ) type standard table of clobjekte -> table of objects assigned to class
et_data type ref to data -> table with characteristics data for all objects assigned to class
e_tablestr type ref to cl_abap_tabledescr  -> table type structure
e_structure type ref to cl_abap_structdescr -> structure

Exceptions:

fetch_values_error
structure_error

Implementation:
Add a comment
Read more ...

Classifications - Part 2 - Get Object Details

Details
Łukasz Pęgiel
How to...
18 May 2013
Hits: 20307
Tags: BAPI_OBJCL_GETDETAIL , KKEK_CONVERT_FLOAT_TO_CURR , CL_ABAP_TYPEDESCR
 
In the first part I show how to create a structure on a base of class characteristics, now I will describe how to get the characteristics values for a object and how to fill the structure we've created in part 1. To get the characteristics values for an object I will use FM BAPI_OBJCL_GETDETAIL, then using field-symbols I will move the data from its result tables to our structure. I will use also cl_abap_typedescr to get the type of the field (needed for proper conversion) and FM KKEK_CONVERT_FLOAT_TO_CURR to convert currency values stored as float on database into currency fields.
 
Importing:

i_object type bapi1003_key-object -> key of object to be classified
i_class type klah-class -> class number
i_classtype type klah-klart -> class type
i_objecttable type bapi1003_key-objecttable optional -> name of database table for object
i_key_date type sy-datum  default sy-datum -> key date for classification
i_structure type ref to cl_abap_structdescr optional -> structure

Exporting:

et_objvaluesnum  type tt_bapi1003_alloc_values_num -> table with num characteristics
et_objvalueschar type tt_bapi1003_alloc_values_char -> table with char characteristics
et_objvaluescurr type tt_bapi1003_alloc_values_curr -> table with curr characteristics
e_data type ref to data -> filled structure for object with all characteristics

Exceptions:

fetch_values_error -> error while trying to receive object characteristics value
structure_error -> structure has wrong fields

Implementation:
Add a comment
Read more ...

Classifications - Part 1 - prepare structure for class data

Details
Łukasz Pęgiel
How to...
17 May 2013
Hits: 13184
Tags: BAPI_CLASS_READ , BAPI_CHARACT_GETDETAIL , CL_ABAP_ELEMDESCR , CL_ABAP_STRUCTDESCR , CL_ABAP_TABLEDESCR
Today I'll start to show you how you can prepare some methods to be able to read classification data without carrying each time about the kind of characteristics. If you follow my suggestions then you'll be able to use this methods each time you deal with classifications. In this part I will show you how to prepare a method to create a structure and table for classification data. I know that some of you can say we can create such structure manually with data or types statement directly in each of our development, but one day you'll see that sometimes it's easier to prepare a function or method which will do it for you so you can keep the logic in each of your program without doing maual work.
 
To create the structure of the class I will use FM BAPI_CLASS_READ  to read class data, then I will use FM BAPI_CHARACT_GETDETAIL to read the characteristics and in each step I'll be using classes cl_abap_elemdescr, cl_abap_structdescr and cl_abap_tabledescr to create the structure I need.
 
Import:

i_classtype klah-class-> class number
i_classtypetype klah-klart ->class type
i_key_datetype sy-datum  default sy-datum-> key date for class

Export:

e_structuretype ref to cl_abap_structdescr-> structure for our class
et_datatype ref to data -> table created on a base of class structure
e_tabletype ref to cl_abap_tabledescr-> table type for our class

Exceptions:

class_classtype_fetch_error
error_creating_table
characteristics_error

Implementation of method:
Add a comment
Read more ...

Create XLSX/MHTML file from internal table in background

Details
Łukasz Pęgiel
Tricks
12 May 2013
Hits: 171629
Tags: CL_SALV_COLUMNS_TABLE , CL_SALV_AGGREGATIONS , CL_SALV_TABLE , CL_SALV_CONTROLLER_METADATA=>GET_LVC_FIELDCATALOG , CL_SALV_EX_UTIL , CL_SALV_BS_TT_UTIL , SCMS_XSTRING_TO_BINARY
I think that any of us had meet the situation when we needed to create an Excel output from internal table in background. There is a really nice project called ABAP2XLSX which gives you to possibility to do all you need but in some case you won't be allowed to install ABAP2XLSX at you SAP instance. Don't worry there is a way to do it, but in older SAP version we will be allowed only to save the file as MHTML excel (like in ALV->Export to Spreadsheet). In newest version we're able save the file directly to XLSX also. In a method shown bellow you can see that to create Excel file you need to only pass internal table, the rest of the parameters are option which gives you opurtinity to pass the settings you've made in your program to the output file. 

So what am I doing here.... firstly I check if the fieldcatalog was passed. If not then I create it on a base of internal table with usage of cl_salv_table  and cl_salv_controller_metadata=>get_lvc_fieldcatalog. After I finally have the fieldcatalog I create result table with sort and filter criteria if they were passed. To do that  I use class cl_salv_ex_util. At the end result table is transformed to xstring with method cl_salv_bs_tt_util=>if_salv_bs_tt_util~transform. So you're receiving at the end of the method an xstring file so you can do what you want with it, for example send via mail to the user, or save it on local PC (like in the example found at the end). The most important is that you can use this method in a background so you can prepare some jobs for your programs and send results of them to the users!
 
Importing:

it_fieldcat type lvc_t_fcat optional -> field catalog for list viewer control
it_sort type lvc_t_sort optional -> alv control: table of sort criteria
it_filt type lvc_t_filt optional -> alv control: table of filter conditions
is_layout type lvc_s_layo optional -> alv control: layout structure
i_xlsx type flag optional -> create xlsx file?

Add a comment
Read more ...

More Articles ...

  1. Create a nice looking chart with CL_GUI_CHART_ENGINE - Part 3 - Chart Data and render
  2. Create a nice looking chart with CL_GUI_CHART_ENGINE - Part 2 - Customization
  3. Create a nice looking chart with CL_GUI_CHART_ENGINE - Part 1 - Chart Designer
  4. Load variant to single subscreen (selection screen)
  5. Subtotal lines of ALV GRID OO as content separator
  6. Secure call of "starting new task" using RM_FREE_SESSION_CHECK
  7. F4 Help for external date
  8. Save variant for single selection screen subscreen
  9. Refresh ALV GRID and keep position and current cell
  10. Delete Routing - piece of cake
Page 9 of 11
  • Start
  • Prev
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • Next
  • End
Łukasz Pęgiel
ALV GRID IN THE NUTSHELL FIELDCATALOG RESET REL ALLOWED LVC FCAT KEY SEL Unlock yourself on the DEV system FALV Fast ALV Grid - First blood DELETE USER SETTINGS ALV GRID ALV Grid in the nutshell Field catalog - reptext Heading SAVE OBJECTS GUI ALV GRID Download IXML OSTREAM SAP SCRIPT VL473 ESRUO - MM settings table - Part 3 SUBTOTAL TEXT ECLIPSE RELEASABLE SYMBOL ADT ELEMENT Field catalog - col pos The SIN of progress indicator ENCODING ESDUS DOCKING CONTAINER PURCHASE REQUISITION SALV CONTROLLER METADATA SAP TechEd 2016 OUT Field catalog - lzero AiE Get filename and extension from full path ACR id - ALV control Column ID TEACH ABAP BOM SCAN ABAP-SOURCE MB51 CMD API SAPGUI PROGRESS INDICATOR ABAP FAVORITES READ LOOP AT SCREEN Convert date to and from external date type PARSER ZDEMO FALV07 - Columns field catalog settings GTGET REUSE MERGE Load variant to single subscreen selection screen TOOL ACCESS Why I like to code in ABAP in Eclipse AiE dark theme settings Function Module or Method LEX TSK UNLOCK EDIT MASK CREATE VARIANT Field catalog - currency PERIOD AND DATE CONVERT INPUT
  • Laserowe usuwanie blizn Tychy
  • Laserowe usuwanie zmarszczek Tychy
  • Paznokcie hybrydowe Tychy
  • Paznokcie tytanowe Tychy
  • Salon Kosmetyczny Tychy
  • Trycholog Tychy
  • Wypadanie włosów Tychy
Tweets by abapblog

Eclipse Plugins for ABAP

ABAP Favorites

Drag to your running Eclipse* workspace. *Requires Eclipse Marketplace Client

ABAP ADT Extensions

Drag to your running Eclipse* workspace. *Requires Eclipse Marketplace Client

ABAP Quick Fixes

Drag to your running Eclipse* workspace. *Requires Eclipse Marketplace Client

 

Latest Articles

  • ABAP in Eclipse - Install, Configure, Use, and Enhance Your ADT
  • ALV Grid in the nutshell: Field catalog - col_id - ALV control: Column ID
  • ALV Grid in the nutshell: Field catalog - dfieldname – Fieldname for column group
  • ALV Grid in the nutshell: Field catalog - Hotspot - ALV control: SingleClick-sensitive
  • ALV Grid in the nutshell: Field catalog - sp_group - Group key
  • ALV Grid in the nutshell: Field catalog - domname - Domain name
  • ALV Grid in the nutshell: Field catalog - reprep - ALV control: Value is selection criterion for rep./rep.intf.
  • ALV Grid in the nutshell: Field catalog - reptext – Heading
  • ALV Grid in the nutshell: Field catalog - lowercase - Lowercase letters allowed/not allowed
  • ALV Grid in the nutshell: Field catalog - intlen - Internal Length in Bytes
  • Downloading Exchange Rates from NBP (National Bank of Poland)
  • Downloading Exchange Rates from Central Bank of Turkey
  • ABAP Extensions - Automatic Logon
  • ALV Grid in the nutshell: Field catalog - inttype - ABAP data type (C,D,N,...)
  • ALV Grid in the nutshell: Field catalog - datatype

Most Read

  • Create XLSX/MHTML file from internal table in background
  • Refresh ALV GRID and keep position and current cell
  • FALV (Fast ALV Grid)
  • Call standard F4 search help with customized parameters
  • Dynamic GUI STATUS & TITLE with ABAP code
  • Create XLSX file from internal table in background v2
  • ATC Pseudo Comments list
  • Create fieldcatalog from internal table
  • Create a nice looking chart with CL_GUI_CHART_ENGINE - Part 3 - Chart Data and render
  • Link Attachments of Purchase Requisition to Purchase Order
  • GOS - How to add business documents at creation of object
  • Endless loop in BADI ME_PROCESS_PO_CUST
  • How to access private or protected data and methods of CL_GUI_ALV_GRID
  • Subtotal lines of ALV GRID OO as content separator
  • Popup with multi-select ALV
feed-image Feed Entries

Latest Comments

ABAP code and articles provided on http://abapblog.com, if it is not statet otherwise, were created by Łukasz Pęgiel. You can use the code in your SAP instance for commercial and non-commercial use without any warranty from side of the author. You cannot sell the code as a full program or a part of it.
Replicating of the articles and code is prohibited unless the agreement of the author is given to you. 

Bootstrap is a front-end framework of Twitter, Inc. Code licensed under MIT License. Font Awesome font licensed under SIL OFL 1.1.