Skip to Content
author's profile photo Former Member
Former Member

dataset_r

How can we send a flat file into Application layer

Say this I have flat file in this format

1234 ravi 20070102

8932 suresh 20060205

How do I send this to apllication layer .

And get a <name>.txt...............so that I can acess this directly ?

Any suggestions ?

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Sep 12, 2007 at 01:40 PM

    open dataset for output in text mode.

    transfer itab to dataset.

    close dataset.

    itab should contain....data u want........

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 12, 2007 at 01:50 PM

    Hi,

    You can use the below code

    *   Download internal table to Application server file(Unix)
    DATA: e_file like rlgrap-filename value '/usr/sap/tmp/file.txt'.      
    
      open dataset e_file for output in text mode.
      lOOP AT it_datatab......
        transfer it_datatab to e_file.
      ENDLOOP.
     
      close dataset e_file.

    Regards

    Sudheer

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 12, 2007 at 02:09 PM

    INTERACTIVE ALV

    REPORT Z50651_ALV_INTERACTIVE MESSAGE-ID ZMSG_50651

    LINE-SIZE 100

    LINE-COUNT 60

    NO STANDARD PAGE HEADING.

    ******************TABLES DECLARATION*****************

    TABLES : VBAP,MARA.

    *****************TYPE POOLS**************************

    TYPE-POOLS : SLIS.

    ****************INTERNAL TABLES**********************

    DATA : BEGIN OF IT_VBAP OCCURS 0,

    VBELN LIKE VBAP-VBELN, "SALES DOCUMENT

    POSNR LIKE VBAP-POSNR, "SALES DOCUMENT ITEM

    MATNR LIKE VBAP-MATNR, "MATERIAL NUMBER

    END OF IT_VBAP.

    ****************TEMPORARY VARIABLES******************

    DATA : V_VBELN LIKE VBAP-VBELN."SALES DOCUMENT

    DATA : V_MTART LIKE MARA-MTART. "MATERIAL TYPE

    *****************FIELD CATALOG***********************

    DATA : IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,

    WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.

    ****************LAYOUT*******************************

    DATA : WA_LAYOUT TYPE SLIS_LAYOUT_ALV.

    ***************VARIANT*******************************

    DATA : G_VARIANT LIKE DISVARIANT.

    ****************SAVE*********************************

    DATA : G_SAVE(1) TYPE C.

    *****************EVENTS******************************

    DATA : XS_EVENTS TYPE SLIS_ALV_EVENT,

    G_EVENTS TYPE SLIS_T_EVENT.

    ******************PF STATUS**************************

    DATA : PF_STATUS TYPE SLIS_FORMNAME VALUE 'SET_PF_STATUS'.

    ******************USER COMMAND************************

    DATA : USER_COMMAND TYPE SLIS_FORMNAME VALUE 'SET_USER_COMMAND',

    R_UCOMM LIKE SY-UCOMM.

    ****************SELECTION SCREEN************************

    SELECT-OPTIONS : S_VBELN FOR VBAP-VBELN.

    ***************AT SELECTION SCREEN*********************

    AT SELECTION-SCREEN.

    PERFORM VALIDATE.

    **************START-OF-SELECTION**************************

    START-OF-SELECTION.

    PERFORM GET_DETAILS.

    PERFORM FIELDCAT.

    PERFORM LAYOUT.

    PERFORM VARIANT.

    PERFORM SAVE.

    PERFORM EVENTS.

    PERFORM ALV_DISPLAY.

    *********************FORMS*******************************************

    &----


    *& Form validate

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM VALIDATE .

    SELECT SINGLE VBELN

    FROM VBAP

    INTO V_VBELN

    WHERE VBELN IN S_VBELN.

    IF SY-SUBRC <> 0.

    MESSAGE E000 WITH 'enter valid vbeln'.

    ENDIF.

    ENDFORM. " validate

    &----


    *& Form get_details

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM GET_DETAILS .

    SELECT VBELN

    POSNR

    MATNR

    FROM VBAP

    INTO TABLE IT_VBAP

    WHERE VBELN IN S_VBELN.

    IF SY-SUBRC <> 0.

    MESSAGE E000 WITH 'no details found'.

    ENDIF.

    ENDFORM. " get_details

    &----


    *& Form fieldcat

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM FIELDCAT .

    WA_FIELDCAT-TABNAME = 'IT_VBAP'.

    WA_FIELDCAT-FIELDNAME = 'VBELN'.

    WA_FIELDCAT-OUTPUTLEN = 10.

    WA_FIELDCAT-SELTEXT_L = 'SALES DOC'.

    APPEND WA_FIELDCAT TO IT_FIELDCAT.

    CLEAR WA_FIELDCAT.

    WA_FIELDCAT-TABNAME = 'IT_VBAP'.

    WA_FIELDCAT-FIELDNAME = 'POSNR'.

    WA_FIELDCAT-OUTPUTLEN = 6.

    WA_FIELDCAT-SELTEXT_L = 'ITEM'.

    APPEND WA_FIELDCAT TO IT_FIELDCAT.

    CLEAR WA_FIELDCAT.

    WA_FIELDCAT-TABNAME = 'IT_VBAP'.

    WA_FIELDCAT-FIELDNAME = 'MATNR'.

    WA_FIELDCAT-OUTPUTLEN = 18.

    WA_FIELDCAT-SELTEXT_L = 'MATERIAL NO'.

    APPEND WA_FIELDCAT TO IT_FIELDCAT.

    CLEAR WA_FIELDCAT.

    ENDFORM. " fieldcat

    &----


    *& Form LAYOUT

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM LAYOUT .

    WA_LAYOUT-ZEBRA = 'X'.

    ENDFORM. " LAYOUT

    &----


    *& Form VARIANT

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM VARIANT .

    CLEAR G_VARIANT.

    G_VARIANT-REPORT = SY-REPID.

    ENDFORM. " VARIANT

    &----


    *& Form SAVE

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM SAVE .

    CLEAR G_SAVE.

    G_SAVE = 'A'.

    ENDFORM. " SAVE

    &----


    *& Form EVENTS

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM EVENTS .

    CLEAR XS_EVENTS.

    XS_EVENTS-NAME = SLIS_EV_TOP_OF_PAGE.

    XS_EVENTS-FORM = 'TOP_OF_PAGE'.

    APPEND XS_EVENTS TO G_EVENTS.

    ENDFORM. " EVENTS

    &----


    *& Form TOP_OF_PAGE

    &----


    • text

    ----


    FORM TOP_OF_PAGE.

    WRITE :/ ' INTELLI GROUP'.

    ENDFORM. "TOP_OF_PAGE

    &----


    *& Form ALV_DISPLAY

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM ALV_DISPLAY .

    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

    EXPORTING

    • I_INTERFACE_CHECK = ' '

    • I_BYPASSING_BUFFER =

    • I_BUFFER_ACTIVE = ' '

    I_CALLBACK_PROGRAM = SY-REPID

    I_CALLBACK_PF_STATUS_SET = PF_STATUS

    I_CALLBACK_USER_COMMAND = USER_COMMAND

    • I_STRUCTURE_NAME =

    IS_LAYOUT = WA_LAYOUT

    IT_FIELDCAT = IT_FIELDCAT

    • IT_EXCLUDING =

    • IT_SPECIAL_GROUPS =

    • IT_SORT =

    • IT_FILTER =

    • IS_SEL_HIDE =

    • I_DEFAULT = 'X'

    I_SAVE = G_SAVE

    IS_VARIANT = G_VARIANT

    IT_EVENTS = G_EVENTS

    • IT_EVENT_EXIT =

    • IS_PRINT =

    • IS_REPREP_ID =

    • I_SCREEN_START_COLUMN = 0

    • I_SCREEN_START_LINE = 0

    • I_SCREEN_END_COLUMN = 0

    • I_SCREEN_END_LINE = 0

    • IMPORTING

    • E_EXIT_CAUSED_BY_CALLER =

    • ES_EXIT_CAUSED_BY_USER =

    TABLES

    T_OUTTAB = IT_VBAP

    EXCEPTIONS

    PROGRAM_ERROR = 1

    OTHERS = 2

    .

    IF SY-SUBRC <> 0.

    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

    ENDIF.

    ENDFORM. " ALV_DISPLAY

    &----


    *& Form SET_PF_STATUS

    &----


    • text

    ----


    FORM SET_PF_STATUS USING EXTAB TYPE SLIS_T_EXTAB.

    SET PF-STATUS 'Z50651_PFSTATUS' EXCLUDING EXTAB.

    ENDFORM. "SET_PF_STATUS

    &----


    *& Form SET_USER_COMMAND

    &----


    • text

    ----


    FORM SET_USER_COMMAND USING R_UCOMM

    RS_SELFIELD TYPE SLIS_SELFIELD.

    CASE R_UCOMM.

    WHEN 'DC'.

    READ TABLE IT_VBAP INDEX RS_SELFIELD-TABINDEX.

    IF SY-SUBRC = 0.

    SELECT SINGLE MTART

    FROM MARA

    INTO V_MTART

    WHERE MATNR = IT_VBAP-MATNR.

    IF SY-SUBRC <> 0.

    MESSAGE E000 WITH 'NO MATERIAL DESCRIPTION FOR SELECTED MATERIAL NO'.

    ELSE.

    WRITE :/ 'MATERIAL NO :',IT_VBAP-MATNR.

    WRITE :/ 'MATERIAL TYPE :' , V_MTART.

    ENDIF.

    ENDIF.

    WHEN 'BACK'.

    LEAVE TO SCREEN 0.

    WHEN 'EXIT'.

    LEAVE TO SCREEN 0.

    WHEN 'CLOSE'.

    CALL TRANSACTION 'SE38'.

    ENDCASE.

    ENDFORM. "SET_USER_COMMAND

    Regards

    Vasu

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.