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

Date and Time for back ground program selection

Former Member
0 Likes
1,223

Hi All,

I am creating a program with date and time as input fields for my slection. Based on this selection program will fetch

change document history of BOM.

How to handle this date and time as a selection for above scenario to run this program in background job ? We need to consider

the job failures also.

Thanks,

Vinay.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,190

IT seems you want to enter current date and time in those field..

if yes.

then at initilisation event you can populate them with sy-datum and sy-uzeit

if no.

then you may need to create a Z table and get the date and time from it.

11 REPLIES 11
Read only

Former Member
0 Likes
1,190

hi vinay,

create your program and schedule it to background mode.before scheduling it you can export the date and time fields..


   data:  indxkey    TYPE indx-srtfd VALUE 'KEYVALUE',
     l_number   TYPE tbtcjob-jobcount,
     l_name     TYPE tbtcjob-jobname.
EXPORT i_vbap to DATABASE indx(t1) id indxkey.
  CALL FUNCTION 'JOB_OPEN'
        EXPORTING
          jobname          = l_name
        IMPORTING
          jobcount         = l_number
        EXCEPTIONS
          cant_create_job  = 1
          invalid_job_data = 2
          jobname_missing  = 3
          OTHERS           = 4.

      IF sy-subrc = 0.
    

        SUBMIT zls_open_delivery  VIA JOB l_name NUMBER l_number
                                    AND RETURN .
        IF sy-subrc = 0.
          CALL FUNCTION 'JOB_CLOSE'
            EXPORTING
              jobcount             = l_number
              jobname              = l_name
              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.
        ENDIF.
      ENDIF.

hope this helps.

thanks

tanmaya

Read only

Former Member
0 Likes
1,191

IT seems you want to enter current date and time in those field..

if yes.

then at initilisation event you can populate them with sy-datum and sy-uzeit

if no.

then you may need to create a Z table and get the date and time from it.

Read only

0 Likes
1,190

Hi Alnoor,

Thanks for your response ! I think I need to create a ztable to get the date and time.

Could you please explain me more about this point ? How to manage the variant if I need to schedule background ?

Any other inputs plz.

Regards,

Vinay.

Read only

0 Likes
1,190

Hi,

How you wan to schedule the job through progarm or manually.

If through program then answer is alreday given, if manually then you can directly execute progarm in background. Regarding variant, you can set the variant to always show current date and time also there are many manupulation possibal with date and time while creating variant.

Read only

0 Likes
1,190

hi vinay,

In case you have only date and time on your field then you don't need a variant.

in case want to go via variant you have to pass the same variable sy-datum and sy-uzeit in the variant .

--AL

Read only

0 Likes
1,190

Hi Anurag,

I want to schedule job through program not manually . Please help.

Thanks,

Vinay

Read only

0 Likes
1,190

HI,

What I guess is you are having date and time in your selection screen... Now tell what exactly wat date and time you want to put.. then we can move further

Read only

0 Likes
1,190

Hi Anurag,

I will give selection screen as plant and date and time for initial run. Then I will run the job

If job runs every 1 hour , time will increase one hour . so keep on changing.

Thanks,

Vinay

Read only

0 Likes
1,190

Hi,

what you can do is in your progarm. Initialization write P_time( variable for time you have used ) = sy-uzeit.

similarly p_date = sy-datum

Read only

0 Likes
1,190

Hi,

Create table entries in TVARVC table and get the values at runtime from the table and update the values to the same entry for the next time to execute with new values in same program.

Let me know if if is not clear.

--Naresh.

Read only

0 Likes
1,190

Hi Naresh,

can plz elaborate .....i am also facing the prob.....

thnks

Yerukala Setty