Save a variant in a custom module-pool.

Hi all,
i hope there is someone that can help me.
My problem is: i've to save a variant in a module-pool custom SAPMZ...ecc.
Is there a function module or a routine or some specific ABAP istruction to save a variant?
I ask this because in my custom module-pool i've insert input field in main dynpro.
Thanks a lot,
regards,
Alex.

Please use below code it works for me:
What I did was copy the function group SVAR.  When it asked what function module to copy just select
'RS_VARIANT_SAVE_FROM_SELSCREEN' and renamed it to 'ZS_VARIANT_SAVE_FROM_SELSCR'.
DATA: lv_screen LIKE sy-dynnr.
  CLEAR: t_rkey, t_screen.
  REFRESH: t_rkey,  t_screen.
  t_rkey-report = sy-repid.
  APPEND t_rkey.
  t_screen-program   = sy-repid.
  t_screen-dynnr     = '0101'.
  t_screen-type      = 4.
  APPEND t_screen.
  lv_screen = '0101'.
  EXPORT lv_screen TO MEMORY ID 'MZ_COMISSION_REPORT_F02_SCREEN'.
  CALL FUNCTION 'ZS_VARIANT_SAVE_FROM_SELSCR'
    EXPORTING
      curr_report          = sy-repid
      vari_report          = sy-repid
    IMPORTING
      variant              = w_variant
    TABLES
       p_screens           = t_screen
     p_sscr               = t_selctab
     p_vari               = t_vari
    EXCEPTIONS
      illegal_variant_name = 1
      not_authorized       = 2
      no_report            = 3
      report_not_existent  = 4
      report_not_supplied  = 5
      OTHERS               = 6.
  t_rkey-variant = w_variant.
  MODIFY t_rkey INDEX 1.
  CALL FUNCTION 'RS_RWSET_SAVE_VARIANT'
    EXPORTING
      rkey    = t_rkey
    TABLES
      selctab = t_selctab.
Then in program LZSVARF07 function save_as_variant find where it's transfering the screen.
  READ TABLE variscreens WITH KEY dynnr = sy-dynnr.
  IF sy-subrc NE 0.
    IMPORT lv_screen FROM MEMORY ID 'MZ_COMISSION_REPORT_F02_SCREEN'.
    IF lv_screen IS INITIAL.
      variscreens-dynnr = sy-dynnr.
    ENDIF.
  ENDIF.
  PERFORM fill_varidyn TABLES p_dynsfields
                       USING  $rkey space. "Kein import von DYNSFIELDS
Good luck!
Edited by: Alex Nguyen on May 2, 2009 1:36 AM
Edited by: Alex Nguyen on May 5, 2009 5:26 PM

Similar Messages

  • Triggering Workflow from Custom Module pool

    Hi,
    I am trying to trigger my workflow from my custom module pool using the function module "SAP_WAPI_START_WORKFLOW". I am passing the following parameters for the above function module
    TASK, LANGUAGE, DO_COMMIT, USER and INPUT_CONTAINER
    but, it is returning the following message
    "You are not one of the possible agents of task 'WS90100020'"
    Please suggest a solution for this problem?
    Regards
    Sujith P. Soman

    Hi,
    A better way would be to trigger your WF using an event and calling SAP_WAPI_CREATE_EVENT. But if you want to start it directly then if you are calling this FM in dialog you need to be a possible agent. The easiest is if you jsut make it a general task so anyone can start it.
    In PFTC, open your WF goto Additional Data -> Agent assignment -> Maintain. Click on 'Attribnutes' and select 'General Task'.
    Also run SWU_OBUF afterwards to synch all buffers before testing your FM again.
    Cheers,
    Mike

  • Custom module pool + Amount field decimals display same as standard screen display

    Hi All,
    Requirement: A custom module program screen field has to be designed which displays decimal values of amount fields same as amount fields in standard screen.
    Standard screen behavior: If the standard screen fields are observed, they refer to data elements WRBTR or AZSOL_F05A (transactions FB50/FB03/FB01). However, number of decimal places that are visible on screen are dependent on the currency that is provided.
    Both the data elements have 2 decimal places.
    For currency USD two decimal places are displayed - in TCURX - decimal places are two.
    For currency JPY or CLP - zero decimal places are displayed  - in TCURX - decimal places are zero.
    i.e., even though the screen field refers to data element or domain that has the characteristic to show 2 decimal places, based on currency, decimal places are adjusted.
    I would like to know how this is happening on standard screen fields.
    Solution Required for: How to make the custom screen amounts to display same number of decimal places as standard screen amount fields.
    P.S: Before posting the query here, research has been done in SDN and other places. It has been identified that quantity fields adjustments are discussed. However for amount field even though discussed earlier, did not reach a conclusion.
    I would like to get a solution for this one.
    Thanks in advance.
    Goutham.

    Thank you all for taking time to take a look at this query.
    This issue has been resolved.
    Resolution: If the standard transactions (FI transactions in specific) are observed, whenever there is a field that displays amount value, there will be a corresponding field (may not be beside the amount field, somewhere on the screen or in the same sequence of screens) where the currency key value would be entered.
    For instance, if you look at FB50 - there is field on top for the user to input currency key value (like USD or CLP or INR).
    When any amount field is declared - this currency key field is provided as the reference field in the screen attributes of the amount field.
    In short, in the custom module pool program, provide a field that holds currency key value and use this field as reference field for the amount fields.
    Do repond to this thread if the resolution is not clear.
    Thank you all once again.
    Goutham.

  • Custom Module Pool...

    Hello SDN ABAP Community,
    I researched this question on the web and in SDN before posting this because I would like an up-to-date understanding of best way to do this.
    I have a need to write a custom module pool.  It has been a while since I have been to class.  I need to get figured out how my naming conventions will work for all the pieces of the module pool (SE51, SE41, pieces of the SE38 module pool).
    I seem to remember the teacher saying that the way that SAP allows for customer created module pools was to set the 5th character of the name to 'Z'.  eg- sap would use SAPMPetc.  customer would use SAPMZetc.
    From my searching of web I found following naming standards...
    Module pool                             - SAPDY* SAPDZ*
    Module pool for dialog               - DY* DZ*
    INCLUDES                              - SAPMY* SAPMZ*
    Module pool for screens            - MY* MZ*
    INCLUDES                              - MP9*
    Module pool for info types         - MP9*
    INCLUDES                              - SAPFY* SAPFZ*
    Module pool for subroutines      - FY* FZ*
    INCLUDES                              - SAPUY* SAPUZ*
    Module pool for update program - UY* UZ*
    INCLUDES
    From searching SDN I found following link for ABAP objects, but I am needing for module pool.
    http://help.sap.com/saphelp_nw04/helpdata/en/92/c2b084bc1d11d2958700a0c94260a5/frameset.htm 
    So my question... is there any SAP resource that I can look at to see SAP naming conventions for customer created module pool with SE41, SE51 and SE38?
    Thank you,
    Dean Atteberry.

    Hi Dean, here you can take a look at SAP´s official customer name ranges for all objects, including Module Pool: http://help.sap.com/saphelp_nw04/helpdata/EN/2a/6b0b1f547a11d189600000e829fbbd/frameset.htm
    Best regards,
    Federico Alvarez

  • Custome module pool creation

    Hi All,
    I have a requirement to create a module pool for maintaining data for some custom tables I created in SAP.
    I'd like to ask what the quickest way to create a module pool for the above is. I have been able to create maintenance screens using the extended table maintenance tool but there is a requirement for a more user friendly holistic approach.
    Any helpful suggestions will be greatly appreciated.
    Regards,
    Andy.
    Moderator message - This is not the place to learn module pool programing. Please try to ask a specific question.
    Edited by: Rob Burbank on Apr 16, 2009 9:14 AM

    Do like below
    if ok_code  = 'MODI' .  " for your modify button
    call transaction ' you transaction name '.
    now
    if  sy-ucomm = 'SAVE' or 'EXIT' or 'BACK' or 'CANC' .
    call screen 'your basic screen no.'.
    endif.
    endif.
    reward if helpful

  • Is it possible to save a variant in Module Pool program

    Hi,
    We have got a requirement to save a Variant for the user selections in Module Pool Program. Is it possible to save a variant in a Module Pool Program?
    Please let me know how to do that if it is possible.
    Thanks in Advance.

    hi Dagny,
      You can't have variants for module pool. It is possible only for selection screen.
    You have following alternatives :-
    1. Create a report with same selection screen as you have now in module pool.
    And then make a call screen to your intial module pool.
    In this way you can all the advantage of variants as well as module pool.
    OR
    2. Create a transaction variant using transaction SHDO.
    Hope it is helpful.
    and do search the form , it is already answered before.
    regards
    venkat

  • 'Save As Variant' for Module Pool Program - FM to be called?

    I have a dialog program, i want to activate the 'Save As variant' when i click on save on the selection screen of the transaction i created for the dialog program. What funtionality should be called or written for the PF-STATUS to implement the functionality.

    hi Dagny,
      You can't have variants for module pool. It is possible only for selection screen.
    You have following alternatives :-
    1. Create a report with same selection screen as you have now in module pool.
    And then make a call screen to your intial module pool.
    In this way you can all the advantage of variants as well as module pool.
    OR
    2. Create a transaction variant using transaction SHDO.
    Hope it is helpful.
    and do search the form , it is already answered before.
    regards
    venkat

  • User Decision in a Module Pool

    Hello Guys,
    I am relatively new to SAP workflows. I am implementing a solution here and I have mixed feelings about the design. I would love to hear some advice on how to proceed or some reassurance that I am going in the right path.
    Requirement:
    If a Requeust (say Material Creation)  is created by the Initiator in my Custom Module Pool program, the workflow is triggered and sent to the Approver.
    The Approver should View the Request by executing the workitem from his Inbox which will in-turn call the Module Pool Program.
    From there the approver will have two options either to Approve or Send Back.
    I have designed my workflow like this...
              View Request  (Activity)
                      |
              Aprrove / Reject  (User Decision)
       5.  I am marking the 'View Request' activty as complete from my Dialog Program so as to make the workflow come to the User Decision step so that I can pick one and execute form the Module Pool. I have a bad feeling that it might not be a standardized method. If not, then how shall I proceed.??

    From my point of view the decision step is completely unnecessary (or alternatively I am missing a point here). What is the role of the decision step in the process?
    If you have some kind of approval, you should be able to handle it with a one single workflow step. There is no "standard way" of doing things, but there are best practices. If you take a look to any of the SAP standard workflows, they normally work like this (let's take a leave request as an example):
    1. Approver clicks the "Approve leave" work item from his inbox
    2. This will open the leave request approval application
    3. Approver clicks the approve button.
    4. Clicking the approval button updates the leave request status to approved in the database and at the same time completes the "Approve leave" work item, and thus the workflow will continue.
    Everything is handled with a single step and there is no need for some kind of sequential decision step.
    Even better would be that when you click the approve button, you would trigger an event REQUEST.APPROVED of your possible business object instance, and your task would be waiting for this event. The event would complete the even, and thus you would not need to use SAP_WAPI_WORKITEM_COMPLETE (=your application/module pool does not need to know anything about the workflow (=work item ID) - it would just trigger the event for the request). The best approach is to separate the business logic / application from the workflow, if you have a possibility for it (and if you are building something from scratch, then you have all the possibilities for this).
    Kind regards,
    Karri

  • Reusing Standard Classes for Module pool Programming using Abap Objects

    Hi.,
        I debugged the ME21n transaction and found a number of classes such as
             CL_BASIC_MODEL_VIEW_MM
             CL_GENERIC_MODEL_VIEW_MM
             CL_GENERIC_VALUE_MODEL_MM
             CL_MODEL_CONTAINER_MM
             CL_MODEL_CONTROL_VIEW_MM
             CL_MODEL_VIEW_MM
             CL_TABLE_MODEL_MM
             CL_TABLE_MODEL_TREE_VIEW_MM
             CL_VALUE_MODEL_MM
             CL_VALUE_MODEL_VIEW_MM
             CL_BASIC_MODEL_VIEW_MM
            CL_COMPOSITE_SCREEN_VIEW_M
            CL_CUSTOM_CONTROL_VIEW_MM
            CL_EXPAND_BUTTON_VIEW_MM
            CL_EXPAND_VIEW_MM
            CL_FOREIGN_APPLICATION_VIE
            CL_GENERIC_MODEL_VIEW_MM
            CL_GRID_VIEW_MM
            CL_MODEL_CONTROL_VIEW_MM
           CL_MODEL_VIEW_MM
           CL_SCREEN_VIEW_MM
          CL_SETUPVIEW_BUILDER_MM
            CL_SIMPLE_TREE_VIEW_MM
             CL_TABLE_MODEL_TREE_VIEW_M
             CL_TABLE_VIEW_CONTAINER_MM
             CL_TABLE_VIEW_MM
             CL_TABSTRIP_VIEW_MM
             CL_TC_BUTTON_VIEW_MM
             CL_TC_ITEM_VIEW_MM
             CL_TOGGLE_VIEW_MM
             CL_VALUE_MODEL_VIEW_MM
             CL_DEFAULT_CONTROLLER_MM
             CL_CONTROLLER_MM
             CL_ATP_CONTROLLER_MM
             CL_DRAG_DROP_CONTROLLER_MM  ..
                   How we can reuse these classes to build a custom module pool program which supports MVC architecture as used in enjoy SAP transactions .I am very much confused from where to start .
    Guide me on this.I want to create a simple module pool program with Subscreens, Table Controls and Tabstrips ..
    Regards.,
    S.Sivakumar

    Have you got any solution on this.
    because i want to use CL_GRID_VIEW_MM->handle_on_data_changed for one of my development related to ME51N.

  • Building Module Pool using Objects ?

    Hi,
    I want to develop custom module pool programs / transactions, using ABAP Objects, can anybody please provide me some sample abap code ( or links ) or coding conventions to develop a custom transaction using ABAP objects.
    thanks and regards,
    Navneeth K.

    Hi Navneeth,
    <b>Please check out this below Module Pool
    SAPM00PS_WB</b>
    HR PS : Process Workbench Engine ( PWE)
    This Program seems to be a good example
    SAPSIMPLE_TREE_CONTROL_DEMO
    ++++++
    DEMO_ABAP_OBJECTS              Complete Demonstration for ABAP Objects    
    DEMO_ABAP_OBJECTS_CONTROLS     GUI Controls on Screen                     
    DEMO_ABAP_OBJECTS_DIALOG_BOX   Splitter Control for Screen with Dialog Box
    DEMO_ABAP_OBJECTS_EVENTS       Demonstration of Events in ABAP Objects    
    DEMO_ABAP_OBJECTS_GENERAL      ABAP Objects Demonstration                 
    DEMO_ABAP_OBJECTS_METHODS      Demonstration of Methods in ABAP Objects   
    DEMO_ABAP_OBJECTS_SPLIT_SCREEN Splitter Control on Screen                 
    <b>Try out Transaction
    ABAPDOCU
    Or better in SE38
    DEMO*  and press F4</b>
    Regards,
    ABY

  • Module Pool Selection Screen

    The user wants the custom module pool selection screen to look like a list selection screen.  Meaning that they want to have the multiple selection box come up at the end of the field.  I don't think that this is possible but maybe someone has some ideas

    Use code like the following in your TOP include.
    Note that we have defined screen 500 in the code.
    Now in your transaction code for this module pool set this as the openingscreen. Please revert in case of any clarifications.
    Code.
    =AF---
    selection-screen : begin of screen 500 as window.
    selection-screen : begin of block abc with frame title text-001.
    select-options : s_bukrs for mseg-bukrs no intervals no-extension
    obligatory.
    parameter : p_postdt like mkpf-budat obligatory.
    select-options : s_vendor for mseg-lifnr.
    selection-screen : end of block abc.
    selection-screen : begin of block def with frame title text-002.
    parameter : c_fore radiobutton group g1 default 'X',
    c_back radiobutton group g1 .
    selection-screen : end of block def.
    selection-screen : end of screen 500.
    at selection-screen.
    if sy-ucomm = 'CRET'.
    perform get_data.
    endif.

  • How to create transaction or screen variant for custom tcode in module pool

    Hi,
              I have one module pool program with custome tcode ,i want to create transaction or screen variant for this tcode.Next time when we run this tcode we need a variant for this tcode.
    I tried by using of SHD0 but it is working only for standred tcodes.Is there any possibilty please help me.
    thanks,
    Lavanya.

    Hi,
    you created a Custom Tcode for ur module pool Pgm..if u execute the Tcode in the output screen give the input details and press Save Option then variant will be created. Then you can use that variant.
    otherwise.. while creating a Tcode..
    select an option for Tcode type Tranasction With variant ..there u will provide the variant for ur Tcode ( which is already created ).
    Regards,
    PraVeen.

  • How to save Custom control records through module pool program ?

    Hi guru ,
    1. How to save Custom control records through module pool program ?
    I wrote multiple lines of record in custom control
    Who to save that records ?
    thanking you.
    Regards,
    Subash.

    Hi,
    can refer following code -
    IN PAI , CODE is as follows-
    *&      Form  editor_output
    FORM editor_output .
    NARRATION1 is name of custom controller
      IF v_editor IS INITIAL.
      Create obejct for custom container
        CREATE OBJECT v_custom_container
          EXPORTING
            container_name              = 'NARRATION1'
          EXCEPTIONS
            cntl_error                  = 1
            cntl_system_error           = 2
            create_error                = 3
            lifetime_error              = 4
            lifetime_dynpro_dynpro_link = 5
            OTHERS                      = 6.
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE 'I' NUMBER sy-msgno
                     WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
      Create obejct for the TextEditor control
        CREATE OBJECT v_editor
          EXPORTING
            wordwrap_mode              = cl_gui_textedit=>wordwrap_at_fixed_position
            wordwrap_position          = line_length
            wordwrap_to_linebreak_mode = cl_gui_textedit=>true
            parent                     = v_custom_container
          EXCEPTIONS
            error_cntl_create          = 1
            error_cntl_init            = 2
            error_cntl_link            = 3
            error_dp_create            = 4
            gui_type_not_supported     = 5
            OTHERS                     = 6.
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE 'I' NUMBER sy-msgno
                     WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
      ENDIF.
    ENDFORM.                    " editor_output
    getting textdata in internal table as follows
    *&      Form  create_text
    FORM create_text .
      REFRESH : it_texttable,
                it_text.
      IF v_doc_number IS NOT INITIAL.
        IF v_editor IS NOT INITIAL.
          CALL METHOD v_editor->get_text_as_r3table
            IMPORTING
              table                  = it_texttable
            EXCEPTIONS
              error_dp               = 1
              error_cntl_call_method = 2
              error_dp_create        = 3
              potential_data_loss    = 4
              OTHERS                 = 5.
          IF sy-subrc <> 0.
            MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                       WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
          ENDIF.
    Now, our final text data is in internal table it_texttable.
    pls, Reward if found helpful.

  • How to save Custom control records module pool program ?

    Hi guru ,
    1. How to save Custom control records module pool program ?
    I wrote multiple lines of record in custom control
    Who to save that records ?
    thanking you.
    Regards,
    Subash.

    Hi Subasha,
    Please check the format below since it is based on a working code
    **************data declarations
    TYPES: BEGIN OF TY_EDITOR,
    EDIT(254) TYPE C,
    END OF TY_EDITOR.
    data: int_line type table of tline with header line.
    data: gw_thead like thead.
    data: int_table type standard table of ty_editor.
    You should create a text for uniquely identifying the text you are saving each time so that it doesn't get overwritten
    For this a key combination must be decidedd to uniquely identify the test..here it is loc_nam
    ****************fill header..from SO10( t-code )
    GW_THEAD-TDNAME = loc_nam. " unique key for the text
    GW_THEAD-TDID = 'ST'. " Text ID
    GW_THEAD-TDSPRAS = SY-LANGU.
    GW_THEAD-TDOBJECT = 'ZXXX'. "name of the text object created
    *Read Container and get data to int_table
    CALL METHOD EDITOR ->GET_TEXT_AS_R3TABLE
    IMPORTING
    TABLE = int_table
    EXCEPTIONS
    ERROR_DP = 1
    ERROR_CNTL_CALL_METHOD = 2
    ERROR_DP_CREATE = 3
    POTENTIAL_DATA_LOSS = 4
    others = 5.
    IF SY-SUBRC 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    loop data from int_table and save to int_line-tdline appending it.
    *save the text
    CALL FUNCTION 'SAVE_TEXT'
    EXPORTING
    HEADER = GW_THEAD
    TABLES
    LINES = InT_LINE
    EXCEPTIONS
    ID = 1
    LANGUAGE = 2
    NAME = 3
    OBJECT = 4
    OTHERS = 5.
    IF SY-SUBRC 0.
    ENDIF.
    The code shown above is ok and working fine for save also,hope that the above sample with helps you solve the problem
    Please check and revert,
    Reward if helpful
    Regards
    Byju

  • How can one save variants for module pool screens.

    hai all,
         i have done a module pool screen for taking information from user..later i leave to list processor and give a report to the user.
      i am testing the program with many input parameters.i don't want to enter the values each time i execute the program.can i not save a variant like i save for normal abap editor programs?
    any other solution ?

    Hii..
    Variants can be created in Selection Screen only...
    For ur Scenario:
    To leave to the list use the Statements
    <b>LEAVE TO LIST-PROCESSING And return .</b>
    then the Data will be automatically retained.
    <b>Reward if Helpful</b>

Maybe you are looking for