amator
4th January 2017, 09:28
Hi Guys,

I want to know if is it possible to choose the report where I will send the data from my function.

Just to be clear this is how I print data:
----------------------------------------------------------------------------
choice.cont.process:
on.choice:
execute(print.data)

choice.print.data:
on.choice:
if rprt_open() then
read.main.table()
rprt_close()
else
choice.again()
endif
----------------------------------------------------------------------------
As you know the "read.main.table" is a function.

What I want to do is I have 2 different functions that will print data into 2 different reports.

Just to be clear again:

Function1 will send to Report1
Function2 will send to Report2

and then when I generate data from my session and I choose the Report2 the Function2 should be the one to generate.

Thanks in advance guys,

JaapJD
4th January 2017, 10:21
Two options:
- Define the 2 reports in different report groups. Have a field on the screen that the user can choose the type of report
- Define both reports in same group. Then the user will be prompted to choose the report. Based on the report$ variable you can execute the correct function.

mark_h
4th January 2017, 14:59
Moved to the correct forum. Another option is to just do something with the report name in spool.report. For example:

if(rprt_open())then
on case spool.report
case "rtisfcxxxx01000":
case "rtisfcxxxx01200":
case "rtisfcxxxx05000":
select.sub.workcenter.records()
break
case "rtisfcxxxx01100":
case "rtisfcxxxx01300":
select.main.workcenter.records()
break
endcase
rprt_close()
else
choice.again()
endif

amator
5th January 2017, 04:11
Hi JaapJD and mark_h,

Thanks for the reply I tried the 2nd option mentioned by JaapJD which is connected to the reply of mark_h. I think I'm on the right solution and I'm still testing it.

mark_h, I just have a question. I tried the code that you mentioned and it doesn't have any error while compiling but while trying the session it doesn't get any data or in short in didn't enter the condition.

Please check my code if I have any mistakes:
---------------------------------------------------------------------------------------------------------------------------
choice.cont.process:
on.choice:
execute(print.data)

choice.print.data:
on.choice:
if(rprt_open())then
on case spool.report
case "whinhxxx000x01":
read.main.table()
break
case "whinhxxx000x02":
read.second.table()
break
endcase
rprt_close()
else
choice.again()
endif
---------------------------------------------------------------------------------------------------------------------------

I think the problem here is the case where I declare the report code but I exactly declare the right report code.

Thank you in advance,

rahul ingale
5th January 2017, 06:51
Possibly you are missing r in report code.it should be r and then reportname like
rtdsls4411000.

amator
5th January 2017, 07:38
Hi rahul ingale,

Thanks for the help. It works perfectly now.

Thanks for all the help guys.