Skip to Content
avatar image
Former Member

OPEN DATA SEt Problems

Hi freinds,

Referring to the thread

open-dataset-in-background-problem

I am facing the same issue. So if u can pls paste the sample code how u make it correct that will be great.

Regards

Thanura

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Oct 11, 2007 at 08:51 AM

    hi Thanura,

    This might help you .....Your problem seems to related with stmt in Bold. Check in SM51..

    From one of my articles...all may not be relevant to you.

    Did you check that the shared directory, being accessed in your program, is accessible from all the Servers ( Development, Test as well as Production )?

    And did you also check that directory is accessible from all the Application Servers, in case there are multiple Application Servers in production?

    Your customer reported that he is not able to download the file on configured directory and program is terminating with some message like ‘File could not be opened’ or ‘Directory not accessible’.

    You tried from your side and everything is working fine.

    So do you think that now your user is trying to irritate you like you did to him earlier?

    Not really, just check out and there might be multiple Application Servers in production ( Use Transaction SM51 ) and probably the way you coded and configured file path, either you made it Application Server dependent or it is not accessible from all the application servers ( except from the central instance as this particular directory is only created on central application server ). e.g in FILE transaction, you have configured the file path as

    ‘
    < INSTANCE>\Outbound’ or ‘
    < HOST>\Outbound’

    Now, since as a developer, you generally login to central instance, you will not be able to see the problem unless you deliberately login to other instances. Ask the user to run it from central instance for the time being and then modify you program to make the file path instance independent.

    Pls reward if helpful.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi,

      As u said I have 2 application server in sm51.

      One is in As400 and the other one is a dialog instant in a windows server.

      How the OPEN DATASET going to be looks like.

      This the statement currently using and is works fine in foreground

      Pls chenge this and show me.

      f_filename = '/usr/sap/DBI/INVD.txt'.

      OPEN DATASET f_filename FOR OUTPUT IN TEXT MODE ENCODING DEFAULT

      MESSAGE mess.

      since the application in as400 I have to use '/' not like windows '\'.

      ANd sm51 shows the following details

      R3PROD_R3P_00 R3PROD Dialog Update Enqueue Backg Spool Upd2 ICM Active

      r3prod-d_R3P_02 R3PROD-D Dialog Update Backg Spool Upd2 ICM Active

      Pls use this detail and correct my statement.

      Appreciate u'r help.

      Best regards

      Thanura

  • avatar image
    Former Member
    Oct 11, 2007 at 08:58 AM

    Hi,

    Check this simple code,

    DATA : BEGIN OF WA_CUST_INITIAL,
           STYPE(5),
           CUSTOMER(10),
           Company_Code(10),
           Sales_Organization(10),
           Distribution_Channel(10),
           Division(10),
           Account_Group(10),
           END OF WA_CUST_INITIAL.
     
    DATA : IT_CUST_INITIAL LIKE STANDARD TABLE OF WA_CUST_INITIAL WITH HEADER LINE.
     
    DATA : SOURCE_FILE_INITIAL TYPE STRING VALUE 'C:256_FLATCUST_INITIAL.TXT'.
    DATA : TARGET_FILE_INITIAL(200) VALUE 'D:usrsaptransCUST_INITIAL.TXT'.
     
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        FILENAME                      = SOURCE_FILE_INITIAL
       FILETYPE                      = 'ASC'
       HAS_FIELD_SEPARATOR           = 'X'
     
     TABLES
        DATA_TAB                      = IT_CUST_INITIAL.
     
    OPEN DATASET TARGET_FILE_INITIAL IN TEXT MODE FOR OUTPUT ENCODING DEFAULT.
     
    LOOP AT IT_CUST_INITIAL INTO WA_CUST_INITIAL.
    TRANSFER WA_CUST_INITIAL TO TARGET_FILE_INITIAL.
    ENDLOOP.
    CLOSE DATASET TARGET_FILE_INITIAL.

    Thanks.

    Reward If Helpful.

    Add comment
    10|10000 characters needed characters exceeded