• 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

Enhanced MB51 Part 3 - Get selection parameters

Details
Łukasz Pęgiel
Tricks
27 March 2014
Hits: 6812
Tags: RS_REFRESH_FROM_SELECTOPTIONS , MB51 , RM07DOCS
As I have needed types I can start to create methods which I need. Firstly fast method the read select-option data from any program which will call our class. I will use here FM RS_REFRESH_FROM_SELECTOPTIONS . If you're thinking about it's restrictions to keep only 40 characters from screen parameters then please check your system as for some of the new versions this FM contains a table parameter of structure RSPARAMSL_255 which allows to store up to 255 characters.
 
Importing:

i_progname type sy-repid

Changing:

it_seltab type rsparams_tt

Implementation:

method get_selection_screen_criteria.

    call function 'RS_REFRESH_FROM_SELECTOPTIONS'     
    exporting
      curr_report     = i_progname
    
tables
      selection_table = it_seltab
    
exceptions
      not_found       = 1
      no_report       = 2
      others          = 3.
    case sy-subrc.
    when 0.
    when 1.
      "raise not_found.
    when 2.
      "raise no_report.
    when others.
      "raise other_error.
    endcase.

endmethod.

Add a comment

Enhanced MB51 Part 2 - Structure for data

Details
Łukasz Pęgiel
Tricks
27 March 2014
Hits: 10409
Tags: MB51 , MB51 ENHANCEMENT , RM07DOCS
I've decided which way should I go, so now time to do it. I need to do following things to get what I desired:
  • Create a function group or class to be able to reuse the solution in other programs also
  • Create implicit enhancement in MB51 to be able to export it's results and stop MB51 if it's called from outside
  • Create a program with selection screen fields from MB51 + my own desired additional filters. This program should call standard MB51 and display some additional fields in ALV Grid.
I prefer to create a class in which I will store all needed methods to call MB51 with selection-options filled and to get back the results. 
 
I will need a type for the structure which will be used as a base type to all copy / move functions from MB51 to class and program. Bellow you'll find a type t_list which contains most of the fields which are available in MB51 (structure list in RM07DOCS). Just after t_list you'll find type tt_list which is just table type for t_list.
Add a comment
Read more ...

Enhanced MB51 Part 1 - Goal and prerequisites

Details
Łukasz Pęgiel
Tricks
24 March 2014
Hits: 22741
Tags: MMIM_REP_CUST , MB51 , MB51 ENHANCEMENT , RM07DOCS
It think that some of you involved in MM or PP had already a request or need to add some fields to MB51 or to call it directly with ALV grid instead of old style view. I also had such request and it contained both needs - additional fields and direct display of ALV grid. So I started to dig and debug to see what is possible to do and these possibilities I found:
  1. Copy program RM07DOCS (MB51) to Z-one and to the changes there - but I don't like such solutions so I didn't want to do that way
     
  2. Create own program which selects data from MKPF and MSEG and display it like MB51 do - but this would be to time consuming to prepare same logic like in MB51 and in case of any changes in oryginal transaction I would need to adjust program again
     
  3. Do implicit enhancement in RM07DOCS to add missing fields to the field catalog and then fill them during the call of MB51 - this would solve the first part of the request but users will have to do additional two clicks to go to ALV grid which as you may know already is sometimes to much :) Nevertheless if someone of you would like to go this way then you should do two implicit enhancements in RM07DOCS:
    Add a comment
Read more ...

Reset rejection of Purchase Requisition

Details
Łukasz Pęgiel
How to...
24 March 2014
Hits: 15561
Tags: IF_PURCHASE_REQUISITION , IF_RELEASABLE_MM , MEPO_DOCUMENT , MEREQ_GET_FACTORY , IF_PURCHASE_REQ_FACTORY , IS_RESET_REJ_ALLOWED
As promised today I'll put code for a method to reset the rejection of the Purchase requisition. Most of the code is the same like in the check method, in fact even the code is repeated again so you can use this one without checking if reset of rejection can be done or not.
 
Importing:

I_BANFN TYPE EBAN-BANFN -> Purchase Requistion number

Changing:

C_FACTORY TYPE REF TO IF_PURCHASE_REQ_FACTORY -> Purchase requisition factory

Exporting:

E_RESET TYPE FLAG -> Reset was successful

Exceptions:

HEADER_COULDNT_BE_CREATED
ERROR_DURING_RESET
CANNOT_RESET

Add a comment
Read more ...

Other checks on purchase requisition state

Details
Łukasz Pęgiel
How to...
22 March 2014
Hits: 4825
Tags: IF_RELEASABLE_MM , IS_REJECTION_ALLOWED , IS_RELEASE_ALLOWED , IS_RESET_REL_ALLOWED
In the previous article I've shown how to check if we can reset the rejection of the purchase requisition. In the same way you can check if rejection is allowed or if release is allowed or if reset of release is allowed. To do that you'll have to replace  following piece of code from previous example fo_releasable->is_reset_rej_allowed( )
 with one of the following:
  • fo_releasable->is_rejection_allowed( ) 
  • fo_releasable->is_release_allowed( )
  • fo_releasable->is_reset_rel_allowed( ) 
 
In next article I will show you how to reset the rejection of PR .
Add a comment

How to check if for purchase requisition rejection can be reset?

Details
Łukasz Pęgiel
How to...
18 March 2014
Hits: 9078
Tags: IF_PURCHASE_REQUISITION , IF_RELEASABLE_MM , MEPO_DOCUMENT , MEREQ_GET_FACTORY , IF_PURCHASE_REQ_FACTORY , IS_RESET_REJ_ALLOWED
Working with Purchase Requisitions in ABAP is quite pleasant job, but sometimes it's not so easy like with other documents types. You cannot easily say if Requisition is rejected and can be reset by checking EBAN table. You have to use OO PR objects to be able to do so. Bellow you can find a method how to check if you can reset the rejection of the requisition done in the WF. 
 
Importing:

I_BANFN TYPE EBAN-BANFN ->Purchase Requisition Number

Exporting:

E_RESETABLE TYPE FLAG -> If rejection can be reset this parameter will be set to 'X'

Changing:

CO_FACTORY TYPE REF TO IF_PURCHASE_REQ_FACTORY -> Purchase requisition factory

Exception:

HEADER_COULDNT_BE_CREATED

Add a comment
Read more ...

Range to search in lower case fields

Details
Łukasz Pęgiel
Tricks
13 March 2014
Hits: 10309
Tags: LOWER CASE , UPPER CASE , SEARCH , LOOP , SELECT
It may happen that you'll need to do select or loop on a base of the field which is kept in lower case, but you don't know exactly what's the value o field. In such case you may want to build a range of the possible values to be able to fulfill the task. Here is how to do it quite fast by doing FM:
 

function z_ab_prep_val_for_case_search.
*"--------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     VALUE(I_TEXT) TYPE  CSEQUENCE
*"     VALUE(I_SIGN) TYPE  CHAR1
*"     VALUE(I_OPTION) TYPE  CHAR2
*"  EXPORTING
*"     REFERENCE(ER_RANGE) TYPE  STANDARD TABLE
*"--------------------------------------------------------------------
  field-symbols: <low> type any.
  field-symbols: <sign> type any.
  field-symbols: <opt> type any.
  field-symbols: <line> type any.
  field-symbols: <linenew> type any.
  field-symbols: <lownew> type any.
  field-symbols: <tab> type standard table.
  data: f_times type i.
  data: f_text type string.
  data: f_textnew type string.
  data: f_insidel type i.
  data: f_insidel2 type i.
  data: ft_data type ref to data.

  "create temp table and assign it to FS
  create data ft_data like er_range.
  assign ft_data->* to <tab>.

  f_text = i_text.

  "get lenght
  f_times = strlen( f_text ).
  "translate to upper case so we have always same start
  translate f_text to upper case.

  "append initial line to range and put first value into table
  append initial line to er_range assigning <line>.
  check sy-subrc eq 0.
  assign component 'LOW' of structure <line> to <low>.
  check sy-subrc eq 0.
  <low> = i_text. "all in uppercase
  assign component 'SIGN' of structure <line> to <sign>.
  check sy-subrc eq 0.
  <sign> = i_sign.
  assign component 'OPTION' of structure <line> to <opt>.
  check sy-subrc eq 0.
  <opt> = i_option.
  translate <low> to upper case.

  "create entries for each other combination of cases
  do f_times times.
    f_insidel2 = sy-index - 1.
    loop at er_range assigning <line>.
      assign component 'LOW' of structure <line> to <low>.
      check sy-subrc eq 0.
      if f_text+f_insidel2(1) ca '*+' and ( i_option eq 'CP' or i_option eq 'NP' ).

      else.
        append initial line to <tab> assigning <linenew>.
        check sy-subrc eq 0.
        assign component 'LOW' of structure <linenew> to <lownew>.
        check sy-subrc eq 0.
        assign component 'SIGN' of structure <linenew> to <sign>.
        check sy-subrc eq 0.
        <sign> = i_sign.
        assign component 'OPTION' of structure <linenew> to <opt>.
        check sy-subrc eq 0.
        <opt> = i_option.
        <lownew> = <low>.
        f_textnew = <lownew>+f_insidel2(1).
        translate f_textnew to lower case.
        <lownew>+f_insidel2(1) = f_textnew.
      endif.
    endloop.
    append lines of <tab> to er_range.
    refresh <tab>[].
  enddo.

endfunction.

Add a comment
Read more ...

Characteristic's own input screen - Part 8 - example of use

Details
Łukasz Pęgiel
How to...
17 November 2013
Hits: 5850
We got all needed functions, so I'll give you an example how to call the methods correctly to get characteristics update window like this:
 
Program bellow is reading firstly the info about stored values in given characteristic and then throws an update screen. After exiting from the screen it's saving data to database.
Add a comment
Read more ...

Characteristic's own input screen - Part 7 - save characteristic value to database

Details
Łukasz Pęgiel
How to...
17 November 2013
Hits: 10483
Tags: BAPI_OBJCL_CHANGE , BAPI_OBJCL_GETDETAIL
Now it's time to save the values entered into database. I will use here previously created method to move data from reference structure to BAPI tables, then I will read values from database to see if something has changed with BAPI_OBJCL_GETDETAIL, then save the values with BAPI_OBJCL_CHANGE. Just one remark, you have to pass all values always to that FM!
 
Importing:

I_DATA TYPE DATA OPTIONAL
value( I_CHANGE_NUMBER ) TYPE BAPI1003_KEY-CHANGENUMBER OPTIONAL -> Change Number 

Exception:

NO_DATA  

Add a comment
Read more ...

Characteristic's own input screen - Part 6 - move reference data to bapi structures

Details
Łukasz Pęgiel
How to...
17 November 2013
Hits: 6018
Tags: BAPI_CLASS_READ , COC1_FEATURE_CHECK
Our characteristics update screen was displayed, data was changes so we need to read the reference data and put the values into BAPI structures in order to be able to save the values to database.
I will use here BAPI_CLASS_READ to read all possible characteristics and COC1_FEATURE_CHECK to get characteristic details.
 
Importing:

I_DATA TYPE REF TO DATA

Changing:

CT_OBJVALUESNUM TYPE TT_BAPI1003_ALLOC_VALUES_NUM
CT_OBJVALUESCHAR TYPE TT_BAPI1003_ALLOC_VALUES_CHAR
CT_OBJVALUESCURR TYPE TT_BAPI1003_ALLOC_VALUES_CURR

Exceptions:

NO_DATA_TO_PASS 

Add a comment
Read more ...

Characteristic's own input screen - Part 5 - show characteristic's own update screen

Details
Łukasz Pęgiel
How to...
14 November 2013
Hits: 9305
Tags: COC1_FEATURE_CHECK , CTMS_DDB_INIT , CTMS_CLASS_DDB , CTMS_DDB_SET_VAL_FROM_OBJECT , CTMS_DDB_SET_VALUE_INTERNAL , CTMS_DDB_SET_VALUE_ONLINE , CTMS_DDB_HAS_VALUES_INTERNAL
Now we're ready to build the data for screen output, call the update screen and then move the data back from screen to reference data. We will use here:
  • COC1_FEATURE_CHECK to get characteristic ID
  • CTMS_DDB_INIT to initialize memory 
  • CTMS_CLASS_DDB to put in memory classification settings
  • CTMS_DDB_SET_VAL_FROM_OBJECT to set values in update screen from existing object (option)
  • CTMS_DDB_SET_VALUE_INTERNAL to set values in update screen in case of using reference data structure
  • CTMS_DDB_SET_VALUE_ONLINE to call the update screen
  • CTMS_DDB_HAS_VALUES_INTERNAL to check and get the values from the update screen after user action
  • zcl_abapblog_com_classific=>create_structure_for_class to create reference data structure
  • zcl_abapblog_com_classific=>move_screen_val_to_ref_data to move screen values to reference data
  • zcl_abapblog_com_classific=>clear_initial_line_api_vari to delete initial line for multiple values characteristics
  • zcl_abapblog_com_classific=>move_ref_data_to_screen_val to move reference data to update screen values table
Add a comment
Read more ...

Characteristic's own input screen - Part 4 - Move screen values to reference data

Details
Łukasz Pęgiel
How to...
14 November 2013
Hits: 4848
Tags: KKEK_CONVERT_FLOAT_TO_CURR , COC1_FEATURE_CHECK
In previous article I've shown how to move characteristics from reference data to screen values table, this method is doing opposite way from screen values table to reference data structure.
 
Importing:

IT_VALUES TYPE TT_API_VALI -> screen values table
I_ATNAM TYPE API_VALI-ATNAM -> Characteristic Name

Changing:

C_DATA TYPE REF TO DATA

Exceptions:

NO_DATA_TO_CHANGE

Add a comment
Read more ...

Characteristic's own input screen - Part 3 - Move reference data values to screen

Details
Łukasz Pęgiel
How to...
14 November 2013
Hits: 6225
Tags: COC1_FEATURE_CHECK
Before we can call the screen with the characteristic value to change we need to convert data from our reference data structure to table of type TT_API_VALI. Following method shows how to do it.
 
Importing:

I_ATNAMTYPE API_VALI-ATNAM ->Characteristic Name
I_DATATYPE REF TO DATA-> our reference data

Changing:

CT_VALUES TYPE TT_API_VALI-> Structure for characteristic screen

Exceptions:

NO_DATA_TO_CHANGE

Add a comment
Read more ...

Characteristic's own input screen - Part 2 - Clear Initial Line

Details
Łukasz Pęgiel
How to...
31 August 2013
Hits: 7533
Tags: CTMS_DDB_SET_VALUE_ONLINE , CTMS_DDB_SET_VALUE_INTERNAL , CTMS_DDB_HAS_VALUES_INTERNAL , CTMS_DDB_SET_VAL_FROM_OBJECT
We've got method to convert internal value to float, now it's time for next one which I didn't suppose it would be needed but when I was calling CTMS_DDB_SET_VALUE_ONLINE to show input screen with previously filled data by CTMS_DDB_SET_VALUE_INTERNAL then for multiple value characteristic I was always receiving one additional line to these which was passed by me in export parameters. The funny thing was that it wasn't the case when CTMS_DDB_SET_VAL_FROM_OBJECT was used. Of course this line was initial but the values were treated after as imputed by user. So as always I started to debug the code to see why it's happening. Finally I found that internal table WS in the function group CTMS was not refreshed during the call of CTMS_DDB_SET_VALUE_INTERNAL. 
As I couldn't refresh it in any call of FM from this function group I had to use old trick with assignment of data from program in memory. But firstly I check with FM CTMS_DDB_HAS_VALUES_INTERNAL if any values are already there.
 
Importing:

IT_API_CHAR TYPE TT_API_CHAR -> Table type for structure api_char_tab

Add a comment
Read more ...

More Articles ...

  1. Characteristic's own input screen - Part 1 - Convert Values To Float
  2. Scan program for authority-check
  3. Extend allowed runtime of a program
  4. Custom selection-screen fields for MD07/MS07
  5. Selection Screen - Part1 - Parameters
  6. Call standard F4 search help with customized parameters
  7. Endless loop in BADI ME_PROCESS_PO_CUST
  8. How to select proper configuration entry
  9. Copy routing (create on a base of existing one)
  10. Classifications - Part 4 - example of use
Page 8 of 11
  • Start
  • Prev
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • Next
  • End
Łukasz Pęgiel
Secure call of starting new task using RM FREE SESSION CHECK ALV GRID SCMS XSTRING BINARY ABAP EXTENSIONS FIELDCATALOG IXML DOCUMENT REFRESH TABLE DISPLAY ZDEMO FALV10 - Color Settings COMPONENTS MAINTAIN GET CURRENT CELL Download CV01N 3N documents to PC Create a nice looking chart with CL GUI CHART ENGINE - Part 2 - Customization FALV ADT FALV08 - Mass replace function ALV GRID IN THE NUTSHELL ALV Grid in the nutshell Field catalog - fix column QM ATTACHMENTS ZIP a file using ABAP ALV GRID PURCHASE REQUISITION Creating editor for dynamic code SE38 like Field catalog - tooltip PRAGMA Why I like to code in ABAP in Eclipse FALV Fast ALV Grid STRING Field catalog - ifieldname MMIM REP CUST OUTLOOK APPLICATION MB51 ENHANCEMENT ABAP4 CALL TRANSACTION AUTOMATIC LOGON DATATYPE CVAPI DOC GETDETAIL SYNTAX-CHECK Field catalog - no out SALV UTIL ALV POPUP SELECTED CELLS Field catalog - key ABAP DEVELOPMENTS TOOLS CTMS DDB SET VALUE INTERNAL MB51 SAVE USER SETTINGS RSDBRUNT OUTPUTLEN TIMER TOOL ACCESS LOAD COMPLEX ITM TVCPL CALL TRANSFORMATION MEREQ FACTORY OSTREAM RELEASABLE OBJECTS
  • 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.