Calling custom dialog screen from Standard Transaction(user Exit)

Hi, I'm calling Standard Transaction from a Custom Screen. I'm calling a custom screen again with in standard transaction (implemented custom screen thru user exits using macros). But when I click 'continue/cancel' in the custom screen, control is going back to main cutom screen rather go back to standard transaction. Could anyone please help me out how to come back to standard transaction from custom screen rather going back to main cutom screen.
***INCLUDE LZ_R_FORWARD_FORWARD_LOADI01 .
*&      Module  USER_COMMAND_9000  INPUT
MODULE user_command_9000 INPUT.
  CASE sy-ucomm.
    WHEN 'EXEC'.
      PERFORM validate_popup_data.
      IF flag_error_screen NE 'X'.
        MOVE-CORRESPONDING ZFFL_POPUP to var_ZFFL_POPUP.
        clear flag_return.
        SET SCREEN 0.
        LEAVE SCREEN.
      ENDIF.
    WHEN 'CANC'.
      flag_return = 'X'.
      SET SCREEN 0.
      LEAVE SCREEN.
    WHEN OTHERS.
  ENDCASE.
ENDMODULE.                 " USER_COMMAND_9000  INPUT
*&      Module  exit_9000  INPUT
MODULE exit_9000 INPUT.
  CASE sy-ucomm.
    WHEN 'CANC'.
*      MOVE perf_flag TO lbpla_exist_flag.
      flag_return = 'X'.
      SET SCREEN 0.
      LEAVE SCREEN.
  ENDCASE.
ENDMODULE.                 " exit_9000  INPUT
Thanks in advance.

Hi
So the command SET SCREEN 0. LEAVE SCREEN. should "place" the program just after the calling of the popup so here:
FUNCTION z_call_screen.
* Call the Pop up screen
    CALL SCREEN 9000 STARTING AT 35 05.
"<------------------------- The program should be here after going back from popup 9000
ENDFUNCTION.
Is it true?
Max

Similar Messages

  • How to call Custom screen in standard transaction on same session

    Hi ,
    I am getting this Problem.
      After one of the screen in standard Transaction (CV01N) I need to call one custom screen. for this I created one program type M with screen. in Stan. transaction I am calling like Call transaction 'XXXX'(for above M program).here I am geeting all my required functionality .but I am getting this custom screen in separate session. I want to call this custom screen on same session of std transaction ( means background custom screen is std.screen).
    Can any one guide me to achive this functionality;
    Regards,
    Saida.

    Hi Agasti,
      Thnx for your reply.
      I tried that method also. even that also calling the Custom screen in new session not in SAP standard session.
    Regards,
    Saida

  • HOW TO PASS THE DATA FROM SELECTION SCREEN TO STANDARD TRANSACTION?

    HI,
    HOW TO PASS THE DATA FROM SELECTION SCREEN TO STANDARD TRANSACTION?
    thanks,
    samba.

    By selection screen, what do you mean?   There is no selection screen in WDA as there was in classic dynpro. Do you mean you are using the Select-Options reusable component?  Are you wanting to call a standard transaction via ITS - SAPGUI for HTML?  Please provide more details to your question.

  • How to call a sub screen from abap report

    Hellow friends,
    how to call sub screen 1001 prog name SAPLMGD1
    and main program SAPLMGMM screen 4000 of tcode MM02.
    i need to call the sub screen from abap report

    Hi Rajesh,
    You can use FM MATERIAL_MAINTAIN_DIALOGUE to go to subcreen MRP1 in MM02.
    Please check this sample code from other thread and enter 'MRP 1' for p_dytxt.
    REPORT zsritest.
    TABLES mara.
    DATA: lv_bilds LIKE t133a-bilds,
    ls_t130m LIKE t130m,
    ls_rmmg1 LIKE rmmg1,
    lwa_view TYPE mbildtab,
    lwa_auswg TYPE mgauswg,
    lt_views TYPE STANDARD TABLE OF mbildtab INITIAL SIZE 0,
    lt_auswg TYPE STANDARD TABLE OF mgauswg INITIAL SIZE 0.
    PARAMETERS: p_matnr LIKE mara-matnr,
    p_werks LIKE marc-werks,
    p_dytxt LIKE mbildtab-dytxt.
    SELECT SINGLE * FROM mara WHERE matnr EQ p_matnr.
    CHECK sy-subrc EQ 0.
    CALL FUNCTION 'T130M_SINGLE_READ'
    EXPORTING
    tcode = 'MM02'
    kzrfb = 'X'
    IMPORTING
    wt130m = ls_t130m
    EXCEPTIONS
    not_found = 1
    wrong_call = 2
    OTHERS = 3.
    CALL FUNCTION 'BILDSEQUENZ_IDENTIFY'
    EXPORTING
    branche = mara-mbrsh
    materialart = mara-mtart
    tcode_ref = ls_t130m-trref
    * KZRFB = ' '
    IMPORTING
    bildsequenz = lv_bilds
    * KZ_BILDS_CHANGED =
    EXCEPTIONS
    wrong_call = 1
    not_found = 2
    OTHERS = 3.
    CALL FUNCTION 'SELECTION_VIEWS_FIND'
    EXPORTING
    bildsequenz = lv_bilds
    pflegestatus = mara-pstat
    TABLES
    bildtab = lt_views[]
    EXCEPTIONS
    call_wrong = 1
    empty_selection = 2
    OTHERS = 3.
    ls_rmmg1-matnr = mara-matnr.
    ls_rmmg1-werks = p_werks.
    READ TABLE lt_views INTO lwa_view WITH KEY dytxt = p_dytxt.
    CHECK sy-subrc EQ 0.
    lwa_auswg-auswg = lwa_view-auswg.
    APPEND lwa_auswg TO lt_auswg.
    CALL FUNCTION 'MATERIAL_MAINTAIN_DIALOGUE'
    EXPORTING
    irmmg1 = ls_rmmg1
    * IRMMG1_REF = ' '
    KZ_EIN_DARK = 'X'
    t_tcode = 'MM02'
    * FLG_MATNR_RES = ' '
    p_pstat = mara-pstat
    * FLG_STAT_ALL = ' '
    * CALL_MODE2 = ' '
    * IMPORTING
    * MATERIAL_NO =
    * UPDATE_OK =
    TABLES
    iauswg = lt_auswg[]
    EXCEPTIONS
    no_authority = 1
    OTHERS = 2.
    IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Regards,
    Ferry Lianto

  • Can we call a selection screen from List output

    Hi Folks,
    Can we call a selection screen from the list output?
    I mean for ex:-
    i am getting the data from MAKT and displaying it in the list output having a button EMAIL.
    When I press that button it should call a selection screen asking the user to enter EMAIL id .
    Thanks,
    K.Kiran.

    Hi
    U can create a dynpro as SELECTION SCREEN and call it using CALL SELECTION-SCREEN statament:
    SELECTION-SCREEN BEGIN OF SCREEN 100.
    PARAMETERS: P_MAIL(80) TYPE C.
    SELECTION-SCREEN END    OF SCREEN  100.
    AT USER-COMMAND.
       CASE SY-UCOMM.
          WHEN 'MAIL'.
              CALL SELECTION-SCREEN 100.
              IF SY-SUBRC = 0. "User press F8
              ELSE.
                " User press exit or back
              ENDIF.
    U can use the addition STARTING AT ..... ENDING AT ..... if you need to show the selection-screen as popup
    Max

  • Calling a Selection Screen from a Function Module/Method

    Hi,
      I would like to call a selection screen from a function module or method. I understand it is not possible by the definition. Are there any alternative options as I am looking for the Variants Save option on the screen. Any thoughts?
    Thanks
    Raghav

    Since i don't know your exact requirements (standard SAP selection screen? your own selection screen?) the onl;y thing i can come up with is:
    1. in your function pool create your own screen with a subscreen area
    2. create your own selection screen as a subscreen.
    3. include the selection subscreen in the first screen
    4. call the first screen in your function.

  • Calling a Web service from Standard OAF Page.

    Hi All,
    how to call a webservice page from Standard OAF Page and get back the response from that webservice.
    Can anyone please give me the process how to do it.Can anyone please provide code it will helpful to me.
    Not using any PL/SQL API's.only through web services how to do it?.
    Thanks in Advance.
    Regards,
    Ajay.

    look in the tutorial the web-client example or the dii interface example... and read all about jaxrpc ...
    bye
    J

  • PO Creation from Sales Order User Exit

    Hi,
    I have a business requirement where I need to  create a Stock Transport Order (STO) for a particular kind of sales order. I outlined different options for achieving this functionality.
    1. Trigger a workflow for creating STO.
    2. Configure it an EDI output for sales orders. Using the EDI document, create STO in the same system.
    3. Create STO using BAPI from the sales order exit 'USEREXIT_SAVE_DOCUMENT'.
    I am trying to understand the issues if I go with option of creating STO from sales order user-exit. I tested it and it is working fine. But what concerns is me transaction integrity. In other words I am trying to  execute another transaction within a transaction. Both Transactions (VA01 and ME21N/BAPI) may be trying to access same tables. Anyways I havent see any potential overlap.
    I would like to know anybody implemented such a solution?
    What could be the potential issues? Does it really affect transaction integrity?
    Thanks A Lot
    Anil

    I would also be concerned with the possibility of the order failing to update AFTER you call the BAPI.  You could create a custom output type that processes on order create for that order type.  You could add your BAPI call to the processing routine of the output type.

  • Calling a BDC program in side a user-exit

    Hi all,
    I need to call a BDC program in side a user-exit of sales order change
    . i want to make user by calling this BDC program that it wont effect any of my other code's on that and that the customer wont be noticed with any inconvenience.
    i know to use
    CALL TRANSACTION 'zprogram'.
    but i want to make sure that till will not do any harm for any of other parts.
    Regards Nafran.

    Hi
    Make sure you dont change any values of standard SAP variables,structures and internal table values inside the user exit.This is the only way where the other functionality gets affected(unless it is the requirement).
    Reward if helpful.
    Thanks & regards,
    Ramya

  • How to restrict some users from viewing a screen of standard transaction

    Hi All,
    I need to restrict certain user ids from viewing the 'Payment Transactions' screen for the below mentioned transactions.
    FK01, FK02, FK03, MK01, MK02, MK03, XK01, XK02, XK03
    The Basis consultant has tried to configure it. However its not working. So need to find other solution.
    For all transactions other than FK01, MK01, XK01 (create vendor), the BAdi GOS_SRV_SELECT is called before the payment transaction screen appears. But for transactions FK01, MK01and XK0, no such BAdi is there.
    Also I'm not able to figure out how to restrict that particular screen using Badi GOS_SRV_SELECT. What will be the service name for this?
    Please help !!!
    Thanks in advance,
    Radhika

    hi,
    u can do this using user exits.
    identify the appropriate exit for ur transaction and thn put condition like
    if username = ...
    loop at screen.
    hide..
    endloop.
    i was just trying to give u some hint .make it to ur best.
    reward if hlpful.

  • Calling screen from another transaction

    Hi,
    If I want to call screen from other standard or custom transaction into my custom transaction, how do I do it?
    Thanks.
    Tushar.

    Hello See this link ,
    http://www.sapgenie.com/abap/bdc.htm
    This contains the program which calls the transaction using BDC.
    Hopping this will help for you

  • How to get the screen value to custom screen from standard screen

    Hi all,
    I have a standard screen which is attached to a standard function group and a custom screen which is attached to a custom function group... Now my requirement is to get some field values from the Std screen to my custom screen ...
    I have used the FM DYNP_VALUES_READ but its resuts in error...
    in my current screen PBO i called this FM and given the prog name as the Std pgm name which being created while creating the screen from the function group and the screen number as the standard screen number...
    Eg : Standard Function gp = FSBP_02
           Pgm name  = SAPLFSBP_02
          Screen Naumber = 0220
    Custom screen = 9001
    Pgn Name = zname
    in 9001 PBo i called
    DATA: IT_DYNPFIELDS  TYPE TABLE OF DYNPREAD,
           WA_DYNPFIELDS like line of IT_DYNPFIELDS.
    WA_DYNPFIELDS-FIELDNAME = 'BP021-BUSINESS_Y'.
    APPEND WA_DYNPFIELDS TO IT_DYNPFIELDS.
    CALL FUNCTION 'DYNP_VALUES_READ'
       EXPORTING
         DYNAME                               = 'SAPLFSBP_02'
         DYNUMB                               = '0220'
        TRANSLATE_TO_UPPER                   = ' '
        REQUEST                              = ' '
        PERFORM_CONVERSION_EXITS             = ' '
        PERFORM_INPUT_CONVERSION             = ' '
        DETERMINE_LOOP_INDEX                 = ' '
        START_SEARCH_IN_CURRENT_SCREEN       = ' '
        START_SEARCH_IN_MAIN_SCREEN          = ' '
        START_SEARCH_IN_STACKED_SCREEN       = ' '
        START_SEARCH_ON_SCR_STACKPOS         = ' '
        SEARCH_OWN_SUBSCREENS_FIRST          = ' '
        SEARCHPATH_OF_SUBSCREEN_AREAS        = ' '
       TABLES
         DYNPFIELDS                           = IT_DYNPFIELDS
      EXCEPTIONS
        INVALID_ABAPWORKAREA                 = 1
        INVALID_DYNPROFIELD                  = 2
        INVALID_DYNPRONAME                   = 3
        INVALID_DYNPRONUMMER                 = 4
        INVALID_REQUEST                      = 5
        NO_FIELDDESCRIPTION                  = 6
        INVALID_PARAMETER                    = 7
        UNDEFIND_ERROR                       = 8
        DOUBLE_CONVERSION                    = 9
        STEPL_NOT_FOUND                      = 10
        OTHERS                               = 11
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    How Can i get that... Its important ... Please help me...

    Hi,
        Try with the below FM
    RS_REFRESH_FROM_SELECTOPTIONS
    in your custorm program, check the SY-CPROG and SY-XPROG values, for the standard program name or directly pass the importing parameter for the above FM as SAPLFSBP_02.
    Regards
    Bala Krishna

  • Calling WebDynpro input screen from within an abap Function module / user

    Hi,
    I am posting SAP data with a BAPI from an Web Dynpro Application.
    In the Bapi I must use an BADI/User -EXIT to add some infornation.
    Today this is done by calling an Dynpro in a function module. This creates a pop up, data is filled and posted on commit.
    How can I get a Web Dynpro application to display this popup without showing the "call screen without connection " error ?
    Thanks for any help.
    Marcus

    >
    Deok-Byung Lim wrote:
    > Here is an unofficial way to get current WD component.
    > (WDR_TASK class is not for customer)
    >
    >   DATA lo_wdr_component TYPE REF TO cl_wdr_component.
    >   lo_wdr_component = wdr_task=>application->component.
    >
    >
    > then.. attach component usage and popup your WD screen
    >
    > BUT IT'S NOT OFFICIAL!!
    This approach is absolutely NOT supported nor recommended by SAP.

  • Can we add one additional screen in standard transaction.

    One requirement is to create screen after executing the standard transaction.
    I have an UserExit to create from where i can use to write a code for the standard tramsaction ,
    But How can i add one userdefined screen in SAP Stardard Transaction.
    I am not talking about the subscreen / custom exit.
    I want to create a small screen  this would be itself a screen not imposed on any other screen.
    Points will be rewarded for the help full answer.

    Hi, Mike.  It depend on the transaction, but a quick and easy way is to develop a function module which will throw a popup screen and call the function in your user exit.
    Regards,
    Rich Heilman

  • Data retrival from standard transaction with in a report

    hi all,
    i have a requirement like i need to pass the selection screen selections  to a standard transaction ca80 and need to get the material list from there to my report for furthur processing. is it possible with bdc or a bapi for this.
    can anyone please help urgent its eating my brain. points awarded for solution
    thanks in advance
    anupama

    hi deep kammula,
    this is a sample code for your query just check. it may help you.
    all the best.
    reward me points if usefull.
    Sample HR Reports - Allocate Petrol Allowance
    Two ABAP HR Programs, which are interconnected, the first takes employee numbers which should not be given Petrol allowance and the other program gives the petrol allowance to employees.
    FIRST PRG
    REPORT  ZPETROL_EXCLUDE                         .
    TABLES SSCRFIELDS.
    SELECTION-SCREEN BEGIN OF SCREEN 100.
    SELECTION-SCREEN SKIP 9.
    PARAMETERS NUMBER(200) TYPE C.
    SELECTION-SCREEN SKIP 2.
    SELECTION-SCREEN:
    BEGIN OF LINE,
      PUSHBUTTON 2(10) TEXT-001 USER-COMMAND PROC,
    END OF LINE.
    SELECTION-SCREEN END OF SCREEN 100.
    CALL SCREEN 100.
    AT SELECTION-SCREEN.
    CASE SSCRFIELDS.
    WHEN 'PROC'.
    SET PARAMETER ID: 'NUM' FIELD NUMBER.
    CALL TRANSACTION 'ZP_PALLOWANCE'.
    LEAVE TO SCREEN 0.
    ENDCASE.
    SECOND PRG
    REPORT  ZPR_PETROL_ALLOWANCE NO STANDARD PAGE
    HEADING                   .
    *-- Infotypes
    INFOTYPES : 0000, "Actions
                0002, "Personal Data
                0008. "Basic pay details
    *-- Tables
    TABLES : PERNR,   "Standard Selections for HR Master Data Reporting
             PC207,   "Payroll Results: Results Table
             PCL1,    "HR Cluster 1
             PCL2,    "HR Cluster 2
             T510,    "Pay scales
             T549A,   "Payroll areas
             T549Q,   "Payroll Periods
             PA0002.  "Personal details
    *-- Internal Tables
    *-- Internal Table Declaration For Holding The Data
    DATA: BEGIN OF INT_PETROL OCCURS 0,
            PERNR LIKE PA0008-PERNR,      "Personnel Number
            TRFST LIKE PA0008-TRFST,      "Pay Scale Level
            NAME(40),                     "Name of Employee
            PALLOWANCE TYPE P DECIMALS 2, "Petrol Allowance Amount
          END OF INT_PETROL.
    DATA: BEGIN OF PA0015_DATA OCCURS 0,
            PERNR LIKE PA0015-PERNR,
            BETRG LIKE PA0015-BETRG,
          END OF PA0015_DATA.
    DATA:BEGIN OF INT_PETROL2 OCCURS 0,
          PERNR LIKE PA0008-PERNR,      "Personnel Number
          VORNA LIKE PA0002-VORNA,      "First Name
          NACHN LIKE PA0002-NACHN,      "Last Name
          TRFST LIKE PA0008-TRFST,      "Pay Scale Level
          NAME(40),                     "Name of Employee
          PALLOWANCE TYPE P DECIMALS 2, "Petrol Allowance Amount
         END OF INT_PETROL2.
    DATA : TITLE TYPE LVC_TITLE.
    DATA:  BEGIN OF PER_NO OCCURS 0,
            PERNR LIKE PA0008-PERNR,
            TRFST LIKE PA0008-TRFST,
           END OF PER_NO.
    DATA: BEGIN OF MSG OCCURS 0,
          MSG1(100) TYPE C,
          END OF MSG.
    DATA: FLAG TYPE I VALUE '0',
          DIS_FLAG TYPE I VALUE '0'.
    DATA: INT_PETROL3 LIKE STANDARD TABLE OF INT_PETROL2 INITIAL SIZE 0
    WITH HEADER LINE.
    DATA: INT_PETROL1 LIKE STANDARD TABLE OF INT_PETROL INITIAL SIZE 0 WITH
    HEADER LINE.
    DATA: WA_PET_ALLOWANCE TYPE ZBPETROL_ALL.    "WORKAREA FOR INSERTING
    VALUES.
    *DATA: P_LGART1 LIKE T512T-LGART VALUE '0010'.  "CHANGE WAGE TYPE HERE
    DATA: P_LGART1 LIKE T512T-LGART VALUE '0077'.  "CHANGE WAGE TYPE HERE
    DATA: BEGIN OF INT_0015 OCCURS 0,
            PERNR(038),
            BEGDA(010),
            BETRG(018),
          END OF INT_0015.
    *--  Internal Table To Store Error Records.
    DATA: E_INT_0015 LIKE INT_0015 OCCURS 0 WITH HEADER LINE.
    *-- Batch Input Data of Single Transaction
    DATA: BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
    *-- Internal Table For Export and Import Payroll Results
    DATA: INT_RGDIR LIKE PC261 OCCURS 0 WITH HEADER LINE,
          LGTXT LIKE T512T-LGTXT.
    DATA: BEGIN OF EMP_NO OCCURS 0,
            PERNR(4) TYPE C,
          END OF EMP_NO.
    DATA: BEGIN OF EMP_NO1 OCCURS 0,
            PERNR TYPE I,
          END OF EMP_NO1.
    DATA EMPNO LIKE STANDARD TABLE OF EMP_NO INITIAL SIZE 0.
    DATA EMPNO1 LIKE STANDARD TABLE OF EMP_NO1 INITIAL SIZE 0 WITH HEADER
    LINE.
    DATA LEN1 TYPE I.
    DATA: ERR  LIKE MESSAGE.
    DATA TEMP_NUM(200) TYPE C.
    *-- Includes
    *-- International Include
    INCLUDE RPC2CD09.  "Cluster CD data definition
    INCLUDE RPC2CA00.  "Cluster CA Data-Definition
    INCLUDE RPPPXD00.  "Data Definition buffer PCL1/PCL2 Buffer INCLUDE RPPPXD10.
    "Common part buffer PCL1/PCL2 INCLUDE RPPPXM00.  "Buffer Handling routine
    *-- Country Specific Include
    INCLUDE PC2RXIN0.  "Cluster IN data definition
    INCLUDE RPC2RX09.
    *-- ALV Declaration
    TYPE-POOLS : SLIS.
    DATA: INT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
          INT_EVENTS TYPE SLIS_T_EVENT,
          INT_LAYOUT TYPE SLIS_LAYOUT_ALV,
          WS_EVENTS TYPE SLIS_ALV_EVENT,
          WS_REPID LIKE SY-REPID.
    *-- Initialization
    INITIALIZATION.
      WS_REPID = SY-REPID.
    *-- At Selection-Screen
    START-OF-SELECTION.
      SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
      SELECTION-SCREEN BEGIN OF LINE.
      SELECTION-SCREEN COMMENT 1(30) TEXT-002.
      SELECTION-SCREEN POSITION 33.
      PARAMETERS: P_RATE TYPE P DECIMALS 2.
      SELECTION-SCREEN END OF LINE.
      SELECTION-SCREEN END OF BLOCK B1.
      SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-003.
      SELECTION-SCREEN BEGIN OF BLOCK B3.
      PARAMETERS: P_UPLOAD AS CHECKBOX,
                  P_FG RADIOBUTTON GROUP G1,
                  P_BG RADIOBUTTON GROUP G1.
      SELECTION-SCREEN END OF BLOCK B3.
      SELECTION-SCREEN BEGIN OF BLOCK B4.
      PARAMETERS: P_DI AS CHECKBOX.
      SELECTION-SCREEN END OF BLOCK B4.
      SELECTION-SCREEN END OF BLOCK B2.
    AT SELECTION-SCREEN.
    *-- Wate Type Text
      SELECT SINGLE LGTXT INTO LGTXT FROM T512T WHERE SPRSL = 'E' AND
                                      MOLGA = '40' AND LGART = P_LGART1 .
    *-- Data Retrieval From Logical Database PNP
    GET PERNR.
      PROVIDE PERNR FROM P0000 VORNA NACHN FROM P0002 BETWEEN PN-BEGDA AND
    PN-ENDDA.
        INT_PETROL1-PERNR = P0000-PERNR.
        CONCATENATE P0002-VORNA P0002-NACHN INTO INT_PETROL1-NAME SEPARATED
    BY SPACE.
      ENDPROVIDE.
    *-- Clear Data
      CLEAR: RGDIR, INT_RGDIR.
      REFRESH: RGDIR, INT_RGDIR.
    *-- Read All The Payroll Runs For An Employee
      CD-KEY-PERNR = PERNR-PERNR.
      RP-IMP-C2-CU.
      CHECK RP-IMP-CD-SUBRC EQ 0.
    *-- Clear Data
      REFRESH: RT.
    Read IN Cluster.
      LOOP AT RGDIR WHERE FPBEG >= PN-BEGDA AND FPEND <= PN-ENDDA.
        MOVE-CORRESPONDING RGDIR TO INT_RGDIR.
        APPEND INT_RGDIR.
        CLEAR INT_RGDIR.
      ENDLOOP.
    Read the last record.
      SORT INT_RGDIR BY SEQNR DESCENDING.
      READ TABLE INT_RGDIR INDEX 1.
      RX-KEY-SEQNO = INT_RGDIR-SEQNR.
      RX-KEY-PERNR = PERNR-PERNR.
      RP-IMP-C2-IN.
      CHECK RP-IMP-IN-SUBRC EQ 0.
      READ TABLE RT WITH KEY LGART = P_LGART1.
      IF SY-SUBRC = 0.
        INT_PETROL1-PALLOWANCE = RT-BETRG.
      ENDIF.
      APPEND INT_PETROL1.
      CLEAR INT_PETROL1.
      SELECT TRFST PERNR
      INTO CORRESPONDING FIELDS OF TABLE PER_NO
      FROM PA0008
      WHERE TRFST LIKE 'L%'
      AND BET01 > 0.
      SORT PER_NO.
      DELETE ADJACENT DUPLICATES FROM PER_NO.
    *-- END-OF-SELECTION.
    END-OF-SELECTION.
      LOOP AT INT_PETROL1.
        READ TABLE PER_NO WITH KEY PERNR = INT_PETROL1-PERNR.
        IF SY-SUBRC = 0.
          INT_PETROL-TRFST = PER_NO-TRFST.
          MODIFY INT_PETROL1 FROM INT_PETROL TRANSPORTING TRFST.
        ENDIF.
      ENDLOOP.
      SORT INT_PETROL1.
      DELETE ADJACENT DUPLICATES FROM INT_PETROL1.
      CONCATENATE 'From'  '  :  ' PN-BEGDA6(2) '.' PN-BEGDA4(2) '.' PN-
    BEGDA+0(4)
      '   To' ' :  '  PN-ENDDA6(2) '.' PN-ENDDA4(2) '.' PN-ENDDA+0(4)
    INTO TITLE.
      IF P_DI = 'X'.    "TO DISPLAY PETROL ALLOWANCE ONLY
        IF PNPTIMRA = 'X'.      "CHECK OTHER PERIOD CHECKED
          DIS_FLAG = 1.
        ENDIF.
        IF PNPTIMR9 = 'X'.    "CHECK TO SEE CURRENT PERIOD SELECTED
    CASES - NO RATE GIVEN, RATE GIVEN
    CURRENT PERIOD UPLOADED BUT PAYROLL NOT WRITTEN SO NO RESULT FROM LDB
            SELECT RATE INTO P_RATE FROM ZBPETROL_ALL WHERE BEGDA = PN- BEGDA AND ENDDA = PN-ENDDA.
            ENDSELECT.
            IF SY-DBCNT = 0.
              MESSAGE I455(0) WITH 'NO PETROL RATE EXSISTS'.
            ELSE.
              FLAG = 1.
            ENDIF.  "OF SY-DBCNT
          IF P_RATE > 0 AND FLAG = 1. " PETROL RATE EXSISTS.
            SELECT PERNR SUM( BETRG ) INTO TABLE PA0015_DATA
            FROM PA0015
            WHERE BEGDA BETWEEN PN-BEGDA AND PN-ENDDA
            GROUP BY PERNR.
            SELECT APERNR ATRFST BVORNA BNACHN
            INTO CORRESPONDING FIELDS OF TABLE INT_PETROL3
            FROM PA0008 AS A
            INNER JOIN PA0002 AS B ON BPERNR = APERNR
            WHERE A~TRFST LIKE 'L%'
            AND A~BET01 > 0.
            SORT INT_PETROL3.
            DELETE ADJACENT DUPLICATES FROM INT_PETROL3.
            REFRESH INT_PETROL1.
            LOOP AT INT_PETROL3 INTO INT_PETROL2.    "loop to transport
    employee name
              CONCATENATE INT_PETROL2-VORNA INT_PETROL2-NACHN INTO
    INT_PETROL2-NAME SEPARATED BY SPACE.
              MODIFY INT_PETROL3 FROM INT_PETROL2 TRANSPORTING NAME.
            ENDLOOP.
            LOOP AT INT_PETROL3 INTO INT_PETROL2.    "loop to transport
    one
    table to another table
              READ TABLE PA0015_DATA WITH KEY PERNR = INT_PETROL2-PERNR.
              IF SY-SUBRC = 0.
                INT_PETROL-PERNR = INT_PETROL2-PERNR.
                INT_PETROL-TRFST = INT_PETROL2-TRFST.
                INT_PETROL-NAME = INT_PETROL2-NAME.
                INT_PETROL-PALLOWANCE = PA0015_DATA-BETRG.
                APPEND INT_PETROL TO INT_PETROL1.
              ENDIF.
            ENDLOOP.
            DIS_FLAG = 1.
          ENDIF.  "P_RATE > 0 AND FLAG = 1.
          IF P_RATE > 0 AND FLAG = 0.  "CURRENT PERIOD AND DATA NOT UPLOADED
            SELECT APERNR ATRFST BVORNA BNACHN
            INTO CORRESPONDING FIELDS OF TABLE INT_PETROL3
            FROM PA0008 AS A
            INNER JOIN PA0002 AS B ON BPERNR = APERNR
            WHERE A~TRFST LIKE 'L%'
            AND A~BET01 > 0.
            SORT INT_PETROL3.
            DELETE ADJACENT DUPLICATES FROM INT_PETROL3.
            REFRESH INT_PETROL1.
            LOOP AT INT_PETROL3 INTO INT_PETROL2.    "loop to transport
    employee name
              CONCATENATE INT_PETROL2-VORNA INT_PETROL2-NACHN INTO
    INT_PETROL2-NAME SEPARATED BY SPACE.
              MODIFY INT_PETROL3 FROM INT_PETROL2 TRANSPORTING NAME.
            ENDLOOP.
            PERFORM GET_VALUE.  "TO CONVERT THE FIRST SCREEN PERNR INTO
    NUMBER FORMATE
            LOOP AT INT_PETROL3 INTO INT_PETROL2.    "loop to transport
    one
    table to another table
              READ TABLE EMPNO1 WITH KEY PERNR = INT_PETROL2-PERNR.
              IF SY-SUBRC <> 0.
                INT_PETROL-PERNR = INT_PETROL2-PERNR.
                INT_PETROL-TRFST = INT_PETROL2-TRFST.
                INT_PETROL-NAME = INT_PETROL2-NAME.
                APPEND INT_PETROL TO INT_PETROL1.
              ENDIF.
            ENDLOOP.
            PERFORM CAL_ALLOWANCE.
          ENDIF.  " OF P_RATE > 0
          DIS_FLAG = 1.
        ENDIF.  " OF CURRENT PERIOD CHECK.
      ENDIF.  " OF CHECK DISPLAY.
    *----BDC
      IF P_UPLOAD = 'X'.
        IF PNPTIMRA = 'X'.      "CHECK OTHER PERIOD CHECKED
          MESSAGE I455(0) WITH 'Petrol Allowance cannot be uploaded'.
          LEAVE SCREEN.
        ENDIF.
        IF P_RATE > 0.
         IF P_RATE > 0 OR P_RATE = 0.
          IF PNPTIMR9 = 'X'.    "CHECK TO SEE CURRENT PERIOD SELECTED
            WA_PET_ALLOWANCE-BEGDA = PN-BEGDA.
            WA_PET_ALLOWANCE-ENDDA = PN-ENDDA.
            WA_PET_ALLOWANCE-RATE = P_RATE.
            WA_PET_ALLOWANCE-CURR = 'INR'.
            INSERT INTO ZBPETROL_ALL VALUES WA_PET_ALLOWANCE.
            SELECT A~PERNR A~TRFST B~VORNA B~NACHN
            INTO CORRESPONDING FIELDS OF TABLE INT_PETROL3
            FROM PA0008 AS A
            INNER JOIN PA0002 AS B ON B~PERNR = A~PERNR
            WHERE A~TRFST IN ('L1' , 'L2' , 'L3')
            AND A~BET01 > 0.
            SORT INT_PETROL3.
            DELETE ADJACENT DUPLICATES FROM INT_PETROL3.
            REFRESH INT_PETROL1.
            LOOP AT INT_PETROL3 INTO INT_PETROL2.    "loop to transport
    employee name
              CONCATENATE INT_PETROL2-VORNA INT_PETROL2-NACHN INTO
    INT_PETROL2-NAME SEPARATED BY SPACE.
              MODIFY INT_PETROL3 FROM INT_PETROL2 TRANSPORTING NAME.
            ENDLOOP.
            PERFORM GET_VALUE.  "TO CONVERT THE FIRST SCREEN PERNR INTO
    NUMBER FORMATE
            LOOP AT INT_PETROL3 INTO INT_PETROL2.    "loop to transport
    one
    table to another table
              READ TABLE EMPNO1 WITH KEY PERNR = INT_PETROL2-PERNR.
              IF SY-SUBRC <> 0.
                INT_PETROL-PERNR = INT_PETROL2-PERNR.
                INT_PETROL-TRFST = INT_PETROL2-TRFST.
                INT_PETROL-NAME = INT_PETROL2-NAME.
                APPEND INT_PETROL TO INT_PETROL1.
              ENDIF.
            ENDLOOP.
            PERFORM CAL_ALLOWANCE.
            DIS_FLAG = 1.
            SORT INT_PETROL1.
            LOOP AT INT_PETROL1.
              MOVE: INT_PETROL1-PERNR TO INT_0015-PERNR,
              INT_PETROL1-PALLOWANCE TO INT_0015-BETRG.
              CONCATENATE PN-ENDDA6(2) PN-ENDDA4(2) PN-ENDDA+0(4) INTO
    INT_0015-BEGDA SEPARATED BY '.'.
              APPEND INT_0015.
              CLEAR INT_0015.
            ENDLOOP.
            LOOP AT INT_0015.
              PERFORM F_BDCDATA.
              IF P_FG = 'X'.
                CALL TRANSACTION 'PA30' USING BDCDATA MODE 'A' UPDATE 'S'.
              ELSE.
                CALL TRANSACTION 'PA30' USING BDCDATA MODE 'N' UPDATE 'S'.
              ENDIF.
    *-- Handling Error records.
              IF SY-SUBRC <> 0.
    *-- Handling Error Messages
                PERFORM ERROR_MSG.
                MOVE-CORRESPONDING INT_0015 TO E_INT_0015.
                APPEND E_INT_0015.
                CLEAR E_INT_0015.
              ENDIF.
              REFRESH BDCDATA.
            ENDLOOP.
    *-- Downloading Error Records.
            CALL FUNCTION 'GUI_DOWNLOAD'
              EXPORTING
                FILENAME = 'C:\Errors.Txt'
                FILETYPE = 'ASC'
              TABLES
                DATA_TAB = E_INT_0015.
    *-- Downloading Error Messages.
            CALL FUNCTION 'GUI_DOWNLOAD'
              EXPORTING
                FILENAME = 'C:\Err_Msg.Txt'
                FILETYPE = 'ASC'
              TABLES
                DATA_TAB = MSG.
          ENDIF.  " FOR CURRENT PERIOD
      ENDIF.
        ELSE.
          MESSAGE I455(0) WITH 'Enter Petrol Rate'.
          LEAVE TO SCREEN 0.
        ENDIF.    " FOR PETROL RATE
      ENDIF.    " FOR UPLOAD
      IF DIS_FLAG = 1.
        INT_LAYOUT-SUBTOTALS_TEXT = TEXT-004.
        INT_LAYOUT-TOTALS_TEXT = TEXT-004.
        INT_LAYOUT-ZEBRA = 'X'.
        PERFORM FILL_FIELDCAT.
        PERFORM GET_EVENTS_ALV.
        CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
          EXPORTING
            I_CALLBACK_PROGRAM = WS_REPID
            IS_LAYOUT          = INT_LAYOUT
            IT_FIELDCAT        = INT_FIELDCAT[]
            I_DEFAULT          = 'X'
            I_SAVE             = 'X'
            IT_EVENTS          = INT_EVENTS
          TABLES
            T_OUTTAB           = INT_PETROL1
          EXCEPTIONS
            PROGRAM_ERROR      = 1
            OTHERS             = 2.
        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.
    *&      Form  GET_VALUE
          text
    FORM GET_VALUE.
      GET PARAMETER ID: 'NUM' FIELD TEMP_NUM.
      IF TEMP_NUM <> ''.
        LEN1 = STRLEN( TEMP_NUM ).
        PERFORM GET_PERNR.
        APPEND TEMP_NUM TO EMPNO.
        LOOP AT EMPNO INTO EMP_NO.
          CALL FUNCTION 'CHECK_AND_CONVERT_NUMERICS'
          EXPORTING
        DFELD              = ' '
            DMZEI              = ','
            DTYPE              = 'STRING'
        DYPNO              = ' '
            EFELD              = EMP_NO-PERNR
        FNAME              = ' '
        PROGR              = ' '
        IMP_DECIMALS       = '0'
          IMPORTING
        ERROR              =
           IFELD              = EMP_NO1-PERNR
           MESSG              = ERR
        MSGLN              =
          IF ( ERR-MSGID = '' ).
            APPEND EMP_NO1 TO EMPNO1.
            CLEAR EMP_NO1-PERNR.
          ELSE.
            MESSAGE I455(0) WITH 'Could not convert employee number'.
            LEAVE TO SCREEN 0.
          ENDIF.
        ENDLOOP.
      ENDIF.
    ENDFORM.                    "GET_VALUE
    *&      Form  GET_PERNR
          text
    FORM GET_PERNR.
      SPLIT TEMP_NUM AT ',' INTO EMP_NO TEMP_NUM.
      APPEND EMP_NO TO EMPNO.
      CLEAR EMP_NO.
      SEARCH TEMP_NUM FOR ','.
      IF SY-SUBRC = 0.
        PERFORM GET_PERNR.
      ENDIF.
    ENDFORM.                    "GET_PERNR
    *&      Form  ERROR_MSG
          text
    -->  p1        text
    <--  p2        text
    FORM ERROR_MSG.
      IF SY-SUBRC <> 0.
        CALL FUNCTION 'FORMAT_MESSAGE'
          EXPORTING
            LANG = SY-LANGU
          IMPORTING
            MSG  = MSG-MSG1.
        APPEND MSG.
        CLEAR MSG.
      ENDIF.
    ENDFORM.                    "ERROR_MSG
    *&      Form  F_BDCDATA
          text
    FORM F_BDCDATA.
      PERFORM BDC_DYNPRO      USING 'SAPMP50A' '1000'.
      PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                    '=INS'.
      PERFORM BDC_FIELD       USING 'RP50G-PERNR'
                                    INT_0015-PERNR.
      PERFORM BDC_FIELD       USING 'RP50G-TIMR6'
                                    'X'.
      PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                    'RP50G-CHOIC'.
      PERFORM BDC_FIELD       USING 'RP50G-CHOIC'
                                    '0015'.
      PERFORM BDC_DYNPRO      USING 'MP001500' '2000'.
      PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                    'Q0015-BETRG'.
      PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                    '/00'.
      PERFORM BDC_FIELD       USING 'P0015-LGART'
                                    '0077'.        "CHANGE WAGE TYPE HERE
    ALSO
      PERFORM BDC_FIELD       USING 'Q0015-BETRG'
                                    INT_0015-BETRG.
      PERFORM BDC_FIELD       USING 'P0015-WAERS'
                                    'INR'.
      PERFORM BDC_FIELD       USING 'P0015-BEGDA'
                                     INT_0015-BEGDA.
      PERFORM BDC_DYNPRO      USING 'MP001500' '2000'.
      PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                    'P0015-LGART'.
      PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                    '=UPD'.
      PERFORM BDC_FIELD       USING 'P0015-LGART'
                                    '0077'.       "CHANGE WAGE TYPE HERE
    ALSO
      PERFORM BDC_FIELD       USING 'Q0015-BETRG'
                                    INT_0015-BETRG.
      PERFORM BDC_FIELD       USING 'P0015-WAERS'
                                    'INR'.
      PERFORM BDC_FIELD       USING 'P0015-BEGDA'
                                    INT_0015-BEGDA.
    ENDFORM.                    "F_BDCDATA
    *&      Form  BDC_DYNPRO
          text
         -->P_0732   text
         -->P_0733   text
    FORM BDC_DYNPRO  USING    VALUE(P_0732) TYPE C
                              VALUE(P_0733) TYPE C.
      CLEAR BDCDATA.
      BDCDATA-PROGRAM  = P_0732.
      BDCDATA-DYNPRO   = P_0733.
      BDCDATA-DYNBEGIN = 'X'.
      APPEND BDCDATA.
    ENDFORM.                    " BDC_DYNPRO
    *&      Form  BDC_FIELD
          text
         -->P_0755   text
         -->P_0756   text
    FORM BDC_FIELD  USING    VALUE(P_0755) TYPE C
                             VALUE(P_0756) TYPE C.
      CLEAR BDCDATA.
      BDCDATA-FNAM = P_0755.
      BDCDATA-FVAL = P_0756.
      APPEND BDCDATA.
    ENDFORM.                    " BDC_FIELD
    *&      Form  CAL_ALLOWANCE
          text
    FORM CAL_ALLOWANCE.
      LOOP AT INT_PETROL1 INTO INT_PETROL.
        IF INT_PETROL-TRFST = 'L1'.
          INT_PETROL-PALLOWANCE = P_RATE * 100.   "CHANGE TO SELECT WHEN
    DISPLAY
        ELSEIF INT_PETROL-TRFST = 'L2'.
          INT_PETROL-PALLOWANCE = P_RATE * 150.
        ELSEIF INT_PETROL-TRFST = 'L3'.
          INT_PETROL-PALLOWANCE = P_RATE * 150.
        ELSEIF INT_PETROL-TRFST = 'L4'.
    INT_PETROL-PALLOWANCE = P_RATE * 200.
        ELSEIF INT_PETROL-TRFST = 'L5'.
    INT_PETROL-PALLOWANCE = P_RATE * 250.
        ENDIF.
        MODIFY INT_PETROL1 FROM INT_PETROL TRANSPORTING PALLOWANCE.
      ENDLOOP.
    ENDFORM.                    "CAL_ALLOWANCE
    *&      Form  FILL_FIELDCAT
          text
    -->  p1        text
    <--  p2        text
    FORM FILL_FIELDCAT.
      INT_FIELDCAT-COL_POS = 1.
      INT_FIELDCAT-TABNAME = 'INT_PETROL1'.
      INT_FIELDCAT-FIELDNAME = 'PERNR'.
      INT_FIELDCAT-SELTEXT_L = TEXT-005.
      INT_FIELDCAT-OUTPUTLEN = 10.
      INT_FIELDCAT-KEY = 'X'.
      APPEND INT_FIELDCAT.
      CLEAR INT_FIELDCAT.
      INT_FIELDCAT-COL_POS = 2.
      INT_FIELDCAT-TABNAME = 'INT_PETROL1'.
      INT_FIELDCAT-FIELDNAME = 'NAME'.
      INT_FIELDCAT-SELTEXT_L = TEXT-006.
      INT_FIELDCAT-OUTPUTLEN = 25.
      INT_FIELDCAT-KEY = 'X'.
      APPEND INT_FIELDCAT.
      CLEAR INT_FIELDCAT.
      INT_FIELDCAT-COL_POS = 3.
      INT_FIELDCAT-TABNAME = 'INT_PETROL1'.
      INT_FIELDCAT-FIELDNAME = 'TRFST'.
      INT_FIELDCAT-SELTEXT_L = TEXT-007.
      INT_FIELDCAT-OUTPUTLEN = 5.
      INT_FIELDCAT-KEY = 'X'.
      APPEND INT_FIELDCAT.
      CLEAR INT_FIELDCAT.
      INT_FIELDCAT-COL_POS = 4.
      INT_FIELDCAT-TABNAME = 'INT_PETROL1'.
      INT_FIELDCAT-FIELDNAME = 'PALLOWANCE'.
      INT_FIELDCAT-SELTEXT_L = TEXT-008.
      INT_FIELDCAT-OUTPUTLEN = 16.
      INT_FIELDCAT-KEY = 'X'.
      APPEND INT_FIELDCAT.
      CLEAR INT_FIELDCAT.
    ENDFORM.                    " FILL_FIELDCAT
    *&      Form  GET_EVENTS_ALV
          text
    -->  p1        text
    <--  p2        text
    FORM GET_EVENTS_ALV.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          I_LIST_TYPE     = 1
        IMPORTING
          ET_EVENTS       = INT_EVENTS[]
        EXCEPTIONS
          LIST_TYPE_WRONG = 1
          OTHERS          = 2.
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      READ TABLE INT_EVENTS INTO WS_EVENTS WITH KEY NAME =
    SLIS_EV_TOP_OF_PAGE.
      IF SY-SUBRC = 0.
        WS_EVENTS-FORM = 'TOP'.
        MODIFY INT_EVENTS FROM WS_EVENTS INDEX SY-TABIX.
      ENDIF.
    ENDFORM.                    " GET_EVENTS_ALV
    *&      Form  TOP-OF-PAGE
          text
    FORM TOP.
    *-- ALV Declarations
      DATA: WS_HEADER TYPE SLIS_T_LISTHEADER,
            WA_HEADER TYPE SLIS_LISTHEADER.
    *-- Title
      WA_HEADER-TYP = 'H'.
      WA_HEADER-INFO = TEXT-009.
      APPEND WA_HEADER TO WS_HEADER.
      CLEAR WA_HEADER.
      WA_HEADER-TYP = 'H'.
      WA_HEADER-INFO = TITLE.
      APPEND WA_HEADER TO WS_HEADER.
      CLEAR WA_HEADER.
      WA_HEADER-TYP = 'H'.
      WA_HEADER-INFO = ' '.
      APPEND WA_HEADER TO WS_HEADER.
      CLEAR WA_HEADER.
      WA_HEADER-TYP = 'H'.
      WA_HEADER-INFO = ' '.
      APPEND WA_HEADER TO WS_HEADER.
      CLEAR WA_HEADER.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          IT_LIST_COMMENTARY = WS_HEADER
          I_LOGO             = 'LOGO'.
    ENDFORM.                    "TOP-OF-PAGE
    regards
    karthik
    Edited by: KARTIKEYA (EDS-VZG) on May 5, 2008 1:41 PM

Maybe you are looking for

  • Purchase Order using ESOA

    Hi, I am working on ERP 6 (Ehp 4) and SUS. Could someone pl provide me the settings to be made in ERP for sending out PO's to SUS using ESOA. Pl throw some light on t-code SOAMANAGER and the settings to be made to enable sending out PO from ECC to SU

  • Strings in the BPM Repository

    I have a String value that I am storing in the BPM repository (not xml). I want to be able to set a String variable to the contents in the repository. I can't find a way to get the String back out. Is there any way to do this?

  • How do I get rid of genii as my search engine

    how do I get rid of genii as my search engine

  • Planning at cost element group level

    Is it possible to plan values  at cost element group level instead of at cost element level in CCA? Thanks

  • T430s with Win 8, how can I activate the GPS?

    I have T430s with Win 8 64-bit, with embedded mobile broadband module. The WAN is working just fine, and the GPS is seen when I explore the (wireless) tab under Settings, but .. I can not use it, Google earth can not see it and I don't have any softw