Do you know the function module to create variants?

To automate the setting of variants on the selection-screens, I'd like to make some tool program to create variants.
I'd appreciate if you could tell me some function module(or any other methods) to create variants.
Thank you in advance for your information.

Hi,
You would find useful FMs in the following link:
http://www.sapdevelopment.co.uk/fmodules/fmssap.htm
FASU_V_CREATE_VARIANT_RFC      ASU: Create variant
FASU_RS_CREATE_VARIANT         create variant (w/o selection screen) - client dependent
FASU_RS_CHANGE_CREATED_VARIANT change variant w/o selection screen - client dependent
Sample Program:
REPORT z_co99_cji5
NO STANDARD PAGE HEADING
MESSAGE-ID 00
LINE-SIZE 290.
PROGRAM : Z_CO99_CJI5 *
TITLE : CJI5 In Background *
AUTHOR. : Raja Nesanoor *
DATE WRITTEN : 27-Feb_2007 *
REVTRAC : xxxxxx *
PROGRAM FUNCTION: *
To DISPLAY CJI5 Report in background *
PROGRAM TYPE : Executable program *
DEV. CLASS : XXXXXX *
LOGICAL DB : NA *
AUHTORIZATION CHECKS *
Object Authorization Fields ABAP Fields *
S_TCODE *
BUKRS v_BUKRS *
CHANGE HISTORY *
Date Id Name Indicator Description *
DATA : v_repid LIKE sy-repid VALUE 'ZRKPEP005' ,
v_variant LIKE varid-variant VALUE 'V_CJI5' .
DATA: BEGIN OF w_varid.
INCLUDE STRUCTURE varid.
DATA: END OF w_varid.
DATA: BEGIN OF i_rsparams OCCURS 10.
INCLUDE STRUCTURE rsparams.
DATA: END OF i_rsparams.
DATA: BEGIN OF i_rsparams1 OCCURS 10.
INCLUDE STRUCTURE rsparams.
DATA: END OF i_rsparams1.
DATA: BEGIN OF i_varit OCCURS 2.
INCLUDE STRUCTURE varit.
DATA: END OF i_varit.
DATA: BEGIN OF i_vscreens OCCURS 2.
INCLUDE STRUCTURE rsdynnr.
DATA: END OF i_vscreens.
start-of-Selection
START-OF-SELECTION.
SET PARAMETER ID 'CAC' FIELD 'GC10'.
SET PARAMETER ID 'PDB' FIELD '000000000001'.
PERFORM populate_var_table.
PERFORM create_variant.
PERFORM submit_cji5.
*& Form POPULATE_VAR_TABLE
text
--> p1 text
<-- p2 text
FORM populate_var_table .
CLEAR w_varid .
REFRESH i_varit .
REFRESH i_rsparams .
i_rsparams-selname = 'CN_NETNR'.
i_rsparams-kind = 'S'.
i_rsparams-sign = 'I'.
i_rsparams-option = 'EQ'.
i_rsparams-low = '90273536'.
i_rsparams-high = space.
APPEND i_rsparams.
CLEAR : i_rsparams .
i_rsparams-selname = 'CN_NETNR'.
i_rsparams-kind = 'S'.
i_rsparams-sign = 'I'.
i_rsparams-option = 'EQ'.
i_rsparams-low = '90274010'.
i_rsparams-high = space.
APPEND i_rsparams.
CLEAR : i_rsparams .
i_rsparams-selname = 'R_OBDAT'.
i_rsparams-kind = 'S'.
i_rsparams-sign = 'I'.
i_rsparams-option = 'BT'.
i_rsparams-low = space .
i_rsparams-high = space.
APPEND i_rsparams.
CLEAR : i_rsparams .
i_rsparams-selname = 'P_DISVAR'.
i_rsparams-kind = 'P'.
i_rsparams-sign = 'I'.
i_rsparams-option = 'EQ'.
i_rsparams-low = '1SAP' .
APPEND i_rsparams.
CLEAR : i_rsparams .
i_rsparams-selname = 'P_USEDB'.
i_rsparams-kind = 'P'.
i_rsparams-sign = 'I'.
i_rsparams-option = 'EQ'.
i_rsparams-low = SPACE.
APPEND i_rsparams.
w_varid-mandt = sy-mandt.
w_varid-report = v_repid.
w_varid-variant = v_variant.
w_varid-flag1 = space.
w_varid-flag2 = space.
w_varid-transport = space.
w_varid-environmnt = 'A'. "Variant for batch and online
w_varid-protected = space.
w_varid-secu = space.
w_varid-version = '0'.
w_varid-ename = sy-uname.
w_varid-edat = sy-datum.
w_varid-etime = sy-uzeit.
w_varid-aename = space.
w_varid-aedat = space.
w_varid-aetime = space.
w_varid-mlangu = sy-langu.
i_varit-mandt = sy-mandt.
i_varit-langu = sy-langu.
i_varit-report = w_varid-report.
i_varit-variant = w_varid-variant.
i_varit-vtext = 'CO99-OUTPUT'.
APPEND i_varit.
ENDFORM. " POPULATE_VAR_TABLE
*& Form CREATE_VARIANT
text
--> p1 text
<-- p2 text
FORM create_variant .
data: h_rc like sy-subrc.
*Check variant exists.
CALL FUNCTION 'RS_VARIANT_EXISTS'
EXPORTING
report = v_repid
variant = v_variant
IMPORTING
R_C = h_rc
EXCEPTIONS
not_authorized = 01
no_report = 02
report_not_existent = 03
report_not_supplied = 04.
IF h_rc = 0.
CALL FUNCTION 'RS_CHANGE_CREATED_VARIANT'
EXPORTING
curr_report = v_repid
curr_variant = v_variant
vari_desc = w_varid
TABLES
vari_contents = i_rsparams
vari_text = i_varit
EXCEPTIONS
illegal_report_or_variant = 01
illegal_variantname = 02
not_authorized = 03
not_executed = 04
report_not_existent = 05
report_not_supplied = 06
variant_doesnt_exist = 07
variant_locked = 08
selections_no_match = 09.
COMMIT WORK.
ELSE.
CALL FUNCTION 'RS_CREATE_VARIANT'
EXPORTING
curr_report = v_repid
curr_variant = v_variant
vari_desc = w_varid
TABLES
vari_contents = i_rsparams
vari_text = i_varit
EXCEPTIONS
illegal_report_or_variant = 1
illegal_variantname = 2
not_authorized = 3
not_executed = 4
report_not_existent = 5
report_not_supplied = 6
variant_exists = 7
variant_locked = 8
OTHERS = 9.
COMMIT WORK.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDIF.
ENDFORM. " CREATE_VARIANT
*& Form submit_cji5
text
--> p1 text
<-- p2 text
FORM submit_cji5 .
CALL FUNCTION 'SUBST_START_REPORT_IN_BATCH'
EXPORTING
iv_jobname = 'TEST_JOB'
iv_repname = v_repid
iv_varname = v_variant
iv_authcknam = sy-uname
iv_language = sy-langu
iv_varianttext = 'CO99-OUTPUT'
TABLES
tt_reportparam = i_rsparams
EXCEPTIONS
variant_exist_check_failed = 1
variant_update_failed = 2
variant_update_not_authorized = 3
variant_update_no_report = 4
variant_update_no_variant = 5
variant_update_variant_locked = 6
variant_insert_failed = 7
variant_insert_not_authorized = 8
variant_insert_no_report = 9
variant_insert_variant_exists = 10
variant_insert_variant_locked = 11
variant_write_failed = 12
no_batch_service = 13
no_server_list = 14
batch_scheduling_failed = 15
OTHERS = 16.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM.
Regards,
Srilatha.

Similar Messages

  • How to know the function module for a message type

    hi sd gurus,
    how can i know the function modules used ( based  on message type can i know it?) in inbound idoc processing.
    can anyone  let me know where can i find it out and the related transaction codes
    Thanks&Regards
    Srini

    You can find out the Functionmodule if you know the message type.
    Go to WE20, find the message type for hte relevant partner type by clicking the partner type and then clicking one partner int hat partner type.
    Now on the right hand side, you will get a screen. Based on whether it is your outbound IDOC or ibound, click the relevant parameters, select the message type and double click.
    In the new screen open the Message control tab and fidn out the process code of the IDOC.
    Now go to WE41 if ur IDOC is outbound or WE42 for inbound IDOC.
    Search for the process code which is assigned to the message type in WE20.
    Double click the process code, you will see the relevant function module in the 3rd field.
    Hope thsi helps you
    Pls reward if it helps.

  • HOW CAN I KNOW THE FUNCTION CODE OF CREATE NEW SESSION

    <b>HOW</b> CAN I KNOW THE FUNCTION CODE OF CREATE NEW SESSION?
    THANKS...

    Hi
    Please put a "/n" (to open a new session after killing the current session)
    or "/o" (to open a new session without killing the current session)
    or "/i" (to end the current session) before the below T Codes as per your requirement...
    Try thistoo <b>O0</b>
    <u><b>demo-like programs</b></u>
    RSIMC000
    RSIMC001
    RSIMC002
    RSIMC003
    RSIMCTRX
    RSIMCTST
    Reward all helpfull answers
    Regards
    Pavan

  • Would any one know the function module to view t attchmnts mde in o/b deliv

    Hai ,
    Would any one know the function module to view  attchmnts mde in o/b delivy
    Regards
    Sunil

    you can use the Tables SRRELROLES and IDOCREL
    if it is inbound delivery the use the business object BUS2015(outbound use LIKP)
    first get the ROLEID using the Delivery number as Objectkey(business obecjt BUS2015/LIK) from the SRRELROLES,
    then pass the ROLEID to the table IDOCREL to ROLE_A , get the ROLE_B,
    use this ROLE_B supply to ROLEID of SRRELROLES table(business object as IDOC, )
    get the objkey which is nothing But IDOC.

  • What are the function modules to create a follow on documents for SC

    Could any one please tell me What are the function modules ( like PO , Preq ...)  to create a follow on documents for Shopping Cart?
    Thanks
    Murali

    Murali,
    That depends on what scenario you've got implemented.
    Classic scenario: FM BBP_REQREQ_TRANSFER
    Extended classic: FM BBP_PD_PO_CREATE
    Regards,
    Franz

  • Want to know the function module for Partial Payment F-28 in FI

    Hello all
    i want to know the Funtion Module for the documents in which Partial payment have been made .
    For that i have the customer and invoice number .

    Hi,
    Use the FM FI_TERMS_OF_PAYMENT_PROPOSE for calculating the Payment due date call function     'FI_TERMS_OF_PAYMENT_PROPOSE'
    hope it will help u.
    thanks,
    Neelima.

  • How to know the Function Module of a standard datasource?

    Hi All,
    As per my understanding there will be an underlying Function Module for each SAP BI datasource. But I dont know how to know the name of that  Function Module for a particular datasource.Could anybody pls help me as i am need of this urgently.
    Thanks in advance.
    Regards,
    kp

    Run transaction RSO2 and enter the required datasource whether transaction data, MD attributes or Text then click on display.  In the message pain and the bottom of the gui it will tell you which function module said datasource uses for extraction.
    Cheers
    Craig

  • Function Module which creates goods receipt document

    Dear all:
    Do you know a function module which creates goods receipt document?
    Thanks
    Bac

    Hello, Satyanarayana and Mickael,
    I found the function module.  It is called BAPI_GOODSMVT_CREATE. 
    Thank you for your suggestion.  I think your suggestion works also, so now I have two solutions that I can use.
    Bac

  • Function modules to create leave request?

    Hi experts,
    In my project I need to create a leave request and trigger workflow for approval. Do you know any function modules existed for this purpose? Or shall we need to create workflow and attach it with inserting IT2001 records?
    Thanks a lot.

    Are you going to use standard SAP Portal application for leave or not?
    If yes there are documents available about ESS configuration for the same and you can assign the standard workflow or copy and make the required chnages then assign it in configuration.
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/108c31e7-b6a7-2d10-3692-c1a9f7a5c4dc?QuickLink=index&overridelayout=true
    Regards
    Ajay

  • Function module for creating Transport Request in 4.7

    Hi All,
    Can anyone let me know how to create a Transport request for an object programmatically....
    I am using the function module TRINT_ORDER_CHOICE but that just gives me the transport request number but does not assigns it to the object which I mention in that function module.
    Please let me know the function module which will assign the transport request to the given object....
    I am using SAP 4.7 version
    Thanks,
    Siddarth

    Re: FUnction Module to create development request automatically

  • Log on into the function module with different user name.

    hi,
            i log on into the system with my user id suppose 'mukka' and i have to check the authorization of another user say 'you' using the function module "authority_check_tcode". but here i am getting the problem that when i assigned sy-uname to 'you' and execute the function module it is entering into the function module with 'mukka' user name only.
    sample code:-
                                sy-uname  = p_uname.
        CALL FUNCTION 'AUTHORITY_CHECK_TCODE'  "#EC"
          EXPORTING
            tcode  = v_tcode
          EXCEPTIONS
            ok     = 1
            not_ok = 2.
    when i am changing the sy-uname with p_uname the sy-uname is changed but when i entered into the function module authority_check_tcode in the debugging mode at the below the sy-uname variable is showing  as 'mukka' only. but i need to check the authorizations of user 'you' pls give me solution to my problem.

    Hi,
    Why would you want to check the authorisation of another user and not the one currently logged in?  The idea of authorisations is to check the current user is able to perform a certain activity.  The majority of fields on SYST are constantly updated to have the correct values (partly so you can't fiddel authorisation checks like this
    Maybe if you explain to us what you are trying to do we can offer some other help.
    Gareth.

  • BAPI or Function Module to create the Rebate Agreement

    Hi All,
    I have a requirement where I get the flat file which consists of the header and item level data. Using that I have to create the REBATE AGREEMENT. The transaction code to create the Rebate Agreement is VBO1 (Create Rebate Agreement).
    Is there any BAPI or FUNCTION MODULE available in SAP to create the Rebate Agreement. Please tell me if you know any suitable BAPI or FM.
    Thanks in advance.
    Best Regards,
    Paddu.

    Hi Paddu
    Were you able to find a BAPI or Function Module to create Rebate Agreement. We have a similar requirement where we have to create Rebate Agreements with Conditions.
    If you have found a solution do share it with us.
    Regards
    Salil

  • Function module to create Invoice from the Delivery no ?

    Hi All,
    Is there any way (function module) to create an Invoice from the Delivery no and the Billing Type ? We do not want to go with BDC for transaction VF01.
    Details:
    We want to generate a pro-forma invoice while saving the delivery. We will have 'Special Function' (NAST-NACHA = 8) in the output determination and a routine would be called from there. That routine would contain the code to generate the Invoice. We will have only the 'Delivery no and the Billing Type'  in that routine. So trying to find any function module which can create an Invoice from the Delivery no and the Billing Type.
    Any suggestion / hint  is welcome.
    Thanks,
    Ashok

    Hello Ashok Satapathy ,
                                        The only option  for you is to call the FM "GN_INVOICE_CREATE" .
    There is no special FM availaible to pass only the delivery number at this point.
    You need to retrieve all the delivery information details and need to pass it to the FM "GN_INVOICE_CREATE".
    Thanks,
    Greetson

  • Function modules to create the relationship for Reference Personnel IT0031

    I tried using BDC recording PA30 to create the relationship for reference personnel but it dun seems to work. Anyone knows of any standard function module to create that relationship instead.

    I have tried both and it doesnt work. The behaviour of this reference personnel number is different from the normal object relationships. Does anyone have experience using function module to create reference personnel relationship instead of giving the stand FM to create the records.

  • I need to create RFC function module which creates the IDOC

    Hi-
    Any idea how to create RFC function module which creates the outbound IDOC. If you have any sample code please forward to me.
    Thanks,
    Sony

    My Problem is
    Whenever they create Invoice using T-code's like FV65(Parked Document), automatically should create IDOC's...
    I have used message type FIDCC1 but this message type is usefull only for Posting documents.
    1. Whenever they create parked document, entries will be stored in BKPF(Parked Document-Filed-BKPF-BSTAT = 'V') and Bseg....
    2. I have to read entries from those tables and should create IDOC...
    3. I checked FM's(FI_IDOC_CREATE_FIDCC1, FI_IDOC_PREPARE) but are not useful...
    4. Now I need to write one RFC function module and that FM should create the IDOC's....
    Can anyone please help me out?
    Thanks,
    Sony

Maybe you are looking for