cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

GET Parameter ID in Update-Function-Module

master1980
Explorer
0 Likes
75

I have written a Report in which i I set a parameter ID (= SET PARAMETER-ID Z....).
After this i do an Batch Input (Call Transaction MODE "E") on Transaction CO02 (Change Production Order) and just presses "PRINT" and then "SAVE". Within UPDATE-TASK (CO_VB_ORDER_PRINT).
a Smartform is called. In this Smartform i GET the parameter ID which is unfortunately always empty.

Why is the Parameter ID empty and what would be the best solution?

 

 

Accepted Solutions (1)

Accepted Solutions (1)

Sandra_Rossi
Active Contributor

If you have your Z report like this:

REPORT zreport.
SET PARAMETER ID 'ZZ' FIELD 'VALUE'.
CALL TRANSACTION 'CO02' MODE 'E'...

and CO02 does:

CALL FUNCTION 'CO_VB_ORDER_PRINT' IN UPDATE TASK...
...
COMMIT WORK. " triggers all CALL FUNCTION IN UPDATE TASK asynchronously by default

an update task is created by default (unless SET UPDATE TASK LOCAL  runs). It corresponds to a brand new User Session which doesn't access the same memory context. Ref: ABAP Keyword Documentation - Sessions and Memory Areas.

Several solutions:

  1. Force the update task to run in the same User Session via CALL TRANSACTION 'CO02' UPDMODE 'L' (it's equivalent to run SET UPDATE TASK LOCAL at the start of the new user session).
  2. If you need to keep the synchronous or local execution of the update task, you may also pass anything to the memory of the update task by creating a Z update function module which does SET PARAMETER ID 'ZZ' FIELD 'VALUE', calling this function module via CALL FUNCTION 'ZYOURFM' IN UPDATE TASK EXPORTING zz = value before CALL FUNCTION 'CO_VB_ORDER_PRINT' IN UPDATE TASK
  3. As already said, you may use any other solution which stores data in a persistent storage, but the solution is more complex if you want to handle several users running the program at the same time.

Answers (2)

Answers (2)

sravan_aleshwaram
Active Participant
0 Likes

Hello @master1980 

The parameter ID is empty because SET/GET parameters don’t work across update tasks.
Your SmartForm runs in an update task (different LUW/session), so it cannot access the GET parameter set earlier

Thanks,
Sravan

suresh_datti
Active Contributor
0 Likes

You can't GET that parameter in a background session. Either store it in a custom table & SESLECT form it or EXPORT to database in the  report and IMPORT form database in the batch job.