Application Development 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: 

User exit EXIT_SAPLL03T_002 and jobs

rvmosquera
Explorer
0 Kudos
532

Hi everybody,

I have a problem with user exit EXIT_SAPLL03T_002 and trx LT12, i put code (the code is in the end) in the user exit in order to update the field QNAME from the standar table LTAP, the sentences for the update are in a job.

The problem is when a run the LT12, put the order and press enter the trx finish normally, but when i see the jobs resumen (SM37) there isnt any job.

Thank you for your help, see you.

*----


*

  • INCLUDE ZXLTOU02 *

*----


*

DATA:

WJ_JTANUM LIKE LTAP-TANUM,

WJ_LGNUM LIKE LTAP-LGNUM,

WJ_WERKS LIKE LTAP-WERKS,

WJ_USER LIKE SY-UNAME,

  • Parametros para el Job

l_numero LIKE tbtcjob-jobcount, "ID de un job de fondo

l_fecha LIKE tbtcjob-laststrtdt, "Fecha de ejecución más tardía

l_hora LIKE tbtcjob-laststrttm, "Ultima hora de ejecución para

l_jobname LIKE tbtco-jobname VALUE 'JOB_RF',

W_USER LIKE SY-UNAME,

W_HORA LIKE SY-UZEIT,

W_DIA LIKE SY-DATUM.

GET PARAMETER ID 'mb_usuario' FIELD W_USER.

  • Solo lo realiza para la transaccion LM05 y LM07

  • y si es por logueo No SAP

***ANTIGUO

*IF ( SY-TCODE EQ 'LM05' OR

  • SY-TCODE EQ 'LM07' OR SY-TCODE EQ 'LM03' OR

  • SY-TCODE EQ 'LM04') AND ( W_USER NE '' ).

**********

**********ACTUALIZADO 07/02*********

IF ( SY-TCODE EQ 'LM05' OR

SY-TCODE EQ 'LM07' OR SY-TCODE EQ 'LM03' OR

SY-TCODE EQ 'LM04' OR SY-TCODE EQ 'LT12' ) AND ( W_USER NE '' ).

*************************************

      • ojo

UPDATE ZTMB_USERCOLA

SET STATU = ' ' DOCNUM = ' '

WHERE

BNAME = W_USER.

***

GET PARAMETER ID 'mb_hora' FIELD W_HORA.

GET PARAMETER ID 'mb_dia' FIELD W_DIA.

CALL FUNCTION 'JOB_OPEN'

EXPORTING

jobname = l_jobname

IMPORTING

jobcount = l_numero

EXCEPTIONS

cant_create_job = 1

invalid_job_data = 2

jobname_missing = 3

OTHERS = 4.

SUBMIT ZUPDATE_LTAP

AND RETURN

VIA JOB l_jobname NUMBER l_numero

WITH WJ_TANUM = T_LTAP_VB-TANUM

WITH WJ_LGNUM = T_LTAP_VB-LGNUM

WITH WJ_WERKS = T_LTAP_VB-WERKS

WITH WJ_USER = W_USER.

  • Llama a la funcion para cerrar el Job

CALL FUNCTION 'JOB_CLOSE'

EXPORTING

jobcount = l_numero

jobname = l_jobname

strtimmed = 'X' "Inicio inmediato

EXCEPTIONS

cant_start_immediate = 1

invalid_startdate = 2

jobname_missing = 3

job_close_failed = 4

job_nosteps = 5

job_notex = 6

lock_failed = 7

OTHERS = 8.

ENDIF.

*----


*

*----


*

REPORT ZUPDATE_LTAP .

PARAMETERS:

WJ_TANUM LIKE LTAP-TANUM, " Numero de OT

WJ_LGNUM LIKE LTAP-LGNUM, " Almacen

WJ_WERKS LIKE LTAP-WERKS, " Centro

WJ_USER LIKE SY-UNAME, " Usuario SAP

W_QNAME LIKE LTAP-QNAME.

data: w_actual, w_timeout type i.

  • Actualiza el campos de usuario

w_actual = '0'.

w_timeout = 0.

while w_actual = '0' and w_timeout < 300.

w_timeout = w_timeout + 1.

WAIT UP TO 7 SECONDS.

UPDATE LTAP

SET QNAME = WJ_USER ZZRF_BNAME = WJ_USER

WHERE

TANUM = WJ_TANUM

AND

LGNUM = WJ_LGNUM

AND

WERKS = WJ_WERKS.

            • AGREGANDO 4 ENERO

UPDATE ZTMB_USERCOLA

SET TPICKEO = SY-UZEIT FPICKEO = SY-DATUM

WHERE

LGNUM = WJ_LGNUM

AND

BNAME = WJ_USER.

            • AGREGANDO 4 ENERO

if sy-subrc = 0.

w_actual = '1'.

  • UPDATE LTAK SET ZZRF_BNAME = WJ_USER

  • WHERE TANUM = WJ_TANUM AND

  • LGNUM = WJ_LGNUM.

endif.

commit work.

endwhile.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
188

Hi,

Check the print parameters. Probably after execution you may be deleting the job.

You can change the print parameters during runtime.

CALL FUNCTION 'GET_PRINT_PARAMETERS'

EXPORTING

no_dialog = 'X'

user = sy-uname

IMPORTING

  • OUT_ARCHIVE_PARAMETERS =

out_parameters = params

valid = ws_valid.

IF ws_valid <> space.

params-pdest = 'LOCL'. "Destination

params-primm = ''. "Print Immediately

params-prnew = 'X'. "New Spool Request.

params-armod = '1'. "Print: Archiving Mode - Print Only

params-linct = 65. "Rows

params-linsz = 255. "Cols

params-paart = 'X_65_255'.

params-prrec = sy-uname. "User name

params-prsap = ''. "Print: SAP Cover Page

params-prunx = ''. "PRINT: Host spool cover page

params-prcop = '001'. "number of copies

SUBMIT zmib_fiber_link_background

WITH file = i_file_list-name

WITH rb1 = space

WITH rb2 = c_x

WITH p_launch = c_x

VIA JOB ws_c_session NUMBER ws_c_jobnum

EXPORTING LIST TO MEMORY

TO SAP-SPOOL

WITHOUT SPOOL DYNPRO

SPOOL PARAMETERS params

AND RETURN.

endif.

CALL FUNCTION 'JOB_CLOSE'

EXPORTING

jobcount = ws_c_jobnum

jobname = ws_c_session

strtimmed = 'X'

EXCEPTIONS

cant_start_immediate = 1

invalid_startdate = 2

jobname_missing = 3

job_close_failed = 4

job_nosteps = 5

job_notex = 6

lock_failed = 7

OTHERS = 8.

Also check the sy-subrc after JOB_OPEN.

Regards

Subramanian

1 REPLY 1

Former Member
0 Kudos
189

Hi,

Check the print parameters. Probably after execution you may be deleting the job.

You can change the print parameters during runtime.

CALL FUNCTION 'GET_PRINT_PARAMETERS'

EXPORTING

no_dialog = 'X'

user = sy-uname

IMPORTING

  • OUT_ARCHIVE_PARAMETERS =

out_parameters = params

valid = ws_valid.

IF ws_valid <> space.

params-pdest = 'LOCL'. "Destination

params-primm = ''. "Print Immediately

params-prnew = 'X'. "New Spool Request.

params-armod = '1'. "Print: Archiving Mode - Print Only

params-linct = 65. "Rows

params-linsz = 255. "Cols

params-paart = 'X_65_255'.

params-prrec = sy-uname. "User name

params-prsap = ''. "Print: SAP Cover Page

params-prunx = ''. "PRINT: Host spool cover page

params-prcop = '001'. "number of copies

SUBMIT zmib_fiber_link_background

WITH file = i_file_list-name

WITH rb1 = space

WITH rb2 = c_x

WITH p_launch = c_x

VIA JOB ws_c_session NUMBER ws_c_jobnum

EXPORTING LIST TO MEMORY

TO SAP-SPOOL

WITHOUT SPOOL DYNPRO

SPOOL PARAMETERS params

AND RETURN.

endif.

CALL FUNCTION 'JOB_CLOSE'

EXPORTING

jobcount = ws_c_jobnum

jobname = ws_c_session

strtimmed = 'X'

EXCEPTIONS

cant_start_immediate = 1

invalid_startdate = 2

jobname_missing = 3

job_close_failed = 4

job_nosteps = 5

job_notex = 6

lock_failed = 7

OTHERS = 8.

Also check the sy-subrc after JOB_OPEN.

Regards

Subramanian