Create variants through ABAP

Hi,
Can an SAP ABAP program be built to create variants for other ABAP programs?
This is required as we have a regular interface inbound job which will
provide information on the values of the fields that need to be input
into the program. This program will then be scheduled to run periodically
using this new variant.
Thanks!

Hello Gordon,
When you execute your abap program on the first selection screen you have an option from the menu bar to save that layout as a variant .
That is: from GOTO->VARIANTS ->SAVE AS VARIANTS..
Hope it helps you.
Thanks Mansi

Similar Messages

  • Creating varient through ABAP

    Hello,
    I am giving selection screen to users & after giving input screen values, I want to create a varient out of that input using ABAP.
    How to create the varient this way?
    Krutika

    Hi,
    In ALV you can create variant like:
    DATA : s_variant TYPE disvariant.
    PARAMETER  : s_var TYPE disvariant-variant.
    INITIALIZATION.
      s_variant-report = sy-repid.
      CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
        EXPORTING
          i_save        = 'A'
        CHANGING
          cs_variant    = s_variant
        EXCEPTIONS
          wrong_input   = 1
          not_found     = 2
          program_error = 3
          OTHERS        = 4.
      IF sy-subrc = 0.              " IF DEFAULT VARIANT FOUND
        s_var = s_variant-variant.  " PASS THE DEFAULT VARIANT RECEIVED TO THE SELECTION SCREEN FIELD
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_var.
      CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
        EXPORTING
          is_variant                = s_variant
    *   I_TABNAME_HEADER          =
    *   I_TABNAME_ITEM            =
    *   IT_DEFAULT_FIELDCAT       =
         i_save                    = 'A'
    *   I_DISPLAY_VIA_GRID        = ' '
       IMPORTING
    *   E_EXIT                    =
         es_variant                = s_variant
       EXCEPTIONS
         not_found                 = 1
         program_error             = 2
         OTHERS                    = 3.
    *********TO GET THE SELECTED VARIANT FROM THE LIST IN THE SELECTION FIELD********************            .
      IF sy-subrc = 0.
        s_var = s_variant-variant.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    AT SELECTION-SCREEN.
      s_variant-variant = s_var.
      CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
        EXPORTING
          i_save        = 'A'
        CHANGING
          cs_variant    = s_variant
        EXCEPTIONS
          wrong_input   = 1
          not_found     = 2
          program_error = 3
          OTHERS        = 4.
      IF sy-subrc <> 0.
        MESSAGE w000(zgg_msg).
        CLEAR s_variant.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    Hope it helps
    Regards
    Mansi

  • Create Variant through Function

    How to create variant by using function module .
    what will be the requirement for this .
    If any program then please forward.
    Thanks in advance

    When you are running a program and want to save the parameter values as variants you can do that using the funcitons.
    Look at the RSVARIANT. There will be about 3-4 functions whihc you can use.
    Regards,
    Ravi
    Note - Please mark all the helpful answers

  • How to create Spool through ABAP program

    How to create spool request for Smartforms through program. So I can go in TCODE SP01 and see the output of my smartforms.

    Include the below code in ur program .......
      DATA: PRINT_PARAMETERS TYPE PRI_PARAMS,
            VALID_FLAG       TYPE C LENGTH 1.
      CALL FUNCTION 'GET_PRINT_PARAMETERS'
      EXPORTING
      IMMEDIATELY = 'X' "C_IMMEDIATELY
    *LAYOUT = 'Z_48_144'
    *LINE_COUNT = '48'
      LINE_SIZE = '255'
    *NEW_LIST_ID = C_NEW_LIST_ID
      NO_DIALOG = 'X'
      RELEASE = 'X'
      IMPORTING
      OUT_PARAMETERS = PRINT_PARAMETERS
      VALID = VALID_FLAG
      EXCEPTIONS
      ARCHIVE_INFO_NOT_FOUND = 1
      INVALID_PRINT_PARAMS = 2
      INVALID_ARCHIVE_PARAMS = 3
      OTHERS = 4 .
      G_PDEST = PRINT_PARAMETERS-PDEST.
      NEW-PAGE PRINT ON PARAMETERS PRINT_PARAMETERS
                        NO DIALOG.
    List of write statements to be output.......
    NEW-PAGE PRINT OFF.
    Reward if useful..............

  • Create Attachment in workflow through ABAP Class in ECC 5.0

    Hi,
    Wr are using SAP ECC 5.0 and i am trying to create attachment through ABAP class.
    Here in ECC 5.0, macro INCLUDE cntn01_swc is not available.
    I am getting an error in declaration of SOFM object, because again SWC0_OBJECT is not available.
    I've tried creating the parameter as type SOFM and of type table of SOFM but it also not working.
    Can anybody help me how i can create SOFM instance in ABAP class in ECC 5.0?
    Regards,
    Smit

    Hi
    I am not very much sure about ECC 5.0 environment. Firstly are you looking to create a SOFM object inside any class or program or Function module , If yes then you need to include a include INCLUDE CNTN01_SWC (No arrow brackets) if this include is not available then use INCLUDE<CNTN01>  then declare a variable of type SWC0_OBJECT if you are using first include or declare of type SWC_OBJECT.
    Once you include any of the includes then by making use of SWC macros you can create a object
    SWC0_CREATE_OBJECT <VARAIBLE> <BOR NAME> <BORKEY> for first include.
    SWC_CREATE_OBJECT <VARAIBLE> <BOR NAME> <BORKEY> for second include.
    Regards
    Pavan

  • Creation of IDOC through abap program.

    hello all,
    I hav created idoc through abap program. I hav used FM 'Master_idoc _distrribute'.this program creates an idoc but giving status 30. can any one tell me how to get status 03. I hav already created port, Logical sys,partner no.,distribution model.
    My Program is as follows:
    ABLES : CRMD_ORDERADM_I,CRMD_ORDERADM_H,CRMD_SCHEDLIN.
    DATA : S_CTRL_REC LIKE EDIDC OCCURS 0 WITH HEADER LINE,"Idoc Control Record
           ORDER_NO TYPE CRMT_OBJECT_ID VALUE '5000000032'," SEGMENT ORDER DATA
           PRODUCT TYPE CRMT_ORDERED_PROD VALUE 'SRV_01',
           QUANTITY TYPE CRMT_SCHEDLIN_QUAN VALUE '1.000'.
    DATA : ZORDER LIKE ZORDER_NUM OCCURS 0 WITH HEADER LINE.
    DATA :  T_EDIDD LIKE EDIDD OCCURS 0 WITH HEADER LINE.     "Data Records
    DATA :  T_COMM_IDOC LIKE EDIDC OCCURS 0 WITH HEADER LINE. "Generated Communication IDOc
    CONSTANTS :
    C_ZRZSEG1 LIKE EDIDD-SEGNAM VALUE 'ZORDER_NUM'.
    PARAMETERS :  C_MESTYP LIKE EDIDC-MESTYP DEFAULT 'ZORDER_IDOC2', "Message Type
                  C_RCVPRT LIKE EDIDC-RCVPRT DEFAULT 'LS',          "Partner type of receiver
                  C_LOGSYS LIKE EDIDC-RCVPRN DEFAULT 'BSNL_OUT',
                  C_RCVPOR LIKE EDIDC-RCVPOR DEFAULT 'A000000006',
                  C_SNDPOR LIKE EDIDC-SNDPOR DEFAULT 'SAPBCD0000',
                  C_SNDPRN LIKE EDIDC-SNDPRN DEFAULT 'BCDCLNT100',
                  C_IDOCTP LIKE EDIDC-IDOCTP DEFAULT 'ZORDER2',
                  C_SNDPRT LIKE EDIDC-SNDPRT DEFAULT 'LS'.          "Destination System
    ***START-OF-SELECTION
    START-OF-SELECTION.
      PERFORM GENERATE_CONTROL_RECORD.
      PERFORM SEND_IDOC.
    *&      Form  generate_control_record
    FORM GENERATE_CONTROL_RECORD .
      S_CTRL_REC-RCVPOR = C_RCVPOR. "Receiver Port
      S_CTRL_REC-MESTYP = C_MESTYP. "Message type
      S_CTRL_REC-IDOCTP = C_IDOCTP. "Basic IDOC type
      S_CTRL_REC-RCVPRT = C_RCVPRT. "Partner type of receiver
      S_CTRL_REC-SNDPOR = C_SNDPOR. "SENDER PORT
      S_CTRL_REC-RCVPRN = C_LOGSYS. "Partner number of receiver
      S_CTRL_REC-SNDPRT = C_SNDPRT. "Sender Partner type
      S_CTRL_REC-SNDPRN = C_SNDPRN. "Sender Partner Number
    APPEND S_CTRL_REC.
    ENDFORM.                    " generate_control_record
    *&      Form  send_idoc
    FORM SEND_IDOC.
    ZORDER-ORDER_NO = ORDER_NO.
    ZORDER-PRODUCT = PRODUCT.
    ZORDER-QUANTITY = QUANTITY.
    APPEND ZORDER.
    T_EDIDD-SEGNAM = C_ZRZSEG1.
    T_EDIDD-SDATA = ZORDER.
    APPEND T_EDIDD.
      CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'
        EXPORTING
          MASTER_IDOC_CONTROL            = S_CTRL_REC
        TABLES
          COMMUNICATION_IDOC_CONTROL     = T_COMM_IDOC
          MASTER_IDOC_DATA               = T_EDIDD
        EXCEPTIONS
          ERROR_IN_IDOC_CONTROL          = 1
          ERROR_WRITING_IDOC_STATUS      = 2
          ERROR_IN_IDOC_DATA             = 3
          SENDING_LOGICAL_SYSTEM_UNKNOWN = 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.
      ELSE.
        COMMIT WORK.
        LOOP AT T_COMM_IDOC.
          WRITE:/ 'IDoc Generated - ', T_COMM_IDOC-DOCNUM.
        ENDLOOP.
      ENDIF.
    ENDFORM.                    " send_idoc
    I hav created segment , basic type,message typealso and release also .I also linked them.
    Plz help me.
    Hemlata

    Hi Hemalatha,
    Just call this Progream RSEOUT00 from your Zprogram and pass the basic parameters like IDOC number, Basic type,Partner number etc.
    You can check the parameters by executing the Program RSEOUT00.
    This Program will change the status of your IDOC 30 to 03.
    Thanks.
    Note:Reward Points if you find useful.

  • Can we create a Calender through abap in hr module

    Dear Freinds
                could any body let me know can we create a Calender  through abap .
    my requirement is user is asking me to create a calnder .....and give me him a tcode..........when we click on the calnder for him a rport should be displayed ........
    as he would like to place an object on each particular day........once he lick on that
    day and futher clicks on that object he should get details of the object.
    Please let me know..........as this little bit urgent.
    regards
    vams

    Dear Freinds
                could any body let me know can we create a Calender  through abap .
    my requirement is user is asking me to create a calnder .....and give me him a tcode..........when we click on the calnder for him a rport should be displayed ........
    as he would like to place an object on each particular day........once he lick on that
    day and futher clicks on that object he should get details of the object.
    Please let me know..........as this little bit urgent.
    regards
    vams

  • Unable to created users through UME on portal with AS ABAP as its data sorc

    Hi,
    Unable to created users through UME on portal with AS ABAP as its data source.
    I have assigned SAP_BC_JSF_COMMUNICATION to the user SAPJSF but this only helps in editing the already existing users but not in creating new users on portal.
    I have checked that that the role SAP_BC_JSF_COMMUNICATION is properly generated and has *  in all authorizations. I have even assigned SAP_ALL and SAP_NEW to SAPJSF and another ID.
    DO we need to make any config changes to make the database writable from portal. Please advise.
    Thanks,

    Hi,
    If your system is a AS ABAP + +JAVA System,, you have to do the following
    1. Login to Client 001 using SAP GUI
    2. Create a user id
    3. Login to portal and you will be able to see the user.
    4.Assign him the portal rights
    If you want the portal to use seperate Database for USers, there is a setting in Visual admin, that you can change for the same, but i dont remember that

  • How to Create selection variant in ABAP

    Hi all,
    i want to create variant selection in get data of the variant on my ALV Grid.
    See on the screenshot my problem :
    http://www.casimages.com/img.php?i=101006040413882278.jpg
    Thank you very much for your answers.

    i Want to make new functionnality of my program which permit user to Save a selection variant with the result of the alv (Mark row)
    It is a new variant and this variant is use for the same program.
    In fact this functionnality permit to the user to make a variant selection with a selection of article without knowing the reference of article.
    Thank you very much.

  • How to create variant for table/view ?

    Hi,
    When I go through SM30, I find a radio button called variant. I don't know the effect.
    Can anyone tell me how to create variant for table / view ?
    I want to know when we need to create variant for table/view.
    Best regards,
    Chris Gu

    hi ,
    Whenever you start a program in which selection screens are defined, the system displays a set of input fields for database-specific and program-specific selections. To select a certain set of data, you enter an appropriate range of values.
    For further information about selection screens, refer to Selection Screens in the ABAP User's Guide.
    If you often run the same program with the same set of selections (for example, to create a monthly statistical report), you can save the values in a selection set called a variant
    Procedure
    To create a new variant:
           1.      On the ABAP Editor initial screen, enter the name of the program for which you want to create a variant, select Variants, and choose Change.
           2.      On the variant maintenance initial screen, enter the name of the variant to be created.
    Note the naming convention for variants (see below).
           3.      Choose Create.
    If the program has more than one selection screen, a dialog box for screen assignment appears. The dialog box does not appear if the program only has one selection screen. The selection screen appears in this case.
           4.      If there is more than one selection screen, select the screens for which you want to create the variant
    5.      Choose Continue.
    The (first) selection screen for the report appears.
    If your program has more than one selection screen, use the scroll buttons in the left-hand corner of the application toolbar to navigate between them and to fill the fields with values. If you keep scrolling forwards, the Continue button appears on the last selection screen.
           6.      Enter the desired selection values, including multiple selection and dynamic selection.
           7.      Choose Continue.

  • BAPI for creating variant table

    Hi,
    Cu61 and Cu60 are two transactions in SAP (comes under Variant Configuration) to create a variant table and fill its contents respectively.
         Now, I am trying to create a transaction in SAP such that on the screen it takes the name of the variant table to be created and an excel file as input from the user and thus create a variant table and fill its contents in the background. Now, ofcourse I have to do this through ABAP coding. I know how to upload the excel file into the internal table but I am not able to figure out that how should i create the variant table and transfer the contents of that internal table to the variant table? That is, how should i transfer the contents to the variant table?
    I have been able to find out the tables involved in the process viz, CUVTAB, CUVTAB_FLD, CUVTAB_VALC.
    Does there exist any BAPI for doing the same?
    Please Help.

    Hi Reema,
       Thanks for replying but this is not what I am looking for. I do not want to create a cluster table rather I want to create a variant table (it is a table used in variant configuration to store the combinations of a material whose characteristics can take varying values at the time of configuration). A table that we create through the transaction Cu61 and populate its contents through the transaction Cu60.
    However, I still tried your suggestion but it did not result in what I want.
    My problem still exists.

  • Short Dump While selecting Variant for ABAP query

    Hi,
    ABAP query is going to short dump (CONNE_IMPORT_WRONG_COMP_LENG) while selecting a Variant. If i create and use variant then i am able to see Output of Variant.But not able to use Earlier created variants .
    I think some mismatch between variant values and selection screen fields.Can anyone tell me how to rectify this ?
    I am not able to debug the code as dump is coming in a System program(RSDBSPVD).Can anyone tell me which database table i can use to get values of the Variant.
    Thanks in Advance.
    Nirmala K

    Hi nirmala,
    chk the links:
    http://help.sap.com/saphelp_webas620/helpdata/en/c0/980398e58611d194cc00a0c94260a5/content.htm
    http://help.sap.com/saphelp_webas620/helpdata/en/c0/9803a7e58611d194cc00a0c94260a5/content.htm
    regards,
    keerthi.

  • Steps to  create variant configuation dependencies code

    Hello Guru's,
    steps to create variant configuration dependency using code?.  will anyone guide me.

    Check the below links.
    Variant Configuration (LO-VC)
    [http://help.sap.com/printdocu/core/Print46c/en/data/pdf/LOVC/LOVC.pdf|http://help.sap.com/printdocu/core/Print46c/en/data/pdf/LOVC/LOVC.pdf]
    Variant Configuration for an Order BOM
    [http://help.sap.com/saphelp_ides/helpdata/en/0a/857463c87611d1a7760000e8a5f6c8/content.htm|http://help.sap.com/saphelp_ides/helpdata/en/0a/857463c87611d1a7760000e8a5f6c8/content.htm]
    [www.sapmmforum.blogspot.com/2007/10/variant-configuration-for-order-bom.html |www.sapmmforum.blogspot.com/2007/10/variant-configuration-for-order-bom.html ]
    Steps for SD Variant Configuration
    [www.sap-img.com/sap-sd/steps-for-sd-variant-configuration.htm|www.sap-img.com/sap-sd/steps-for-sd-variant-configuration.htm]
    Steps for Variant Configuration & Pricing
    [www.sap-basis-abap.com/sd/steps-for-variant-configuration-and-pricing.htm|www.sap-basis-abap.com/sd/steps-for-variant-configuration-and-pricing.htm]
    [www.sapsdforum.blogspot.com/2007/10/steps-for-variant-configuration-and.html |www.sapsdforum.blogspot.com/2007/10/steps-for-variant-configuration-and.html ]
    Hope this helps. Reward points if helpful.
    Thanks,
    Balaji

  • Problem in creating IR through BAPI_INCOMINGINVOICE_create BAPI

    Hi,
    Some problem in creating IR through the BAPI BAPI_INCOMINGINVOICE_create. I am able to see the IR number after executing the BAPI but unable to see the IR number in the table. The IR number is not getting updated in the database table even though we are doing the commit work after executing the BAPI. Could anyone help me out with this error.
    Regards,
    Ram

    First of all I am assuming that you did not get any error in the BAPI return structure (even though you see document number populated).
    Secondly,  I guess you tested the BAPI with SE37 and did not get any error (functionally there are a number of BAPIs available to post an invoice and it is important to figure out the correct BAPI - e.g. PO, non-PO invoice, invoice as a GL entry only, etc.).
    If that is not true (there is some error in posting), since during the BAPI call the next document number is obtained as a first step, you will see the document number but subsequently if for some reason it is not posted, you will see the result as you mentioned (no data in the database).
    If you are using correct BAPI and have no errors, then  in ABAP program make sure to call 'BAPI_TRANSACTION_COMMIT' after the BAPI call to post invoice.
    For non-SAP external system, you need not have to call the commit BAPI but just closing the connection to SAP will help.

  • What is variant in ABAP Program Process Block in Process Chain?

    I wrote an ABAP program:
    REPORT ZTEST,
    PARAMETERS:  PROC(80) TYPE C.
    I can test this PORGRAM from SE38, it shows me a pop-up screen for PROC and I can enter a value and execute.
    Now I want to call this  program ZTEST from a process chain. In Process Chain Selected a Process u201CABAP Programu201D. It asks me program name and Program variant, I entered Program Name as ZTEST and
    Program variant as a character string HELLO.
    When I execute Porcess Chain, ABAP Program errors saying that variant HELLO not found.
    What is Program variant in ABAP Program Process in Process Chain?
    Thanks,

    Dont get confused here.
    Variant name is not which you are pasing to the program.
    You enter some values inside the variant and you specify the program to take the input from the variant.
    Suppose you have to pass 10 parameters to a program.
    user1 creates a variant " hello1" which contains his own selection for the 10 values
    user2 creates another variant "hello2" which contain his own set of selecion values.
    When we use this program in PC, you can use the variant user1 or user2 as per our requirement.
    please check if you are giving variant as input or the proc value.
    Hope this helps,
    Sri....

Maybe you are looking for

  • Consolidating Music Files into Itunes - File Name Invalid/Too Long!

    When trying to consolidate music files into my library, I get an error message stating "Failed, The file name was invalid or too long." ???? I have tons of songs and don't know which file name is invalid or too long???

  • How to handle multiple key press in numeric keys

    I have used the code from eta . Code is somethg like tis lastKeyPress = System.currentTimeMillis(); protected void keyPressed(int keyCode){           boolean keyRepeated = false;           if(System.currentTimeMillis() - lastKeyPress < 1000 &&      l

  • How do you save edits to bookmarks in Adobe 10?

    After editing the bookmarks in a PDF file when the file is saved it appears that the bookmarks revert back to the original text.  Is there a specific way to save these bookmark changes?  Do you need to perform a Save As to capture the bookmark change

  • 9320 battery doesn't charge properly

    I have a .month and a half old 9320 and the Battery doesn't charge properly and is clearly alto. How do I et a replacement sent out?

  • Is Posting/Subscribing Podcasts any Easier (College Sports)

    Tried to post some Podcasts of our college (Quinnipiac) sports broadcasts for students and families to subscribe and listen this summer and gave up as it was a nightmare. We have all our sports audio and video posted to our server: http://athleticsme