Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

PRoblem regarding Submit -> Open/Transfer/Close Dataset

Former Member
0 Likes
727

Hello again, I know I keep asking the same topic (regarding datasets) for the past week. Its been a new topic for me. However, I have a program which I am testing that is shown below.

<b>REPORT ZPROG_COOL7 NO STANDARD PAGE HEADING.

DATA: ITAB_LIST TYPE STANDARD TABLE OF ABAPLIST WITH HEADER LINE.

PARAMETERS: PNAME TYPE SYCPROG. (this does nothing yet ...)

SUBMIT ZPROGRAM EXPORTING LIST TO MEMORY AND RETURN

USING SELECTION-SET 'CEDEX'.

CALL FUNCTION 'LIST_FROM_MEMORY'

TABLES

LISTOBJECT = ITAB_LIST

  • 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.

IF SY-SUBRC = 0.

CALL FUNCTION 'WRITE_LIST'

TABLES

LISTOBJECT = ITAB_LIST.

ENDIF.

DATA: LD_FILENAME TYPE LOCALFILE.

DATA: I_MONTH TYPE TABLE OF T247 WITH HEADER LINE.

DATA: IHTML TYPE TABLE OF W3HTML WITH HEADER LINE.

CALL FUNCTION 'WWW_LIST_TO_HTML'

  • EXPORTING

  • list_index = sy-lsind

TABLES

HTML = IHTML.

CLEAR IHTML.

LD_FILENAME = '
H******\SAPReport\death.html'.

OPEN DATASET LD_FILENAME FOR OUTPUT IN BINARY MODE.

LOOP AT IHTML.

TRANSFER IHTML TO LD_FILENAME.

ENDLOOP.

CLOSE DATASET LD_FILENAME.

CLEAR: LD_FILENAME.</b>

As you can see it is suposed to get a list from a diffrent program, write the list, and then transfer the list into a directory in the SAP application server. This all works fine on foreground but in Background Proccessing the story is diffrent.

Here is the problem:

If Iam to send a job in background, the report will generate fine if you view the spool list <b>but there HTML file that is supposed to be saved becomes blank.</b> Is there a way to solve this issue? Thank you all take care, and good day.

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
671

I am concerned that his part does not work in background.



CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
LISTOBJECT = ITAB_LIST
* 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.

IF SY-SUBRC = 0.
CALL FUNCTION 'WRITE_LIST'
TABLES
LISTOBJECT = ITAB_LIST.
ENDIF.

DATA: LD_FILENAME TYPE LOCALFILE.
DATA: I_MONTH TYPE TABLE OF T247 WITH HEADER LINE.
DATA: IHTML TYPE TABLE OF W3HTML WITH HEADER LINE.

<b>CALL FUNCTION 'WWW_LIST_TO_HTML'
* EXPORTING
* list_index = sy-lsind
TABLES
HTML = IHTML.
CLEAR IHTML.</b>

LD_FILENAME = '\H******SAPReportdeath.html'.

OPEN DATASET LD_FILENAME FOR OUTPUT IN BINARY MODE.
LOOP AT IHTML.
TRANSFER IHTML TO LD_FILENAME.
ENDLOOP.
CLOSE DATASET LD_FILENAME.
CLEAR: LD_FILENAME.


I ran across this before and I did find a solution, I'll get back.

Regards,

Rich Heilman

Hello again, I know I keep asking the same topic (regarding datasets) for the past week. Its been a new topic for me. However, I have a program which I am testing that is shown below.

<b>REPORT ZPROG_COOL7 NO STANDARD PAGE HEADING.

DATA: ITAB_LIST TYPE STANDARD TABLE OF ABAPLIST WITH HEADER LINE.

PARAMETERS: PNAME TYPE SYCPROG. (this does nothing yet ...)

SUBMIT ZPROGRAM EXPORTING LIST TO MEMORY AND RETURN

USING SELECTION-SET 'CEDEX'.

CALL FUNCTION 'LIST_FROM_MEMORY'

TABLES

LISTOBJECT = ITAB_LIST

  • 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.

IF SY-SUBRC = 0.

CALL FUNCTION 'WRITE_LIST'

TABLES

LISTOBJECT = ITAB_LIST.

ENDIF.

DATA: LD_FILENAME TYPE LOCALFILE.

DATA: I_MONTH TYPE TABLE OF T247 WITH HEADER LINE.

DATA: IHTML TYPE TABLE OF W3HTML WITH HEADER LINE.

CALL FUNCTION 'WWW_LIST_TO_HTML'

  • EXPORTING

  • list_index = sy-lsind

TABLES

HTML = IHTML.

CLEAR IHTML.

LD_FILENAME = '
H******\SAPReport\death.html'.

OPEN DATASET LD_FILENAME FOR OUTPUT IN BINARY MODE.

LOOP AT IHTML.

TRANSFER IHTML TO LD_FILENAME.

ENDLOOP.

CLOSE DATASET LD_FILENAME.

CLEAR: LD_FILENAME.</b>

As you can see it is suposed to get a list from a diffrent program, write the list, and then transfer the list into a directory in the SAP application server. This all works fine on foreground but in Background Proccessing the story is diffrent.

Here is the problem:

If Iam to send a job in background, the report will generate fine if you view the spool list <b>but there HTML file that is supposed to be saved becomes blank.</b> Is there a way to solve this issue? Thank you all take care, and good day.

3 REPLIES 3
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
672

I am concerned that his part does not work in background.



CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
LISTOBJECT = ITAB_LIST
* 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.

IF SY-SUBRC = 0.
CALL FUNCTION 'WRITE_LIST'
TABLES
LISTOBJECT = ITAB_LIST.
ENDIF.

DATA: LD_FILENAME TYPE LOCALFILE.
DATA: I_MONTH TYPE TABLE OF T247 WITH HEADER LINE.
DATA: IHTML TYPE TABLE OF W3HTML WITH HEADER LINE.

<b>CALL FUNCTION 'WWW_LIST_TO_HTML'
* EXPORTING
* list_index = sy-lsind
TABLES
HTML = IHTML.
CLEAR IHTML.</b>

LD_FILENAME = '\H******SAPReportdeath.html'.

OPEN DATASET LD_FILENAME FOR OUTPUT IN BINARY MODE.
LOOP AT IHTML.
TRANSFER IHTML TO LD_FILENAME.
ENDLOOP.
CLOSE DATASET LD_FILENAME.
CLEAR: LD_FILENAME.


I ran across this before and I did find a solution, I'll get back.

Regards,

Rich Heilman

Read only

0 Likes
671

Please try this instead.




  call function 'LIST_FROM_MEMORY'
       tables
            listobject = list
       exceptions
            not_found  = 1
            others     = 2.
 
<b>  call function 'WWW_HTML_FROM_LISTOBJECT'
       tables
            html       = htmllines
            listobject = list.</b>


Regards,

Rich Heilman

Read only

Former Member
0 Likes
671

Thanks Rich, as always, you have been very helpful. Im thanks again Im sure to mention you and others in my special thanks section.