Creating session for the Error records

Hi Guys,
  Iam posting some data using the Custom FM. If i get any errors out of that i need to create a BDC session for those errors.Can anyone throw some light on how to acheive this.
Regards,
Kittu.

HI,
check this code
report  zsh_recording_fk01                      .
tables : lfa1  .  " Vendor Master.
  I N T E R N A L T A B L E - D E C L A R A T I O N                  *
data : begin of it_tab occurs 0,
           lifnr(16),        "account number of vendor
           ktokk(4),         "Vendor Number
           anred(15),        "Account Group
           name1(35),        "Name
           sortl(10),        "Sort field
           land1(3) ,        "Land
           spras(1),         "Language Key
           kunnr(10),        "customer number
           banks(3),         "Bank country key
           bankl(15),        "Bank Key
           bankn(18),        "Bank Account Number
           koinh(60),        "Account Holder Name
           banka(60),        "Name of bank
           provz(3),         "region
end of it_tab.
data : begin of it_tab1 occurs 0,
           banks(3),         "Bank country key
           bankl(15),        "Bank Key
           bankn(18),        "Bank Account Number
           koinh(60),        "Account Holder Name
           banka(60),        "Name of bank
           provz(3),         "region
end of it_tab1.
DATA:it_BDCtab LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
ERROR MESSAGE TABLE
DATA:it_MSGtab LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
data: program type BDCDATA-PROGRAM,
      dynpro  type BDCDATA-dynpro,
      fnam    type BDCDATA-fnam,
      fval    type BDCDATA-fval.
              S E L E C T I O N  -  S C R E E N                      *
selection-screen : begin of block bl1 with frame.
parameter        : p_file type rlgrap-filename default
'C:\Vendor.txt.txt' obligatory,
                   p_file1 type rlgrap-filename default
'C:\Vendor1.txt.txt' obligatory.
selection-screen : end of block bl1.
           A T  S E L E C T I O N  -  S C R E E N                    *
at selection-screen on value-request for p_file.
to get F4 help for p_file
  perform f4_get_help using p_file.
to get F4 help for p_file
   perform f4_get_help1 using p_file1.
            S T A R T   O F   S E L E C T I O N                      *
start-of-selection.
Uploading data from flat file into it_tab
  perform bdc_upload.
  perform bdc_upload1.
  perform populate_bdc.
             E N D    O F   S E L E C T I O N                        *
end-of-selection.
displaying fields which r uploaded from flat file.
  perform display_report.
             T O P  _  O F _  P A G E                                *
top-of-page.
to display header in the report
  perform header.
*&      Form  f4_get_help
      text
     -->P_P_FILE  text
form f4_get_help  using    p_p_file.
  call function 'F4_FILENAME'
   exporting
     program_name        = syst-cprog
     dynpro_number       = syst-dynnr
  FIELD_NAME          = ' '
   importing
     file_name           =  p_p_file.
endform.                    " f4_get_help
*&      Form  bdc_upload
      text
-->  p1        text
<--  p2        text
form bdc_upload .
  data: v_file type string.
  v_file = p_file.
  call function 'GUI_UPLOAD'
    exporting
      filename                      = v_file
      filetype                      = 'ASC'
  HAS_FIELD_SEPARATOR           = ' '
  HEADER_LENGTH                 = 0
  READ_BY_LINE                  = 'X'
  DAT_MODE                      = ' '
  CODEPAGE                      = ' '
  IGNORE_CERR                   = ABAP_TRUE
  REPLACEMENT                   = '#'
  CHECK_BOM                     = ' '
IMPORTING
  FILELENGTH                    =
  HEADER                        =
    tables
      data_tab                      = it_tab
   exceptions
     file_open_error               = 1
     file_read_error               = 2
     no_batch                      = 3
     gui_refuse_filetransfer       = 4
     invalid_type                  = 5
     no_authority                  = 6
     unknown_error                 = 7
     bad_data_format               = 8
     header_not_allowed            = 9
     separator_not_allowed         = 10
     header_too_long               = 11
     unknown_dp_error              = 12
     access_denied                 = 13
     dp_out_of_memory              = 14
     disk_full                     = 15
     dp_timeout                    = 16
     others                        = 17.
  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_upload
*&      Form  display_report
      text
-->  p1        text
<--  p2        text
form display_report .
  uline 1(86).
  loop at it_tab .
    format color 2.
    write :/1   sy-vline,
            2   it_tab-lifnr,
            12  it_tab-ktokk ,
            18  it_tab-anred ,
            30  it_tab-name1 ,
            55  it_tab-sortl ,
            58  it_tab-land1 ,
            72  it_tab-spras ,
            76  it_tab-kunnr ,
            88  it_tab-banks ,
            94  it_tab-bankl ,
            112 it_tab-bankn ,
            132 it_tab-koinh ,
            194 it_tab-banka ,
            256 it_tab-provz ,
            260 sy-vline.
  endloop.
  uline 1(86).
endform.                    " display_report
*&      Form  header
      text
-->  p1        text
<--  p2        text
form header .
  uline 1(86).
  format color col_heading.
  write :/1   sy-vline,
          2   'VEN.NO',
          12  'ACC' ,
          18  'TITLE' ,
          30  'NAME' ,
          55  'ST',
          58  'LAND' ,
          72  'L' ,
          76  'CUSTNO',
          88  'CKI',
          94  'BANKKEY',
          112 'B.NO',
          132 'ACC HOLDER NAME',
          194 'BANK NAME',
          256 'reg',
          260 sy-vline.
endform.                    " header
*&      Form  populate_bdc
      text
form populate_bdc .
loop at it_tab.
  perform build_screen_details using 'SAPMF02K' '0105'.
  perform build_fields using: 'BDC_OKCODE' '/00',
                              'RF02K-LIFNR' it_tab-lifnr,
                              'RF02K-KTOKK' it_tab-ktokk.
  perform build_screen_details using 'SAPMF02K'     '0110'.
  perform build_fields using:    'BDC_OKCODE' '/00',
                               'LFA1-ANRED'  it_tab-anred,
                               'LFA1-NAME1'  it_tab-name1,
                               'LFA1-SORTL'  it_tab-sortl,
                               'LFA1-LAND1'  it_tab-land1,
                               'LFA1-SPRAS'  it_tab-spras.
  perform build_screen_details using 'SAPMF02K'     '0120'.
  perform build_fields using:    'BDC_OKCODE' '/00'.
  perform build_screen_details using 'SAPMF02K'     '0130'.
  perform build_fields using:    'BDC_OKCODE' '=BANK',
                                 'LFBK-BANKS(01)' it_tab-banks,
                                 'LFBK-BANKL(01)' it_tab-bankl,
                                 'LFBK-BANKN(01)' it_tab-bankn,
                                 'LFBK-KOINH(01)' it_tab-koinh.
  perform build_screen_details using 'SAPLBANK'     '0100'.
  perform build_fields using:    'BDC_OKCODE' '=ENTR',
                                 'BNKA-BANKA'     it_tab-banka,
                                 'BNKA-PROVZ'       it_tab-provz.
  perform build_screen_details using 'SAPMF02K'     '0130'.
  perform build_fields using:    'BDC_OKCODE' '=UPDA'.
endloop.
  call transaction 'FK01' using it_bdctab mode 'A' update
  'S' messages into it_msgtab.
clear it_bdctab.
refresh it_bdctab.
loop at it_msgtab.
perform format_message.
endloop.
endform.                    " populate_bdc
*&      Form  build_screen_details
      text
form build_screen_details  using    p_program type BDCDATA-PROGRAM
                                    p_dynpro  type BDCDATA-dynpro.
  it_BDCtab-PROGRAM  = p_program.    " Program Name
  it_BDCtab-DYNPRO   = p_dynpro.     " Screen Number
  it_BDCtab-DYNBEGIN = 'X'.          " New screen
  Append it_bdctab.
  clear it_bdctab.
endform.                    " build_screen_details
*&      Form  build_fields
      text
form build_fields  using    p_fnam
                            p_fval.
  it_BDCtab-FNAM     = p_fnam.
  it_BDCtab-FVAL     = p_fval.
  Append it_bdctab.
  clear  it_bdctab.
endform.                    " build_fields
*&      Form  format_message
      text
-->  p1        text
<--  p2        text
form format_message .
call function 'FORMAT_MESSAGE'
EXPORTING
   ID              = SY-MSGID
   LANG            = sy-langu
   NO              = SY-MSGNO
   V1              = SY-MSGV1
   V2              = SY-MSGV2
   V3              = SY-MSGV3
   V4              = SY-MSGV4
IMPORTING
   MSG             = it_msgtab
EXCEPTIONS
   NOT_FOUND       = 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.                    " format_message
*&      Form  bdc_upload1
      text
-->  p1        text
<--  p2        text
form bdc_upload1 .
data : v_file1 type string.
v_file1 = p_file1.
call function 'GUI_UPLOAD'
  exporting
    filename                      = v_file1
   FILETYPE                      = 'ASC'
  HAS_FIELD_SEPARATOR           = ' '
  HEADER_LENGTH                 = 0
  READ_BY_LINE                  = 'X'
  DAT_MODE                      = ' '
  CODEPAGE                      = ' '
  IGNORE_CERR                   = ABAP_TRUE
  REPLACEMENT                   = '#'
  CHECK_BOM                     = ' '
IMPORTING
  FILELENGTH                    =
  HEADER                        =
  tables
    data_tab                      = it_tab1
EXCEPTIONS
   FILE_OPEN_ERROR               = 1
   FILE_READ_ERROR               = 2
   NO_BATCH                      = 3
   GUI_REFUSE_FILETRANSFER       = 4
   INVALID_TYPE                  = 5
   NO_AUTHORITY                  = 6
   UNKNOWN_ERROR                 = 7
   BAD_DATA_FORMAT               = 8
   HEADER_NOT_ALLOWED            = 9
   SEPARATOR_NOT_ALLOWED         = 10
   HEADER_TOO_LONG               = 11
   UNKNOWN_DP_ERROR              = 12
   ACCESS_DENIED                 = 13
   DP_OUT_OF_MEMORY              = 14
   DISK_FULL                     = 15
   DP_TIMEOUT                    = 16
   OTHERS                        = 17
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_upload1
*&      Form  f4_get_help1
      text
     -->P_P_FILE1  text
form f4_get_help1  using    p_p_file1.
call function 'F4_FILENAME'
EXPORTING
   PROGRAM_NAME        = SYST-CPROG
   DYNPRO_NUMBER       = SYST-DYNNR
  FIELD_NAME          = ' '
IMPORTING
   FILE_NAME           = p_p_file1
endform.                    " f4_get_help1
Regards,
Laxmi

Similar Messages

  • About "the hospital for the error records"...

    Hi folks,
    I am new to ODI, and I am not buying the idea of "the hospital for the error records". In my personal opinion it introduces many complications. If some dimension records are "dirty" and we put them in the error table, then we are splitting the natural relation of the data, aren't we. The DWH data won't correspond to the source anymore, the dimension's data will be artificially split (the error records could apear on the next day), and we will need an additional process which should update the corresponding fact records on the next day (late arriving changes for the existing facts). Sounds much more complicated, than just to allow the ETL process to fail, fix the issue and start it again.
    Experts, please, help with an opinion.
    Thanks in advance!

    @DecaXD, thanks for your comment.
    "after that under my opinion "something is better than none"" This is exactly what I am worried about. The whole "hospital" idea, is something, which makes the whole process more complicated, without clear benefits. I like the idea to have E$ tables, but just for debugging purposes, just to be able to identify quickly, what were the error rows, so I can do a investigation based on failed data. What, I don't like is the idea that we can EASILY reuse the error data to recover the DWH state later.
    "Are you sure that you want to stop ALL your datawarehouse because the Address field is null?"Well, if during the analysis phase (especially, the data profiling step), we missed the fact that the address table could be null, then yes, I would like to stop the whole ETL, because this is situation, which has not been addressed correctly during the design of the ETL process.
    A rithorical question: Are you going to keep recovering the null records after each run (even a "successfull" one), or you would fix the interface/mapping to allow nulls, which would be updated on subsequent runs naturally ?
    What about more complicated error rows, like missing dimension key, which relates to many fact records ? Should we put the related fact records in their E$ table either. What if we have a snowflake design with many references to/from the error dimension records. Sounds too complicated for me.
    I would just store the error rows, and stop the ETL. Note, that I allow for dellay, but don't publish any not consistent data in the DWH.
    Bellow is a quote from the book you mentioned:
    "Don’t overuse the reject file! Reject files are notorious for being dumping
    grounds for data we’ll deal with later. When records wind up in the reject file,
    unless they are processed before the next major load step is allowed to run to
    completion, the data warehouse and the production system are out of sync."
    I am looking for more arguments, I do understand that it is not a simple issue, but I would like to see your real life experience here..
    Thanks!
    Edited by: hayrabedian on 2013-4-29 14:01
    Edited by: hayrabedian on 2013-4-29 14:02

  • How to create hyperlink for the messages in oneorder documents

    Hi ,
    I want to create hyperlink for the error messages that are raised for a payment request, so that i can navigate to that particular object ID mentioned in the message.

    Hi Paparao,
    But we can find the same functionality for trade promotions overlap, the messages raised when two or more tradepromotions overlap, provide us with hyperlink through which we can navigate to that particular object id.
    Regards
    Tejarshi
    Edited by: tejarshi vadduri on Apr 17, 2009 6:55 AM

  • DRM-61026: Unable to create user session for the following reason: Login failed. Invalid user name or password.

    All Im very new to Oracle DRM and Im trying to get the app setup on Windows server running SQL Server 2008.  When I try to login to the Web Client I keep getting this error.
    DRM-61026: Unable to create user session for the following reason: Login failed. Invalid user name or password.
    Can you please help

    This might be due to The 'Oracle Instance' path may not have been set to a path relative to the 'CSS Bridge Host' (i.e. the Foundation Services machine) on the Configuration > Host Machines > CSS > General tab of the DRM Configuration Utility.
    if this is the case then
    1. Open the DRM Configuration Console.
    2. Go to the Configuration > Host Machines > CSS > General tab of the DRM Configuration Utility.
    3. Ensure that the path in 'Oracle Instance' has been set relative to the 'CSS Bridge Host' (i.e. the Foundation Services machine defined in 'CSS Bridge Host').
    4. If corrections are made to 'Oracle Instance' then restart the DRM services to pick up the change.
    Thanks,
    ~KKT~

  • Imp: new session for the same user if  idle for 4 mins. or else throw error

    Dear All,
    I have a requirement where for security reasons if a session remains idle for 4 mins. or more, it should redirect to login page. This is easy as there is a feature in apex itself under security in application properties. This works fine.
    But I also don't want the users to start two active parallel sessions for the same user, and allow user to login only if the session for the user is idle for 4mins. or more or else display error message that the user has already logged.
    A second in sequence, on submit process for this in page 101 when login button is hit is written for this. It is as follows:
    declare
    found boolean := false;
    begin
    for x in (SELECT a.apex_user from apex_workspace_activity_log a,apex_workspace_sessions b, (SELECT max(view_date) as maxdate FROM apex_workspace_activity_log where upper(apex_user)=upper(:P101_USERNAME) and APPLICATION_ID=120) maxresults, (SELECT max(session_created) as maxcreate FROM apex_workspace_sessions where upper(user_name)=upper(:P101_USERNAME)) maxsession where b.session_created=maxsession.maxcreate AND b.APEX_SESSION_ID!=:SESSION and upper(b.user_name)=upper(:P101_USERNAME) and b.APEX_SESSION_ID=a.APEX_SESSION_ID and a.seconds_ago<240 AND a.APPLICATION_ID=120 and a.view_date=maxresults.maxdate and rownum=1) loop
    found:=true;
    raise_application_error(-20000, 'Already Logged.');
    exit;
    end loop;
    IF not found THEN
    null;
    END IF;
    end;
    But for some this reason this does not work as intended. Two users can login parallely.
    When I trace the program, I see that it should catch the parallel user login. But it does not.
    Is it some db cache issue? I don't know.
    Kindly let me know how to fix this. It is crucial for us to achieve this.
    Thanking in advance.
    Regards,
    Deepika.

    Dear Fateh,
    Thanks for the reply.
    The features of this plugin are:
    Configurable timeout actions including alert, redirect, and logout
    Optional and configurable warning message
    Option to keep session alive if user isn’t truly idle. Special thanks to Martin D’Souza for a great idea on how to implement this feature.
    But it cannot stop a new session for a user, if there is an active (in my definition apex_workspace_activity_log.seconds_ago<240) session already running for that user.
    Regards,
    Deepika.

  • Any option is there to find the error record in loop for huge amount of rec

    Hi Guru's,
    In our production system we got a error. While debugging we found one of our loop getting 1 lakh records. One of the record from the internal table having some wrong values because of that its giving a error message. But we are not getting any proper message.
    Now our problem is its very difficult to debug all the records one by one. Even its not possible to give Watchpoint. bze in what situations its giving this error that also not predictable. So how to find the error record?
    Kindly suggest.
    Ananadhan

    Need a lot more info.
    To start with is this CR Designer or some other product?
    I suspect it's classic SAP products like Business One etc., if so please mark as answered and post your question int the correct forum.
    Thank you
    Don

  • How to get the index of the error record when uploaded using standard LSMW

    Hi Experts,
    When uploading data using lsmw standard batch input method which creates an error session if any errors,how can we able to find the index of the error record
    eg: If 3rd record in input file is incorrect then error session is getting created with the error and index as 1.But I want to know that 3rd record in my input file is incorrect.
    Please help me out.

    Srinivas,
    In global data, i've written like this.
    TYPES: BEGIN OF TYPE_ERROR,
                 INDEX TYPE I,
                 END OF TYPE_ERROR.
    DATA: GT_ERROR TYPE TABLE OF TYPE_ERROR,
               GS_ERROR TYPE TYPE_ERROR,
               GV_TOTAL_COUNT TYPE I, GV_INDEX TYPE I,
               GV_STRING TYPE STRING,
              GV_FILE TYPE STRING VALUE '/usr/sap/interfaces/LSMW/Asseterror
    In Begin of transaction,
    GV_TOTAL_COUNT = GV_TOTAL_COUNT + 1.
    In End of processing,
    OPEN DATASET GV_FILE FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
    IF SY-SUBRC = 0.
    CLEAR GS_ERROR.
    LOOP AT GT_ERROR INTO GS_ERROR.
    CONCATENATE 'INDEX OF THE ERROR RECORD IS:' GS_ERROR INTO GV_STRING.
    TRANSFER GV_STRING TO GV_FILE.
    CLEAR: GV_STRING, GS_ERROR.
    ENDLOOP.
    ENDIF.
    How and where will I be assigning error count and append it to the internal table.
    Please help me out.

  • Edit the error records in error stack

    Hi,
    I want to edit the error records in error stack. There are around 300 records in error stack . I want to replace the value in one field with blank to correct the records. Can you please help me how to replace the value with blank.
    Thanks,
    Priya

    Hi,
    Open the original DTP and click on change.
    1) In Update you will find "create error DTP", just click on it system automatically create error DTP for you original DTP.
    2) Do not change any thing, just come back to your original DTP and activate your DTP again.
    Now come back and refresh the info provider tree.
    now execute your DTP, request will be green in target and you will error records in error stack.
    How to edit the error records in error DTP
    please find the doc.
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/b0406328-29c7-2e10-5db5-afe9b5695eeb?overridelayout=t…
    Thanks,
    Phani.

  • Multiple sessions for the same user

    Hi,
    The scenario is like this. The user is logged into the system using JAAS and
    has a session object created. I want to create a new session for the same user
    with the already available credentials. This is to provide the same user the access
    to the application in another window with different session object. How can do
    that in Weblogic 8.1 server ?
    thanks in advance,
    Krishna.

    Hi
    I think it would be easier to enable session time out settings using GPO considering you work in a domain environment..
    Having session timeouts settings you could say... hey after 15 min of inactivity disconnect the user and then after 15 min of disconnected session log him off
    Take a look at this URL: http://technet.microsoft.com/en-us/library/cc754272.aspx
    Hope this helps
    Best regards
    Joaquin Camarero Muñoz

  • Issue regarding bdc for capturing error records

    Hi All,
            My requirement is to capture the error record and download the error record to a flat file .
    I have done recording for MM01 transaction .
    I am getting a problem like no error records are downloaded into the flat file .It is downloading only the empty records.
    Pls see the below code which i developed & modify it for any changes .Its an urgent .Pls provide me the solution ASAP.
    My Flat file
    M     FERT     X     MATL105     KG     
    X     FERT     X     MATL106     KG
    In the above flat file 'X' is an Industry sector which doesnot exists which is an error record that has to be captured and download it into the flat file .
    Source code :
    report Z_MM01_MSG_F MESSAGE-ID MSG1
           no standard page heading line-size 255.
    include bdcrecx1.
    parameters: dataset(132) lower case.
    ***    DO NOT CHANGE - the generated data section - DO NOT CHANGE    ***
    *   If it is nessesary to change the data section use the rules:
    *   1.) Each definition of a field exists of two lines
    *   2.) The first line shows exactly the comment
    *       '* data element: ' followed with the data element
    *       which describes the field.
    *       If you don't have a data element use the
    *       comment without a data element name
    *   3.) The second line shows the fieldname of the
    *       structure, the fieldname must consist of
    *       a fieldname and optional the character '_' and
    *       three numbers and the field length in brackets
    *   4.) Each field must be type C.
    *** Generated data section with specific formatting - DO NOT CHANGE  ***
    data: begin of record occurs 0,
    * data element: MBRSH
            MBRSH_001(001),
    * data element: MTART
            MTART_002(004),
    * data element: XFELD
            KZSEL_01_003(001),
    * data element: MAKTX
            MAKTX_004(040),
    * data element: MEINS
            MEINS_005(003),
    * data element: MTPOS_MARA
            MTPOS_MARA_006(004),
          end of record.
    *DECLARATION OF BDCDATA STRUCTURE
    DATA: IT_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE .
    *declaration to store the message
    DATA: IT_MESSTAB LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE .
    *DECLARATION TO STORE THE MESSAGE
    DATA: BEGIN OF IT_STORE_MSG OCCURS 0,
          STORE(1000),
          END OF IT_STORE_MSG.
    *declaration SUCCESS MESG
    DATA: BEGIN OF IT_SUCCESS OCCURS 0,
          SUCCESS_REC(10),
          MBRSH(10),
          TABIX LIKE SY-TABIX,
          END OF IT_SUCCESS.
    *declaration ERROR MESSAGE
    DATA: BEGIN OF IT_ERROR  OCCURS  0,
          ERROR_REC(10),
          MBRSH(10),
             TABIX LIKE SY-TABIX,
          END OF IT_ERROR.
    DATA:TABIX LIKE SY-TABIX.
    *validating Material type(mtart) field data with table T134
    data : v_type like T134-mtart.
    DATA: V_INDSECT LIKE MARA-MBRSH.
    *** End generated data section ***
    start-of-selection.
    CALL FUNCTION 'UPLOAD'
    * EXPORTING
    *   CODEPAGE                      = ' '
    *   FILENAME                      = ' '
    *   FILETYPE                      = ' '
    *   ITEM                          = ' '
    *   FILEMASK_MASK                 = ' '
    *   FILEMASK_TEXT                 = ' '
    *   FILETYPE_NO_CHANGE            = ' '
    *   FILEMASK_ALL                  = ' '
    *   FILETYPE_NO_SHOW              = ' '
    *   LINE_EXIT                     = ' '
    *   USER_FORM                     = ' '
    *   USER_PROG                     = ' '
    *   SILENT                        = 'S'
    * IMPORTING
    *   FILESIZE                      =
    *   CANCEL                        =
    *   ACT_FILENAME                  =
    *   ACT_FILETYPE                  =
      TABLES
        data_tab                      = record
    * EXCEPTIONS
    *   CONVERSION_ERROR              = 1
    *   INVALID_TABLE_WIDTH           = 2
    *   INVALID_TYPE                  = 3
    *   NO_BATCH                      = 4
    *   UNKNOWN_ERROR                 = 5
    *   GUI_REFUSE_FILETRANSFER       = 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.
    *perform open_dataset using dataset.
    perform open_group.
    LOOP AT RECORD.
    perform bdc_dynpro      using 'SAPLMGMM' '0060'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RMMG1-MATNR'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    *- Validating industry sector(MBRSH) from the master table(MARA)
    select single MBRSH from T137  into V_INDSECT where MBRSH eq
    record-MBRSH_001.
    IF SY-SUBRC EQ 0.
    perform bdc_field       using 'RMMG1-MBRSH'
                                  record-MBRSH_001.
    *endif.
    perform bdc_field       using 'RMMG1-MTART'
                                  record-MTART_002.
    perform bdc_dynpro      using 'SAPLMGMM' '0070'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MSICHTAUSW-DYTXT(01)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=ENTR'.
    perform bdc_field       using 'MSICHTAUSW-KZSEL(01)'
                                  record-KZSEL_01_003.
    perform bdc_dynpro      using 'SAPLMGMM' '4004'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'MAKT-MAKTX'
                                  record-MAKTX_004.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MARA-MEINS'.
    perform bdc_field       using 'MARA-MEINS'
                                  record-MEINS_005.
    perform bdc_field       using 'MARA-MTPOS_MARA'
                                  record-MTPOS_MARA_006.
    perform bdc_dynpro      using 'SAPLSPO1' '0300'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=YES'.
    perform bdc_transaction using 'MM01'.
    *ELSE.
    *message  E000 WITH 'Industry sector does not Exist' .
    *endif.
    LOOP AT MESSTAB.
    CALL FUNCTION 'FORMAT_MESSAGE'
    EXPORTING
       ID              = MESSTAB-MSGID
       LANG            = MESSTAB-MSGSPRA
       NO              = MESSTAB-MSGNR
       V1              = MESSTAB-MSGV1
       V2              = MESSTAB-MSGV2
    *   V3              = SY-MSGV3
    *   V4              = SY-MSGV4
    IMPORTING
       MSG             = IT_STORE_MSG-STORE
       EXCEPTIONS
    *   NOT_FOUND       = 1
       OTHERS          = 0.
    IF MESSTAB-MSGTYP = 'S'.
       IT_SUCCESS-SUCCESS_REC = IT_STORE_MSG-STORE.
       IT_SUCCESS-MBRSH = record-MBRSH_001.
       IT_SUCCESS-TABIX = TABIX.
       APPEND IT_SUCCESS.
       ELSEIF  MESSTAB-MSGTYP = 'E'.
       IT_ERROR-ERROR_REC = IT_STORE_MSG-STORE.
       IT_ERROR-MBRSH = record-MBRSH_001.
       IT_ERROR-TABIX = TABIX.
      APPEND IT_ERROR.
    ENDIF.
    endloop.
    endif.
    ENDLOOP.
    CALL FUNCTION 'DOWNLOAD'
      TABLES
        DATA_TAB                      = IT_error
    *   FIELDNAMES                    =
    * EXCEPTIONS
    *   INVALID_FILESIZE              = 1
    *   INVALID_TABLE_WIDTH           = 2
    *   INVALID_TYPE                  = 3
    *   NO_BATCH                      = 4
    *   UNKNOWN_ERROR                 = 5
    *   GUI_REFUSE_FILETRANSFER       = 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.
    perform close_group.
    *perform close_dataset using dataset.
    Code Formatted by: Alvaro Tejada Galindo on Apr 9, 2008 5:05 PM

    Hi,
    DATA: IT_MESSTAB LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE .
    CALL FUNCTION 'DOWNLOAD'
    TABLES
    DATA_TAB = IT_error
    FIELDNAMES =
    EXCEPTIONS
    INVALID_FILESIZE = 1
    INVALID_TABLE_WIDTH = 2
    INVALID_TYPE = 3
    NO_BATCH = 4
    UNKNOWN_ERROR = 5
    GUI_REFUSE_FILETRANSFER = 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.
    instead of using IT_error ion tables use IT_MESSTAB.
    <REMOVED BY MODERATOR>
    Code Formatted by: Alvaro Tejada Galindo on Apr 9, 2008 5:07 PM

  • Hi All,Issue regarding bdc for capturing error records,its urgent

    Hi All,
            My requirement is to capture the error record and download the error record to a flat file .
    I have done recording for MM01 transaction .
    I am getting a problem like no error records are downloaded into the flat file .It is downloading only the empty records.
    Pls see the below code which i developed & modify it for any changes .Its an urgent .Pls provide me the solution ASAP.
    My Flat file
    M     FERT     X     MATL105     KG     
    X     FERT     X     MATL106     KG
    In the above flat file 'X' is an Industry sector which doesnot exists which is an error record that has to be captured and download it into the flat file .
    Source code :
    report Z_MM01_MSG_F MESSAGE-ID MSG1
           no standard page heading line-size 255.
    include bdcrecx1.
    parameters: dataset(132) lower case.
       DO NOT CHANGE - the generated data section - DO NOT CHANGE    ***
      If it is nessesary to change the data section use the rules:
      1.) Each definition of a field exists of two lines
      2.) The first line shows exactly the comment
          '* data element: ' followed with the data element
          which describes the field.
          If you don't have a data element use the
          comment without a data element name
      3.) The second line shows the fieldname of the
          structure, the fieldname must consist of
          a fieldname and optional the character '_' and
          three numbers and the field length in brackets
      4.) Each field must be type C.
    Generated data section with specific formatting - DO NOT CHANGE  ***
    data: begin of record occurs 0,
    data element: MBRSH
            MBRSH_001(001),
    data element: MTART
            MTART_002(004),
    data element: XFELD
            KZSEL_01_003(001),
    data element: MAKTX
            MAKTX_004(040),
    data element: MEINS
            MEINS_005(003),
    data element: MTPOS_MARA
            MTPOS_MARA_006(004),
          end of record.
    *DECLARATION OF BDCDATA STRUCTURE
    DATA: IT_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE .
    *declaration to store the message
    DATA: IT_MESSTAB LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE .
    *DECLARATION TO STORE THE MESSAGE
    DATA: BEGIN OF IT_STORE_MSG OCCURS 0,
          STORE(1000),
          END OF IT_STORE_MSG.
    *declaration SUCCESS MESG
    DATA: BEGIN OF IT_SUCCESS OCCURS 0,
          SUCCESS_REC(10),
          MBRSH(10),
          TABIX LIKE SY-TABIX,
          END OF IT_SUCCESS.
    *declaration ERROR MESSAGE
    DATA: BEGIN OF IT_ERROR  OCCURS  0,
          ERROR_REC(10),
          MBRSH(10),
             TABIX LIKE SY-TABIX,
          END OF IT_ERROR.
    DATA:TABIX LIKE SY-TABIX.
    *validating Material type(mtart) field data with table T134
    data : v_type like T134-mtart.
    DATA: V_INDSECT LIKE MARA-MBRSH.
    End generated data section ***
    start-of-selection.
    CALL FUNCTION 'UPLOAD'
    EXPORTING
      CODEPAGE                      = ' '
      FILENAME                      = ' '
      FILETYPE                      = ' '
      ITEM                          = ' '
      FILEMASK_MASK                 = ' '
      FILEMASK_TEXT                 = ' '
      FILETYPE_NO_CHANGE            = ' '
      FILEMASK_ALL                  = ' '
      FILETYPE_NO_SHOW              = ' '
      LINE_EXIT                     = ' '
      USER_FORM                     = ' '
      USER_PROG                     = ' '
      SILENT                        = 'S'
    IMPORTING
      FILESIZE                      =
      CANCEL                        =
      ACT_FILENAME                  =
      ACT_FILETYPE                  =
      TABLES
        data_tab                      = record
    EXCEPTIONS
      CONVERSION_ERROR              = 1
      INVALID_TABLE_WIDTH           = 2
      INVALID_TYPE                  = 3
      NO_BATCH                      = 4
      UNKNOWN_ERROR                 = 5
      GUI_REFUSE_FILETRANSFER       = 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.
    *perform open_dataset using dataset.
    perform open_group.
    LOOP AT RECORD.
    perform bdc_dynpro      using 'SAPLMGMM' '0060'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RMMG1-MATNR'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    *- Validating industry sector(MBRSH) from the master table(MARA)
    select single MBRSH from T137  into V_INDSECT where MBRSH eq
    record-MBRSH_001.
    IF SY-SUBRC EQ 0.
    perform bdc_field       using 'RMMG1-MBRSH'
                                  record-MBRSH_001.
    *endif.
    perform bdc_field       using 'RMMG1-MTART'
                                  record-MTART_002.
    perform bdc_dynpro      using 'SAPLMGMM' '0070'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MSICHTAUSW-DYTXT(01)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=ENTR'.
    perform bdc_field       using 'MSICHTAUSW-KZSEL(01)'
                                  record-KZSEL_01_003.
    perform bdc_dynpro      using 'SAPLMGMM' '4004'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'MAKT-MAKTX'
                                  record-MAKTX_004.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MARA-MEINS'.
    perform bdc_field       using 'MARA-MEINS'
                                  record-MEINS_005.
    perform bdc_field       using 'MARA-MTPOS_MARA'
                                  record-MTPOS_MARA_006.
    perform bdc_dynpro      using 'SAPLSPO1' '0300'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=YES'.
    perform bdc_transaction using 'MM01'.
    *ELSE.
    *message  E000 WITH 'Industry sector does not Exist' .
    *endif.
    LOOP AT MESSTAB.
    CALL FUNCTION 'FORMAT_MESSAGE'
    EXPORTING
       ID              = MESSTAB-MSGID
       LANG            = MESSTAB-MSGSPRA
       NO              = MESSTAB-MSGNR
       V1              = MESSTAB-MSGV1
       V2              = MESSTAB-MSGV2
      V3              = SY-MSGV3
      V4              = SY-MSGV4
    IMPORTING
       MSG             = IT_STORE_MSG-STORE
       EXCEPTIONS
      NOT_FOUND       = 1
       OTHERS          = 0.
    IF MESSTAB-MSGTYP = 'S'.
       IT_SUCCESS-SUCCESS_REC = IT_STORE_MSG-STORE.
       IT_SUCCESS-MBRSH = record-MBRSH_001.
       IT_SUCCESS-TABIX = TABIX.
       APPEND IT_SUCCESS.
       ELSEIF  MESSTAB-MSGTYP = 'E'.
       IT_ERROR-ERROR_REC = IT_STORE_MSG-STORE.
       IT_ERROR-MBRSH = record-MBRSH_001.
       IT_ERROR-TABIX = TABIX.
      APPEND IT_ERROR.
    ENDIF.
    endloop.
    endif.
    ENDLOOP.
    CALL FUNCTION 'DOWNLOAD'
      TABLES
        DATA_TAB                      = IT_error
      FIELDNAMES                    =
    EXCEPTIONS
      INVALID_FILESIZE              = 1
      INVALID_TABLE_WIDTH           = 2
      INVALID_TYPE                  = 3
      NO_BATCH                      = 4
      UNKNOWN_ERROR                 = 5
      GUI_REFUSE_FILETRANSFER       = 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.
    perform close_group.
    *perform close_dataset using dataset.

    Hi,
    DATA: IT_MESSTAB LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE .
    CALL FUNCTION 'DOWNLOAD'
    TABLES
    DATA_TAB = IT_error
    FIELDNAMES =
    EXCEPTIONS
    INVALID_FILESIZE = 1
    INVALID_TABLE_WIDTH = 2
    INVALID_TYPE = 3
    NO_BATCH = 4
    UNKNOWN_ERROR = 5
    GUI_REFUSE_FILETRANSFER = 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.
    instead of using IT_error ion tables use IT_MESSTAB.
    <REMOVED BY MODERATOR>
    Code Formatted by: Alvaro Tejada Galindo on Apr 9, 2008 5:07 PM

  • Logic to capture the Error records

    Hi All ,
               I have one scenario like this ,one report program runs in R/3 system to fetch some data from BW system .
    It uses Remote FM to do this .
    The problem is the FM has got error table with error msgs , if there is any problem in fetching the data in R/3 system.
    But when program is excuted it fails after returning to R/3 system with  error msg in WHEN OTHERS and stops there itself
    Instead it should proceed with other program codes and then
    finally output the error records .There is already subroutine in the program to display the erros records in last.  How do i do it programatically
    CALL FUNCTION 'ZC_BW_FIREFIGHT' DESTINATION p_r3rfc
          EXPORTING
            mrp_planning_scenario       = p_mrppln
            error_indicator             = p_info
          IMPORTING
            r3client                    = w_r3client
            r3instance                  = w_r3instance
          TABLES
            materials                   = t_bwmat
            plants                      = s_plant
            firefighting                = t_firefight1
            error_msgs                  = t_r3_errors
          EXCEPTIONS
            no_material_data_found      = 1
            no_storage_loc_data         = 2
            proc_complete_no_rcds_found = 3
            OTHERS                      = 4.
        CASE sy-subrc.
          WHEN 0.
            PERFORM f4020_confirm_fm_executed.
          WHEN 1.
            MESSAGE e999 WITH
                  'R3: No material data found for materials/plants.'(049).
          WHEN 2.
            MESSAGE e999 WITH
                  'R3: No storage location data for materials/plants.'(050).
          WHEN 3.
            MESSAGE e999 WITH
                  'R3: ZC_BWFIREFIGHT processed, but no data found.'(051).
          WHEN OTHERS.
            MESSAGE e999 WITH
                  'R3: ZC_BWFIREFIGHT FM call to R3 failed'(052).
        ENDCASE.
      ENDIF .
    ENDFORM.                    " f4010_call_zc_bwfirefight
    <REMOVED BY MODERATOR>
    Kumaran.C
    Edited by: Alvaro Tejada Galindo on Feb 25, 2008 2:46 PM

    Try with the following method
    DATA : bapireturn TYPE TABLE OF bapireturn WITH HEADER LINE.
    CASE sy-subrc.
      WHEN 0.
        PERFORM f4020_confirm_fm_executed.
      WHEN 1.
        CALL FUNCTION 'BALW_BAPIRETURN_GET'
          EXPORTING
            type                       = 'E'
            cl                         = <msgclass>
            number                     = '049'
            par1                       = 'R3: No material data found for materials/plants.'
          IMPORTING
            bapireturn                 = bapireturn
          EXCEPTIONS
            only_2_char_for_message_id = 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.
        ELSE.
          APPEND bapireturn.
          CLEAR bapireturn.
        ENDIF.
      WHEN 2.
        " Do Simillarly
      WHEN 3.
        " Do Simillarly
      WHEN OTHERS.
        " Do Simillarly
    ENDCASE.

  • Copying the error records in a custom table

    Hi,
    I  have a report program which is fetching Invoice header and line items . I need to copy the error records (records having a custom field ZZKUNNR as blank) in a custom table . I am executing this report in background daily .
    The records in the custom table can be corrected by functional guys
    Daily the report should fetch the data from SAP and also it should check whether there are correct records in the custom table .
    If the records are found from custom table then those records also must be fetched.
    Finally the output is stored in an application server .
    Kindly help how to write the code for error records.

    Hang on a moment here... I am sure we deleted your user ID a few months ago for ponits gaming!
    Did it "pay off" somehow and now you have a "real job" but don't have a clue what you are doing?
    Doesn't that make you feel just a little bit unconfident about life, the universe and ABAP?
    Cheers,
    Julius

  • APP-PAY-07092: This action is invalid for the current record.

    Unable to access employees assignment panel in order to make updates within oracle HR receiving this error.How to fix this.

    Please see these docs.
    APP-PAY-07092 This action is invalid for the current record when Trying to Access Assignment [ID 813815.1]
    PERWSHRG APP-PAY-07092 when Navigating to Assignments Screen [ID 796523.1]
    PERWSHRG APP-PAY-07092 Trying to Access Assignment [ID 1434212.1]
    PERWSEAC Cannot enter Costing for Contingent Workers APP-PAY-07092 [ID 1458000.1]
    App-Pay-07092:Action Invalid for Current Record:Salary for Active Contingent Asg [ID 360168.1]
    Payment Method Errors When Opened: APP-PAY-07092: This process is invalid for the current record. [ID 289691.1
    Thanks,
    Hussein                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • I have a message: "Could not get session for the OEM Repository."

    Dear Sir,
    I browsed reports that has been published in OEM. But I received an error:
    "Could not get session for the OEM Repository. Check to ensure that the OEM Repository is up."
    What can I do?
    Thank a lot

    You will need to go into your Files and locate the song.  By default, iTunes saves songs in the iTunes Media Folder which can be found in the following locations:
    Mac OS X: /Users/username/Music
    Windows XP: \Documents and Settings\username\My Documents\My Music\
    Windows Vista: \Users\username\Music\iTunes
    Windows 7 and Windows 8: \Users\username\My Music\iTunes
    If you locate your song file, when you try to play it in iTunes, you will be given an option to locate.  Navigate to the file in the pop up window and iTunes will re-path the file location.
    Most people encounter this issue when moving to a new computer or if you have your music saved on an external drive or folder that you have since moved or removed.  The imperative part is finding the song so you can re-map it.

Maybe you are looking for

  • Problem when importing two photo galleries with the same name. Please Help!

    Hi Guys, I'm not a pro in dreamweaver so I would appreciate if your answer wouldn't be too technical... Anyway I have experienced a problem. Heres the sotory, I have been making a websie in DW and used Adobe Bridge CS5 to create a photo gallery SWF f

  • Validation Error - JSF Custom Component

    I am trying to create a Custom Component. It is a pre-populated list of selection items. So all that the page author would have to do is use a tag like <jsfcust:mySelectOneComponent  value="#{requestScope.selectedItem}/>and this should display a drop

  • Organizing songs in separate playlists as I wish?

    In iTunes, how do I organize music into several playlists so That I may choose the one I want?

  • Installer build error LV2010

    Hello, I am using LV2010 32bit, vision tools, database tools, Win7 64bit. I am getting the following error when I try to build an installer.  The executable builds without any problems only the installer: CodeSignAPI.lvlib:Get Signing Error String.vi

  • Problem with a new iDVD08 Theme - please help

    Here is my problem with a new iDVD08 Theme: When I used a new iDVD08's theme (a first from the top, from the new 07 - the Revolution one) for my iMovie06 imported to iDVD08 with the project's chapters made in iMovie, all works fine, B U T: when I cli