ABAP code for creating a report variant

Hi,
I would like to create parameter on selection screen type SLIS_VARI. I would like that the program will start with pre-defined variant in ALV grid, the same as it is on standard stock report (MB52)...
Can someone tell me how to do this, and where to put the code?
Thanks in advance,
Saso

Hi,
This is the code for variant as parameter and F4 help.
DATA: g_repid LIKE sy-repid,
      g_dynnr LIKE sy-dynnr.
DATA: g_save(1) TYPE c VALUE 'A',
      g_exit(1) TYPE c,
      gx_variant LIKE disvariant,
      g_variant LIKE disvariant.
PARAMETERS: p_vari LIKE disvariant-variant.
INITIALIZATION.
  g_repid = sy-repid.
  g_dynnr = sy-dynnr.
  PERFORM variant_init.
*Get default variant
  gx_variant = g_variant.
  CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
    EXPORTING
      i_save     = g_save
    CHANGING
      cs_variant = gx_variant
    EXCEPTIONS
      not_found  = 2.
  IF sy-subrc = 0.
    p_vari = gx_variant-variant.
  ENDIF.
                  AT SELECTION SCREEN                               *
AT SELECTION-SCREEN.
*--PAI of selection screen
  PERFORM pai_of_selection_screen.
*---F4 option for report variant
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.
  PERFORM f4_for_variant.
                     SUB-ROUTINES                                   *
FORM variant_init.
  CLEAR g_variant.
  g_variant-report = g_repid.
ENDFORM.                    " variant_init
FORM pai_of_selection_screen.
  IF NOT p_vari IS INITIAL.
    MOVE g_variant TO gx_variant.
    MOVE p_vari TO gx_variant-variant.
    CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
      EXPORTING
        i_save     = g_save
      CHANGING
        cs_variant = gx_variant.
    g_variant = gx_variant.
  ELSE.
    PERFORM variant_init.
  ENDIF.
ENDFORM.                    " pai_of_selection_screen
  CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
    EXPORTING
      is_variant = g_variant
      i_save     = g_save
    IMPORTING
      e_exit     = g_exit
      es_variant = gx_variant
    EXCEPTIONS
      not_found  = 2.
  IF sy-subrc = 2.
    MESSAGE ID sy-msgid TYPE 'S'      NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ELSE.
    IF g_exit = space.
      p_vari = gx_variant-variant.
    ENDIF.
  ENDIF.
AND pass this gx_variant to ALV Function module.
Rewards points if helpful.
Regards,
Srinivas ch

Similar Messages

  • How To Create ABAP Code For HR Context Sensitive Structural Authorization

    Hello,
    We have created a HR Custom Program which IS NOT built off the PCH or PNP Logical Database. As a result, we need to manually create ABAP code for HR Context Sensitive Structural Authorization Check in our custom HR program. Via HR Context Sensitive Structural Authorizations, we are restricting access to personnel numbers and the underlying HRP* tables.
    Any assistance would be greatly appreciated with the identification of the SAP standard function modules (Ex. RH_STRU_AUTHORITY_CHECK, HR_CHECK_AUTHORITY_INFTY, HR_CHECK_AUTHORITY_INFTY , etc) used in HR Context Sensitive Structural Authorization Check, how they are used to control HR Structural authorization (P_ORGINCON), and some sample code.
    Thank you in advance for all your assistance,
    Ken Bowers

    Hello Ken
    You can use the interface methods IF_EX_HRPAD00AUTH_CHECK to get the same structural authorization as you can see in PA20/PA30. You need to use the methods set_org_assignment and check_authorization for this purpose. For more information you can refer to include FP50PE21 from line 237 onwards till 270.
    Regards
    Ranganath

  • ABAP  Code for SAP exit varaibles?

    Hi,
    i) Where can I find the abap code for SAP exit variables
    OP_KEYDT used for the net due date
    OP_KEYD2 used for the posting date
    OP_KEYD3 used for the clearing date, which are used in FI AR aging report(0FIAR_C03).
    Based on the Net Due Date, which is key date(0NETDUEDATE), entered by the user at runtime, the posting date and celaring date are populated.
    II) The problem is we want to simulate a similar scenario, but with key date, which user enters is based on the custom Net Due Date(ZNETDUEDATE).And this date is populated to posting date and clearing date variables.
    How do we acheive that.
    Thanks.

    Hi Kumar,
    Try this below mentioned example where default date is current date.
    Step1: Create a variable(ex: cur_date) on requrired characteristic with Processing type "Customer Eixt" and check the check box for ready for input(if this variable need in selection screen).
    Step 2: Goto T Code : CMOD and provide appropriate Project and choose components and click on display.
    Step3: Double click on exit "EXIT_SAPLRRS0_001" you can see include "ZXRSRU01", double click on include.
    Step4: Sample code to populate.
    WHEN 'CUR_DATE'.
    Data : l_p_range_SSS TYPE rrrangesid.
    IF I_STEP = 1.
    l_p_range_SSS-Low = sy-datum.
    l_p_range_SSS-Sign = 'I'.
    l_p_range_SSS-Opt = 'EQ'.
    APPEND l_p_range_SSS TO e_t_range.
    Endif.
    The following values are valid for I_STEP:
    · I_STEP = 1
    Call up takes place directly before variable entry
    · I_STEP = 2
    Call up takes place directly after variable entry. This step is only started up when the same variable could not be filled at I_STEP=1.
    · I_STEP = 3
    In this call up, you can check the values of the variables. Triggering an exception (RAISE) causes the variable screen to appear once more. Afterwards, I_STEP=2 is also called up again.
    · I_STEP = 0
    The enhancement is not called from the variable screen. The call up can come from the authorization check or from the Monitor.
    Also, refer this link..
    http://help.sap.com/saphelp_bw320/helpdata/en/1d/ca10d858c2e949ba4a152c44f8128a/content.htm
    Cheers,
    Allen

  • Transaction code for SAP query reports

    Hi All,
    I am trying to create transaction code for sap query report but couldn't go further.
    1) Created User group in SQ03
    2) Created infoset in SQ03 and assigned that to the user group
    3) Created query in SQ01 using the infoset.
    I executed the report in SQ01 and it is working fine.
    Now I try to create a transaction code in SE93 using the steps mentioned in the following link:
    Assign transaction code to SAP Query (created via SQ01)
    But when try to execute the report using the transaction code, it is giving error message 'User group xxxxxx is not yet created'
    Could any one advice me if I miss something? Or please help me to create this transaction code and transport to production?
    Thanks in advance

    HI,
    based on the thread you've already mentioned:
    In SE93, Create a Paramter Transaction
    -> Transaction = Start_report
    -> In default values, give the below details:
    D_SREPOVARI-REPORTTYPE = AQ
    D_SREPOVARI-EXTDREPORT = Name of the Query
    D_SREPOVARI-REPORT = User Group
    So check if the user group is typed correct in SE93 and check also if the user group exits in the system where you are trying to run the transaction.
    best regards, Christian

  • Need ABAP code for the below Services requirement

    Hi,
    We have a requirement to show all the services for a particular Purchase order number.For this I built a view on 2 tables ESLL and EKPO.Now based on the below logic I need to bring the services for the Purchase order..
    1.Enter PO number,item no. and Doc category in EKPO and find the Pack no.
    2.Now take the Pack no. of EKPO and give in ESLL and find the Sub pack no.
    3.Now take this Subpack no. and Give this sub pack as Pack no. in ESLL
    4.This will be the Service entry record for that PO number.
    Can any one Please suggest me to how to write the ABAP code for the above logic.
    Thanks & Regards,
    Dinakar

    Hi Dinaker,
    Did you find any solution for this issue. I too have a similar requirement of pulling all the service orders for a specific Purchase Order in the BW report.
    Thanks,
    SAPBWI

  • GRR2- 4FM-RepPaint(put ABAP code for convert data in field)

    Hi,
    If somebody know how possible add ABAP code for convert data in some column-field of report (by RepWriter,UserExit,BADI)?
    Thanks a lot.

    Elaborate your question. Not clear ??

  • How to get Transaction code for SAP standard report painter in FI

    Hi All -
       Please let me know, How to get the transaction code for Standard SAP report painter / report writer in FI module.
    These report painters are created thru GR51...
    Thanks,
    Kannan

    Please refer to [Creating Transaction Code For Report Painter Reports|http://www.google.com/url?sa=t&source=web&ct=res&cd=1&ved=0CAgQFjAA&url=http%3A%2F%2Fdap-consulting.com%2Fyahoo_site_admin%2Fassets%2Fdocs%2FReport_Painter_Reports.47142031.pdf&ei=MiWYS5ilCYeOlAfn4pCGDQ&usg=AFQjCNEZ0YO6vJ97K24MbU_NI5ROTb5vJA&sig2=Ke-svnqddqrz8RMcTuEnaw].

  • ABAP Code for BI objects

    Hi Friends,
    I have created BI objects like infocubes, infoobjects, DTP, Datasource to transfer data from a flat file to BI system using SAP GUI... All data from flat file are transfered to BI successfully... i dont have any knowledge in ABAP... So i need to see the ABAP code for the BI objects i created above in my project... how can i see the coding for that?
    thanks in advance
    sasi

    Hi Sasi,
    All the objects which you create in BI will be stored in some standad tables,it only fetch details accordingly from those tables.For MasterData you can find the option as Display Routines in Extras.If you want to get more infomation about the STD Table and the Program involed in BI objects,just enter in (/h) mode.
    Regards,
    Prem

  • ABAP Functions for creating vendor

    Hello,
    I would like to create a program for creating vendor automatically by uploading a text file, where the text file contain the vendor information.
    Can I ask are there any ABAP function for creating vendor? I have searched a function BAPI_VENDOR_CREATE, but I don't know how to use it.
    Can anyone give me some ideas?
    Many thanks
    Sunny

    Hi,
    BAPI_VENDOR_CREATE is a online BAPI which calls the XK01 screen internally. There wont be any import or export parameters for this BAPI. If you have to upload from a text file, you can try with either of the options
    1) Use the standard program RFBIKR00 to upload the vendor from the flat file. check the documentation of the report for details
    2) Create a BDC recording on XK01 and upload the vendor from the flat file
    Vikranth

  • Abap code for sap exit variables?

    Hi,
    i) Where can I find the abap code for SAP exit variables
    OP_KEYDT used for the net due date
    OP_KEYD2 used for the posting date
    OP_KEYD3 used for the clearing date, which are used in FI AR aging report(0FIAR_C03).
    Based on the Net Due Date, which  is key date(0NETDUEDATE),  entered by the user at runtime, the posting date and celaring date are populated.
    II) The problem is we want to simulate a similar scenario, but with key date, which user enters is based on the custom  Net Due Date(ZNETDUEDATE).And this date is populated to posting date and  clearing date variables.
    How do we acheive that.
    Thanks.

    Please tell how u solved ur issue i have the same scenario to be do.

  • ABAP code for Date Range

    Hi All,
    I have requirement to write code for date range.
    Characterstic = Run-Out Date, it was created reference to 0Date.
    Requirement is data should load depends on Run-Out Date 7 days old and 14 days future.
    Logic is -7 days old >= Run_out date <= 14 days future.
    please let me know how I need to proceed with ABAP code for this requirement.
    Thanks.
    Please do not ask for ABAP code here. Its not a training forum
    Edited by: Pravender on Aug 18, 2011 1:46 AM

    >
    Sree vignesh wrote:
    > Hi,
    > In the select option we have a field month range as
    > SELECT-OPTION : FROM 01.2007       TO  01.2009 " Let say Ur Selection option is SO_MONTH
    > but now i need to add the DMBTR field considering the month range in the SELECT OPTION i.e., only FROM 01.2007 TO  01.2009 i mean without 2006 data.
    >
    > LOOP AT LT_DATA WHERE month in SO_MONTH. " Here add a Where condition
    >     ls_output-matnr = lt_data-belnr.
    >     ls_output-werks = lt_data-bukrs.
    >     ls_output-lgort = lt_data-dmbtr.   
    >
    >     COLLECT  ls_output INTO lt_output .
    >
    >   ENDLOOP.
    >
    > please help with code .
    >
    > thanks in advance.
    Regards,
    Suneel G

  • How to write abap code to create manual hierarchy

    Hi,
    This is urgent got to write abap code to create manual hierarchy.
    Thanks

    Hi Adam
    Thanks for replying.
    In my scenario i have one custom zinfoobject which have lots of attributes.
    So, i have to create hierarchy for this zinfoobject with three nodes. one node/charateristic is present in this zinfoobject as attribute. which will be the first node of hierarchy.
    Then second custom infoobject is external not present in attribute list. which will be the second node of hierarchy.
    Third node will be for which i am creating hierarchy.
    So basically need solution for this first.
    some one will load hierarchy info in some table and then will create view on top of that then i have to create datasource on top of that and write a program to load the data from that view in this hierarchy.
    Need solution for this abap program also.
    Thanks
    SAPBW

  • Launch HTML Editor for creating webi reports - Java sdk

    Is there a way to launch HTML editor directly for creating webi reports..I know we can set the preference for HTML report panel in infoview...but thats not the requirement. I have to launch the HTML or Java report panel editor according to the User selection on the fly....its a customized java code for webi reports.
    Any help on this is appreciated!
    Thanks
    Chenthil

    Guys will this link work to launch the HTML editor....
    desktoplaunch/querywizard/jsp/entry.jsp?skin=skin_standard&docname=&docid=&isNew=true&isModified=&doctoken=we00010000b5d263b7d0a6&repotype=&unvname=&unvid=UnivCUID%3DAZu2kpoiudVOk35pUtr6.qQ%3BUnivName%3DKalvin&unvrepoid=&mode=C&decsep=.&unit=in&lang=en&doctype=wid&viewType=H&isModify=yes

  • Needs sample ABAP code for field routine

    Dear Expert,
    There is a field "Pay Scale Group" in my DSO which stores the data in the format
    AA1/B1/CCC2/DD2/EEE1, A1/BB2/CC2/DDD3/EE2 etc. These data has to be transferred to
    InfoCube where "pay Scale Group" in the InfoCube will store the data like EEE1,EE2 etc.
    I need to write a field routine on the transformation between DSO and Cube.
    Can any one please help me with the sample ABAP code for this scenario.
    Some more examples for better understanding of the requirement:-
    Data in DSO(Source)            Data in Cube(Target)
    ===================            ===================
    AA1/B1/CCC2/DD2/EEE1            EEE1
    AAA1/BB2/CC1/DDD3/EE2           EE2
    A2/BBB2/CC2/DDD3/EEE5           EEE5
    AA2/BB1/C1/DDD3/EE3             EE3
    A3/B1/CC2/DDD1/EE4              EE4
    Many thanks in advance.
    Regards,
    Prakash
    Please do not dump your code requirements in SDN
    Edited by: Pravender on May 18, 2011 11:37 AM

    Hi,
    You can use the following code :
    Suppose the technical name of the field coming from DSO is ZPAY_SGRP.
    And also for example let me take one record, that is ZPAY_SGRP = AA1/B1/CCC2/DD2/EEE1 .
    My assumption is that there will always be 4 '/'.
    In the field routine write the below code
    data: V1(5) type c,
              V2(5) type c,
             V3(5) type c,
              V4(5) type c,
             V5(5) type c.
    data : VAR1 TYPE /BIC/OIZPAY_SGRP.
    split VAR 1  at '/' into V1 V2 V3 V4 V5.
    result = V5.
    V5 will be having the characters after the last '/' .That is V5 = EEE1.
    Hope the above reply was helpful.
    Kind Regards,
    Ashutosh Singh
    Edited by: Ashutosh Singh on May 17, 2011 3:53 PM
    Edited by: Ashutosh Singh on May 17, 2011 4:17 PM

  • ABAP code for BI 7.0 transformations start routine

    Hi all,
    I am trying to update data from DSO1 (Source1: transaction data) to Infocube(TARGET)
    In the transformations Start routine, I have to read DSO2(Source2: Master data) for some fields.
    DSO1 has CUSTOMER as part of key
    DSO2 has CUSTOMER (key) and other fields....FIELD1, FILED2, FIELD3
    Infocube to be updated with FIELDS1,2 & 3 WHILE READING DSO2.
    WHERE DSO1 CUSTOMER matches with DSO2 CUSTOMER.
    Also, data NOT TO BE UPLOADED into Infocube if FIELD1 in DSO2= NULL
    Please give me the abap code for the above logic.
    Appreciate any help in this regard.
    Thanks.

    This is a doc from this site:
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/6090a621-c170-2910-c1ab-d9203321ee19
    Ravi Thothadri

Maybe you are looking for

  • Oracle EDI - Bank Statement Interface, Payment file to Bank and AR Auto Lockbox

    Hello, There is a need from the client to do setups for EDI - this is needed for Bank Statement Import from the Bank, sending Bank Payment file and also getting the Lockbox details. How is this done? What are the steps? What are the setup steps? Than

  • How can I change the size of table control in table maintenance re-gen?

    Hello Experts, I hv created a maintenance view and after generated table maintenance view for it. now it adjusts the size of table control in table maintenance generation. I want to change the size (width) of table control and again re-generate the t

  • Quicktime 7 Installation Error

    I currently have an older version of quicktime installed(6.5.1). Everytime I try to update it to the new version (7.1.0.210) the installation fails because of Error Number 0X80040707, Description DLL function call crashed: QTInstallCode.QuickTimePost

  • Sap wm RF id configuration.barcoding .

    hi gurus, anybody explain how to configure the RF ID in the sap system by step by step. thanks inadvance,

  • Update enrolled table which has 6 composite primary key

    Hi Everyone, I am trying to update a grade column in table called enrolled which has 6 composite primary key column including SID, TERMYEAR, FACCODE, DEPCODE, COURSENO, SECNO and 2 extra column including GRADE, IDD all of them are of type VARCHAR2 as