Skip to Content
avatar image
Former Member

download file to presentation server with header

Hello,

I have a scenario where i have download the file into presentation server with field header like' purchase order number' and so on in the header level and then next below item should be po number.. is there any function module can you for this or how to aceive this scenario as well please your input for same format put in the application server?

thanks,

john.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Aug 20, 2007 at 07:18 PM

    HI John,

    This is one method of doing it.

    Populate the descriptions of the header in an internal table of the same structure as the data internal table.

    Download that internal table using GUI_DOWNLOAD functionmodule.

    Then download the actual data to the same file, but in APPEND mode.(Pass APPEND = 'X' in the FM parameters).

    Regards,

    Ravi Kanth

    Add comment
    10|10000 characters needed characters exceeded

    • Hi..

      For Application Server this is the code:

      DATA : BEGIN OF IT_HEADER OCCURS 0,

      EBELN TYPE EKKO-EBELN,

      LIFNR TYPE EKKO-LIFNR,

      END OF IT_HEADER.

      DATA : BEGIN OF IT_ITEM OCCURS 0,

      EBELN TYPE EKKO-EBELN,

      MATNR TYPE EKKO-MATNR,

      END OF IT_ITEM.

      PARAMETERS : P_DSN(40) . "file name

      data : v_rec(120) .

      START-OF-SELECTION.

      SELECT ebeln lifnr FROM EKKO INTO TABLE IT_HEADER.

      IF IT_HEADER[] IS NOT INITIAL.

      SELECT ebeln matnr FROM EKPO INTO TABLE IT_ITEM FOR ALL ENTRIES IN IT_HEADER WHERE EBELN = IT_HEADER-EBELN.

      ENDIF.

      OPEN DATASET P_DSN

      FOR OUTPUT

      IN TEXT MODE ENCODING DEFAULT.

      IF SY-SUBRC NE 0.

      Message 'File not opened' type 'E'.

      ENDIF.

      LOOP AT IT_HEADER .

      CONCATENEATE IT_HEADER-EBELN IT_HEADER-LIFNR

      INTO V_REC SEPERATED BY ';'.

      TRANSFER V_REC TO P_DSN.

      LOOP AT IT_ITEM WHERE EBELN = IT_HEADER-EBELN.

      CONCATENEATE IT_ITEM-EBELN IT_ITEM-MATNR

      INTO V_REC SEPERATED BY ';'.

      TRANSFER V_REC TO P_DSN.

      ENDLOOP.

      ENDLOOP.

      CLOSE DATASET P_DSN.

      <b>Reward points if helpful</b>

  • avatar image
    Former Member
    Aug 20, 2007 at 09:01 PM

    Hello John

    Perhaps the function module <b>SAP_CONVERT_TO_CSV_FORMAT</b> may be helpful.

    In addition, have a look at my sample report <b>ZUS_SDN_CSV_FILE_DOWNLOAD</b> in thread:

    delimiter "prakash";'sharma";"992224"

    Regards

    Uwe

    Add comment
    10|10000 characters needed characters exceeded