SY-REPID and SY-CPROG

Hi, experts.
What is the difference between SY-REPID and SY-CPROG ?
Thanks in advance,
Brian Gonsales

SY-CPROG
In externally called procedures, the name of the calling program, otherwise the name of the current program. If an externally called procedure calls another external procedure, SY-CPROG keeps the name of the first main program and is not given the name of the main program of the further caller.
SY-REPID
Name of current ABAP program. With externally called procedures this is the name of the procedure’s main program.
If SY-REPID was transferred to an external procedure as an actual parameter before Release 6.10, the formal parameter was not given the name of the caller, but the name of the procedure’s main program. SY-REID had to be transferred to an auxiliary variable before the call or you had to use SY-PROG.
As of Release 6.10, SY-REPID is a separate constant that is no longer part of the structure SYST or SY. It can be transferred to external procedures directly.
~Copied from Rich's reply.

Similar Messages

  • Difference between sy-repid and sy-cprog

    Hi all,
    in a function module call I want to pass the calling report's name as an import parameter. I want to do this dynamically so that the 'call function ....' code can be copied to any report.
    I found two SY-fields, sy-repid and sy-cprog. So far both always contain the running report's name.
    Is there an important difference between the two? Is one perhaps deprecated?
    Regards,
    Eric

    Hi Eric,
    SY-REPID:
    Name of the current ABAP program. For externally-called procedures, it is the name of the main program of the procedure. If you pass SY-REPID as an actual parameter to an external procedure, the formal parameter does not contain the name of the caller, but that of the main program of the procedure. To avoid this, assign SY-REPID to an auxiliary variable and use that in the call, or use the system field SY-CPROG.
    SY-CPROG:
    The name of the calling program in an external routine, otherwise the name of the current program.
    For more information, please check this links.
    http://help.sap.com/saphelp_nw2004s/helpdata/en/7b/fb96c8882811d295a90000e8353423/content.htm
    http://help.sap.com/saphelp_46c/helpdata/en/7b/fb96c8882811d295a90000e8353423/content.htm
    Hope this will help.
    Regards,
    Ferry Lianto

  • Diffrence between sy-cprog and sy-repid

    Dear all,
    Could someone tell me what are the differences between fields sy-repid and sy-cprog ?
    Also,
    Why is field REPID not present in SYST structure ?
    Already thank's
    Nicolas

    Hi Nicolas
    You already have reasonable anwswers. 
    Check the link below, it will give you information about all system fields:
    http://www.planetsap.com/Abap_System%20fields.htm
    You can see values of all system fields while debugging, just enter 'SY' and see all the fields while degugging. And, don't forget to compare sy-cprog and sy-repid
    Cheers
    Ashish

  • How to determine main program name?

    Hello Forums,
    I am working on a customer exit that is called by a function module and I would like to have a condition in my include that states
    if program_name =   SAPLV56K .
    do logic in here.
    Endif.
    is it possible to determine the program name?
    thanks

    Hi,
    Do following step,
    1 declare global Variable of type sy-repid. eg data g_repid like sy-repid.
    2 assign program name to variable at Initialization stmt.
         INITIALIZATION
         g_repid = sy-repid.
    3 Use this variable.
    other wise use sy-cprog.
    Difference between sy-repid and sy-cprog
    Sy-repid --- It contains the name of current program.
    Sy-cprog---Contains the name of calling program.
    Thanks & Regards,
    ShreeMohan

  • Query related to alv grid and sap script

    Hi All,
    I have a requirement where i should read the values which are selected on the alv grid list output and those values i need to display on the script(layout).
    Help me out guru's its an urgency...
    thanks in advance .
    regards
    ravi ganji

    Hi Ravi,
    I have done it exactly like your requirement. This program contains ALV and Smartform.
    But whatever may be, both are layouts and having driver program. So just finish your driver program and Script layout and then use this program.
    I have written this code to print contact letters from VA42. So, modify this code to insert your transaction code.
    Let me know if you have any questions.
    Here is the code.
    REPORT ILETTER MESSAGE-ID CM.
    TYPE POOLS (ALV)
      TYPE-POOLS:
                slis.
    Customized Types
      TYPES:
            BEGIN OF ty_cntrt,
              box(1)   TYPE c,
              kunnr    TYPE kunag,
              vbeln    TYPE vbeln_va,
              vbeln1   TYPE vbeln_va,
              vposn    TYPE posnr,
              vuntdat  TYPE vudat_veda,
              vbegdat  TYPE vbdat_veda,
              vdemdat  TYPE vddat_veda,
              venddat  TYPE vndat_veda,
            END   OF ty_cntrt,
          single line TYPES
            BEGIN OF ty_vkorg,
             vkorg    TYPE vkorg,
            END   OF ty_vkorg.
    Constants
      CONSTANTS:
         c_sform  TYPE char10             VALUE 'SMARTFORMS',
         c_tcode  TYPE sy-tcode           VALUE 'VA42',
         c_mode   TYPE c                  VALUE 'N',
         c_updat  TYPE c                  VALUE 'A',
         c_batch  TYPE sy-callr           VALUE 'BATCH',
         c_dclick TYPE char10             VALUE '&IC1'.
    Internal tables
      DATA: it_cntrt TYPE TABLE OF ty_cntrt,
            it_bdc   TYPE TABLE OF bdcdata,
            it_mesg  TYPE TABLE OF bdcmsgcoll,
            it_const TYPE TABLE OF /SIE/SSG_XCM_CUC,
            it_vkorg TYPE TABLE OF ty_vkorg.
    Work areas
      DATA: wa_cntrt TYPE ty_cntrt,
            wa_bdc   TYPE bdcdata,
            wa_const TYPE /SIE/SSG_XCM_CUC,
            w_vbak   TYPE vbak,
            w_veda   TYPE veda,
            w_xcm_pr TYPE /sie/ssg_xcm_pr,
            w_vkorg  TYPE ty_vkorg.
    Variables
      DATA: l_repid    TYPE sy-repid,
            l_vakey    TYPE vakey,
            l_variant  TYPE varid-variant,
            l_vbeln    TYPE i,
            l_vkorg    TYPE i,
            l_vkbur    TYPE i,
            l_vkgrp    TYPE i,
            l_ckappl(40)   TYPE c,
            l_ckschl(40)   TYPE c,
            l_cauart(40)   TYPE c.
    Program Constants
      DATA: c_kappl    TYPE kappl,
            c_kschl    TYPE kschl,
            c_auart    TYPE auart,
            c_repco    TYPE /sie/ssg_xcm_const,
            c_value    TYPE /sie/ssg_xcm_value.
    ALV data declarations
      DATA:
          gt_fieldcat  TYPE slis_t_fieldcat_alv,
          gt_tab_group TYPE slis_t_sp_group_alv,
          gs_layout    TYPE slis_layout_alv,
          gs_repid     TYPE sy-repid,
          gs_sort      TYPE TABLE OF slis_sortinfo_alv.
    Selection screen
      SELECTION-SCREEN BEGIN OF BLOCK indletter WITH FRAME TITLE text-001.
      skip one line
        SELECTION-SCREEN SKIP.
        SELECT-OPTIONS:
                     contract
                       so_vbeln FOR w_vbak-vbeln,
                     category
                       so_auart FOR w_vbak-auart NO-DISPLAY,
                     Sales Org
                       so_vkorg FOR w_vbak-vkorg OBLIGATORY,
                     Dis Channel
                       so_vtweg FOR w_vbak-vtweg,
                     Division
                       so_spart FOR w_vbak-spart,
                     Sales Group
                       so_vkgrp FOR w_vbak-vkgrp,
                     Sales Office
                       so_vkbur FOR w_vbak-vkbur OBLIGATORY,
                     Cancellation Procedure
                       so_vkues FOR w_veda-vkuesch OBLIGATORY,
                     Contract Signed Date
                       so_vuntd FOR w_veda-vuntdat,
                     created by
                       so_ernam FOR w_vbak-ernam,
                     Fixed Indexation formula
                       so_fnum  FOR w_xcm_pr-fnum OBLIGATORY.
      skip one line
        SELECTION-SCREEN SKIP.
      Indexation letter
        PARAMETERS: rb_index  RADIOBUTTON GROUP radi USER-COMMAND usr.
      Follow up report
        PARAMETERS: rb_follo  RADIOBUTTON GROUP radi.
      skip one line
        SELECTION-SCREEN SKIP.
      Manual processing checkbox
        PARAMETERS:    p_manpr AS CHECKBOX.
      SELECTION-SCREEN END   OF BLOCK indletter.
    Printer block
      SELECTION-SCREEN BEGIN OF BLOCK blk_par WITH FRAME TITLE text-002.
      Printer
        PARAMETERS:     p_print  LIKE nast-ldest DEFAULT 'LOCL' OBLIGATORY.
      SELECTION-SCREEN END OF BLOCK blk_par.
    User selection data validation
      AT SELECTION-SCREEN ON so_vkorg.
    Ragne for sales org
      RANGES: r_vkorg FOR vbak-vkorg.
      REFRESH: it_const, r_vkorg.
      CLEAR   wa_const.
    Proceed for execution only for Sales Orgs in /SIE/SSG_XCM_CUC
      LOOP AT so_vkorg.
       r_vkorg-sign = 'I'.
       r_vkorg-option = 'EQ'.
       r_vkorg-low    = so_vkorg-low.
       APPEND r_vkorg.
    Check Sales Org intervals entered in the selection screen
       IF NOT so_vkorg-high IS INITIAL.
    Get all Sales Org for interval
         SELECT vkorg FROM tvko INTO TABLE it_vkorg
           WHERE vkorg BETWEEN so_vkorg-low AND so_vkorg-high.
         IF sy-subrc = 0.
         Add all Sales org into one internal table
           LOOP AT it_vkorg INTO w_vkorg.
             r_vkorg-low = w_vkorg-vkorg.
             APPEND r_vkorg.
             CLEAR: w_vkorg.
           ENDLOOP.
         delete repeated records
           DELETE ADJACENT DUPLICATES FROM r_vkorg COMPARING low.
         ENDIF.
       ENDIF.
       CLEAR r_vkorg.
      ENDLOOP.
    Get Sales Org entries maintained in /SIE/SSG_XCM_CUC
      l_repid = sy-repid.
    Check Sales Org is maintained for Renewal Letter?
      LOOP AT r_vkorg.
      concatenate constant with Sales Org
        CONCATENATE 'INX_LETTER_CREATE_' r_vkorg-low INTO c_repco.
      Get constant
        SELECT SINGLE value
          FROM /sie/ssg_xcm_cuc
          INTO c_value
         WHERE repid = l_repid
           AND const = c_repco
           AND vkorg EQ so_vkorg-low.
      Check alerady maintained?
        IF sy-subrc <> 0 OR
          ( sy-subrc = 0 AND c_value <> 'X' ).
        Issue massage 'Sales Org no permitted for renewal Letter'.
          MESSAGE E012.
          CLEAR: c_repco, r_vkorg.
          EXIT.
        ENDIF.
        CLEAR: c_repco, r_vkorg.
      ENDLOOP.
      AT SELECTION-SCREEN.
    Read single Sales Org
       READ TABLE so_vkorg INDEX 1.
       IF sy-subrc = 0.
         CLEAR: l_ckappl, l_ckschl, l_cauart, c_kappl, c_kschl, c_auart.
       for application
         CONCATENATE 'INX_LETTER_V1_' so_vkorg-low INTO l_ckappl.
       for output type
         CONCATENATE 'INX_LETTER_Y6C4_' so_vkorg-low INTO l_ckschl.
       document type
         CONCATENATE 'INX_LETTER_AUART_' so_vkorg-low INTO l_cauart.
       Get application
         SELECT SINGLE value FROM /sie/ssg_xcm_cuc
           INTO c_kappl WHERE repid = sy-repid AND const LIKE l_ckappl.
       Get output type
         SELECT SINGLE value FROM /sie/ssg_xcm_cuc
           INTO c_kschl WHERE repid = sy-repid AND const LIKE l_ckschl.
       Get document type
         SELECT SINGLE value FROM /sie/ssg_xcm_cuc
           INTO c_auart WHERE repid = sy-repid AND const LIKE l_cauart.
       ENDIF.
    find no of Sales org entries entered in the selection screen
       DESCRIBE TABLE so_vkorg LINES l_vkorg.
    find no of Sales office entries entered in the selection screen
       DESCRIBE TABLE so_vkbur LINES l_vkbur.
    find no of Sales Group entries entered in the selection screen
       DESCRIBE TABLE so_vkgrp LINES l_vkgrp.
    Check if enterred more than one entry
       IF l_vkorg = 1 AND l_vkbur = 1.
         add Sales Org, Sales office, Sales group for key
         IF NOT so_vkgrp[] IS INITIAL.
           CONCATENATE so_vkorg-low so_vkbur-low so_vkgrp-low INTO l_vakey.
         ELSE.
           CONCATENATE so_vkorg-low so_vkbur-low '%' INTO l_vakey.
         ENDIF.
         CONDENSE l_vakey.
       Get printer name for selection.
         SELECT SINGLE ldest FROM nach INTO p_print
          WHERE kappl = c_kappl AND kschl = c_kschl AND vakey LIKE l_vakey.
       ENDIF.
    Manual processing is possible for Renewal Letter in advance only
      IF p_manpr = 'X' AND rb_follo = 'X'.
        MESSAGE E017.
      ENDIF.
    Main Processing
    START-OF-SELECTION.
      Check for the Follow up report
        IF rb_follo = 'X'.
        Call Follow up report with Selection criteria
          SUBMIT /SIE/SWE_XCM_INDEX_FOLLOWUP
           USING SELECTION-SET l_variant
            WITH so_vbeln IN so_vbeln
            WITH so_vkorg IN so_vkorg
            WITH so_vtweg IN so_vtweg
            WITH so_spart IN so_spart
            WITH so_vkgrp IN so_vkgrp
            WITH so_vkbur IN so_vkbur
            WITH so_vkues IN so_vkues
            WITH so_vuntd IN so_vuntd
            WITH so_ernam IN so_ernam
            WITH so_fnum  IN so_fnum
            WITH p_kappl  EQ c_kappl
            WITH p_kschl  EQ c_kschl
            WITH p_auart  EQ c_auart
          AND RETURN.
        ELSE.
        Process for Indexation Report
          gs_repid = sy-repid.
        Get data.
          PERFORM get_data.
        Filter data based on Siemens France rules
          PERFORM process_data.
        Check contract data is available for selection criteria
          IF NOT it_cntrt[] IS INITIAL.
          create ALV output header
            PERFORM alv_fieldcat USING gt_fieldcat[].
          create ALV layout
            PERFORM alv_layout CHANGING gs_layout.
          Sort ALV output
            PERFORM alv_sort.
          display filtered contract data
            PERFORM output_data.
          ELSE.
          Display a message 'No records found'.
            MESSAGE I011.
            EXIT.
          ENDIF.
        ENDIF.
    *&      Form  get_data
          Retrieve contracts data from tables
    -->  p1        text
    <--  p2        text
    FORM get_data.
    Get contract data from VBAK and VEDA.
      SELECT avbeln   aaudat   a~kunnr
             bvuntdat bvbegdat
             bvdemdat bvenddat
        INTO CORRESPONDING FIELDS OF TABLE it_cntrt
        FROM vbak AS a INNER JOIN veda AS b
          ON avbeln = bvbeln
       WHERE a~vbeln   IN so_vbeln
         AND a~auart   EQ c_auart
         AND a~vkorg   IN so_vkorg
         AND a~vtweg   IN so_vtweg
         AND a~spart   IN so_spart
         AND a~vkgrp   IN so_vkgrp
         AND a~vkbur   IN so_vkbur
         AND a~ernam   IN so_ernam
         AND b~vposn   = '000000'
         AND b~vkuesch IN so_vkues
         AND b~vuntdat IN so_vuntd.
    ENDFORM.                    " get_data
    *&      Form  process_data
          text
    -->  p1        text
    <--  p2        text
    FORM process_data.
    Internal tables
      DATA: l_nast   TYPE TABLE OF nast,
            it_pr    TYPE TABLE OF /sie/ssg_xcm_pr.
    Work areas
      DATA: w_nast   TYPE nast,
            wa_pr    TYPE /sie/ssg_xcm_pr.
    local Variables
      DATA: l_datum1 TYPE sy-datum,
            l_datum2 TYPE sy-datum,
            l_d3last TYPE sy-datum,
            l_d3next TYPE sy-datum.
    current date.
      l_datum1 = sy-datum.
    Calcuate date after 3 months.
      CALL FUNCTION 'DATE_CREATE'
        EXPORTING
          ANZAHL_MONATE        = 3
          DATUM_EIN            = l_datum1
        IMPORTING
          DATUM_AUS            = l_datum2.
      l_datum2 = l_datum2 - 1.
      SORT it_cntrt BY KUNNR VBELN.
    Get corresponding records from /SIE/SSG_XCM_PR.
      SELECT vbeln posnr fnum
          FROM /SIE/SSG_XCM_PR
          INTO CORRESPONDING FIELDS OF TABLE it_pr
           FOR ALL ENTRIES IN it_cntrt
         WHERE vbeln = it_cntrt-vbeln
          AND posnr = it_cntrt-vposn
           AND fnum IN so_fnum.
    clear workarea
      CLEAR wa_cntrt.
    filter contracts agaist the table /SIE/SSG_XCM_PR records.
      LOOP AT it_cntrt INTO wa_cntrt.
        CLEAR wa_pr.
      check contracts available in table /SIE/SSG_XCM_PR
        READ TABLE it_pr INTO wa_pr WITH KEY vbeln = wa_cntrt-vbeln.
        IF sy-subrc <> 0.
            DELETE it_cntrt.
            CLEAR wa_pr.
            CONTINUE.
        ELSEIF sy-subrc = 0 AND NOT wa_pr-fnum IN so_fnum.
      if not available, do not consider this contract
            DELETE it_cntrt.
            CLEAR wa_pr.
            CONTINUE.
        ENDIF.
         Dont consider contracts expires before today and after 3 months.
        IF wa_cntrt-vdemdat > l_datum1.   "current date
               IF wa_cntrt-vdemdat(6) > l_datum2(6). "AND   "after 3 months
               delete contract
                 DELETE it_cntrt.
                 CLEAR wa_cntrt.
                 CONTINUE.
               ENDIF.
        ELSE.
            DELETE it_cntrt.
            CLEAR wa_cntrt.
            CONTINUE.
        ENDIF.
      Is contract renewal letter has been sent already?
      Get all records from NAST to find letter sent?
        SELECT kappl objky kschl nacha datvr
          FROM NAST
          INTO CORRESPONDING FIELDS OF TABLE l_nast
         WHERE kappl = c_kappl
           AND objky = wa_cntrt-vbeln
           AND kschl = c_kschl
           AND nacha = '1'.
        IF sy-subrc = 0.
           sort renewal letter sent dates by latest is first
             SORT l_nast BY datvr DESCENDING.
           Get latest nast record
             READ TABLE l_nast INTO w_nast INDEX 1.
             IF sy-subrc = 0.
                IF p_manpr <> 'X'.  " ignore 3 month logic
                    l_d3next = wa_cntrt-vdemdat(06).
                    l_d3next+6(2) = '01'.
                  Calcuate date after 3 months.
                    CALL FUNCTION 'DATE_CREATE'
                      EXPORTING
                        ANZAHL_MONATE        = -3
                        DATUM_EIN            = l_d3next
                      IMPORTING
                        DATUM_AUS            = l_d3last.
                    l_d3last = l_d3last + 1.
                  Check letter already sent year equals current year
                    IF w_nast-datvr BETWEEN l_d3last AND wa_cntrt-vdemdat.
                     do not consider it
                       DELETE it_cntrt.
                       CLEAR: l_d3last, wa_cntrt, w_nast, l_d3next.
                       CONTINUE.
                    ENDIF.
                ENDIF.
             ENDIF.
        ENDIF.
      no leading zeros to contract
        WRITE wa_cntrt-vbeln TO wa_cntrt-vbeln1 NO-ZERO.
      modify internal table
        MODIFY it_cntrt FROM wa_cntrt.
        CLEAR: l_nast, w_nast.
      ENDLOOP.
    ENDFORM.                    " process_data
    *&      Form  output_data
          text
    -->  p1        text
    <--  p2        text
    FORM output_data.
    Display output in a ALV Grid
       CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
           I_CALLBACK_PROGRAM                = gs_repid
           I_CALLBACK_PF_STATUS_SET          = 'ALV_STATUS'
           I_CALLBACK_USER_COMMAND           = 'USER_COMMAND'
           IS_LAYOUT                         = gs_layout
           IT_FIELDCAT                       = gt_fieldcat
           IT_SORT                           = gs_sort
           I_SAVE                            = 'A'
         TABLES
           T_OUTTAB                          = it_cntrt
         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.
    ENDFORM.                    " output_data
    *&      Form  alv_header
          text
    -->  p1        text
    <--  p2        text
    FORM alv_fieldcat USING gs_fieldcat TYPE slis_t_fieldcat_alv.
      DATA: ls_fieldcat TYPE slis_fieldcat_alv.
    Sold-to Party header
      ls_fieldcat-col_pos = 1.
      ls_fieldcat-fieldname = 'KUNNR'.
      ls_fieldcat-seltext_m = 'Sold-to Party'.
      ls_fieldcat-outputlen = 14.
      ls_fieldcat-datatype  = 'CHAR'.
      ls_fieldcat-key       = 'X'.
      APPEND ls_fieldcat TO gs_fieldcat.
      CLEAR ls_fieldcat.
    Contract number
      ls_fieldcat-col_pos = 2.
      ls_fieldcat-fieldname = 'VBELN'.
      ls_fieldcat-seltext_m = 'Contract Number'.
      ls_fieldcat-outputlen = 20.
      ls_fieldcat-datatype  = 'CHAR'.
      APPEND ls_fieldcat TO gs_fieldcat.
      CLEAR ls_fieldcat.
    Contract Signed Date
      ls_fieldcat-col_pos = 3.
      ls_fieldcat-fieldname = 'VUNTDAT'.
      ls_fieldcat-seltext_m = 'Contract signed date'.
      ls_fieldcat-outputlen = 20.
      ls_fieldcat-datatype  = 'DATS'.
      APPEND ls_fieldcat TO gs_fieldcat.
      CLEAR ls_fieldcat.
    Contract Start Date
      ls_fieldcat-col_pos = 4.
      ls_fieldcat-fieldname = 'VBEGDAT'.
      ls_fieldcat-seltext_m = 'Contract start date'.
      ls_fieldcat-outputlen = '20'.
      ls_fieldcat-datatype  = 'DATS'.
      APPEND ls_fieldcat TO gs_fieldcat.
      CLEAR ls_fieldcat.
    Dismantling date
      ls_fieldcat-col_pos = 5.
      ls_fieldcat-fieldname = 'VDEMDAT'.
      ls_fieldcat-seltext_m = 'Dismantling date'.
      ls_fieldcat-outputlen = 14.
      ls_fieldcat-datatype  = 'DATS'.
      APPEND ls_fieldcat TO gs_fieldcat.
      CLEAR ls_fieldcat.
    ENDFORM.                    " alv_header
    *&      Form  alv_layout
          text
    -->  p1        text
    <--  p2        text
    FORM alv_layout USING ls_layout TYPE slis_layout_alv.
    No input
      ls_layout-no_input          = 'X'.
    Column width is flexible
    ls_layout-colwidth_optimize = 'X'.
      ls_layout-box_fieldname = 'BOX'.
      ls_layout-info_fieldname = 'LINE_COLOR'.
      ls_layout-zebra = 'X'.
      ls_layout-get_selinfos = 'X'.
      ls_layout-reprep = 'X'.
    ENDFORM.                    " alv_layout
    *&      Form  alv_status
          text
    -->  p1        text
    <--  p2        text
    FORM alv_status USING rt_extab TYPE slis_t_extab.
    GUI Status and Application Toolbar
      SET PF-STATUS '/SIE/SWE_XCM_INDEXLE'.
    ENDFORM.
    *&      Form  user_command
          text
    -->  p1        text
    <--  p2        text
    FORM user_command USING l_ucomm      LIKE sy-ucomm
                            l_selfield   TYPE slis_selfield.
      RANGES: r_kappl FOR nast-kappl,
              r_objky FOR nast-objky,
              r_kschl FOR nast-kschl,
              r_nacha FOR nast-nacha.
      DATA: l_jobname  TYPE TBTCJOB-JOBNAME,
            l_jobcount TYPE TBTCJOB-JOBCOUNT,
            l_repid    TYPE sy-repid,
            l_print_params TYPE PRI_PARAMS,
            l_arc_params   TYPE ARC_PARAMS,
            l_valid        TYPE c,
            l_retcode      TYPE sy-subrc,
            l_blines       TYPE i.
      CASE l_ucomm.
      Process button seleted
        WHEN c_sform.
        process selected records.
          LOOP AT it_cntrt INTO wa_cntrt.
             IF wa_cntrt-box = 'X'.
              place output type in the contract
                PERFORM bdc_output USING wa_cntrt
                                   CHANGING l_retcode.
                IF l_retcode = 0.
                add record for jobground job
                  r_objky-sign   = 'I'.
                  r_objky-option = 'EQ'.
                  r_objky-low    = wa_cntrt-vbeln.
                  APPEND r_objky.
                ENDIF.
                CLEAR: wa_cntrt, l_retcode, r_objky.
             ENDIF.
          ENDLOOP.
        WHEN c_dclick.
        set contract number id with the selected contract
          SET PARAMETER ID 'AUN' FIELD l_selfield-value.
          SET PARAMETER ID 'KTN' FIELD l_selfield-value.
        call va42 tcode when double click on contract
          CALL TRANSACTION c_tcode AND SKIP FIRST SCREEN.
      ENDCASE.
      DESCRIBE TABLE r_objky LINES l_blines.
    IF NOT r_objky[] IS INITIAL.
      IF l_blines > 0.
        Background job name.
          CONCATENATE 'XCM_INDEXATION' sy-uname '_' sy-uzeit
                 INTO l_jobname.
        Application
          r_kappl-sign   = 'I'.
          r_kappl-option = 'EQ'.
          r_kappl-low    = 'V1'.
          APPEND r_kappl.
        Message Type
          r_kschl-sign   = 'I'.
          r_kschl-option = 'EQ'.
          r_kschl-low    = c_kschl.
          APPEND r_kschl.
        Message transmission medium
          r_nacha-sign   = 'I'.
          r_nacha-option = 'EQ'.
          r_nacha-low    = '1'.
          APPEND r_nacha.
          l_repid = sy-repid.
        Print Parameters
          CALL FUNCTION 'GET_PRINT_PARAMETERS'
            EXPORTING
              DESTINATION                  = p_print
              MODE                         = c_batch
              NO_DIALOG                    = 'X'
              REPORT                       = l_repid
              EXPIRATION                   = 2
              IMMEDIATELY                  = 'X'
              NEW_LIST_ID                  = 'X'
            IMPORTING
              OUT_ARCHIVE_PARAMETERS       = l_arc_params
              OUT_PARAMETERS               = l_print_params
              VALID                        = l_valid
            EXCEPTIONS
              ARCHIVE_INFO_NOT_FOUND       = 1
              INVALID_PRINT_PARAMS         = 2
              INVALID_ARCHIVE_PARAMS       = 3
              OTHERS                       = 4.
          IF SY-SUBRC <> 0.
             MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                      WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.
        opening the job
          CALL FUNCTION 'JOB_OPEN'
            EXPORTING
              JOBNAME                = l_jobname
            IMPORTING
              JOBCOUNT               = l_jobcount
           EXCEPTIONS
             CANT_CREATE_JOB        = 1
             INVALID_JOB_DATA       = 2
             JOBNAME_MISSING        = 3
             OTHERS                 = 4.
          IF SY-SUBRC <> 0.
           MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                   WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.
        Job submit
          SUBMIT /sie/swe_xcm_index_rsnast00 TO SAP-SPOOL
                          USER sy-uname
                          WITH s_kappl IN r_kappl
                          WITH s_objky IN r_objky
                          WITH s_kschl IN r_kschl
                          WITH s_nacha IN r_nacha
                          WITH p_print  EQ p_print
             VIA JOB l_jobname NUMBER l_jobcount
             SPOOL PARAMETERS l_print_params
             WITHOUT SPOOL DYNPRO
             AND RETURN.
          IF sy-subrc <> 0.
          display message when error in scheduling background job
            MESSAGE E016 WITH 'Error scheduling Job'.
          ENDIF.
        Job close
          CALL FUNCTION 'JOB_CLOSE'
            EXPORTING
              JOBCOUNT                          = l_jobcount
              JOBNAME                           = l_jobname
              STRTIMMED                         = 'X'
           EXCEPTIONS
             CANT_START_IMMEDIATE              = 1
             INVALID_STARTDATE                 = 2
             JOBNAME_MISSING                   = 3
             JOB_CLOSE_FAILED                  = 4
             JOB_NOSTEPS                       = 5
             JOB_NOTEX                         = 6
             LOCK_FAILED                       = 7
             OTHERS                            = 8.
          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.
    *&      Form  bdc_output
          text
    -->  p1        text
    <--  p2        text
    FORM bdc_output USING    wa_cntrt  TYPE ty_cntrt
                    CHANGING l_retcode TYPE sy-subrc.
    DATA: l_nast TYPE TABLE OF nast,
           it_nast TYPE TABLE OF nast,
           w_nast TYPE nast,
           l_cellno(2) TYPE n,
           l_vbelv TYPE vbfa-vbelv,
           l_vbpa  TYPE vbpa,
           l_yes(1),
           l_temp(40) TYPE c,
           l_lines    TYPE i,
           l_lesscnt  TYPE i,
           l_less(1),
           l_lines1(2) TYPE n.
        REFRESH: it_nast, l_nast, it_bdc.
        CLEAR: l_nast, w_nast, l_yes, l_cellno,
               it_nast, l_nast, it_bdc.
        PERFORM dyn_scr USING 'SAPMV45A' '0102' 'X'.
          PERFORM dyn_fld USING 'VBAK-VBELN' wa_cntrt-vbeln.
          PERFORM dyn_fld USING 'BDC_OKCODE' '/00'.
        PERFORM dyn_scr USING 'SAPMV45A' '4001' 'X'.
          PERFORM dyn_fld USING 'BDC_OKCODE' '=HEAD'.
        PERFORM dyn_scr USING 'SAPMV45A' '4002' 'X'.
          PERFORM dyn_fld USING 'BDC_OKCODE' '=KDOK'.
        SELECT *
          FROM nast
          INTO CORRESPONDING FIELDS OF TABLE l_nast
         WHERE kappl = c_kappl
           AND objky = wa_cntrt-vbeln.
        IF sy-subrc = 0.
            SORT l_nast BY kschl vstat.
            DESCRIBE TABLE l_nast LINES l_lines.
            LOOP AT l_nast INTO w_nast.
                l_cellno = sy-tabix.
                IF w_nast-kschl = c_kschl AND w_nast-vstat = 0.
                  EXIT.
                ENDIF.
                IF w_nast-kschl > c_kschl OR
                   ( w_nast-kschl = c_kschl AND w_nast-vstat <> 0 ).
                   IF l_less = space.
                     l_cellno = l_cellno - 1.
                   ENDIF.
                   CLEAR l_less.
                  IF l_cellno = 0.
                     l_cellno = 1.
                  ENDIF.
                  l_lines = l_lines + 1.
                  l_lines1 = l_lines.
                  PERFORM dyn_scr USING 'SAPDV70A' '0100' 'X'.
                    CONCATENATE 'DNAST-KSCHL(' l_lines1 ')' INTO l_temp.
                    CONDENSE l_temp.
                    PERFORM dyn_fld USING l_temp 'Y6C4'.
                    CLEAR: l_temp, l_lines, l_lines1.
                    PERFORM dyn_fld USING 'BDC_OKCODE' '/00'.
                  EXIT.
                ELSEIF w_nast-kschl < c_kschl.
                  l_less = 'X'.
                  l_lesscnt = l_lesscnt + 1.
                ENDIF.
            ENDLOOP.
        ELSE.
            l_cellno = '01'.
            PERFORM dyn_scr USING 'SAPDV70A' '0100' 'X'.
              CONCATENATE 'DNAST-KSCHL(' l_cellno ')' INTO l_temp.
              CONDENSE l_temp.
              PERFORM dyn_fld USING l_temp 'Y6C4'.
              CLEAR l_temp.
              PERFORM dyn_fld USING 'BDC_OKCODE' '/00'.
        ENDIF.
        IF l_less = 'X'.
            l_lesscnt = l_lesscnt + 1.
                  l_cellno = l_lesscnt.
                  l_lines = l_lines + 1.
                  l_lines1 = l_lines.
                  PERFORM dyn_scr USING 'SAPDV70A' '0100' 'X'.
                    CONCATENATE 'DNAST-KSCHL(' l_lines1 ')' INTO l_temp.
                    CONDENSE l_temp.
                    PERFORM dyn_fld USING l_temp 'Y6C4'.
                    CLEAR: l_temp, l_lines, l_lines1.
                    PERFORM dyn_fld USING 'BDC_OKCODE' '/00'.
        ENDIF.
        PERFORM dyn_scr USING 'SAPDV70A' '0100' 'X'.
          CONCATENATE 'DV70A-SELKZ(' l_cellno ')' INTO l_temp.
          CONDENSE l_temp.
          PERFORM dyn_fld USING l_temp 'X'.
          CLEAR l_temp.
          PERFORM dyn_fld USING 'BDC_OKCODE' '=V70P'.
        PERFORM dyn_scr USING 'SAPDV70A' '0101' 'X'.
          PERFORM dyn_fld USING 'NAST-LDEST' p_print.
          PERFORM dyn_fld USING 'NAST-DIMME' 'X'.
          PERFORM dyn_fld USING 'NAST-TDARMOD' '1'.
          PERFORM dyn_fld USING 'BDC_OKCODE' '=V70B'.
        PERFORM dyn_scr USING 'SAPDV70A' '0100' 'X'.
          CONCATENATE 'DV70A-SELKZ(' l_cellno ')' INTO l_temp.
          CONDENSE l_temp.
          PERFORM dyn_fld USING l_temp 'X'.
          CLEAR l_temp.
          PERFORM dyn_fld USING 'BDC_OKCODE' '=V70I'.
        PERFORM dyn_scr USING 'SAPDV70A' '0102' 'X'.
          PERFORM dyn_fld USING 'NAST-VSZTP' '1'.
          PERFORM dyn_fld USING 'BDC_OKCODE' '=V70B'.
        PERFORM dyn_scr USING 'SAPDV70A' '0100' 'X'.
          PERFORM dyn_fld USING 'BDC_OKCODE' '=V70S'.
        CALL TRANSACTION c_tcode USING it_bdc
                                 MODE c_mode     "'N'
                                 UPDATE c_updat  "'A'
                                 MESSAGES INTO it_mesg.
        IF sy-subrc = 0.
          l_retcode = 0.
        ENDIF.
    ENDFORM.                    " bdc_output
    *&      Form  dyn_scr
          text
         -->P_0642   text
         -->P_0643   text
         -->P_0644   text
    FORM dyn_scr USING    P_0642
                          P_0643
                          P_0644.
        MOVE:  p_0642 TO wa_bdc-program,
               p_0643 TO wa_bdc-dynpro,
               p_0644 TO wa_bdc-dynbegin.
        APPEND wa_bdc TO it_bdc.
        CLEAR wa_bdc.
    ENDFORM.                    " dyn_scr
    *&      Form  dyn_fld
          text
         -->P_0654   text
         -->P_0655  text
    FORM dyn_fld USING    P_0654
                          P_0655.
       MOVE: p_0654 TO wa_bdc-fnam,
             p_0655 TO wa_bdc-fval.
       APPEND wa_bdc TO it_bdc.
       CLEAR wa_bdc.
    ENDFORM.                    " dyn_fld
    *&      Form  alv_sort
          text
    FORM alv_sort.
      DATA: wa_sortcat  TYPE slis_sortinfo_alv.
      WA_SORTCAT-SPOS      = 1.
      WA_SORTCAT-FIELDNAME = 'KUNNR'.
      WA_SORTCAT-UP        = 'X'.
      WA_SORTCAT-EXPA      = 'X'.
    Appending gd_sortcat-tabname
      APPEND WA_SORTCAT TO gs_sort.
      CLEAR wa_sortcat.
      WA_SORTCAT-SPOS      = 2.
      WA_SORTCAT-FIELDNAME = 'VBELN'.
      WA_SORTCAT-UP        = 'X'.
      WA_SORTCAT-EXPA      = 'X'.
    Appending gd_sortcat-tabname
      APPEND WA_SORTCAT TO gs_sort.
      WA_SORTCAT-SPOS      = 3.
      WA_SORTCAT-FIELDNAME = 'VUNTDAT'.
      WA_SORTCAT-UP        = 'X'.
      WA_SORTCAT-EXPA      = 'X'.
    Appending gd_sortcat-tabname
      APPEND WA_SORTCAT TO gs_sort.
    ENDFORM.                    " alv_sort

  • Upload XML to create and IDOC

    Hi all,
    does anybody use FM IDOC_XML_FROM_FILE?
    I don´t know how to use it?
    Please if somebody has a valid XML example for this FM post it here?
    Regards.
    Jose.
    Mensaje editado por:
            Jose Maria Alot Aguilar

    hi maria,
    here is the code tht i developed once ..let me know if you have any issue.
    *Program name: Z1SR_LOAD_CANON
    *Description: Program to Load PR from cannon.
    *Date/Author: 29-JUN-05 /syed
    *Table Updates: Listing of tables updated
    *Authority Check - < List if any authority checks in program>
    *Includes:
    *     M O D I F I C A T I O N  L O G
    Date        Programmer     SR #          Description
    29-JUN-05    syed     Proj WWIF    New Development
    20-SEP-05    syed      S0000563     Deley IDOC Creation     
    REPORT Z1SR_LOAD_CANON .
    DATA:BEGIN OF IT_FILES OCCURS 0,
            FILENAM LIKE EDI_PATH-PTHNAM,
          END OF IT_FILES.
    S E L E C T I O N   S C R E E N   &  C R I T E R I A
    PARAMETERS:
        P_INPUT(128) LOWER CASE DEFAULT
                             '/usr/sap/ahmo/data/inbound/wwif'.
                      S T A R T  O F  S E L E C T I O N                 *
    START-OF-SELECTION.
      PERFORM CHECK_BATCH_JOB.
      PERFORM GET_FILE_NAMES.
      PERFORM PROCESS_DATA.
    *&      Form  check_batch_job
          text
    -->  p1        text
    <--  p2        text
    FORM CHECK_BATCH_JOB .
      SELECT COUNT(*) FROM TBTCP WHERE
                        PROGNAME EQ SY-REPID AND
                        STATUS   EQ 'P'.
      IF SY-SUBRC = 0.
      ENDIF.
    ENDFORM.                    " check_batch_job
    *&      Form  get_file_names
          text
    -->  p1        text
    <--  p2        text
    FORM GET_FILE_NAMES .
      DATA: LOCPARAM(254),
            NAME(30),
            EXTENSION(10).
      DATA STDOUT(256) OCCURS 0 WITH HEADER LINE.
      REFRESH IT_FILES.
      CONCATENATE 'ls -l' P_INPUT INTO LOCPARAM SEPARATED BY SPACE.
      CALL FUNCTION 'RFC_REMOTE_PIPE' DESTINATION 'SERVER_EXEC'
        EXPORTING
          COMMAND               = LOCPARAM
          READ                  = 'X'
        TABLES
          PIPEDATA              = STDOUT
        EXCEPTIONS
          SYSTEM_FAILURE        = 1
          COMMUNICATION_FAILURE = 2.
      IF SY-SUBRC EQ 0.
        LOOP AT STDOUT.
          IF STDOUT(1) EQ '-'.
            MOVE STDOUT+58 TO IT_FILES-FILENAM.
            SPLIT IT_FILES-FILENAM AT '.' INTO NAME EXTENSION.
            IF EXTENSION = 'xml' OR EXTENSION = 'XML'.
              APPEND IT_FILES.
            ENDIF.
          ENDIF.
        ENDLOOP.
      ENDIF.
    ENDFORM.                    " get_file_names
    *&      Form  process_data
          text
    -->  p1        text
    <--  p2        text
    FORM PROCESS_DATA .
      CLEAR: IT_FILES.
      LOOP AT IT_FILES.
        PERFORM CONVERT_IDOC USING IT_FILES-FILENAM.
        WAIT UP TO 25 SECONDS.
      ENDLOOP.
    ENDFORM.                    " process_data
    *&      Form  convert_idoc
          text
    -->  p1        text
    <--  p2        text
    FORM CONVERT_IDOC USING FILENAME.
      DATA LOC_FILENAME LIKE EDI_PATH-PTHNAM.
      CONCATENATE P_INPUT '/' FILENAME INTO LOC_FILENAME SEPARATED BY
    SPACE.
      CONDENSE LOC_FILENAME NO-GAPS.
      CALL FUNCTION 'IDOC_XML_FROM_FILE'
        EXPORTING
          FILE_NAME                  = LOC_FILENAME
    EXCEPTIONS
      FILE_OPEN_FAILED           = 1
      READ_FILE_FAILED           = 2
      FILE_DELETE_FAILED         = 3
      EVENT_CREATE_FAILED        = 4
      PROLOG_ERROR               = 5
      SEGMENT_ERROR              = 6
      TAG_ERROR                  = 7
      CONTROL_RECORD_ERROR       = 8
      IDOC_NOT_STORED            = 9
      MARKER_TO_BE_DELETED       = 10
      MARKER_MODIFY_FAILED       = 11
      OTHERS                     = 12
      IF SY-SUBRC = 0.
        WRITE:/ 'IDOC Created'.
      ELSE.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " convert_idoc

  • 'F4IF_INT_TABLE_VALUE_REQUEST' is not returning any value when selecting da

    *Hello Guys.*
    *I hv inserted search help in an field of screen exit in T-code IW21. Its showing value properly when i press f4 but when selecting value its nt returning any value properly....*
    *I am pasting code ..please help me out*
    *. Process of value Request*
    *field <fieldname>  module F4_AGENCY*
    *MODULE F4_AGENCY INPUT.*
      *DATA: IT_AGENCY TYPE TABLE OF ZF4_AGENCY WITH HEADER LINE,*
            *it_FIELD_TAB      type table of DFIES WITH HEADER LINE,*
            *IT_DDSHRETVAL TYPE TABLE OF DDSHRETVAL WITH HEADER LINE.*
      *REFRESH : IT_AGENCY[].*
    *clear : VIQMEL-ZZAGENCY.*
    **SELECT * FROM ZF4_AGENCY INTO TABLE IT_AGENCY.**
      *CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'*
        *EXPORTING*
      DDIC_STRUCTURE           = 'ZF4_AGENCY'**
          *RETFIELD               = 'ZZAGENCY'*
        PVALKEY                 = ' '**
         *DYNPPROG                = sy-cprog  "'SAPLXQQM'*
         *DYNPNR                  = sy-dynnr   "'0101'*
         *DYNPROFIELD             = 'VIQMEL-ZZAGENCY'*
        STEPL                  = sy-stepl**
         *VALUE_ORG               = 'S'*
       *TABLES*
        *VALUE_TAB              = IT_AGENCY[]*
        *FIELD_TAB              = it_FIELD_TAB[]*
        *RETURN_TAB             =  IT_DDSHRETVAL[]*
      DYNPFLD_MAPPING        =**
    EXCEPTIONS**
      PARAMETER_ERROR        = 1**
      NO_VALUES_FOUND        = 2**
      OTHERS                 = 3**
      *IF SY-SUBRC <> 0.*
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO**
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.**
      *ENDIF.*
    *wating for any reply*

    Did you take a look at the help for FM? pass the hardcoded value for DYNPPROG and DYNNR (and see if that works)
    DYNPPROG and DYNNR cannot be passed as SY-REPID and SY-DYNNR because they are only analyzed after the function module has been called. Instead, first copy the SY fields to local variables and then pass them to the function module.

  • Add multilple PO's to already existing ALV report

    hello all,
    i have an ALV Report requirement like below...
    serno network no       activity no  service code service text   units purchase requisition num     PR item    PR qty   Agreement num Agrmt item Agremt qty
    1     410000001401     0020          SCL10051      ****          KM    19000000461                        1              20         56000000199      1                 200
    2     410000001401     0030          SCL10052      ****          EA    19000000461                         2              30         56000000199      1                 500
    now my question is i have Purchase Order and PO qty(which i ahve taken from EKPO)...
    for a given purchase requisition number there are multiple PO's (say 10 Po's)...
    how do i add these PO's to above ALV report....
    thanks in advance....

    Dear Vinay,
    Please use these piece of code...........
    These report contains sending Mail & As per your layout comment the sending mail codes and use for your requirement...........
    Paste in a test program and check these is sales order based report..........
    Built field catalog & and sort your PO number as per in the field output display and field catalog....................................
    * Type Group Declaration
    TYPE-POOLS: slis,vrm.
    *  Tables Declaration
    TABLES : vbak.
    *  Structure Declaration
    TYPES: BEGIN OF  ty_vbakvbap,
       vbeln  TYPE vbak-vbeln,
       kunnr  TYPE vbak-kunnr,
       netpr  TYPE vbap-netpr,
       posnr  TYPE vbap-posnr,
       matnr  TYPE vbap-matnr,
       kwmeng TYPE vbap-kwmeng,
       arktx  TYPE vbap-arktx,
    END OF ty_vbakvbap,
    gt_t_vbakvbap TYPE STANDARD TABLE OF ty_vbakvbap.
    TYPES : BEGIN OF ty_kna1,
       kunnr TYPE kna1-kunnr,
       name1 TYPE kna1-name1,
       pstlz TYPE kna1-pstlz,
       stras TYPE kna1-stras,
       ort01 TYPE kna1-ort01,
       land1 TYPE kna1-land1,
    END OF ty_kna1,
    gt_t_kna1 TYPE STANDARD TABLE OF ty_kna1.
    TYPES : BEGIN OF ty_mara,
       mbrsh TYPE mara-mbrsh,
       matnr TYPE mara-matnr,
       mtart TYPE mara-mtart,
       matkl TYPE mara-matkl,
    END OF ty_mara,
    gt_t_mara TYPE STANDARD TABLE OF ty_mara.
    TYPES : BEGIN OF ty_final,
       vbeln  TYPE vbak-vbeln,
       kunnr  TYPE vbak-kunnr,
       netpr  TYPE vbap-netpr,
       posnr  TYPE vbap-posnr,
       matnr  TYPE vbap-matnr,
       kwmeng TYPE vbap-kwmeng,
       arktx  TYPE vbap-arktx,
       name1 TYPE kna1-name1,
       pstlz TYPE kna1-pstlz,
       stras TYPE kna1-stras,
       ort01 TYPE kna1-ort01,
       land1 TYPE kna1-land1,
       mbrsh TYPE mara-mbrsh,
       mtart TYPE mara-mtart,
       matkl TYPE mara-matkl,
    END OF ty_final,
    gt_t_final TYPE STANDARD TABLE OF ty_final.
    * Internal Table Declaration
    DATA: gt_vbakvbap TYPE gt_t_vbakvbap,
           gw_vbakvbap  TYPE  ty_vbakvbap,
           gt_kna1      TYPE  gt_t_kna1,
           gw_kna1      TYPE  ty_kna1,
           gt_mara      TYPE  gt_t_mara,
           gw_mara      TYPE  ty_mara,
           gt_final     TYPE  gt_t_final,
           gw_final     TYPE  ty_final,
           gt_fcat      TYPE slis_t_fieldcat_alv,
           gw_fcat      TYPE slis_fieldcat_alv,
           v_kunnr      TYPE vbak-kunnr,
    * Sub total based on the header details Sales order no. vbeln = 5006.
           gt_sort TYPE slis_t_sortinfo_alv,
           gw_sort TYPE slis_sortinfo_alv,
          g_tab_lines TYPE i,
          e(10) TYPE c,
          gv_selected_value(10) TYPE c,
    * DOC AND VRM DETAILS.
           tab          TYPE TABLE OF ty_final.
    SELECTION-SCREEN  BEGIN OF BLOCK name WITH FRAME TITLE text-001.
    SELECT-OPTIONS : s_vbeln FOR vbak-vbeln DEFAULT '5006' TO '5009'.
    PARAMETERS     : p_kunnr TYPE kna1-kunnr.
    SELECTION-SCREEN  END OF BLOCK name.
    SELECTION-SCREEN  BEGIN OF BLOCK name1 WITH FRAME TITLE text-002.
    PARAMETERS     : r1 RADIOBUTTON GROUP gr1 USER-COMMAND c,
                      r2 RADIOBUTTON GROUP gr1.
    * Selection Screen for Radio button 2
    SELECTION-SCREEN
      BEGIN OF BLOCK name3 WITH FRAME TITLE text-004.
    SELECTION-SCREEN END OF BLOCK name3.
    SELECTION-SCREEN  END OF BLOCK name1.
    INITIALIZATION.
       LOOP AT SCREEN .
         IF screen-group1 = 'ONE' .
           screen-input   = 0.
           screen-invisible = 1.
           MODIFY SCREEN.
         ENDIF.
       ENDLOOP.
    AT SELECTION-SCREEN OUTPUT.
       CASE 'X'.
         WHEN r1.
           LOOP AT SCREEN.
             IF
               screen-group1 = 'ONE' .
               screen-input = 0.
               screen-invisible = 1.
               MODIFY SCREEN.
             ENDIF.
           ENDLOOP.
           ENDCASE.
    START-OF-SELECTION.
       PERFORM f_fetch_ty_vbakbvbap.
       PERFORM f_fetch_ty_kna1.
       PERFORM f_fetch_ty_mara.
       PERFORM f_fetch_ty_final.
       PERFORM top_of_page.
    * Body of the Email.
       PERFORM f_customer_validation.
       CASE 'X'.
         WHEN r1.
           IF gt_final IS NOT INITIAL.
             PERFORM f_field_catalog.
             PERFORM  f_output_display.
           ELSE.
             MESSAGE 'No Records Exist for the radio button' TYPE 'I'.
           ENDIF.
       ENDCASE.
    *&      Form  f_fetch_ty_vbakbvbap
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM f_fetch_ty_vbakbvbap .
       SELECT vbak~vbeln
       vbak~kunnr
       vbap~netpr
       vbap~posnr
       vbap~matnr
       vbap~kwmeng
       vbap~arktx
       INTO TABLE gt_vbakvbap
       FROM vbak
       INNER JOIN vbap
       ON vbak~vbeln = vbap~vbeln
        WHERE vbak~vbeln IN s_vbeln.
    ENDFORM.                    " f_fetch_ty_vbakbvbap
    *&      Form  f_fetch_ty_kna1
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM f_fetch_ty_kna1 .
       IF gt_vbakvbap[] IS NOT INITIAL.
         SELECT kunnr
         name1
         pstlz
         stras
         ort01
         land1
         INTO TABLE gt_kna1
         FROM kna1
         FOR ALL ENTRIES IN gt_vbakvbap
         WHERE kunnr = gt_vbakvbap-kunnr.
       ENDIF.
    ENDFORM.                    " f_fetch_ty_kna1
    *&      Form  f_fetch_ty_mara
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM f_fetch_ty_mara .
       IF gt_kna1[] IS NOT INITIAL.
         SELECT mbrsh
         matnr
         mtart
         matkl
         INTO TABLE gt_mara
         FROM mara
         FOR ALL ENTRIES IN gt_vbakvbap
         WHERE matnr = gt_vbakvbap-matnr.
       ENDIF.
    ENDFORM.                    " f_fetch_ty_mara
    *&      Form  f_fetch_ty_final
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM f_fetch_ty_final .
       SORT gt_kna1 BY kunnr.
       LOOP AT gt_vbakvbap INTO gw_vbakvbap.
         MOVE: gw_vbakvbap-vbeln  TO gw_final-vbeln,
         gw_vbakvbap-kunnr  TO gw_final-kunnr,
         gw_vbakvbap-netpr  TO gw_final-netpr,
         gw_vbakvbap-posnr  TO gw_final-posnr,
         gw_vbakvbap-matnr  TO gw_final-matnr,
         gw_vbakvbap-kwmeng TO gw_final-kwmeng,
         gw_vbakvbap-arktx  TO gw_final-arktx.
         READ TABLE gt_kna1 INTO gw_kna1 WITH KEY kunnr = gw_vbakvbap-kunnr BINARY SEARCH.
         IF sy-subrc = 0.
           MOVE:  gw_kna1-name1 TO gw_final-name1,
           gw_kna1-pstlz TO gw_final-pstlz,
           gw_kna1-stras TO gw_final-stras,
           gw_kna1-ort01 TO gw_final-ort01,
           gw_kna1-land1 TO gw_final-land1.
           READ TABLE gt_mara INTO gw_mara WITH KEY matnr = gw_vbakvbap-matnr.
           MOVE: gw_mara-mbrsh TO gw_final-mbrsh,
           gw_mara-mtart TO gw_final-mtart,
           gw_mara-matkl TO gw_final-matkl.
           APPEND gw_final TO gt_final.
           CLEAR gw_final.
         ENDIF.
       ENDLOOP.
    ENDFORM.                    " f_fetch_ty_final
    *&      Form  f_output_display
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM f_output_display .
       DATA:lv_repid TYPE sy-repid.
       lv_repid = sy-cprog.
       DATA:w_layout TYPE slis_layout_alv.
       w_layout-colwidth_optimize = 'X'.
       w_layout-zebra = 'X'.
       gw_sort-fieldname = 'VBELN'.
       gw_sort-tabname = 'GW_FINAL'.
       gw_sort-subtot = 'X'.
       APPEND gw_sort TO gt_sort.
       CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
    *   I_INTERFACE_CHECK                 = ' '
    *   I_BYPASSING_BUFFER                = ' '
    *   I_BUFFER_ACTIVE                   = ' '
          i_callback_program                = sy-cprog
    *   I_CALLBACK_PF_STATUS_SET          = ' '
          i_callback_user_command           = 'USER_COMMAND'
          i_callback_top_of_page            = 'TOP_OF_PAGE'
    *   I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
    *   I_CALLBACK_HTML_END_OF_LIST       = ' '
    *   I_STRUCTURE_NAME                  =
    *   I_BACKGROUND_ID                   = ' '
    *   I_GRID_TITLE                      =
    *   I_GRID_SETTINGS                   =
           is_layout                         = w_layout
          it_fieldcat                       = gt_fcat
    *   IT_EXCLUDING                      =
    *   IT_SPECIAL_GROUPS                 =
         it_sort                           = gt_sort
    *   IT_FILTER                         =
    *   IS_SEL_HIDE                       =
    *   I_DEFAULT                         = 'X'
    *   I_SAVE                            = ' '
    *   IS_VARIANT                        =
    *   IT_EVENTS                         =
    *   IT_EVENT_EXIT                     =
    *   IS_PRINT                          =
    *   IS_REPREP_ID                      =
    *   I_SCREEN_START_COLUMN             = 0
    *   I_SCREEN_START_LINE               = 0
    *   I_SCREEN_END_COLUMN               = 0
    *   I_SCREEN_END_LINE                 = 0
    *   I_HTML_HEIGHT_TOP                 = 0
    *   I_HTML_HEIGHT_END                 = 0
    *   IT_ALV_GRAPHICS                   =
    *   IT_HYPERLINK                      =
    *   IT_ADD_FIELDCAT                   =
    *   IT_EXCEPT_QINFO                   =
    *   IR_SALV_FULLSCREEN_ADAPTER        =
    * IMPORTING
    *   E_EXIT_CAUSED_BY_CALLER           =
    *   ES_EXIT_CAUSED_BY_USER            =
         TABLES
           t_outtab                          = gt_final
    * 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.
    ENDFORM.                    " f_output_display
    *&      Form  f_field_catalog
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM f_field_catalog .
       gw_fcat-fieldname = 'VBELN'.
       gw_fcat-tabname = 'GT_FINAL'.
       gw_fcat-seltext_m = 'Sales Order No'.
       APPEND gw_fcat TO gt_fcat.
       CLEAR gw_fcat.
       gw_fcat-fieldname = 'KUNNR'.
       gw_fcat-tabname = 'GT_FINAL'.
       gw_fcat-seltext_m = 'Customer Number'.
       APPEND gw_fcat TO gt_fcat.
       CLEAR gw_fcat.
       gw_fcat-fieldname = 'NETPR'.
       gw_fcat-tabname = 'GT_FINAL'.
       gw_fcat-seltext_m = 'Net Price'.
       gw_fcat-do_sum = 'X'.
       APPEND gw_fcat TO gt_fcat.
       CLEAR gw_fcat.
       gw_fcat-fieldname = 'POSNR'.
       gw_fcat-tabname = 'GT_FINAL'.
       gw_fcat-seltext_m = 'Item Number'.
       APPEND gw_fcat TO gt_fcat.
       CLEAR gw_fcat.
       gw_fcat-fieldname = 'MATNR'.
       gw_fcat-tabname = 'GT_FINAL'.
       gw_fcat-seltext_m = 'Material Number'.
       APPEND gw_fcat TO gt_fcat.
       CLEAR gw_fcat.
       gw_fcat-fieldname = 'KWMENG'.
       gw_fcat-tabname = 'GT_FINAL'.
       gw_fcat-seltext_m = 'Cumulative Order Quantity'.
       APPEND gw_fcat TO gt_fcat.
       CLEAR gw_fcat.
       gw_fcat-fieldname = 'ARKTX'.
       gw_fcat-tabname = 'GT_FINAL'.
       gw_fcat-seltext_m = 'Short text for sales '.
       APPEND gw_fcat TO gt_fcat.
       CLEAR gw_fcat.
       gw_fcat-fieldname = 'NAME1'.
       gw_fcat-tabname = 'GT_FINAL'.
       gw_fcat-seltext_m = 'Customer Name'.
       APPEND gw_fcat TO gt_fcat.
       CLEAR gw_fcat.
       gw_fcat-fieldname = 'PSTLZ'.
       gw_fcat-tabname = 'GT_FINAL'.
       gw_fcat-seltext_m = 'Postal Code'.
       APPEND gw_fcat TO gt_fcat.
       CLEAR gw_fcat.
       gw_fcat-fieldname = 'STRAS'.
       gw_fcat-tabname = 'GT_FINAL'.
       gw_fcat-seltext_m = 'House number and street'.
       APPEND gw_fcat TO gt_fcat.
       CLEAR gw_fcat.
       gw_fcat-fieldname = 'ORT01'.
       gw_fcat-tabname = 'GT_FINAL'.
       gw_fcat-seltext_m = 'City'.
       APPEND gw_fcat TO gt_fcat.
       CLEAR gw_fcat.
       gw_fcat-fieldname = 'LAND1'.
       gw_fcat-tabname = 'GT_FINAL'.
       gw_fcat-seltext_m = 'Country Key'.
       APPEND gw_fcat TO gt_fcat.
       CLEAR gw_fcat.
       gw_fcat-fieldname = 'MBRSH'.
       gw_fcat-tabname = 'GT_FINAL'.
       gw_fcat-seltext_m = 'Industry sector'.
       APPEND gw_fcat TO gt_fcat.
       CLEAR gw_fcat.
       gw_fcat-fieldname = 'MTART'.
       gw_fcat-tabname = 'GT_FINAL'.
       gw_fcat-seltext_m = 'Material Type'.
       APPEND gw_fcat TO gt_fcat.
       CLEAR gw_fcat.
       gw_fcat-fieldname = 'MATKL'.
       gw_fcat-tabname = 'GT_FINAL'.
       gw_fcat-seltext_m = 'Material Group'.
       APPEND gw_fcat TO gt_fcat.
       CLEAR gw_fcat.
    ENDFORM.                    " f_field_catalog

  • F4 hep for selection screen field

    Hello ,
    Im trying to create custom f4 help for Parameter ekbe-belnr by using below code. It displaying  F4 values for EKBE-belnr. But when i select any value in F4 hlep , its not displaying in Selection Field. How can i reflect selected value in to selection field.
    REPORT YMP.
    Parameter: p_belnr type ekbe-belnr.
    types: begin of tys_itab,
    belnr type ekbe-belnr,
    end of tys_itab.
    data: itab type table of tys_itab.
    at selection-screen on value-request for p_belnr.
    select belnr from bkpf into table itab .
    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
    DDIC_STRUCTURE =
    retfield = 'BELNR'
    PVALKEY = ' '
    DYNPPROG = Sy-repid
    DYNPNR = SY-DYNNR
    DYNPROFIELD = ' '
    STEPL = 0
    WINDOW_TITLE =
    VALUE = ' '
    VALUE_ORG = 'S'
    MULTIPLE_CHOICE = ' '
    DISPLAY = ' '
    CALLBACK_PROGRAM = ' '
    CALLBACK_FORM = ' '
    MARK_TAB =
    IMPORTING
    USER_RESET =
    tables
    value_tab = itab
    FIELD_TAB =
    RETURN_TAB =
    DYNPFLD_MAPPING =
    EXCEPTIONS
    PARAMETER_ERROR = 1
    NO_VALUES_FOUND = 2
    OTHERS = 3
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Thanks for ur time and help
    sanjana

    hi,
    <b>F4IF_INT_TABLE_VALUE_REQUEST</b>
           This FM is used to dsiplay values stored in an internal table as input
    help.This FM is used to program our own custom help if no such input help
    exists in ABAP dictionary for a particular field. The parameter VALUE_TAB is used to pass the internal table containing input values.The parameter RETFIELD
    is used to specify the internal table field whose value will be returned to the screen field or RETURN_TAB.
           If DYNPNR,DYNPPROG and DYNPROFIELD are specified than the user selection is passed to the screen field specified in the DYNPROFIELD. If RETURN_TAB is specified the selectionis returned in a table.
    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
           EXPORTING
                RETFIELD           = field from int table whose value will be returned
                DYNPPROG        = SY-CPROG
                DYNPNR             = SY-DYNNR
                DYNPROFIELD    = 'screen field'
                VALUE_ORG       = 'S'
           TABLES
                VALUE_TAB        = internal table whose values will be shown.
                RETURN_TAB      = internal table of type DDSHRETVAL 
           EXCEPTIONS
                parameter_error    = 1
                no_values_found   = 2
                others                  = 3.
    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
           retfield = 'BELNR'   " or belnr
           DYNPPROG = Sy-repid   " or SY-CPROG
           DYNPNR = SY-DYNNR
           DYNPROFIELD    = 'p_belnr'
           VALUE_ORG = 'S'
    tables
           value_tab = itab
    regards,
    Ashok Reddy

  • AUTHORITY-CHECK always Return sy-subrc 0

    Hi,
    I have created a Authorization Object  'ZAUTH_ATCH' and created Roles also. This role is assigned to only my Userid.
    When in Report program I do a check:
    AUTHORITY-CHECK OBJECT 'ZAUTH_ATCH'
             ID 'USER' FIELD l_syuname .
    But the AUTHORITY-CHECK return 0 for all User IDs.
    Pls help what could be the Issue.
    Thanks
    Mohammed

    Hi,
    May be you would need to change the auth object and add the following two fields:
    REPID        ABAP Program Name
    ACTVT      Activity
    allowed values for ACTVT :
                                 01     Create or generate
                                 02     Change
                                 03     Display
                                 16     Execute
    In the code you can check
    AUTHORITY-CHECK OBJECT   "OBJECT_NAME"
                          ID   'ACTVT'  FIELD '16'.
                          ID   'REPID'  FIELD sy-cprog.
    Hope it helps.
    Anju

  • What are the various system variabels in ABAP

    What are the various system variabels in ABAP?

    u can view all the system variables in SYST TABLE Also   ...............
    ABAP System Fields
    ABAP system fields are always available in ABAP programs. The runtime system fills them according to context. They can then be used in programs to query the system status. System fields are variables but you should always treat them as though they were constants, and only read them. If you change their values, important information for the flow of the program may be lost. In exceptional circumstances, system fields may be overwritten in an ABAP program to control the system – for example, SY-LSIND (for navigating to a detail list).
    With one exception the names and data types of the system fields are stored in the ABAP Dictionary in the SYST structure and realized as components of the predefined structure SY in ABAP programs.
    The system field SY-REPID is not part of SYST or SY. Instead, every program contains the predefined constants SY-REPID and SYST-REPID, which both contain the name of the corresponding program. Furthermore, there are two predefined types of the same name, SY-REPID and SYST-REPID.
    All system fields are addressed using SY field name and their types using SYST field name.
                                                                                    Alphabetical Overview
    The following table lists the definitions of the structure SYST in the ABAP Dictionary alphabetically. The character in the first column indicates how you can use the corresponding system field in ABAP programs. Name is the name of the component, Type is the Dictionary data type, and Length is the field length defined in the Dictionary. The Use column shows in which environment the system fields are set. The Description indicates the content.
    Name
    Type
    Length
    Use
    Description
    ABCDE
    CHAR
    26
    Constants
    Alphabet (A,B,C,...)
    APPLI
    RAW
    2
    Obsolete
    BATCH
    CHAR
    1
    Background processing
    Program runs in the background
    BATZD
    CHAR
    1
    Obsolete
    BATZM
    CHAR
    1
    Obsolete
    BATZO
    CHAR
    1
    Obsolete
    BATZS
    CHAR
    1
    Obsolete
    BATZW
    CHAR
    1
    Obsolete
    BINPT
    CHAR
    1
    Batch input
    Program runs under batch input
    BREP4
    CHAR
    4
    Obsolete
    BSPLD
    CHAR
    1
    Obsolete
    CALLD
    CHAR
    1
    ABAP Program
    Call mode of ABAP program
    CALLR
    CHAR
    8
    Printing Lists
    ID for print dialog function
    CCURS
    DEC
    9
    Obsolete
    CCURT
    DEC
    9
    Obsolete
    CDATE
    DATS
    8
    Obsolete
    CFWAE
    CUKY
    5
    Internal
    CHWAE
    CUKY
    5
    Internal
    COLNO
    INT4
    10
    Creating Lists
    Current column in the list
    CPAGE
    INT4
    10
    List processing
    Current page number
    CPROG
    CHAR
    40
    ABAP Program
    External procedure call
    CTABL
    CHAR
    4
    Obsolete
    CTYPE
    CHAR
    1
    Obsolete
    CUCOL
    INT4
    10
    Screens
    Horizontal cursor position at PAI
    CUROW
    INT4
    10
    Screens
    Vertical cursor position at PAI
    DATAR
    CHAR
    1
    Screens
    Displays user input
    DATLO
    DATS
    8
    Date and time
    Local date of user
    DATUM
    DATS
    8
    Date and time
    Current (application server) date
    DAYST
    CHAR
    1
    Date and time
    Daylight saving time flag
    DBCNT
    INT4
    10
    Database accesses
    Number of processed table rows
    DBNAM
    CHAR
    20
    ABAP Program
    Linked logical database
    DBSYS
    CHAR
    10
    R/3 System
    Name of central database system
    DCSYS
    CHAR
    4
    Obsolete
    DEBUG
    CHAR
    1
    Internal
    DSNAM
    CHAR
    8
    Internal
    DYNGR
    CHAR
    4
    ABAP Program
    Screen group of current screen
    DYNNR
    CHAR
    4
    ABAP Program
    Number of current screen
    ENTRY
    CHAR
    72
    Internal
    FDAYW
    INT1
    3
    Date and time
    Factory calendar weekday
    FDPOS
    INT4
    10
    Character strings
    Offset in character strings
    FFILE
    CHAR
    8
    Internal
    FLENG
    INT4
    10
    Internal
    FMKEY
    CHAR
    3
    Obsolete
    FODEC
    INT4
    10
    Internal
    FOLEN
    INT4
    10
    Internal
    FTYPE
    CHAR
    1
    Internal
    GROUP
    CHAR
    1
    Internal
    HOST
    CHAR
    8
    R/3 System
    Name of application server
    INDEX
    INT4
    10
    Loops
    Current loop pass
    INPUT
    CHAR
    1
    Internal
    LANGU
    LANG
    1
    R/3 System
    Current language
    LDBPG
    CHAR
    40
    ABAP Program
    Program of logical database
    LILLI
    INT4
    10
    List processing
    Selected list row
    LINCT
    INT4
    10
    Creating Lists
    Page length of list
    LINNO
    INT4
    10
    Creating Lists
    Current row
    LINSZ
    INT4
    10
    Creating Lists
    Column width of list
    LISEL
    CHAR
    255
    List processing
    Content of selected row
    LISTI
    INT4
    10
    List processing
    Index of selected list
    LOCDB
    CHAR
    1
    Obsolete
    LOCOP
    CHAR
    1
    Obsolete
    LOOPC
    INT4
    10
    Screens
    Number of rows visible in table
    LPASS
    CHAR
    4
    Internal
    LSIND
    INT4
    10
    List processing
    Index of detail list
    LSTAT
    CHAR
    16
    List processing
    ID for list levels
    MACDB
    CHAR
    4
    Obsolete
    MACOL
    INT4
    10
    Printing Lists
    Columns from SET MARGIN statement
    MANDT
    CLNT
    3
    R/3 System
    Client number from logon
    MARKY
    CHAR
    1
    Obsolete
    MAROW
    INT4
    10
    Printing Lists
    Rows from SET MARGIN statement
    MODNO
    CHAR
    1
    R/3 System
    Index of external modes
    MSGID
    CHAR
    20
    Messages
    Message class
    MSGLI
    CHAR
    60
    Messages
    Message line
    MSGNO
    NUMC
    3
    Messages
    Message number
    MSGTY
    CHAR
    1
    Messages
    Message type
    MSGV1
    CHAR
    50
    Messages
    Message variable
    MSGV2
    CHAR
    50
    Messages
    Message variable
    MSGV3
    CHAR
    50
    Messages
    Message variable
    MSGV4
    CHAR
    50
    Messages
    Message variable
    NEWPA
    CHAR
    1
    Internal
    NRPAG
    CHAR
    1
    Internal
    ONCOM
    CHAR
    1
    Internal
    OPSYS
    CHAR
    10
    R/3 System
    Operating system of application server
    PAART
    CHAR
    16
    Print parameters
    Print formatting
    PAGCT
    INT4
    10
    Obsolete
    PAGNO
    INT4
    10
    Creating Lists
    Current page:
    PAUTH
    NUMC
    2
    Internal
    PDEST
    CHAR
    4
    Print parameters
    Output device
    PEXPI
    NUMC
    1
    Print parameters
    Retention period
    PFKEY
    CHAR
    20
    Screens
    Current GUI status
    PLAYO
    CHAR
    5
    Internal
    PLAYP
    CHAR
    1
    Internal
    PLIST
    CHAR
    12
    Print parameters
    Name of spool request
    PNWPA
    CHAR
    1
    Internal
    PRABT
    CHAR
    12
    Print parameters
    Part of cover sheet
    PRBIG
    CHAR
    1
    Print parameters
    Selection cover page
    PRCOP
    NUMC
    3
    Print parameters
    Number of copies
    PRDSN
    CHAR
    6
    Print parameters
    Name of spool dataset
    PREFX
    CHAR
    3
    Obsolete
    PRI40
    CHAR
    1
    Internal
    PRIMM
    CHAR
    1
    Print parameters
    Print immediately
    PRINI
    NUMC
    1
    Internal
    PRLOG
    CHAR
    1
    Internal
    PRNEW
    CHAR
    1
    Print parameters
    New spool request
    PRREC
    CHAR
    12
    Print parameters
    Recipient
    PRREL
    CHAR
    1
    Print parameters
    Delete after print
    PRTXT
    CHAR
    68
    Print parameters
    Text for cover sheet
    REPI2
    CHAR
    40
    Internal
    REPID
    CHAR
    40
    ABAP Program
    Current main program
    RSTRT
    CHAR
    1
    Internal
    RTITL
    CHAR
    70
    Print parameters
    Title of printing program
    SAPRL
    CHAR
    4
    R/3 System
    Release status R/3 System
    SCOLS
    INT4
    10
    Screens
    Number of columns
    SFNAM
    CHAR
    30
    Obsolete
    SFOFF
    INT4
    10
    Internal
    SLSET
    CHAR
    14
    Selection screens
    Name of variant
    SPONO
    NUMC
    10
    Printing Lists
    Spool number
    SPONR
    NUMC
    10
    Obsolete
    SROWS
    INT4
    10
    Screens
    Number of rows
    STACO
    INT4
    10
    List processing
    First displayed column
    STARO
    INT4
    10
    List processing
    Uppermost displayed row
    STEPL
    INT4
    10
    Screens
    Index of current table row
    SUBCS
    CHAR
    1
    Internal
    SUBRC
    INT4
    10
    Return value
    Return value after ABAP statement
    SUBTY
    RAW
    1
    Internal
    SYSID
    CHAR
    8
    R/3 System
    Name of R/3 System
    TABID
    CHAR
    8
    Internal
    TABIX
    INT4
    10
    Internal Tables
    Current row index
    TCODE
    CHAR
    20
    ABAP Program
    Current transaction code
    TFDSN
    CHAR
    8
    Obsolete
    TFILL
    INT4
    10
    Internal Tables
    Current number of rows
    TIMLO
    TIMS
    6
    Date and time
    Local time of user
    TITLE
    CHAR
    70
    Screens
    Text in header line
    TLENG
    INT4
    10
    Internal Tables
    Row size
    TLOPC
    INT4
    10
    Internal
    TMAXL
    INT4
    10
    Obsolete
    TNAME
    CHAR
    30
    Obsolete
    TOCCU
    INT4
    10
    Obsolete
    TPAGI
    INT4
    10
    Obsolete
    TSTIS
    INT4
    10
    Internal
    TTABC
    INT4
    10
    Obsolete
    TTABI
    INT4
    10
    Obsolete
    TVAR0
    CHAR
    20
    Creating Lists
    Text variable for headers
    TVAR1
    CHAR
    20
    Creating Lists
    Text variable for headers
    TVAR2
    CHAR
    20
    Creating Lists
    Text variable for headers
    TVAR3
    CHAR
    20
    Creating Lists
    Text variable for headers
    TVAR4
    CHAR
    20
    Creating Lists
    Text variable for headers
    TVAR5
    CHAR
    20
    Creating Lists
    Text variable for headers
    TVAR6
    CHAR
    20
    Creating Lists
    Text variable for headers
    TVAR7
    CHAR
    20
    Creating Lists
    Text variable for headers
    TVAR8
    CHAR
    20
    Creating Lists
    Text variable for headers
    TVAR9
    CHAR
    20
    Creating Lists
    Text variable for headers
    TZONE
    INT4
    10
    Date and time
    Time difference to Greenwich Mean Time
    UCOMM
    CHAR
    70
    Screens
    Function code that triggered PAI
    ULINE
    CHAR
    255
    Constants
    Horizontal line with length 255
    UNAME
    CHAR
    12
    R/3 System
    Logon name of user
    UZEIT
    TIMS
    6
    Date and time
    Current (application server) time
    VLINE
    CHAR
    1
    Constants
    Vertical line
    WAERS
    CUKY
    5
    Obsolete
    WILLI
    INT4
    10
    Obsolete
    WINCO
    INT4
    10
    Obsolete
    WINDI
    INT4
    10
    Obsolete
    WINRO
    INT4
    10
    Obsolete
    WINSL
    CHAR
    79
    Obsolete
    WINX1
    INT4
    10
    Obsolete
    WINX2
    INT4
    10
    Obsolete
    WINY1
    INT4
    10
    Obsolete
    WINY2
    INT4
    10
    Obsolete
    WTITL
    CHAR
    1
    Creating Lists
    Flag for standard page header
    XCODE
    CHAR
    70
    Internal
    XFORM
    CHAR
    30
    Internal
    XPROG
    CHAR
    40
    Internal
    ZONLO
    CHAR
    6
    Date and time
    Time zone of user
    Key:
    The system field is set by the runtime environment. Its content can be evaluated in the ABAP program but not changed.
    The system field is set by the runtime environment. Its content can be changed in the ABAP program to influence the runtime environment.
    The system field must be set in the ABAP program. It can then be evaluated by the runtime environment or the program.
    The system field is only for internal use and must not be used in ABAP programs.
    The system field is obsolete and its content is not set. It cannot be used in ABAP programs.
                                                                                    Thematic Overview
    The following is a thematic summary of the system fields with notes on their use:
    System information
    ·        Information on the current R/3 System
    ·        Information on the user session
    ·        Date and time information
    ·        Information on the current ABAP program
    ·        Background processing
    ·        Batch input
    ABAP programming
    ·        Constants
    ·        Character strings
    ·        Loops
    ·        Internal Tables
    ·        Database accesses
    ·        Return value
    Screens
    ·        Screens
    ·        Selection screens
    ·        Lists
    ·        Messages
    Internal system fields
    Obsolete system fields
                                                                                    System Information
    Information on the Current R/3 System
    SY-DBSYS
    Central database system, for example INFORMIX, ORACLE
    SY-HOST
    Application server, for example HS0333, PAWDF087
    SY-OPSYS
    Operating system of application server, for example HP-UX, SINIX
    SY-SAPRL
    Release status of R/3 System, for example 30D, 46A
    SY-SYSID
    Name of R/3 System, for example B20, I47
    Information on the User Session
    SY-LANGU
    One-digit language key, for example D, E, F. Either logon language of user or set using the SET LOCALE LANGUAGE statement.
    SY-MANDT
    Client number the user logged on with, for example 000, 400.
    For database accesses with Open SQL, SY-MANDT is used as the first key field of the WHERE clause.
    SY-MODNO
    Indexes external modes. Zero in first mode. In new modes, opened using the Create Mode function or by calling a transaction using /o, it is raised by 1. If previous modes were deleted, the free numbers are used first. Modes opened using  CALL TRANSACTION … STARTING NEW TASK start back at 0.
    SY-UNAME
    Logon name of user, for example KELLERH, BC400-01.
    Date and Time Information
    The following system fields are always set automatically. If necessary, the GET TIME statement synchronizes the application server time with that of the database server and writes it to the system field SY-UZEIT. SY-DATUM and the system fields for the local time zone, that is SY-TIMLO, SY-DATLO, and SY-ZONLO are also reset.
    SY-DATLO
    Local date of user, for example 19981129, 19990628.
    SY-DATUM
    Current (application server) date, for example 19981130, 19990627.
    SY-DAYST
    During daylight saving time X, otherwise empty.
    SY-FDAYW
    Factory calendar weekday, Sunday 0 … Saturday 6.
    SY-TIMLO
    Local time of user, for example 154353, 225312.
    SY-TZONE
    Time difference to Greenwich Mean Time (UTC) in seconds, for example 3600, 10800.
    SY-UZEIT
    Current (application server) time, for example 164353, 215312.
    SY-ZONLO
    Time zone of user, for example CET, UTC.
    Information on the Current ABAP Program
    SY-CALLD
    SY-CALLD contains SPACE if the program is the first and only program in a call chain. SY_CALLD contains 'X' if the program is a called program in a call chain (see ABAP Calls Overview).
    ·        SY-CALLD is set to ‘X‘ in a program called using CALL TRANSACTION, CALL DIALOG, or SUBMIT … AND RETURN.
    ·        SY-CALLD is set to SPACE in a program called using LEAVE TO TRANSACTION, entering a transaction code on a screen, and processing batch input folders. 
    ·        With SUBMIT (without RETURN) SY-CALLD retains the previous value.
    SY-CPROG
    In externally called procedures, the name of the calling program, otherwise the name of the current program. If an externally called procedure calls another external procedure, SY-CPROG keeps the name of the first main program and is not given the name of the main program of the further caller.
    SY-DBNAM
    With executable programs this is the linked logical database.
    SY-DYNGR
    Screen group of current screen. You can assign several screens to a common screen group. You can use this, for example, to modify all of the screens in the group in a uniform way.
    SY-DYNNR
    Number of current screen During the selection screen processing, SY-DYNNR contains the screen number of the current selection screen. During list processing, SY-DYNNR contains the number of the container screen. While a subscreen is being processed, SY-DYNNR contains its screen number. This also applies to tabstrips.
    SY-LDBPG
    With executable programs, the database program of the linked logical database.
    SY-REPID
    Name of current ABAP program. With externally called procedures this is the name of the procedure’s main program.
    If SY-REPID was transferred to an external procedure as an actual parameter before Release 6.10, the formal parameter was not given the name of the caller, but the name of the procedure’s main program. SY-REID had to be transferred to an auxiliary variable before the call or you had to use SY-PROG.
    As of Release 6.10, SY-REPID is a separate constant that is no longer part of the structure SYST or SY. It can be transferred to external procedures directly.
    SY-TCODE
    Name of current transaction code.
    Background Processing
    SY-BATCH
    SY-BATCH is set to X in an ABAP program running in the background. Otherwise it is empty.
    Batch Input
    SY-BINPT
    SY-BINPT is set to X during processing of batch input folders and in ABAP programs called with CALL TRANSACTION USING. Otherwise it is empty.
    ·         OPTIONS FROM in the CALL TRANSACTION USING statement can set SY-BINPT to empty for the whole program execution, as well as at the end of the BDC data.
    ·         In CATT procedures, SY-BINPT is always empty.
                                                                                    ABAP Programming
    Constants
    SY-ABCDE
    Contains the Alphabet. Can be used to access individual letters independently of the codepage by specifying offset.
    SY-ULINE
    Contains a horizontal line with length 255. Can be used when creating the list.
    SY-VLINE
    Contains a vertical line (|). Can be used when creating the list
    Loops
    SY-INDEX
    SY-INDEX contains the number of loop passes in DO and WHILE loops, including the current loop pass.
    Character Strings
    SY-FDPOS
    Found location for operations with character-type fields.
    ·        If the operators CO, CN, CA, NA, CS, NS, CP, NP are used in comparisons, SY-FDPOS is assigned offset values depending on the comparison result.
    ·        SEARCH … FOR … sets SY-FDPOS to the offset of the found search string.
    Internal Tables
    SY-TABIX
    Current line in an internal table. With the following statements SY-TABIX is set for index tables. With hashed tables, SY-TABIX is not filled or it is set to 0.
    ·        APPEND sets SY-TABIX to the index of the last table row, that is the total number of entries in the target table.
    ·        COLLECT sets SY-TABIX to the index of the existing or appended table row. With hashed tables, SY-TABIX is set to 0.
    ·        LOOP AT sets SY-TABIX to the index of the current table row at the beginning of every loop pass. After leaving a loop, SY-TABIX is set to the value it had before entering the loop. With hashed tables, SY-TABIX is set to 0.
    ·        READ TABLE sets SY-TABIX to the index of the table row read. If no row is found with binary search while reading, SY-TABIX contains the index of the next-highest row or the total number of rows +1. If no row is found with linear search while reading, SY-TABIX is undefined.
    ·        SEARCH  0). Each time an interactive list event occurs, the system automatically increases SY-LSIND by 1. SY-LSIND can be changed in the ABAP program to navigate between detail lists. Changes to SY-LSIND are not taken into account until the end of the list event. Therefore, any manipulation of SY-LISND should be done using the last command of the processing block.
    SY-LSTAT
    ID for list levels within the program. SY-LSTAT can be filled with values during list creation in the ABAP program. The value valid when the list is completed is saved with the list. In the case of an interactive list event, SY-LSTAT is set to the value it was assigned during the creation of the list from which the event takes place. SY-LSTAT is no longer maintained and should therefore no longer be used.
    SY-STACO
    Number of the first displayed column of the list from which the event was triggered. Counting starts at 1.
    SY-STARO
    Number of the upper-most displayed row of the upper-most page of the list, from which the event was triggered. Counting begins at 1. This does not include the page header.
    Printing Lists
    When printing lists, the spool and runtime systems require certain internal information, which is available in the following system fields and is set during print activation.
    SY-CALLR
    Contains a value that displays where printing was started, for example NEW-PAGE for program-controlled printing or RSDBRUNT for printing from the selection screen.
    SY-PRDSN
    Contains the name of the spool file during printing.
    SY-SPONO
    Contains the name of the spool number during printing.
    SY-MAROW, SY-MACOL
    The SET MARGIN statement fills the system fields SY-MAROW and SY-MACOL, which determine the number of lines on the upper margin and the number of columns on the left margin when printing.
    Print Parameters
    The print parameters are transferred to the spool system by the runtime system in a structure of dictionary type PRI_PARAMS. Before this structure was used, its purpose was served by system fields. Today a subset of the PRI_PARAMS structure is still written to system fields with the same names when printing is activated. This information is redundant and should not be used.
    Messages
    If you execute the MESSAGE statement, the following system fields are set. If you execute the MESSAGE … RAISING statement in function modules and methods, these fields are also set in the calling program, if it handles the exception.
    SY-MSGID
    SY-MSGID contains the message ID.
    SY-MSGNO
    SY-MSGNO contains the message number.
    SY-MSGTY
    SY-MSGTY contains the message type.
    SY-MSGV1,…,SY-MSGV4
    SY-MSGV1 to SY-MSGV4 contain the field contents that are used for the message’s placeholders. 
    Special Actions that Fill Message Fields
    ·        If you request database locks using the ENQUEUE function module, the field SY-MSGV1 contains the name of the user who holds the lock, in the case of the FOREIGN_LOCK exception.
    ·        IN the case of CALL TRANSACTION or CALL DIALOG with the USING addition, a message displayed during the called screen sequence is returned in the fields SY-MSGID, SY-MSGTY, SY-MSGNO, SY-MSGV1, ... , SY-MSGV4.
    ·        During Remote Function Call (RFC), error messages are transferred from the remote system to the calling system and SY-MSGID, SY-MSGTY, SY-MSGNO,SY-MSGV1, SY-MSGV2, SY-MSGV3, SY-MSGV4 are set. If short dumps or type X messages occur, the system also sets the fields.
                                                                                    Internal System Fields
    Internal system fields are only for internal use in the ABAP runtime environment and are defined in the kernel. Under no circumstances must they be overwritten in ABAP programs and they should also not be read (processed).
    SY-CFWAE
    Undocumented
    SY-CHWAE
    Undocumented
    SY-DEBUG
    Undocumented
    SY-DSNAM
    Name of spool output file.

  • More than one print program for one sap script

    Hi Experts,
    I have more than one print program which is attached to one sap script. There is standard text used in the script which has variable as date, i want that date to be converted into the previous date but only for one specific print program. For rest of the print program it should behave as it is.
    I have tried it using ( s_date - 1 ) formula and it is working fine. But the variable s_date is used in other parts of the program which is affecting rest of the functionality when i am using above said formula. I can't use other variable in standard text as it is used by other programs.
    Please guide me to resolve this, thanks in advance.

    Well, I'm not sure if I understand the scenario 100%, but I think what you have is a standard text (that you cannot change) referring to variable &S_DATE&. You want this to display the previous day's date when the form is used by one print program but not when it's called by another.
    Also, you don't want to change S_DATE to S_DATE - 1 for the whole printout, because apart from the text display, S_DATE is used elsewhere and you want to keep the date as S_DATE, not the previous day.
    I assume that you can change the coding of the form.
    If all of the above is correct, then you could change the value for S_DATE in the form to the previous day just before it calls the standard text and change it back after the output of the text is done. So right befor the INCLUDE for the standard text, you could use an IF statement in the form logic, query the value of SY-REPID (or SY-CPROG). You'll have to test which one shows the print program name. Depending on that, you can do S_DATE = S_DATE - 1 and after the INCLUDE, do the same thing and change it back to S_DATE = S_DATE + 1.
    But honestly, this is a pretty shady programming technique... I mean, hard coding references to the print program name in the form logic is certainly not a very clean method

  • RH_UPDATE_INFTY

    Hello,
    Can someone resolve this problem, like you can see, I am using RH_UPDATE_INFTY to update an infotype and I always have the same error message : REPID_FORM_INITIAL  what that mean ? What is the solution ?
    Thanks experts.
    DATA: li_schedule LIKE p1035 OCCURS 0 WITH HEADER LINE,
    lw_schedule LIKE LINE OF li_schedule.
    li_schedule-plvar = lw_course-plvar.
    li_schedule-otype = lw_course-otype.
    li_schedule-objid = lw_course-objid.
    li_schedule-begda = lw_course-begda.
    li_schedule-endda = lw_course-endda.
    li_schedule-infty = '1035'.
    li_schedule-ndays = '3'.
    li_schedule-nhours = '10'.
    Append li_schedule.
    CALL FUNCTION 'RH_UPDATE_INFTY'
    EXPORTING
    vtask ='S'
    * ORDER_FLG = 'X'
    * COMMIT_FLG = 'X'
    * AUTHY = 'X'
    * PPPAR_IMP =
    * OLD_TABNR_NEW_LANGU = ''
    * REPID = ' '
    * FORM = ' '
    * KEEP_LUPD =
    * WORKF_ACTV = 'X'
    tables
    innnn = li_schedule
    * ILFCODE =
    * EXCEPTIONS
    * ERROR_DURING_UPDATE = 1
    * NO_AUTHORIZATION = 2
    * REPID_FORM_INITIAL = 3
    * CORR_EXIT = 4
    * OTHERS = 5
    IF sy-subrc 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.

    Hi,
       Give REPID as SY-CPROG  and
           FORM as Space
    Try with these, will check out and let u know more

  • How to get names of INCLUDE or FORM within included forms

    Hello,
    I want to get names of Include program and included form within included forms.
    I tried SY-REPID or SY-CPROG but these two SYST variables return the name of report program that performs the form, not the name of Include or form.
    Please give me any advice about how to get names of include / included form.
    thanks and regards,
    Hozy

    You can use the statement
    READ REPORT <Report name> into itab
    to read the source code into an internal table.
    Later you can use the "Contains Pattern" operator to get the statements that you need.

  • IF Statement Peformance Question

    I have an abap program that performs 20% better with a simple change in the structure of the if statement.  Anyone got any explaination why this would be so?  I would really appreciate any insight into this.
    This code:
    IF sy-tcode IN r_order_tcodes.
    ...some logic #1....
    ELSEIF sy-batch EQ 'X' OR
           ( sy-cprog = 'ZSR_ECAT_GENERATE_V3' ).
    ...some logic #1....
    ENDIF.
    executes 20% faster than this code:
    IF sy-tcode IN r_order_tcodes OR
       sy-tcode IN r_ecat_tcodes OR
       ( sy-batch EQ 'X' AND
       ( sy-cprog EQ 'ZSR_GENERATE_ECAT_V3' OR
         sy-cprog EQ 'ZSR_ECAT_SINGLE_CONFIG'
      ...some logic #1...
    endif.
    Thanks.
    Scott

    Hi,
    I believe the tcodes in r_order_tcodes and r_ecat_tcodes will have the same programs given in the else condition...
    Looks like This following simple IF statement will work for all the scenarios..
    Try this..
    IF SY-CPROG = 'ZSR_GENERATE_ECAT_V3' OR
        SY-CPROG =  'ZSR_ECAT_SINGLE_CONFIG'.
    ...some logic #1....
    ENDIF.
    Thanks,
    Naren

Maybe you are looking for

  • How can I use photos in FCEHD?

    How can I use photos in FCEHD? (I'm new to the thing - done just one video project so far). When I imported photos from Aperture (first into the folder on desktop, and then from desktop to the Browser in FCEHD3.5, the photos have a black bar/a gray s

  • Drop down in dynamic table in the Adobe Interactive Form (Web dynpro ABAP)

    Hi All, I have scenario use drop down in dynamic table in the adobe interactive form (Using the button the dynamic table row will be increasing and decreasing). Assume I Add five rows dynamically in the dynamic table. The Last column contains Drop do

  • PO pending for Approval   -   tobe sent as mail for Approver (intimation)

    Hi , PO tobe relased tobe sent(Intimated )  as mail for Approver what are the options for configuring this . With Rgds, Krishna. Edited by: Krishna L on May 27, 2011 3:28 PM

  • Problem in designing Adobe forms

    Hi All, I have designed an Adobe form. It is working properly. Now if i am trying to resize the text fields or try to change the properties of the fields, a new page gets inserted  before 1st page. Regards,

  • Please help me my HD is locked

    i have used the device and i went to a website and seems i got hackers on my HARD DISK i tried to open but i couldn't after searching i tried command+R and it help me and it open the utlitly disk and i went there and i erased some of i don't know wha