Syntax error in routine

Hi Gurus,
    I have added new fields in ODS  and Cube.While activating transformation I am getting the following error : 'Start routine:Syntax error in routine'Please let me know how to trouble shoot the same.
Regards
Hasini

Hi Pallavi,
Pls gothroug the Routine:
MONITOR_RECNO.
Runtime attributs
    SOURCE_SYSTEM  = p_r_request->get_logsys( ).
Migrated update rule call
  Perform routine_9998
  TABLES
    SOURCE_PACKAGE
  CHANGING
    l_abort.
*-- Convert Messages in Transformation format
    LOOP AT MONITOR_RECNO INTO ls_monitor_recno.
      move-CORRESPONDING ls_monitor_recno to MONITOR_REC.
      append monitor_rec to MONITOR.
    ENDLOOP.
    LOOP AT MONITOR INTO ls_monitor.
      move-CORRESPONDING ls_monitor to MONITOR_REC.
      append monitor_rec to MONITOR.
    ENDLOOP.
    IF l_abort <> 0.
      RAISE EXCEPTION TYPE CX_RSROUT_ABORT.
    ENDIF.
$$ end of routine - insert your code only before this line         -
  ENDMETHOD.                    "start_routine
      Method inverse_start_routine
E:In PERFORM or CALL FUNCTION "ROUTINE_9998", the actual parameter
SOURCE_PACKAGE" is incompatible with the formal parameter
"DATA_PACKAGE".
Regards
Hasini

Similar Messages

  • Start Routine: Syntax error in routine 2LIS_03_BF Transformations

    Hi experts,
    I enhanced the 2lis_03_bf data source, and replicated the data source in bw system, i have mapped the transformations and when i try to activate the transformations it is giving the below error.
    Start Routine: Syntax error in routine
    when i check the start routine it is giving the  below error message.
    E:In PERFORM or CALL FUNCTION "ROUTINE_9998", the actual parameter
    "SOURCE_PACKAGE" is incompatible with the formal parameter
    "DATA_PACKAGE".
    please provide me the solution.
    Regards
    venuscm

    Hi Venu,
    This seems to me like you have earlier migrated the update rules to transformations. We did the same earlier and faced issues whenever we add new fields/infoobjects. The error message was different, if i remember correctly.
    We had to add the new field/infoobject added, to the structure '_ty_s_*****' that exists at the top of the start routine code. This was one disadvantage of migration of rules.

  • Syntax Error in Routine while Activating Transformation

    Dear All,
    I am activating whole scenario for 0SD_C03. we have made transformation for 2lis_11_vaitm, during installation we get below errors:
    - Rule (target: 0SUBTOT_1S, group: 01 Standard Group): Syntax error in routine
    -Rule (target: 0NET_VAL_S, group: 01 Standard Group): Syntax error in routine
    -Rule (target: 0PROD_CATEG, group: 01 Standard Group): Syntax error in routine
    I really appreciate your any input for this.
    Thanks & Regards,
    Darshan

    Hi,
    I hope there is inbalance in between SOURCE Datapackage and Target Datapackage. So in the start routines pls check it and it not found then add in DATA_PACKAGE...
    Check with ABAPer
    under ,
    TYPES:
          BEGIN OF tys_TG_1_full,
            SUBTOT_1S           TYPE /BI0/OISUBTOT_1S,
    and also you can fin dsimilar kind of threads in SDN.
    Re: Syntax Error in Routine while Activating Transformation
    Re: Issue while creating Transformation from Update rule.
    Re: 0IC_C03 activation of Transformation rule ends with ERROR
    Re: Error in activation of transformation
    Thanks
    Reddy

  • Error while transporting Transformation: Syntax error in Start Routine

    Hi Everyone,
    I'm facing a strange problem during transporting one of the Business Content cubes from Dev. to Quality.
    I'd activated the DSO 'Purchase Order Items (0PUR_O01)' and its entire data flow from the 4 datasources 2LIS_02_CGR, 2LIS_02_SCN, 2LIS_02_SGR, and 2LIS_02_ITM from BC. Then I migrated the Transfer/Update rules to transformations and the DataSources to BI7 DataSource. So far so good. The migration was successful and all the objects were activated.
    Now when I transport the same to Quality, the import fails with return code 8 and the error message says:
    'Start of the after-import method RS_TRFN_AFTER_IMPORT for object type(s) TRFN (Activation Mode)'
    'Start Routine: Syntax error in routine'
    I verified that the transformation where the error orrured was the one from InfoSource Z2LIS_02_ITM to DSO 0PUR_O01. I went and checked the start routine and it did indeed have a syntax error:
    'In PERFORM or CALL FUNCTION "ROUTINE_9998", the actual parameter SOURCE_PACKAGE" is incompatible with the formal parameter DATA_PACKAGE". '
    But when I check in the Dev. system, there is no syntax error for the same routine. Later, I tried to transport only the said transformation by re-activating it in Dev, and again I got the same error.
    I have no idea why I'm getting a syntax error in the start routine when there are non in the Dev. system. Also none of the coding is customised, it was only the BC code, migrated to a transformation.
    Any suggestions on the steps I could take to transport the transformation to my quality system?
    Thanks,
    Ram

    Hi Ajay, Shanthi, svu and Ray
    I do indeed have a start routine in my transformation and it was migrated from a 3.x update rule to a BI 7 transformation routine.
    The migration was successful and the Start Routine has NO syntax errors in the start routine in the Dev. system. I only encounter the error while transporting it to the Quality system. I cannot modify the code in the Quality system because it is non-changelable and there is no point in trying to change the code in Dev. because there are no errors over there.
    I've also made sure that I've transported all the necessary objects required by the transformations to quality. The routine does not perform a lookup, it simply deletes some records from the data package based on the processkey value (which is itself present in the data package).

  • Syntax error in start routine

    Dear All,
    I have activated the infocube 0sd_c03 with grouping "in data flow before" and the infocube is activated with datasources
    2LIS_11_VAITM
    2LIS_11_VAHDR
    2LIS_12_VCITM
    2LIS_12_VCHDR
    2LIS_13_VDITM
    2LIS_13_VDHDR in 3.x where as
    TRCS 2LIS_13_VDITM -> CUBE 0SD_C03 in transformation with DTP.
    when I activate the transformation I get error as mentioned below:
    Start Routine: Syntax error in routine and in the start routine when I check the details of the error is
                      E:In PERFORM or CALL FUNCTION "ROUTINE_9998", the actual parameter
                               "SOURCE_PACKAGE" is incompatible with the formal parameter
                                   "DATA_PACKAGE".
    If source pakage is replaced by data package the system message is data_package is not available.
    What do I do to resolve this issue.
    KS

    hi,
    There is a structral diffrence between SOURCE_PACKAGE and DATA_PACKAGE
    so you need to change tys_SC_1_full
    go through the below links for similar problem
    Re: 0IC_C03: 2LIS_03_BF Transformation Start Routine Activation error
    Re: 2LIS_03_BF transformation problem

  • Data Source 0HR_PA_0 Syntax Error in the start routine while activating

    Hi All,
    I have migrated the Business content for the data source 0HR_PA_0
    While activating the transformation-2 there is errors like:
    Start Routine: Syntax error in routine
    Rule (target: 0HDCNT_LAST, group: 01 Standard Group): Syntax error in routine
    Rule (target: 0AGE_KYF, group: 01 Standard Group): Syntax error in routine
    .................... etc
    I need help to resolve this issue.
    Thanks & Regards,
    Savitha

    Hello Jurgita,
    When Data Source was migrated the codes related to COMM_STRUCTURE was missing in the start routinue.
    Following codes (in bold) with regard to COMM_STRUCTURE added and then got activated
    4.     *--
    5.         COMM_STRUCTURE   type tys_sc_1__rule_25,
    6.         l_subrc          type sy-tabix,
    7.         l_abort          type sy-tabix,
    8.         ls_monitor       TYPE rsmonitor,
    9.         ls_monitor_recno TYPE rsmonitors.
    10.     
    11.       REFRESH:
    12.         MONITOR.
    13.     
    14.     * Runtime attributs
    15.         SOURCE_SYSTEM  = p_r_request->get_logsys( ).
    16.         move-corresponding SOURCE_FIELDS to COMM_STRUCTURE.
    17.     
    18.     *  Migrated update rule call
    19.       Perform routine_0011
    20.       using
    21.         COMM_STRUCTURE
    22.       CHANGING
    Regards,
    Savitha
    Edited by: Savitha  Ravi on Jun 19, 2009 6:34 AM

  • Syntax error  while executing Key Figure routine

    Hello,
    I am posting my question again, as I have not got any solution. Please help it will be really appreciated. Here's the description
    I am loading data from flatfile to an Infocube with 3 keyfigures: Sales Price , Sales Quantity, Sales Revune. Getting values for Sales Price and Salea Quantity  from flatfile and calculating for Sales Revunue IO_VB_REV using routine
    - I created Transformations, and under Rule Group: Standard Group box I have not mapped IO_VB_REV  any datasource field and see 'X' sign against the field.
    - In rules detail screen, I add two source fields of Rule , IO_VB_QU and IO_VB_PRC. I see IO_VB_REV already added under 'Target fields of Rule' section
    - I then add the only following line to routine
    RESULT = SOURCE_FIELDS_RULE-/BIC/IO_VB_QU * SOURCE_FIELDS_RULE-/BIC/IO_VB_PRC .
    - Clicking on check button it gives no syntax error message. I save and exit back to Rule Details page.
    - For IO_VB_REV field If I select any of 2 options i.e. Fixed Unit or No conversion it gives me a dump. So I select 'from conversion' option. In that case I enter USD against 'Conversion Type' field. It gives me information box popup with 'Incorrect Input Message'
    - When check button hit on 'Rule Details' page, it gives me error message ' Syntax error in routine '
    Why is it giving me syntax error, inspite of the fact that I get 'no syntax error' message on routine page. Also why am I getting short dumps on changing Conversion Type

    Hi Olivier,
    I really thank you for ur efforts in helping me solving this problem. Below is complete description of KF defined,
    1. Created InfoObjects for Sales Quantity, Sales Price, Sales Revunue
    Definition of <b>Sales Quantity</b>
    Name: IO_VB_QU
    Type/Data Type : Quantity
    Data Type: QUAN - Quantity field, points to unit field with format UN
    Currency / unit of measure
    Unit / Currency: 0UNIT
    Definition of <b>Sales Price</b>
    Name: IO_VB_PRC
    Type/Data Type : Amount
    Data Type: CURR - Currency field, stored as DEC
    Currency / unit of measure
    Fixed Currency: USD
    Definition of <b>Sales Revunue</b>
    Name: IO_VB_REV
    Type/Data Type : Amount
    Data Type: CURR - Currency field, stored as DEC
    Currency / unit of measure
    Fixed Currency: USD
    2. As the data is being read from flatfile, created DataSource with fields for Sales ID, Sales Price, Sales Quantity. As I am reading unit for quantity from file (has values EA,BOX,CSE), I have a corresponding field UNIT in DataSource. No field for Sales Revunue.
    3. I use 'Create Transformation' functionality to automatically create transformations.
    4. Rule Details page of each of 3 KFs has following values
    <b>Rule Details page of Sales Quantity</b>
    Rule Type: Direct Assignment
    Aggregation : Summation
    Target Unit: 0UNIT
    Unit: from Source
    Source Unit: UNIT
    Source Fields of Rule: /BIC/IO_VB_QU, UNIT
    Target Fields of Rule: 0UNIT, IO_VB_QU
    <b>Rule Details page of Sales Price</b>
    Rule Type: Direct Assignment
    Aggregation : Maximum
    Fixed Target Currency : USD
    Currency: No Conversion
    Source Fields of Rule: /BIC/IO_VB_PRC
    Target Fields of Rule:  IO_VB_PRC
    <b>Rule Details page of Sales Revunue</b>
    Rule Type: Routine   
    Aggregation : Summation
    Fixed Target Currency : USD
    Currency: from Conversion
    Conversion Type: ??????.....(I entered USD it gives me Incorrect Input message)
    Source Fields of Rule: /BIC/IO_VB_PRC, /BIC/IO_VB_QU, UNIT
    Target Fields of Rule:  IO_VB_REV
    I have this line is the routine 
    RESULT = SOURCE_FIELDS_RULE-/BIC/IO_VB_QU *   SOURCE_FIELDS_RULE-/BIC/IO_VB_PRC.
    Let me know if u need any other info......
    I really appreciate u trying  to help me
    Vidya

  • Getting syntax error while executing keyfigure routine BI 7.0

    Hello,
    I am writing a very simple keyfigure routine to calculate sales revune using sales quantity and sales price, I am getting error as follows
    - I am in 'Rules Details' screen and I have selected 'Routine' as the rule type. I enter the following code in routine
         RESULT = SOURCE_FIELDS_RULE-/BIC/IO_VB_QU *
         SOURCE_FIELDS_RULE-/BIC/IO_VB_PRC .
    - I hit the check button on the routine page, it says no syntax errors
    - Now I am back in the 'Rules Details' page and I hit the 'Check' button it gives me the following error
    Rule(target IO_VB_REV, group: Standard Group): Syntax error in routine
    Please tell me what is wrong. what should i check

    Hi Vaibhav,
    Here are the details
    - I am loading data from flatfile to an Infocube with 3 keyfigures: IO_VB_PRC (Sales Price) , IO_VB_QU (Sales Quantity), IO_VB_REV (Sales Revune). Getting values for IO_VB_QU and IO_Vb_PRC from flatfile and calculating for IO_VB_REV using routine
    - I created Transformations, and under  Rule Group: Standard Group box I see 'X' sign against 'IO_VB_REV' field, meaning not mapped to any datasource field
    - In rules detail screen, I add two source fields of Rule , IO_VB_QU and IO_VB_PRC. I see IO_VB_REV already added under 'Target fields of Rule' section
    - I then add the only following line to routine
    RESULT = SOURCE_FIELDS_RULE-/BIC/IO_VB_QU *    SOURCE_FIELDS_RULE-/BIC/IO_VB_PRC .
    Clicking on check button it gives no syntax error message. I save and exit back to Rule Details page.
    - I specify 'USD' as the Conversion Type and then click on check button it initially gives me 'Incorrect Input'  written in an information message box and then error that Syntax error in routine
    Let me know what is that I am missing
    Thanks for helping

  • Transport Error. Sintax error in routine.

    Hi all,
    I'm facing an error and I would like to receive some help.
    I'm trying to transport a transformation of BI7.0 from development to quality environment and I'm receiving this error:
    Start of the after-import method RS_TRFN_AFTER_IMPORT for object type(s) TRFN (activation mode)
    Transformation 0375K6W8L81KCGPGVDUBF7P9Y1O9AZEL deleted in version M of DDIC
    Activation of Transformation type object
    Transformation 0375K6W8L81KCGPGVDUBF7P9Y1O9AZEL
    Rule (target: ZIMPPRESU, group: 01 Grupo estándar): Syntax error in routine
    Transformation  : Rule 13 could not be imported
    I've checked the routine and no sintax errors are found. It works perfectly in dev.
    I found a similar post in sdn:
    And I followed the steps I found in it. I recollected the tranformation objects in the transport connection and no objects were missing.
    In RSLOGSYSMAP table I have one record and the ONLYNEW field is empty. I don't know if it's ok or not but it's not the first time I have transported this transformation.
    Can anyone help me in resolving this issue?
    Thanks, points will be assigned.

    hi,
    We faced a similar problem last week...
    Check the routine first ...There might not be a syntax error but maybe you are using the routine to fetch data from someother ODS or infocube or using an infoobject which might not have been transported...
    In our case, we were fetching data from another ODS using this routine and had not transported that ODS, thats why we faced this problem...
    Some object required for the routine to work fine, has not been transported, thats why its showing this error......
    Regards,

  • Syntax error in Start Routine routine 9998 in transformation

    Hi Guyz,
    I am getting the below error while doinf the syntax check in start routine in one of the transformation in BW production after the failed TR movement
    E:In PERFORM or CALL FUNCTION "ROUTINE_9998", the actual parameter
    "SOURCE_PACKAGE" is incompatible with the formal parameter
    "DATA_PACKAGE".
    but for the same transformation in quality its showing  no syntax errors found.
    its an odd behaviour.
    please guide with ur expertise.
    cheerz,
    raps.

    Hi,
    Check the note 1052648. it says that:
    Start routine:
               In the start routine, all the fields from the source are always available.
    During the migration, a type '_ty_t_SC_1_full' is generated in '2nd part global'. Since Note 1325124, this type has been adjusted when the field list is changed. In the past, a change to the field list caused syntax errors of the type:
    For update rules:
                        E: For PERFORM or CALL FUNCTION "ROUTINE_9998", the actual parameter "SOURCE_PACKAGE" is not compatible with the formal parameter "DATA_PACKAGE".
    For transfer rules:
                        E:For PERFORM or CALL FUNCTION "STARTROUTINE", the actual parameter "SOURCE_PACKAGE" is not compatible with the formal parameter "DATAPAK".
               If this error continues to occur, go to the solution section to correct it.
               Solution:
               This error should now be automatically corrected with Note 1325124. Access the incorrect start routine in change mode. The type '_ty_s_SC_1_full' is then automatically adjusted to the source structure. If this does not work, you should use the tool 'RSTRAN_MIGRATION_CHECK' (described in Note 1369395) to check and possibly repair the transformation in question.
               If this error still occurs, you can correct it manually as follows:
               Copy the field list of the type     '_ty_s_SC_1' from the 'private section' of the CLASS lcl_transform DEFINITION (you can find this when you scroll up in the routine editor of the start routine) to the type '_ty_s_SC_1_full' of '2nd part global'.
    Regards,
    Anil Kumar Sharma .P

  • Syntax error in Transformation routine

    Hi Folks,
    We are In SP 17.
    I have migrated standard 0bpartner_attr transfer rules to a transformation with syntax errors.
    I have a routine for a gender, Valid From and Valid To its giving the following erorr.
    E:Field "TRAN_STRUCTURE-VALID_FROM" is unknown. It is neither in one of
    the specified tables nor defined by a "DATA" statement. "DATA"
    statement.
    the following is the routine code for Gender.
    PROGRAM trans_routine.
          CLASS routine DEFINITION
    CLASS lcl_transform DEFINITION.
      PUBLIC SECTION.
    Attributs
        DATA:
          p_check_master_data_exist
                TYPE RSODSOCHECKONLY READ-ONLY,
    *-    Instance for getting request runtime attributs;
        Available information: Refer to methods of
        interface 'if_rsbk_request_admintab_view'
          p_r_request
                TYPE REF TO if_rsbk_request_admintab_view READ-ONLY.
      PRIVATE SECTION.
        TYPE-POOLS: rsd, rstr.
      Rule specific types
        TYPES:
          BEGIN OF tys_SC_1,
         Field: XSEXM Male.
            XSEXM           TYPE C LENGTH 1,
         Field: XSEXF Female.
            XSEXF           TYPE C LENGTH 1,
         Field: XSEXU Unknown.
            XSEXU           TYPE C LENGTH 1,
         Field: RECORD.
            RECORD           TYPE RSARECORD,
          END   OF tys_SC_1.
        TYPES:
          BEGIN OF tys_TG_1,
         InfoObject: 0GENDER Gender.
            GENDER           TYPE /BI0/OIGENDER,
          END   OF tys_TG_1.
    $$ begin of global - insert your declaration only below this line  -
    ... "insert your code here
    $$ end of global - insert your declaration only before this line   -
        METHODS
          compute_0GENDER
            IMPORTING
              request                  type rsrequest
              datapackid               type rsdatapid
              SOURCE_FIELDS              type tys_SC_1
            EXPORTING
              RESULT                   type tys_TG_1-GENDER
              monitor                  type rstr_ty_t_monitor
            RAISING
              cx_rsrout_abort
              cx_rsrout_skip_record
              cx_rsrout_skip_val.
        METHODS
          invert_0GENDER
            IMPORTING
              i_th_fields_outbound         TYPE rstran_t_field_inv
              i_r_selset_outbound          TYPE REF TO cl_rsmds_set
              i_is_main_selection          TYPE rs_bool
              i_r_selset_outbound_complete TYPE REF TO cl_rsmds_set
              i_r_universe_inbound         TYPE REF TO cl_rsmds_universe
            CHANGING
              c_th_fields_inbound          TYPE rstran_t_field_inv
              c_r_selset_inbound           TYPE REF TO cl_rsmds_set
              c_exact                      TYPE rs_bool.
    ENDCLASS.                    "routine DEFINITION
    $$ begin of 2nd part global - insert your code only below this line  *
    $$ end of rule type
        TYPES:
          BEGIN OF tys_TG_1_full,
         InfoObject: 0BPARTNER Business Partner.
            BPARTNER           TYPE /BI0/OIBPARTNER,
         InfoObject: 0BP_ACTITL1 First Academic Title.
            BP_ACTITL1           TYPE /BI0/OIBP_ACTITL1,
         InfoObject: 0BP_ACTITL2 Second Academic Title.
            BP_ACTITL2           TYPE /BI0/OIBP_ACTITL2,
         InfoObject: 0BP_BTHNAME BP: Person's Name at Birth.
            BP_BTHNAME           TYPE /BI0/OIBP_BTHNAME,
         InfoObject: 0BP_CAT Business Partner Category.
            BP_CAT           TYPE /BI0/OIBP_CAT,
         InfoObject: 0BP_CONS Business Partner (Consolidated/Cleansing).
            BP_CONS           TYPE /BI0/OIBP_CONS,
         InfoObject: 0BP_CONTACT BP: Contact Permission.
            BP_CONTACT           TYPE /BI0/OIBP_CONTACT,
         InfoObject: 0BP_EXTERN BP Number in External System.
            BP_EXTERN           TYPE /BI0/OIBP_EXTERN,
         InfoObject: 0BP_FSTNAME BP: Person's First Name.
            BP_FSTNAME           TYPE /BI0/OIBP_FSTNAME,
         InfoObject: 0BP_GROUP Business Partner Grouping.
            BP_GROUP           TYPE /BI0/OIBP_GROUP,
         InfoObject: 0BP_GRPNAM1 BP: Name 1 (Group).
            BP_GRPNAM1           TYPE /BI0/OIBP_GRPNAM1,
         InfoObject: 0BP_GRPNAM2 BP: Name 2 (Group).
            BP_GRPNAM2           TYPE /BI0/OIBP_GRPNAM2,
         InfoObject: 0BP_GRPTYPE BP: Group Type.
            BP_GRPTYPE           TYPE /BI0/OIBP_GRPTYPE,
         InfoObject: 0BP_LSTNAME BP: Person's Surname.
            BP_LSTNAME           TYPE /BI0/OIBP_LSTNAME,
         InfoObject: 0BP_MAR_STA BP: Marital Status.
            BP_MAR_STA           TYPE /BI0/OIBP_MAR_STA,
         InfoObject: 0BP_MDLNAME BP: Person's Middle Name or Second First
    *Name.
            BP_MDLNAME           TYPE /BI0/OIBP_MDLNAME,
         InfoObject: 0BP_SECNAME BP: Person's Second Surname.
            BP_SECNAME           TYPE /BI0/OIBP_SECNAME,
         InfoObject: 0CHANGEDBY Changed by.
            CHANGEDBY           TYPE /BI0/OICHANGEDBY,
         InfoObject: 0CH_AT Time of Last Change.
            CH_AT           TYPE /BI0/OICH_AT,
         InfoObject: 0CH_ON Last changed on.
            CH_ON           TYPE /BI0/OICH_ON,
         InfoObject: 0CREATEDBY Name of person who created the object.
            CREATEDBY           TYPE /BI0/OICREATEDBY,
         InfoObject: 0CREATEDON Date on which the record was created.
            CREATEDON           TYPE /BI0/OICREATEDON,
         InfoObject: 0CREA_TIME Time Created.
            CREA_TIME           TYPE /BI0/OICREA_TIME,
         InfoObject: 0GENDER Gender.
            GENDER           TYPE /BI0/OIGENDER,
         InfoObject: 0LEGALFORM Legal Status of Organization.
            LEGALFORM           TYPE /BI0/OILEGALFORM,
         InfoObject: 0NAME_ORG1 BP: Organization Name 1.
            NAME_ORG1           TYPE /BI0/OINAME_ORG1,
         InfoObject: 0NAME_ORG2 BP: Organization Name 2.
            NAME_ORG2           TYPE /BI0/OINAME_ORG2,
         InfoObject: 0NAME_ORG3 BP: Organization Name 3.
            NAME_ORG3           TYPE /BI0/OINAME_ORG3,
         InfoObject: 0NAME_ORG4 BP: Organization Name 4.
            NAME_ORG4           TYPE /BI0/OINAME_ORG4,
         InfoObject: 0NATION Nationality.
            NATION           TYPE /BI0/OINATION,
         InfoObject: 0TITLE_SPPL Name Supplement, for example, Noble Title
            TITLE_SPPL           TYPE /BI0/OITITLE_SPPL,
         InfoObject: 0BP_TYPE Partner:Partner Type.
            BP_TYPE           TYPE /BI0/OIBP_TYPE,
         InfoObject: 0GN_PAR_SSY Source System of a Partner.
            GN_PAR_SSY           TYPE /BI0/OIGN_PAR_SSY,
         InfoObject: 0LOGSYS Source System.
            LOGSYS           TYPE RSDLOGSYS,
         InfoObject: 0RECORDMODE BW Delta Process: Record Mode.
            RECORDMODE           TYPE RODMUPDMOD,
         InfoObject: 0BP_GUID GUID of Business Partner.
            BP_GUID           TYPE /BI0/OIBP_GUID,
         InfoObject: 0BPDATEFROM GP Attributes Valid from.
            BPDATEFROM           TYPE /BI0/OIBPDATEFROM,
         InfoObject: 0BPDATETO GP Attributes Valid to.
            BPDATETO           TYPE /BI0/OIBPDATETO,
         Field: RECORD Data record number.
            RECORD           TYPE RSARECORD,
          END   OF tys_TG_1_full.
    Additional declaration for transfer rule interface
      DATA:
        g_t_errorlog TYPE rssm_t_errorlog_int,
        RECORD_ALL   LIKE SY-TABIX.
    global definitions from transfer rules
    DATA: gs_cob_pro TYPE rsd_s_cob_pro,
          gt_viobj   TYPE rsd_t_viobj,
          gs_viobj   TYPE rsd_s_viobj.
    DATA:   l_s_errorlog TYPE rssm_s_errorlog_int,
            l_text TYPE string.
    FORM compute_BPDATEFROM
       CHANGING
        RESULT         TYPE tys_TG_1_full-BPDATEFROM
        RETURNCODE     LIKE sy-subrc
        ABORT          LIKE sy-subrc
      RAISING
        cx_sy_arithmetic_error
        cx_sy_conversion_error.
      INCLUDE rs_bct_bupa_form_valid_from.
    ENDFORM.                    "BPDATEFROM
    FORM compute_BPDATETO
       CHANGING
        RESULT         TYPE tys_TG_1_full-BPDATETO
        RETURNCODE     LIKE sy-subrc
        ABORT          LIKE sy-subrc
      RAISING
        cx_sy_arithmetic_error
        cx_sy_conversion_error.
      INCLUDE rs_bct_bupa_form_valid_to.
    ENDFORM.                    "BPDATETO
    FORM compute_GENDER
       CHANGING
        RESULT         TYPE tys_TG_1_full-GENDER
        RETURNCODE     LIKE sy-subrc
        ABORT          LIKE sy-subrc
      RAISING
        cx_sy_arithmetic_error
        cx_sy_conversion_error.
    INCLUDE rs_bct_bupa_form_gender.
    ENDFORM.                    "GENDER
    FORM compute_GN_PAR_SSY
       CHANGING
        RESULT         TYPE tys_TG_1_full-GN_PAR_SSY
        RETURNCODE     LIKE sy-subrc
        ABORT          LIKE sy-subrc
      RAISING
        cx_sy_arithmetic_error
        cx_sy_conversion_error.
    INCLUDE rs_bct_bupa_form_gn_par_ssy.
    ENDFORM.                    "GN_PAR_SSY
    $$ end of 2nd part global - insert your code only before this line   *
          CLASS routine IMPLEMENTATION
    CLASS lcl_transform IMPLEMENTATION.
      METHOD compute_0GENDER.
      IMPORTING
        request     type rsrequest
        datapackid  type rsdatapid
        SOURCE_FIELDS-XSEXM TYPE C LENGTH 000001
        SOURCE_FIELDS-XSEXF TYPE C LENGTH 000001
        SOURCE_FIELDS-XSEXU TYPE C LENGTH 000001
       EXPORTING
         RESULT type tys_TG_1-GENDER
        DATA:
          MONITOR_REC    TYPE rsmonitor.
    *$*$ begin of routine - insert your code only below this line        *-*
      Data:
        l_s_error_log    type rssm_s_errorlog_int,
        l_subrc          type sy-tabix,
        l_abort          type sy-tabix,
        ls_monitor       TYPE rsmonitor,
        ls_monitor_recno TYPE rsmonitors.
    REFRESH:
      monitor,
      monitor_recno.
    Migrated transfer rule call
      Perform compute_GENDER
        CHANGING
          RESULT
          l_subrc
          l_abort.
    *-- Convert Messages in Transformation format
        LOOP AT G_T_ERRORLOG INTO l_s_error_log.
          move-CORRESPONDING l_s_error_log to MONITOR_REC.
          append monitor_rec to MONITOR.
        ENDLOOP.
        IF l_subrc <> 0.
          RAISE EXCEPTION TYPE cx_rsrout_skip_val.
        ENDIF.
        IF l_abort <> 0.
          RAISE EXCEPTION TYPE CX_RSROUT_ABORT.
        ENDIF.
    $$ end of routine - insert your code only before this line         -
      ENDMETHOD.                    "compute_0GENDER
          Method invert_0GENDER
          This subroutine needs to be implemented only for direct access
          (for better performance) and for the Report/Report Interface
          (drill through).
          The inverse routine should transform a projection and
          a selection for the target to a projection and a selection
          for the source, respectively.
          If the implementation remains empty all fields are filled and
          all values are selected.
      METHOD invert_0GENDER.
    $$ begin of inverse routine - insert your code only below this line-
    ... "insert your code here
    $$ end of inverse routine - insert your code only before this line -
      ENDMETHOD.                    "invert_0GENDER
    ENDCLASS.                    "routine IMPLEMENTATION
    let me know how to correct the above code.
    thanks

    Hi,
    the field tran_structure is no more available. The name changed to source_fields. Additionally there is no datapak available. It is now source_fields_table. You might need to use field symbols to access the fields.
    regards
    Siggi

  • Syntax error during transport on valid transfer routines

    Dear All,
    We have some routines in a tranfer structure that are valid and working just fine in DEV.  But when we transport them to QA we get the following error message :-
    Start of the after-import method for object type R3TR ISTS (Activation Mode)                
    Transfer structure 6DB_V_BW_EPISODE_AD activated under the name 6DB_V_BW_EPISODE_AD         
    It is not necessary to copy dependent objects for transfer structure 6DB_V_BW_EPISODE_AD    
    Syntax error in transfer routine for InfoObject OPEN_DAT                                    
    Activating Transfer Rules 6DB_V_BW_EPISODE_AD ...                                           
    47 Transfer Rule(s) of the transfer structure 6DB_V_BW_EPISODE_AD removed from control table
    53 InfoObject(s) of the transfer structure 6DB_V_BW_EPISODE_AD removed from control table   
    Formulas have been saved                                                                    
    Syntax error in transfer routine for InfoObject OPEN_DAT
    If we remove all the routines the activation works just fine even though our routines are valid and working just fine in DEV.
    Can anyone explain this as this is becoming quite urgent now ?
    Thanks in advance.
    Craig

    Hi Oliver
    I work with Craig. In response to your question, what he means is that all objects independantly have been transported ok, apart from the transfer rules. If you look at the table RSTSRULES you will see a column called CONVROUT_L.
    In our Dev system this field contains the BW generated rule code. Eg.
    45GEGC5I66GA9Z5G4KFDDRIK4 against the Transfer structure. When the after import process runs, it uses the contents of this table together with the contents of the RSAABAP table which contains the code and creates the transfer rule program.
    In RSAABAP we have the following code for CODEID '45GEGC5I66GA9Z5G4KFDDRIK4'
    DATA: l_s_errorlog TYPE rssm_s_errorlog_int.
    CHECK NOT &TS&-opened_date IS INITIAL.
    IF &TS&-opened_date < '19000101'.
    &RS& = '19900101'.
    ELSEIF &TS&-opened_date > '29990101'.
    &RS& = '19900101'.
    ELSE.
    &RS& = &TS&-opened_date.
    ENDIF.
    returncode <> 0 means skip this record
    &RE& = 0.
    abort <> 0 means skip whole data package !!!
    &AB& = 0.
    In our QA system the column is blank because of the wierd Syntax problem when generating the program, therefore the transfer rules dont get activated.
    As you can see there is no problem with the ABAP.
    Regards
    Mark

  • Syntax error in Update Routine

    Dear All,
    While trying to update infoobject /BIC/ZGROSSPRI in an ODS in BI through an update routine, a syntax error is thrown when I am defining a variable of type  tys_TG_1-/BIC/ZGROSSPRI.
    For instance,
    DATA: VALUE TYPE tys_TG_1-/BIC/ZGROSSPRI.
    The error is :
    E:Field "_ty_s_TG_1-/BIC/ZGROSSPRI" is unknown. It is neither in one of the
    specified tables nor defined by a "DATA" statement. "DATA" statement.
    Below given is the code which I am using for the same. Kindly advise how to correct this error.
    Moderator message - Please respect the 2,500 character maximum when posting. Post only the relevant portions of code
    Edited by: Suneeth Sebastian on Apr 7, 2010 4:11 PM
    Edited by: Rob Burbank on Apr 7, 2010 1:19 PM

    Dear All,
    While trying to update infoobject /BIC/ZGROSSPRI in an ODS in BI through an update routine, a syntax error is thrown when I am trying to define a variable of type tys_TG_1-/BIC/ZGROSSPRI. How is it possible to define a variable of type target field(Infoobject) ?
    For instance,
    DATA: VALUE TYPE tys_TG_1-/BIC/ZGROSSPRI.
    The error is :
    E:Field "_ty_s_TG_1-/BIC/ZGROSSPRI" is unknown. It is neither in one of the
    specified tables nor defined by a "DATA" statement. "DATA" statement.
    tys_TG_1-/BIC/ZGROSSPRI is already defined in the Class section as below
    TYPES:
          BEGIN OF tys_TG_1,
         InfoObject: ZGROSSPRI Gross Price in Statistical Currency.
            /BIC/ZGROSSPRI           TYPE /BIC/OIZGROSSPRI,
          END   OF tys_TG_1.

  • Syntax error

    Hi abappers
    I am using the following code in my program.
    i  m getting a syntax error that i do not understand? can any body help me out with this.
    Regards
    Narendiran Rathinavelu
    *& Report  ZTEST_RECUPLOAD
    REPORT  ZTEST_RECUPLOAD.
    *include bdcrecx1.
    ******************Selection screen************************************
    SELECTION-SCREEN BEGIN OF BLOCK 1 WITH FRAME TITLE TEXT-T01 .
    PARAMETERS P_FILE   TYPE RLGRAP-FILENAME OBLIGATORY.
    PARAMETERS P_SESSN  TYPE APQI-GROUPID DEFAULT 'RECURRING'.
    PARAMETERS P_SESSN2 TYPE APQI-GROUPID DEFAULT 'RECURRING_E'.
    SELECTION-SCREEN END OF BLOCK 1.
    ********************Type declaration**********************************
    *type for data input table
    TYPES : BEGIN OF TY_DATA,
            BUKRS    TYPE T001-BUKRS,         "Company code
            BLART    TYPE BKPF-BLART,         "Document type
           BUDAT    TYPE BKPF-BUDAT,         "Posting date
            DBBDT    TYPE BKDF-DBBDT,         "First run
            DBATR    TYPE BKDF-DBATR,         "Next run
            DBEDT    TYPE BKDF-DBEDT,         "last run
            DBMON    TYPE BKDF-DBMON,         "Run frequency
            DBTAG    TYPE BKDF-DBTAG,         "Run date
           DBZHL    TYPE BKDF-DBZHL,         "no of runs
            XBLNR    TYPE BKPF-XBLNR,         "reference(site)
            BKTXT    TYPE BKPF-BKTXT,         "document header data
           USNAM    TYPE BKPF-USNAM,         "User name
           CPUDT    TYPE BKPF-CPUDT,         "Entry date
            BSCHL_1  TYPE BSEG-BSCHL,         "Posting key 1 item
            HKONT_1  TYPE BSEG-HKONT,         "Account 1 item
            DESC_1   TYPE CHAR40,             "Description vendor/GL 1 item
            MWSKZ_1  TYPE BSEG-MWSKZ,         "Tax code 1 item
           MWSTS1_1 TYPE BSEG-MWSTS,         "Tax Amount 1 item
            MWSTS2_1 TYPE BSEG-MWSTS,         "Amount is local currency 1 item
           MWSTS3_1 TYPE BSEG-MWSTS,         "Amount is foreign currency 1 item
            SGTXT_1  TYPE BSEG-SGTXT,         "Item text 1 item
            ZUONR_1  TYPE BSEG-ZUONR,         "Assignment 1 item
            BSCHL_2  TYPE BSEG-BSCHL,         "Posting key 2 item
            HKONT_2  TYPE BSEG-HKONT,         "Account 2 item
            DESC_2   TYPE CHAR40,             "Description vendor/GL 2 item
            MWSKZ_2  TYPE BSEG-MWSKZ,         "Tax code 2 item
           MWSTS1_2 TYPE BSEG-MWSTS,         "Tax Amount 2 item
            MWSTS2_2 TYPE BSEG-MWSTS,         "Amount is local currency 2 item
           MWSTS3_2 TYPE BSEG-MWSTS,         "Amount is foreign currency 2 item
            KOSTL    TYPE COBL-KOSTL,         "Cost center
            AUFNR    TYPE COBL-AUFNR,         "Internal order number
            SGTXT_2  TYPE BSEG-SGTXT,         "Item text 2 item
            ZUONR_2  TYPE BSEG-ZUONR,         "Assignment 2 item
          END OF TY_DATA.
    *type for data error table
    TYPES : BEGIN OF TY_ERROR,
             BUKRS    TYPE T001-BUKRS,         "Company code
            BLART    TYPE BKPF-BLART,         "Document type
           BUDAT    TYPE BKPF-BUDAT,         "Posting date
            DBBDT    TYPE BKDF-DBBDT,         "First run
            DBATR    TYPE BKDF-DBATR,         "Next run
            DBEDT    TYPE BKDF-DBEDT,         "last run
            DBMON    TYPE BKDF-DBMON,         "Run frequency
            DBTAG    TYPE BKDF-DBTAG,         "Run date
           DBZHL    TYPE BKDF-DBZHL,         "no of runs
            XBLNR    TYPE BKPF-XBLNR,         "reference(site)
            BKTXT    TYPE BKPF-BKTXT,         "document header data
           USNAM    TYPE BKPF-USNAM,         "User name
           CPUDT    TYPE BKPF-CPUDT,         "Entry date
            BSCHL_1  TYPE BSEG-BSCHL,         "Posting key 1 item
            HKONT_1  TYPE BSEG-HKONT,         "Account 1 item
            DESC_1   TYPE CHAR40,             "Description vendor/GL 1 item
            MWSKZ_1  TYPE BSEG-MWSKZ,         "Tax code 1 item
           MWSTS1_1 TYPE BSEG-MWSTS,         "Tax Amount 1 item
            MWSTS2_1 TYPE BSEG-MWSTS,         "Amount is local currency 1 item
           MWSTS3_1 TYPE BSEG-MWSTS,         "Amount is foreign currency 1 item
            SGTXT_1  TYPE BSEG-SGTXT,         "Item text 1 item
            ZUONR_1  TYPE BSEG-ZUONR,         "Assignment 1 item
            BSCHL_2  TYPE BSEG-BSCHL,         "Posting key 2 item
            HKONT_2  TYPE BSEG-HKONT,         "Account 2 item
            DESC_2   TYPE CHAR40,             "Description vendor/GL 2 item
            MWSKZ_2  TYPE BSEG-MWSKZ,         "Tax code 2 item
           MWSTS1_2 TYPE BSEG-MWSTS,         "Tax Amount 2 item
            MWSTS2_2 TYPE BSEG-MWSTS,         "Amount is local currency 2 item
           MWSTS3_2 TYPE BSEG-MWSTS,         "Amount is foreign currency 2 item
            KOSTL    TYPE COBL-KOSTL,         "Cost center
            AUFNR    TYPE COBL-AUFNR,         "Internal order number
            SGTXT_2  TYPE BSEG-SGTXT,         "Item text 2 item
            ZUONR_2  TYPE BSEG-ZUONR,         "Assignment 2 item
          END OF TY_ERROR.
    ********************Data declaration***********************************
    DATA : T_DATA TYPE TABLE OF TY_DATA,   "Table to upload correct entries
           T_ERROR TYPE TABLE OF TY_ERROR. "Table to upload error data
    DATA : W_DATA TYPE TY_DATA,            "workarea for t_data
           W_ERROR TYPE TY_ERROR.          "workarea for t_error
    DATA : T_BDCDATA TYPE TABLE OF BDCDATA,
           W_BDCDATA TYPE BDCDATA.
    DATA : T_SEL_FILE TYPE FILETABLE,
           W_RETURN_CODE TYPE I VALUE '0',
           W_SEL_FILE LIKE LINE OF T_SEL_FILE.
    DATA : T_DATAIN TYPE TABLE OF TY_DATA,
           W_DATAIN TYPE string.
    DATA : W_FILE TYPE STRING.
    ********************At Selection Screen*********************************
    *selection screen validations
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
      CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
        EXPORTING
          WINDOW_TITLE            = 'Select File for upload'
       DEFAULT_EXTENSION       =
       DEFAULT_FILENAME        =
          FILE_FILTER             = '*.xls'
       WITH_ENCODING           =
       INITIAL_DIRECTORY       =
       MULTISELECTION          =
        CHANGING
          FILE_TABLE              = T_SEL_FILE
          RC                      = W_RETURN_CODE
       USER_ACTION             =
       FILE_ENCODING           =
        EXCEPTIONS
          FILE_OPEN_DIALOG_FAILED = 1
          CNTL_ERROR              = 2
          ERROR_NO_GUI            = 3
          NOT_SUPPORTED_BY_GUI    = 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.
      IF W_RETURN_CODE <> -1.
        READ TABLE T_SEL_FILE INTO W_SEL_FILE INDEX 1.
        CLEAR P_FILE.
        MOVE W_SEL_FILE TO P_FILE.
      ENDIF.
    *at selection screen
    AT SELECTION-SCREEN ON P_SESSN.
      IF P_SESSN IS INITIAL.
        P_SESSN = 'RECURRING'.
      ENDIF.
    AT SELECTION-SCREEN ON P_SESSN2.
      IF P_SESSN2 IS INITIAL.
        P_SESSN2 = 'RECURRING_E'.
      ENDIF.
    *********************Start of Selection ****************************
    START-OF-SELECTION.
      OPEN DATASET P_FILE FOR INPUT IN TEXT MODE ENCODING DEFAULT.
    *error message when file not found.
      IF SY-SUBRC <> 0.
        MESSAGE 'File Not Found' TYPE 'E'.
      ENDIF.
      DO.
        READ DATASET P_FILE INTO w_datain.
        IF SY-SUBRC EQ 0.
          perform pre_process_record using w_datain
                                     changing w_data.
          PERFORM VALIDATE_DATA TABLES T_DATA
                                       T_ERROR
                                USING  W_DATA.
        ELSE.
          EXIT.
        ENDIF.
      ENDDO.
      CLOSE DATASET P_FILE.
    *check if any error has occured.
      IF T_ERROR[] IS NOT INITIAL.
        PERFORM FILL_BDC_TABLE TABLES T_ERROR
                                      T_BDCDATA
                               USING  P_SESSN2.
      ENDIF.
    *Check if any records are present to be uploaded.
      IF T_DATA[] IS NOT INITIAL.
        PERFORM FILL_BDC_TABLE TABLES T_DATA
                                      T_BDCDATA
                               USING  P_SESSN.
      ELSE.
        WRITE :/ 'No Correct Records were found to create session in SM35',
               / 'Please Check the File'.
      ENDIF.
    *&      Form  validate_data
          Sub routine to check correctness of the uploaded data.
         -->P_T_DATA  table to upload correct entries
         -->P_T_ERROR table to upload erroneous entries
         -->P_W_DATA  current record
    FORM VALIDATE_DATA  TABLES   P_T_DATA STRUCTURE  W_DATA
                                 P_T_ERROR STRUCTURE W_ERROR
                        USING    P_W_DATA.
      DATA : L_W_LIFNR TYPE LFA1-LIFNR,
             L_W_SAKNR TYPE SKA1-SAKNR.
      DATA:  L_W_DATA  TYPE TY_DATA,
             L_W_ERROR TYPE TY_ERROR.
      MOVE P_W_DATA TO L_W_DATA.
      DATA : L_FG_ERROR TYPE C,
             L_W_DATE   TYPE SY-DATUM.
      CONSTANTS : C_X       TYPE C VALUE 'X',
                  C_O2CA(4) TYPE C VALUE 'O2CA',
                  C_ZK_1(2) TYPE C VALUE 'ZK',
                  C_ZK_2(2) TYPE C VALUE 'zk',
                  C_NUM(17) TYPE C VALUE '01234567890/.-, ',
                  C_31(2)   TYPE C VALUE '31',
                  C_40(2)   TYPE C VALUE '40'.
      L_FG_ERROR = SPACE.
      DO.
    *check document type is 'ZK'
        IF NOT L_W_DATA-BLART NE C_ZK_1 OR
           L_W_DATA-BLART NE C_ZK_2.
          L_FG_ERROR = C_X.
          EXIT.
        ENDIF.
    *check 1 item text fields are filled by numeric value.
        IF NOT L_W_DATA-SGTXT_1 CO C_NUM.
          L_FG_ERROR = C_X.
          EXIT.
        ENDIF.
    *check 2 item text fields are filled by date.
        MOVE L_W_DATA-SGTXT_2 TO L_W_DATE.
        CALL FUNCTION 'DATE_CHECK_PLAUSIBILITY'
          EXPORTING
            DATE                      = L_W_DATE
          EXCEPTIONS
            PLAUSIBILITY_CHECK_FAILED = 1
            OTHERS                    = 2.
        IF SY-SUBRC <> 0.
          L_FG_ERROR = C_X.
          EXIT.
        ENDIF.
    *check first posting key is '31'
        IF NOT L_W_DATA-BSCHL_1 EQ C_31.
          L_FG_ERROR = C_X.
          EXIT.
        ENDIF.
    *check second posting key is '40'
        IF NOT L_W_DATA-BSCHL_2 EQ C_40.
          L_FG_ERROR = C_X.
          EXIT.
        ENDIF.
    *check valid Vendor
        SELECT SINGLE LIFNR FROM LFA1 INTO L_W_LIFNR
                            WHERE LIFNR = L_W_DATA-HKONT_1.
        IF SY-SUBRC <> 0.
          L_FG_ERROR = C_X.
          EXIT.
        ENDIF.
    *check valid G/L account.
        SELECT SINGLE SAKNR FROM SKA1 INTO L_W_SAKNR
                            WHERE KTOPL = C_O2CA AND
                                  SAKNR = L_W_DATA-HKONT_2.
        IF SY-SUBRC <> 0.
          L_FG_ERROR = C_X.
          EXIT.
        ENDIF.
    *check 1 item assignment contains numeric value
        IF NOT L_W_DATA-ZUONR_1 CO C_NUM.
          L_FG_ERROR = C_X.
          EXIT.
        ENDIF.
    *check 2 item assigment contains date value
        MOVE L_W_DATA-ZUONR_2 TO L_W_DATE.
        CALL FUNCTION 'DATE_CHECK_PLAUSIBILITY'
          EXPORTING
            DATE                      = L_W_DATE
          EXCEPTIONS
            PLAUSIBILITY_CHECK_FAILED = 1
            OTHERS                    = 2.
        IF SY-SUBRC <> 0.
          L_FG_ERROR = C_X.
          EXIT.
        ENDIF.
    *check if no error has occured
        IF NOT L_FG_ERROR EQ C_X.
          EXIT.
        ENDIF.
      ENDDO.
    *check error flag and insert error text.
      CASE L_FG_ERROR.
        WHEN C_X.                        "When error has occured.
          APPEND L_W_DATA TO P_T_ERROR.
        WHEN OTHERS.                     "When no error has occured.
          APPEND L_W_DATA TO P_T_DATA.
      ENDCASE.
    ENDFORM.                    " validate_data
    *&      Form  download_error_log
          Sub routine to download the error log
         -->P_T_ERROR  error log
    FORM DOWNLOAD_ERROR_LOG  TABLES   P_T_ERROR STRUCTURE W_ERROR.
      DATA : L_FILENAME TYPE STRING,
             L_PATH     TYPE STRING,
             L_FULLPATH TYPE STRING.
      CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG
        EXPORTING
          WINDOW_TITLE         = 'Save the Error log'
        CHANGING
          FILENAME             = L_FILENAME
          PATH                 = L_PATH
          FULLPATH             = L_FULLPATH
        EXCEPTIONS
          CNTL_ERROR           = 1
          ERROR_NO_GUI         = 2
          NOT_SUPPORTED_BY_GUI = 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.
      CHECK L_FULLPATH IS NOT INITIAL.
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          FILENAME                = L_FULLPATH
          FILETYPE                = 'ASC'
          WRITE_FIELD_SEPARATOR   = 'X'
        TABLES
          DATA_TAB                = P_T_ERROR
        EXCEPTIONS
          FILE_WRITE_ERROR        = 1
          NO_BATCH                = 2
          GUI_REFUSE_FILETRANSFER = 3
          INVALID_TYPE            = 4
          NO_AUTHORITY            = 5
          UNKNOWN_ERROR           = 6
          HEADER_NOT_ALLOWED      = 7
          SEPARATOR_NOT_ALLOWED   = 8
          FILESIZE_NOT_ALLOWED    = 9
          HEADER_TOO_LONG         = 10
          DP_ERROR_CREATE         = 11
          DP_ERROR_SEND           = 12
          DP_ERROR_WRITE          = 13
          UNKNOWN_DP_ERROR        = 14
          ACCESS_DENIED           = 15
          DP_OUT_OF_MEMORY        = 16
          DISK_FULL               = 17
          DP_TIMEOUT              = 18
          FILE_NOT_FOUND          = 19
          DATAPROVIDER_EXCEPTION  = 20
          CONTROL_FLUSH_ERROR     = 21
          OTHERS                  = 22.
      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.                    " download_error_log
    *&      Form  fill_bdc_table
          bdc session is created in SM35
         -->P_T_DATA     correct data
         -->P_T_BDCDATA  bdcdata
         -->P_P_SESSN    session name
    FORM FILL_BDC_TABLE  TABLES   P_T_DATA STRUCTURE W_DATA
                                  P_T_BDCDATA STRUCTURE BDCDATA
                         USING    P_P_SESSN.
      DATA : L_W_DATA TYPE TY_DATA.    "workarea for t_data
      CONSTANTS: C_EUR(3) TYPE C VALUE 'EUR'.
    *open batch
      PERFORM OPEN_GROUP USING P_P_SESSN.
      LOOP AT P_T_DATA INTO L_W_DATA.
    *clear the bdc table
        REFRESH P_T_BDCDATA.
    *initial screen
        PERFORM BDC_DYNPRO TABLES P_T_BDCDATA
                           USING  'SAPMF05A' '0106'.
        PERFORM : BDC_FIELD TABLES P_T_BDCDATA USING 'BDC_CURSOR' 'BKPF-WAERS',
                  BDC_FIELD TABLES P_T_BDCDATA USING 'BDC_OKCODE' '/00',            "enter
                  BDC_FIELD TABLES P_T_BDCDATA USING 'BKPF-BUKRS' L_W_DATA-BUKRS,   "company code
                  BDC_FIELD TABLES P_T_BDCDATA USING 'BKDF-DBBDT' L_W_DATA-DBBDT,   "first run on
                  BDC_FIELD TABLES P_T_BDCDATA USING 'BKDF-DBATR' L_W_DATA-DBATR,   "next run on
                  BDC_FIELD TABLES P_T_BDCDATA USING 'BKDF-DBEDT' L_W_DATA-DBEDT,   "last run on
                  BDC_FIELD TABLES P_T_BDCDATA USING 'BKDF-DBMON' L_W_DATA-DBMON,   "run frequency
                  BDC_FIELD TABLES P_T_BDCDATA USING 'BKDF-DBTAG' L_W_DATA-DBTAG,   "run date
                  BDC_FIELD TABLES P_T_BDCDATA USING 'BKPF-BLART' L_W_DATA-BLART,   "document type
                  BDC_FIELD TABLES P_T_BDCDATA USING 'BKPF-WAERS' C_EUR,            "currency
                  BDC_FIELD TABLES P_T_BDCDATA USING 'BKPF-XBLNR' L_W_DATA-XBLNR,   "reference
                  BDC_FIELD TABLES P_T_BDCDATA USING 'BKPF-BKTXT' L_W_DATA-BKTXT,   "document header data
                  BDC_FIELD TABLES P_T_BDCDATA USING 'RF05A-NEWBS' L_W_DATA-BSCHL_1,"posting key
                  BDC_FIELD TABLES P_T_BDCDATA USING 'RF05A-NEWKO' L_W_DATA-HKONT_1."account no
    *second screen (First line item)
        PERFORM BDC_DYNPRO TABLES P_T_BDCDATA
                           USING 'SAPMF05A' '0302'.
        PERFORM : BDC_FIELD TABLES P_T_BDCDATA USING 'BDC_CURSOR' 'RF05A-NEWKO',
                  BDC_FIELD TABLES P_T_BDCDATA USING 'BDC_OKCODE' '/00',              "enter
                  BDC_FIELD TABLES P_T_BDCDATA USING 'BSEG-WRBTR' L_W_DATA-MWSTS2_1,  "amount in LC
                  BDC_FIELD TABLES P_T_BDCDATA USING 'BSEG-MWSKZ' L_W_DATA-MWSKZ_1,   "tax code
                  BDC_FIELD TABLES P_T_BDCDATA USING 'BSEG-ZUONR' L_W_DATA-ZUONR_1,   "assignment
                  BDC_FIELD TABLES P_T_BDCDATA USING 'BSEG-SGTXT' L_W_DATA-SGTXT_1,   "item level text
                  BDC_FIELD TABLES P_T_BDCDATA USING 'RF05A-NEWBS' L_W_DATA-BSCHL_2,  "posting key
                  BDC_FIELD TABLES P_T_BDCDATA USING 'RF05A-NEWKO' L_W_DATA-HKONT_2.  "account no
    *third screen (Second line item)
        PERFORM BDC_DYNPRO TABLES P_T_BDCDATA
                           USING 'SAPMF05A' '0300'.
        PERFORM : BDC_FIELD TABLES P_T_BDCDATA USING 'BDC_CURSOR' 'BSEG-EBELN',
                  BDC_FIELD TABLES P_T_BDCDATA USING 'BDC_OKCODE' '=AB',              "overview button
                  BDC_FIELD TABLES P_T_BDCDATA USING 'BSEG-WRBTR' L_W_DATA-MWSTS2_2,  "amount in LC
                  BDC_FIELD TABLES P_T_BDCDATA USING 'BSEG-MWSKZ' L_W_DATA-MWSKZ_2,   "tax code
                  BDC_FIELD TABLES P_T_BDCDATA USING 'BSEG-ZUONR' L_W_DATA-ZUONR_2,   "assigment
                  BDC_FIELD TABLES P_T_BDCDATA USING 'BSEG-SGTXT' L_W_DATA-SGTXT_2.   "item text
    *fourth screen (pop up)
        PERFORM BDC_DYNPRO TABLES P_T_BDCDATA
                           USING 'SAPLKACB' '0002'.
        PERFORM : BDC_FIELD TABLES P_T_BDCDATA USING 'BDC_CURSOR' 'COBL-KOSTL',
                  BDC_FIELD TABLES P_T_BDCDATA USING 'BDC_OKCODE' '=ENTE',            "ok button
                  BDC_FIELD TABLES P_T_BDCDATA USING 'COBL-KOSTL' L_W_DATA-KOSTL,     "cost center
                  BDC_FIELD TABLES P_T_BDCDATA USING 'COBL-AUFNR' L_W_DATA-AUFNR.     "order number
    *fifth screen
        PERFORM BDC_FIELD TABLES P_T_BDCDATA
                          USING 'SAPMF05A' '0070'.
        PERFORM : BDC_FIELD TABLES P_T_BDCDATA USING 'BDC_CURSOR' 'RF05A-NEWBS',
                  BDC_FIELD TABLES P_T_BDCDATA USING 'BDC_OKCODE' '=BU'.              "save document
        PERFORM BDC_INSERT TABLES P_T_BDCDATA
                            USING 'ZREC_ENTRY'.
      ENDLOOP.
    *close the batch.
      PERFORM CLOSE_GROUP.
    ENDFORM.                    " fill_bdc_table
    *&      Form  bdc_dynpro
          bdc screen insert sub routine
         -->P_T_BDCDATA  BDC table
         -->P_PROGRAM    Program name
         -->P_SCREEN     Screen no
    FORM BDC_DYNPRO  TABLES   P_T_BDCDATA STRUCTURE BDCDATA
                     USING    VALUE(P_PROGRAM)
                              VALUE(P_SCREEN).
      CONSTANTS C_X TYPE C VALUE 'X'.
      DATA L_W_BDCDATA TYPE BDCDATA.
      L_W_BDCDATA-PROGRAM = P_PROGRAM.
      L_W_BDCDATA-DYNPRO = P_SCREEN.
      L_W_BDCDATA-DYNBEGIN = C_X.
      APPEND L_W_BDCDATA TO P_T_BDCDATA.
    ENDFORM.                    " bdc_dynpro
    *&      Form  bdc_field
          bdc field screen routine
         -->P_T_BDCDATA  BDC table
         -->P_FIELD    Field name
         -->P_VALUE      Value
    FORM BDC_FIELD  TABLES   P_T_BDCDATA STRUCTURE BDCDATA
                    USING    VALUE(P_FIELD)
                             VALUE(P_VALUE).
      DATA L_W_BDCDATA TYPE BDCDATA.     "Work area
      L_W_BDCDATA-FNAM = P_FIELD.
      L_W_BDCDATA-FVAL = P_VALUE.
      APPEND L_W_BDCDATA TO P_T_BDCDATA.
    ENDFORM.                    " bdc_field
    *&      Form  open_group
          bdc  open group in sm35
         -->P_P_SESSN  session name
    FORM OPEN_GROUP  USING    P_P_SESSN.
      CONSTANTS C_X TYPE C VALUE 'X'.
      CALL FUNCTION 'BDC_OPEN_GROUP'
        EXPORTING
          CLIENT              = SY-MANDT
          GROUP               = P_P_SESSN
          KEEP                = C_X
          USER                = SY-UNAME
          PROG                = SY-CPROG
        EXCEPTIONS
          CLIENT_INVALID      = 1
          DESTINATION_INVALID = 2
          GROUP_INVALID       = 3
          GROUP_IS_LOCKED     = 4
          HOLDDATE_INVALID    = 5
          INTERNAL_ERROR      = 6
          QUEUE_ERROR         = 7
          RUNNING             = 8
          SYSTEM_LOCK_ERROR   = 9
          USER_INVALID        = 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.
    ENDFORM.                    " open_group
    *&      Form  bdc_insert
          bdc insert in sm35
         -->P_T_BDCDATA  bdcdata table
         -->P_tcode      transaction
    FORM BDC_INSERT  TABLES   P_T_BDCDATA STRUCTURE BDCDATA
                     USING    VALUE(P_TCODE).
      CALL FUNCTION 'BDC_INSERT'
        EXPORTING
          TCODE            = P_TCODE
        TABLES
          DYNPROTAB        = P_T_BDCDATA
        EXCEPTIONS
          INTERNAL_ERROR   = 1
          NOT_OPEN         = 2
          QUEUE_ERROR      = 3
          TCODE_INVALID    = 4
          PRINTING_INVALID = 5
          POSTING_INVALID  = 6
          OTHERS           = 7.
      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.                    " bdc_insert
    *&      Form  close_group
          bdc close group in sm35
    FORM CLOSE_GROUP .
      CALL FUNCTION 'BDC_CLOSE_GROUP'
        EXCEPTIONS
          NOT_OPEN    = 1
          QUEUE_ERROR = 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.
    ENDFORM.                    " close_group
    *&      Form  pre_process_record
          text
         -->P_W_DATAIN  text
         <--P_W_DATA  text
    FORM pre_process_record  USING    P_W_DATAIN
                             CHANGING P_W_DATA.
    move p_w_datain to p_w_data-bukrs.
    ENDFORM.                    " pre_process_record

    copy paste this code
    *& Report ZTEST_RECUPLOAD
    REPORT ZTEST_RECUPLOAD.
    *include bdcrecx1.
    *******************Selection screen*************************************
    SELECTION-SCREEN BEGIN OF BLOCK 1 WITH FRAME TITLE TEXT-T01 .
    PARAMETERS P_FILE TYPE RLGRAP-FILENAME OBLIGATORY.
    PARAMETERS P_SESSN TYPE APQI-GROUPID DEFAULT 'RECURRING'.
    PARAMETERS P_SESSN2 TYPE APQI-GROUPID DEFAULT 'RECURRING_E'.
    SELECTION-SCREEN END OF BLOCK 1.
    *********************Type declaration***********************************
    *type for data input table
    TYPES : BEGIN OF TY_DATA,
    BUKRS TYPE T001-BUKRS, "Company code
    BLART TYPE BKPF-BLART, "Document type
    * BUDAT TYPE BKPF-BUDAT, "Posting date
    DBBDT TYPE BKDF-DBBDT, "First run
    DBATR TYPE BKDF-DBATR, "Next run
    DBEDT TYPE BKDF-DBEDT, "last run
    DBMON TYPE BKDF-DBMON, "Run frequency
    DBTAG TYPE BKDF-DBTAG, "Run date
    * DBZHL TYPE BKDF-DBZHL, "no of runs
    XBLNR TYPE BKPF-XBLNR, "reference(site)
    BKTXT TYPE BKPF-BKTXT, "document header data
    * USNAM TYPE BKPF-USNAM, "User name
    * CPUDT TYPE BKPF-CPUDT, "Entry date
    BSCHL_1 TYPE BSEG-BSCHL, "Posting key 1 item
    HKONT_1 TYPE BSEG-HKONT, "Account 1 item
    DESC_1 TYPE CHAR40, "Description vendor/GL 1 item
    MWSKZ_1 TYPE BSEG-MWSKZ, "Tax code 1 item
    * MWSTS1_1 TYPE BSEG-MWSTS, "Tax Amount 1 item
    MWSTS2_1 TYPE BSEG-MWSTS, "Amount is local currency 1 item
    * MWSTS3_1 TYPE BSEG-MWSTS, "Amount is foreign currency 1 item
    SGTXT_1 TYPE BSEG-SGTXT, "Item text 1 item
    ZUONR_1 TYPE BSEG-ZUONR, "Assignment 1 item
    BSCHL_2 TYPE BSEG-BSCHL, "Posting key 2 item
    HKONT_2 TYPE BSEG-HKONT, "Account 2 item
    DESC_2 TYPE CHAR40, "Description vendor/GL 2 item
    MWSKZ_2 TYPE BSEG-MWSKZ, "Tax code 2 item
    ** MWSTS1_2 TYPE BSEG-MWSTS, "Tax Amount 2 item
    MWSTS2_2 TYPE BSEG-MWSTS, "Amount is local currency 2 item
    * MWSTS3_2 TYPE BSEG-MWSTS, "Amount is foreign currency 2 item
    KOSTL TYPE COBL-KOSTL, "Cost center
    AUFNR TYPE COBL-AUFNR, "Internal order number
    SGTXT_2 TYPE BSEG-SGTXT, "Item text 2 item
    ZUONR_2 TYPE BSEG-ZUONR, "Assignment 2 item
    END OF TY_DATA.
    *type for data error table
    TYPES : BEGIN OF TY_ERROR,
    BUKRS TYPE T001-BUKRS, "Company code
    BLART TYPE BKPF-BLART, "Document type
    * BUDAT TYPE BKPF-BUDAT, "Posting date
    DBBDT TYPE BKDF-DBBDT, "First run
    DBATR TYPE BKDF-DBATR, "Next run
    DBEDT TYPE BKDF-DBEDT, "last run
    DBMON TYPE BKDF-DBMON, "Run frequency
    DBTAG TYPE BKDF-DBTAG, "Run date
    * DBZHL TYPE BKDF-DBZHL, "no of runs
    XBLNR TYPE BKPF-XBLNR, "reference(site)
    BKTXT TYPE BKPF-BKTXT, "document header data
    * USNAM TYPE BKPF-USNAM, "User name
    * CPUDT TYPE BKPF-CPUDT, "Entry date
    BSCHL_1 TYPE BSEG-BSCHL, "Posting key 1 item
    HKONT_1 TYPE BSEG-HKONT, "Account 1 item
    DESC_1 TYPE CHAR40, "Description vendor/GL 1 item
    MWSKZ_1 TYPE BSEG-MWSKZ, "Tax code 1 item
    * MWSTS1_1 TYPE BSEG-MWSTS, "Tax Amount 1 item
    MWSTS2_1 TYPE BSEG-MWSTS, "Amount is local currency 1 item
    * MWSTS3_1 TYPE BSEG-MWSTS, "Amount is foreign currency 1 item
    SGTXT_1 TYPE BSEG-SGTXT, "Item text 1 item
    ZUONR_1 TYPE BSEG-ZUONR, "Assignment 1 item
    BSCHL_2 TYPE BSEG-BSCHL, "Posting key 2 item
    HKONT_2 TYPE BSEG-HKONT, "Account 2 item
    DESC_2 TYPE CHAR40, "Description vendor/GL 2 item
    MWSKZ_2 TYPE BSEG-MWSKZ, "Tax code 2 item
    * MWSTS1_2 TYPE BSEG-MWSTS, "Tax Amount 2 item
    MWSTS2_2 TYPE BSEG-MWSTS, "Amount is local currency 2 item
    * MWSTS3_2 TYPE BSEG-MWSTS, "Amount is foreign currency 2 item
    KOSTL TYPE COBL-KOSTL, "Cost center
    AUFNR TYPE COBL-AUFNR, "Internal order number
    SGTXT_2 TYPE BSEG-SGTXT, "Item text 2 item
    ZUONR_2 TYPE BSEG-ZUONR, "Assignment 2 item
    END OF TY_ERROR.
    *********************Data declaration************************************
    DATA : T_DATA TYPE TABLE OF TY_DATA, "Table to upload correct entries
    T_ERROR TYPE TABLE OF TY_ERROR. "Table to upload error data
    DATA : W_DATA type TY_DATA, "workarea for t_data
    W_ERROR TYPE TY_ERROR. "workarea for t_error
    DATA : T_BDCDATA TYPE TABLE OF BDCDATA,
    W_BDCDATA TYPE BDCDATA.
    DATA : T_SEL_FILE TYPE FILETABLE,
    W_RETURN_CODE TYPE I VALUE '0',
    W_SEL_FILE LIKE LINE OF T_SEL_FILE.
    DATA : T_DATAIN TYPE TABLE OF TY_DATA,
    W_DATAIN TYPE string.
    DATA : W_FILE TYPE STRING.
    *********************At Selection Screen**********************************
    *selection screen validations
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
    CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
    EXPORTING
    WINDOW_TITLE = 'Select File for upload'
    * DEFAULT_EXTENSION =
    * DEFAULT_FILENAME =
    FILE_FILTER = '*.xls'
    * WITH_ENCODING =
    * INITIAL_DIRECTORY =
    * MULTISELECTION =
    CHANGING
    FILE_TABLE = T_SEL_FILE
    RC = W_RETURN_CODE
    * USER_ACTION =
    * FILE_ENCODING =
    EXCEPTIONS
    FILE_OPEN_DIALOG_FAILED = 1
    CNTL_ERROR = 2
    ERROR_NO_GUI = 3
    NOT_SUPPORTED_BY_GUI = 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.
    IF W_RETURN_CODE <> -1.
    READ TABLE T_SEL_FILE INTO W_SEL_FILE INDEX 1.
    CLEAR P_FILE.
    MOVE W_SEL_FILE TO P_FILE.
    ENDIF.
    *at selection screen
    AT SELECTION-SCREEN ON P_SESSN.
    IF P_SESSN IS INITIAL.
    P_SESSN = 'RECURRING'.
    ENDIF.
    AT SELECTION-SCREEN ON P_SESSN2.
    IF P_SESSN2 IS INITIAL.
    P_SESSN2 = 'RECURRING_E'.
    ENDIF.
    *********************Start of Selection ****************************
    START-OF-SELECTION.
    OPEN DATASET P_FILE FOR INPUT IN TEXT MODE ENCODING DEFAULT.
    *error message when file not found.
    IF SY-SUBRC <> 0.
    MESSAGE 'File Not Found' TYPE 'E'.
    ENDIF.
    DO.
    READ DATASET P_FILE INTO w_datain.
    IF SY-SUBRC EQ 0.
    perform pre_process_record using w_datain
    changing w_data.
    PERFORM VALIDATE_DATA TABLES T_DATA
    T_ERROR
    USING W_DATA.
    ELSE.
    EXIT.
    ENDIF.
    ENDDO.
    CLOSE DATASET P_FILE.
    *check if any error has occured.
    IF T_ERROR[] IS NOT INITIAL.
    PERFORM FILL_BDC_TABLE TABLES T_ERROR
    T_BDCDATA
    USING P_SESSN2.
    ENDIF.
    *Check if any records are present to be uploaded.
    IF T_DATA[] IS NOT INITIAL.
    PERFORM FILL_BDC_TABLE TABLES T_DATA
    T_BDCDATA
    USING P_SESSN.
    ELSE.
    WRITE :/ 'No Correct Records were found to create session in SM35',
    / 'Please Check the File'.
    ENDIF.
    *& Form validate_data
    * Sub routine to check correctness of the uploaded data.
    * -->P_T_DATA table to upload correct entries
    * -->P_T_ERROR table to upload erroneous entries
    * -->P_W_DATA current record
    FORM VALIDATE_DATA TABLES P_T_DATA STRUCTURE W_DATA
    P_T_ERROR STRUCTURE W_ERROR
    USING P_W_DATA structure w_data .
    DATA : L_W_LIFNR TYPE LFA1-LIFNR,
    L_W_SAKNR TYPE SKA1-SAKNR.
    DATA: L_W_DATA TYPE TY_DATA,
    L_W_ERROR TYPE TY_ERROR.
    MOVE P_W_DATA TO L_W_DATA.
    DATA : L_FG_ERROR TYPE C,
    L_W_DATE TYPE SY-DATUM.
    CONSTANTS : C_X TYPE C VALUE 'X',
    C_O2CA(4) TYPE C VALUE 'O2CA',
    C_ZK_1(2) TYPE C VALUE 'ZK',
    C_ZK_2(2) TYPE C VALUE 'zk',
    C_NUM(17) TYPE C VALUE '01234567890/.-, ',
    C_31(2) TYPE C VALUE '31',
    C_40(2) TYPE C VALUE '40'.
    L_FG_ERROR = SPACE.
    DO.
    *check document type is 'ZK'
    IF NOT L_W_DATA-BLART NE C_ZK_1 OR
    L_W_DATA-BLART NE C_ZK_2.
    L_FG_ERROR = C_X.
    EXIT.
    ENDIF.
    *check 1 item text fields are filled by numeric value.
    IF NOT L_W_DATA-SGTXT_1 CO C_NUM.
    L_FG_ERROR = C_X.
    EXIT.
    ENDIF.
    *check 2 item text fields are filled by date.
    MOVE L_W_DATA-SGTXT_2 TO L_W_DATE.
    CALL FUNCTION 'DATE_CHECK_PLAUSIBILITY'
    EXPORTING
    DATE = L_W_DATE
    EXCEPTIONS
    PLAUSIBILITY_CHECK_FAILED = 1
    OTHERS = 2.
    IF SY-SUBRC <> 0.
    L_FG_ERROR = C_X.
    EXIT.
    ENDIF.
    *check first posting key is '31'
    IF NOT L_W_DATA-BSCHL_1 EQ C_31.
    L_FG_ERROR = C_X.
    EXIT.
    ENDIF.
    *check second posting key is '40'
    IF NOT L_W_DATA-BSCHL_2 EQ C_40.
    L_FG_ERROR = C_X.
    EXIT.
    ENDIF.
    *check valid Vendor
    SELECT SINGLE LIFNR FROM LFA1 INTO L_W_LIFNR
    WHERE LIFNR = L_W_DATA-HKONT_1.
    IF SY-SUBRC <> 0.
    L_FG_ERROR = C_X.
    EXIT.
    ENDIF.
    *check valid G/L account.
    SELECT SINGLE SAKNR FROM SKA1 INTO L_W_SAKNR
    WHERE KTOPL = C_O2CA AND
    SAKNR = L_W_DATA-HKONT_2.
    IF SY-SUBRC <> 0.
    L_FG_ERROR = C_X.
    EXIT.
    ENDIF.
    *check 1 item assignment contains numeric value
    IF NOT L_W_DATA-ZUONR_1 CO C_NUM.
    L_FG_ERROR = C_X.
    EXIT.
    ENDIF.
    *check 2 item assigment contains date value
    MOVE L_W_DATA-ZUONR_2 TO L_W_DATE.
    CALL FUNCTION 'DATE_CHECK_PLAUSIBILITY'
    EXPORTING
    DATE = L_W_DATE
    EXCEPTIONS
    PLAUSIBILITY_CHECK_FAILED = 1
    OTHERS = 2.
    IF SY-SUBRC <> 0.
    L_FG_ERROR = C_X.
    EXIT.
    ENDIF.
    *check if no error has occured
    IF NOT L_FG_ERROR EQ C_X.
    EXIT.
    ENDIF.
    ENDDO.
    *check error flag and insert error text.
    CASE L_FG_ERROR.
    WHEN C_X. "When error has occured.
    APPEND L_W_DATA TO P_T_ERROR.
    WHEN OTHERS. "When no error has occured.
    APPEND L_W_DATA TO P_T_DATA.
    ENDCASE.
    ENDFORM. " validate_data
    *& Form download_error_log
    * Sub routine to download the error log
    * -->P_T_ERROR error log
    FORM DOWNLOAD_ERROR_LOG TABLES P_T_ERROR STRUCTURE W_ERROR.
    DATA : L_FILENAME TYPE STRING,
    L_PATH TYPE STRING,
    L_FULLPATH TYPE STRING.
    CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG
    EXPORTING
    WINDOW_TITLE = 'Save the Error log'
    CHANGING
    FILENAME = L_FILENAME
    PATH = L_PATH
    FULLPATH = L_FULLPATH
    EXCEPTIONS
    CNTL_ERROR = 1
    ERROR_NO_GUI = 2
    NOT_SUPPORTED_BY_GUI = 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.
    CHECK L_FULLPATH IS NOT INITIAL.
    CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
    FILENAME = L_FULLPATH
    FILETYPE = 'ASC'
    WRITE_FIELD_SEPARATOR = 'X'
    TABLES
    DATA_TAB = P_T_ERROR
    EXCEPTIONS
    FILE_WRITE_ERROR = 1
    NO_BATCH = 2
    GUI_REFUSE_FILETRANSFER = 3
    INVALID_TYPE = 4
    NO_AUTHORITY = 5
    UNKNOWN_ERROR = 6
    HEADER_NOT_ALLOWED = 7
    SEPARATOR_NOT_ALLOWED = 8
    FILESIZE_NOT_ALLOWED = 9
    HEADER_TOO_LONG = 10
    DP_ERROR_CREATE = 11
    DP_ERROR_SEND = 12
    DP_ERROR_WRITE = 13
    UNKNOWN_DP_ERROR = 14
    ACCESS_DENIED = 15
    DP_OUT_OF_MEMORY = 16
    DISK_FULL = 17
    DP_TIMEOUT = 18
    FILE_NOT_FOUND = 19
    DATAPROVIDER_EXCEPTION = 20
    CONTROL_FLUSH_ERROR = 21
    OTHERS = 22.
    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. " download_error_log
    *& Form fill_bdc_table
    * bdc session is created in SM35
    * -->P_T_DATA correct data
    * -->P_T_BDCDATA bdcdata
    * -->P_P_SESSN session name
    FORM FILL_BDC_TABLE TABLES P_T_DATA STRUCTURE W_DATA
    P_T_BDCDATA STRUCTURE BDCDATA
    USING P_P_SESSN.
    DATA : L_W_DATA TYPE TY_DATA. "workarea for t_data
    CONSTANTS: C_EUR(3) TYPE C VALUE 'EUR'.
    *open batch
    PERFORM OPEN_GROUP USING P_P_SESSN.
    LOOP AT P_T_DATA INTO L_W_DATA.
    *clear the bdc table
    REFRESH P_T_BDCDATA.
    *initial screen
    PERFORM BDC_DYNPRO TABLES P_T_BDCDATA
    USING 'SAPMF05A' '0106'.
    PERFORM : BDC_FIELD TABLES P_T_BDCDATA USING 'BDC_CURSOR' 'BKPF-WAERS',
    BDC_FIELD TABLES P_T_BDCDATA USING 'BDC_OKCODE' '/00', "enter
    BDC_FIELD TABLES P_T_BDCDATA USING 'BKPF-BUKRS' L_W_DATA-BUKRS, "company code
    BDC_FIELD TABLES P_T_BDCDATA USING 'BKDF-DBBDT' L_W_DATA-DBBDT, "first run on
    BDC_FIELD TABLES P_T_BDCDATA USING 'BKDF-DBATR' L_W_DATA-DBATR, "next run on
    BDC_FIELD TABLES P_T_BDCDATA USING 'BKDF-DBEDT' L_W_DATA-DBEDT, "last run on
    BDC_FIELD TABLES P_T_BDCDATA USING 'BKDF-DBMON' L_W_DATA-DBMON, "run frequency
    BDC_FIELD TABLES P_T_BDCDATA USING 'BKDF-DBTAG' L_W_DATA-DBTAG, "run date
    BDC_FIELD TABLES P_T_BDCDATA USING 'BKPF-BLART' L_W_DATA-BLART, "document type
    BDC_FIELD TABLES P_T_BDCDATA USING 'BKPF-WAERS' C_EUR, "currency
    BDC_FIELD TABLES P_T_BDCDATA USING 'BKPF-XBLNR' L_W_DATA-XBLNR, "reference
    BDC_FIELD TABLES P_T_BDCDATA USING 'BKPF-BKTXT' L_W_DATA-BKTXT, "document header data
    BDC_FIELD TABLES P_T_BDCDATA USING 'RF05A-NEWBS' L_W_DATA-BSCHL_1,"posting key
    BDC_FIELD TABLES P_T_BDCDATA USING 'RF05A-NEWKO' L_W_DATA-HKONT_1."account no
    *second screen (First line item)
    PERFORM BDC_DYNPRO TABLES P_T_BDCDATA
    USING 'SAPMF05A' '0302'.
    PERFORM : BDC_FIELD TABLES P_T_BDCDATA USING 'BDC_CURSOR' 'RF05A-NEWKO',
    BDC_FIELD TABLES P_T_BDCDATA USING 'BDC_OKCODE' '/00', "enter
    BDC_FIELD TABLES P_T_BDCDATA USING 'BSEG-WRBTR' L_W_DATA-MWSTS2_1, "amount in LC
    BDC_FIELD TABLES P_T_BDCDATA USING 'BSEG-MWSKZ' L_W_DATA-MWSKZ_1, "tax code
    BDC_FIELD TABLES P_T_BDCDATA USING 'BSEG-ZUONR' L_W_DATA-ZUONR_1, "assignment
    BDC_FIELD TABLES P_T_BDCDATA USING 'BSEG-SGTXT' L_W_DATA-SGTXT_1, "item level text
    BDC_FIELD TABLES P_T_BDCDATA USING 'RF05A-NEWBS' L_W_DATA-BSCHL_2, "posting key
    BDC_FIELD TABLES P_T_BDCDATA USING 'RF05A-NEWKO' L_W_DATA-HKONT_2. "account no
    *third screen (Second line item)
    PERFORM BDC_DYNPRO TABLES P_T_BDCDATA
    USING 'SAPMF05A' '0300'.
    PERFORM : BDC_FIELD TABLES P_T_BDCDATA USING 'BDC_CURSOR' 'BSEG-EBELN',
    BDC_FIELD TABLES P_T_BDCDATA USING 'BDC_OKCODE' '=AB', "overview button
    BDC_FIELD TABLES P_T_BDCDATA USING 'BSEG-WRBTR' L_W_DATA-MWSTS2_2, "amount in LC
    BDC_FIELD TABLES P_T_BDCDATA USING 'BSEG-MWSKZ' L_W_DATA-MWSKZ_2, "tax code
    BDC_FIELD TABLES P_T_BDCDATA USING 'BSEG-ZUONR' L_W_DATA-ZUONR_2, "assigment
    BDC_FIELD TABLES P_T_BDCDATA USING 'BSEG-SGTXT' L_W_DATA-SGTXT_2. "item text
    *fourth screen (pop up)
    PERFORM BDC_DYNPRO TABLES P_T_BDCDATA
    USING 'SAPLKACB' '0002'.
    PERFORM : BDC_FIELD TABLES P_T_BDCDATA USING 'BDC_CURSOR' 'COBL-KOSTL',
    BDC_FIELD TABLES P_T_BDCDATA USING 'BDC_OKCODE' '=ENTE', "ok button
    BDC_FIELD TABLES P_T_BDCDATA USING 'COBL-KOSTL' L_W_DATA-KOSTL, "cost center
    BDC_FIELD TABLES P_T_BDCDATA USING 'COBL-AUFNR' L_W_DATA-AUFNR. "order number
    *fifth screen
    PERFORM BDC_FIELD TABLES P_T_BDCDATA
    USING 'SAPMF05A' '0070'.
    PERFORM : BDC_FIELD TABLES P_T_BDCDATA USING 'BDC_CURSOR' 'RF05A-NEWBS',
    BDC_FIELD TABLES P_T_BDCDATA USING 'BDC_OKCODE' '=BU'. "save document
    PERFORM BDC_INSERT TABLES P_T_BDCDATA
    USING 'ZREC_ENTRY'.
    ENDLOOP.
    *close the batch.
    PERFORM CLOSE_GROUP.
    ENDFORM. " fill_bdc_table
    *& Form bdc_dynpro
    * bdc screen insert sub routine
    * -->P_T_BDCDATA BDC table
    * -->P_PROGRAM Program name
    * -->P_SCREEN Screen no
    FORM BDC_DYNPRO TABLES P_T_BDCDATA STRUCTURE BDCDATA
    USING VALUE(P_PROGRAM)
    VALUE(P_SCREEN).
    CONSTANTS C_X TYPE C VALUE 'X'.
    DATA L_W_BDCDATA TYPE BDCDATA.
    L_W_BDCDATA-PROGRAM = P_PROGRAM.
    L_W_BDCDATA-DYNPRO = P_SCREEN.
    L_W_BDCDATA-DYNBEGIN = C_X.
    APPEND L_W_BDCDATA TO P_T_BDCDATA.
    ENDFORM. " bdc_dynpro
    *& Form bdc_field
    * bdc field screen routine
    * -->P_T_BDCDATA BDC table
    * -->P_FIELD Field name
    * -->P_VALUE Value
    FORM BDC_FIELD TABLES P_T_BDCDATA STRUCTURE BDCDATA
    USING VALUE(P_FIELD)
    VALUE(P_VALUE).
    DATA L_W_BDCDATA TYPE BDCDATA. "Work area
    L_W_BDCDATA-FNAM = P_FIELD.
    L_W_BDCDATA-FVAL = P_VALUE.
    APPEND L_W_BDCDATA TO P_T_BDCDATA.
    ENDFORM. " bdc_field
    *& Form open_group
    * bdc open group in sm35
    * -->P_P_SESSN session name
    FORM OPEN_GROUP USING P_P_SESSN.
    CONSTANTS C_X TYPE C VALUE 'X'.
    CALL FUNCTION 'BDC_OPEN_GROUP'
    EXPORTING
    CLIENT = SY-MANDT
    GROUP = P_P_SESSN
    KEEP = C_X
    USER = SY-UNAME
    PROG = SY-CPROG
    EXCEPTIONS
    CLIENT_INVALID = 1
    DESTINATION_INVALID = 2
    GROUP_INVALID = 3
    GROUP_IS_LOCKED = 4
    HOLDDATE_INVALID = 5
    INTERNAL_ERROR = 6
    QUEUE_ERROR = 7
    RUNNING = 8
    SYSTEM_LOCK_ERROR = 9
    USER_INVALID = 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.
    ENDFORM. " open_group
    *& Form bdc_insert
    * bdc insert in sm35
    * -->P_T_BDCDATA bdcdata table
    * -->P_tcode transaction
    FORM BDC_INSERT TABLES P_T_BDCDATA STRUCTURE BDCDATA
    USING VALUE(P_TCODE).
    CALL FUNCTION 'BDC_INSERT'
    EXPORTING
    TCODE = P_TCODE
    TABLES
    DYNPROTAB = P_T_BDCDATA
    EXCEPTIONS
    INTERNAL_ERROR = 1
    NOT_OPEN = 2
    QUEUE_ERROR = 3
    TCODE_INVALID = 4
    PRINTING_INVALID = 5
    POSTING_INVALID = 6
    OTHERS = 7.
    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. " bdc_insert
    *& Form close_group
    * bdc close group in sm35
    FORM CLOSE_GROUP .
    CALL FUNCTION 'BDC_CLOSE_GROUP'
    EXCEPTIONS
    NOT_OPEN = 1
    QUEUE_ERROR = 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.
    ENDFORM. " close_group
    *& Form pre_process_record
    * text
    * -->P_W_DATAIN text
    * <--P_W_DATA text
    FORM pre_process_record USING P_W_DATAIN
    CHANGING P_W_DATA structure w_data.
    move p_w_datain to p_w_data-bukrs.
    ENDFORM. " pre_process_record

  • ABAP SYNTAX ERROR IN STANDARD SAP TRANSFORMATION

    Hi experts, I am facing a problem while activating a transformation for the cube 0CCA_C11. I installed the flow in 3.5 and wen i was migrating the flow, i first migrated the update rule. At that time, the transformation is giving me " syntax error in the routine" for the infoobject 0CO_REPLINE. The eroor message is given below:
    E:The type "_TY_S_SC_1_FULL" is unknown, but there is a type with the similar name "_TY_S_TG_1_FULL". "_TY_S_TG_1_FULL".

    Hi,
    Please check routine if any for 0CO_REPLINE and also expert routine.
    Regards,
    Rema.

Maybe you are looking for

  • How can Verizon bill me for a phone I return and have FedEx proof it was received

    Bought a new phone in Verizon store, camera didn't work.  Verizon sent new phone with prepaid shipping to return broken phone.  I sent phone in via FedEx, FedEx has a signed receipt from Verizon that it was received at their warehouse on July 18th. 

  • Still can't get airplay to work!!!!!

    Grrrrrrrrr. Still can't get airplay to work with either my iPad or my iPhone to my atv2. Everything has the latest firmware, including my airport extreme. Airplay is turned on in options on the atv2. Everything is on the same network. I even switched

  • MW project conversion to 10.1.3.0.0

    I just noticed that when MW auto-upgrades my project when I open pre 10.1.3 projects, it does not convert the datatypes properly in my DB descriptors. (for instance, all INTs become VARCHARSs) I am using SQL Server as my DB Platform Is this a known i

  • Keyboard Volume Keys: half-steps?  Quarter Steps?

    Is it possible to change the amount of increase / decrease the keyboard volume keys cause? Right now, tapping F11 or F12 just once turns the volume up or down a LOT more than I want it to. Subtle changes are impossible. Is there any way for me to cha

  • Best external 1Tb hard drive?

    i have a 750Gb hard drive in an enclosure case that connects via USB to my Macbook Pro, but i had a horrible time when i first got it to actually work with the MBP. anyone have any suggestions for a good 1Tb external drive? USB or Firewire, doesnt ma