Running the alv in the background.
hi,
please tell me the procedure to the run the interactive alv in the background?
thanks in advance
Hi
Gto SM36.
-> give Job name
Priority
->click on Steps button
Enter your interface program in ABAP program block
Click Check button and Save button.
->Click Start Condition button on application tool bar
Click Immediate or Date/Time button depending on the requirement
Click Priod values ...Here u can select the options to run the program daily.
Click Check and Save.
<b>Reward if usefull</b>
Similar Messages
-
Read Error logs after running the background jobs
Hi,
How to read the error logs after running the background jobs. In our scenarion we are running the COHV transaction to release the production orders in background. But we are not finding the error logs after background job. We would like to read the error logs and correct for further processing.
Kindly suggest.
Thanks & Regards,
N. LaxmanHi
you can check the back ground jobs defined by any user in SM37 and where you can see the spool and job logs as well.
plz check in your case and revert back
Regards
Anupam Sharma -
How to Debug a ABAP code running the background in Portal
How can I debug a ABAP code running in the background while executing a transaction code through portal.
e.g Presently I have to incorporate some checks in the portal. For that I know the function module where i need to put though checks. Now I want to know, how does the code during runtime. What values do we get in the function module. For this I need to get into the debugging mode while executing the portal.
So how can we do that???Namit,
it doesnot matter whether it is a standard funtion module or a custom one .check whether you are debugging for proper user(portal user and backend user are same) and check debugging is activated -
Using timeout items and running the background engine
Hi all!
I tried to read all the information about timeouts and engine, but I think I don't understand anything.
I want to use a loop, that after every 4 minutes runs the given plsql code until 15 times.
There are 4 different result. 1: continue the loop, 2: good result, 3: bad result, 4: loop reachs max running count (15).
1. I don't know how to set the result code.
2. How start the background engine. Is it startable from my plsql code? I have to start the engine at every item_type and item_key pair, or I have to start it only once?You need not handle Loop Max out in your result. You can handle that usng Loop Counter standard activity that you can find in the WF Builder. Insert this counter in the Loop.
Write a simple Function Activity that you want to be executed every 4 minutes. That also sits in the Loop.
Now insert a WAIT activity in the loop that should wait for 4 minutes relative to the current completion time. So, that loop will look like...
----> Function ----> Wait ----> Loop Counter ----> (Go back to Function on loop... exit out if maxed out)
The exit condition transition for the loop occurs from Loop Counter activity.
You don't need a timeout here anywhere. Running background engine should be purely outside of your code. It is a concurrent program that you can schedule to run at regular intervals for whatever parameter you choose.
Thanks
Vijay -
Too much stuff running in the background
I have a Casio Commando Gz'One. I installed an App called Advanced Task Killer to be able to turn unnecessary things off that are constantly running the background. What I have noticed is even right after I run Advanced Task Killer, there is A LOT of stuff that keeps turning itself back on. How can I permanently turn off apps/stuff that I rarely if ever use?
As an example of Apps/stuff that constantly is on and turning itself back on in the background........My Verizon Mobile, Gallery, Camera, Desk Cradle, Mobile IM, Skype Mobile, Slacker, City ID, etc etc etc.
I'd prefer to not have all this stuff constantly running in the background and using up memory. I notice that when I don't run Advanced Task Killer for a while my phone responds slower and slower and the longer I leave things be, my available memory available goes down......
How do I do this?Thanks, Ann, that's a great article, very helpful to a veteran Windows user like me, who isn't used to RAM being managed this way by the OS.
I just did a quick check on my Samsung Stratosphere using Menu > Applications > Memory usage, then tapping Running. There's a lot of stuff running, and I do wonder about some of it. Slacker Radio, for instance, which I've never used and don't intend to use, has been running for 24 hours and is using 2.3 MB of memory. When I press and hold it, I get a screen informing me that it was started by an application called Tap to stop, and a warning, "Service started by application. Stopping service may cause application to fail." If I throw caution to the winds and tap Stop anyway, I get another message, "Stop this system service? Some features of your phone may stop working correctly until you turn it off and then on again," at which point I grab caution back from the winds and hit Cancel.
So, granted that I should just leave things alone and "let Android be Android," as the writer of the article you linked to says, I'm still curious. What the heck is the application called "Tap to stop"? I don't see it anywhere. What feature of my phone would fail if I forced Slacker Radio to stop?
Thanks again for the article. It's fun to learn about a new OS. -
My 27 in I-Mac had a voice narrative or podcast running the background when I open Safari. I can't identify this site to find where I might delete it; I don't even remember how I opened it. All I want to do is delete it.
I found the narrative through Mission Control and it was an article on E-Bay which I had opened. It is now closed/deleted.
-
Running ALV REPORT in background
Hi Experts ,
Before writing this query , i went through all the threads related to ALV report in background . But found none of them satisfactory .
I am running a alv report in background . I am not using OO ALV . I am using " REUSE_ALV_GRID_DISPLAY" .
This report is schedules through a background job . It is creating a spool .
But I am getting a error message : *" FRONT END NOT AVIALABLE "*
What i have found so far :
I am planning to use sy-batch variable to check whether it is running in background or not , Then I am planning to read the spool and if the spool is created , i will display the ALV .
Is this the correct approach or some other way to generate the ALV REPORT .
Also by this way will the error message *" FRONT END NOT AVIALABLE "* go .
Please advice .
Regards,
AbhishekHello Everyone ,
Thanks for your replies .
I have the spool generated . But it is waiting status .
The issue here is how I am going to say that the spool is in " Completed " status . Because only after when my spool is in completed status , I want to display the status .
Is there way for this ?
Regards ,
Abhishek -
Field catalogue for ALV Grid when program is run in the background
Hi All,
I have an ALV report that contains approx 27 fields. Not all of these fields will be relevant for different Users, and many will want to change the order the fields appear in.
When running on line the User can set a variant to present the data as they wish. However, I need to email this report to the SAP Inbox with the fields displayed in the same Order with uncessary fields hidden as stated in the Field Catalogue.
On-line none of this is an issue, however GET_FRONTEND_FIELDCATALOG cannot be used in Background, and attribute MT_FIELDCAT_LOCAL is Private and cannot be accessed.
I have looked at using Class CL_ ALV_VARIANT to try to read the Variant being used, but couldn't get the information about the Variant coming back, instead I get an error in CL_ALV_VARIANT->LOAD_VARIANT.
Can anybody recommend how to the Field Cat for a Variant for background processing?
Thanks,
Tony.Hi.
You can not use an ALV report in Background or write to spool because it is a kind of dialog program.
You can write only a List report to spool so please find others sulotions.
Hope it helps.
Sayan. -
Running the alv report in background and sending it thro email
hi,
i have to run the alv report in background and send the output through emailHi
Many a times there is a requirement to display ALV Grid (not ALV List) in the background Job. I have checked the SDN Forum for the same and it has been mentioned that ALV Grid cannot be displayed in Background, but the list output of ALV is possible. So user wont have the actual Grid interface but the List interface.
There is a workaround to display ALV Grid in Background Job. The only restriction is you cant schedule the job through SM36. You need to execute the transaction of the report program, fill in the selection screen data and hit Execute.
The job would be executed in background. User will be able to see the Job Log and Job Status after executing the program. User doesnt have to go to SM37 to view the job status/log. Once the Job Status is changed to COMPLETED, user can click on DISPLAY SPOOL to view the ALV Grid.
Limitations:
Cant schedulea background job
The session should be active until the background job is completed. If the session is closed, then user wont be able to check the output in ALV Grid. User would be able to check the output through spool or SM37
Advantages:
If the spool width is greater than 255 characters, then the entire width could be seen in the output because the output is directed to an ALV Grid and not to spool
Interface of ALV Grid is available instead of ALV List even though its a background job.
Program wont give the TIME OUT error
Steps Required:
1. Once you execute the program, the following screen would be displayed
2. Click Display Job Status to check the Status of the Background Job
3. Click on Display the Job Log to check the Log
4. Click on Display Job Status to check the Job Status
5. Click on DISPLAY SPOOL to check the spool content once the Job Status is changed to COMPLETED. Output is displayed in ALV Grid
Programs:
1. Two different programs needs to be created
ZPROGRAM_ONE: This is the 1st program, where the selection screen and all the data validations would be done. Error handling for invalid data should be done in this program.
Once the data validation is done, this program would call the 2nd program ZPROGEAM_TWO. Build the logic to display ALV Grid in this program. The logic will only display ALV in foreground and it wont be reflected in the spool.
ZPROGRAM_TWO: This program would fetch all the data and do all the processing. If you want the spool output along with ALV Grid output, then build the logic in this program to display ALV Grid.
*& Report ZPROGRAM_ONE *
REPORT zprogram_one .
PRASHANT PATIL
TABLES : mara,
tsp01.
type-pools:slis.
TYPES : BEGIN OF t_mara,
matnr TYPE mara-matnr,
ersda TYPE mara-ersda,
ernam TYPE mara-ernam,
laeda TYPE mara-laeda,
END OF t_mara.
DATA : i_mara TYPE STANDARD TABLE OF t_mara,
wa_mara TYPE t_mara,
wa_index TYPE indx, " For Index details
wa_index_key TYPE indx-srtfd VALUE 'PRG_ONE',
i_jobsteplist TYPE STANDARD TABLE OF tbtcstep, " For spool number
wa_params TYPE pri_params, " To Get Print Parameters
wa_jobhead TYPE tbtcjob, " To know the status of job
wa_jobsteplist TYPE tbtcstep, " To know the spool
w_jobname TYPE tbtco-jobname, " Job name for bckgrnd job
w_jobcount TYPE tbtco-jobcount, " Unique id for bckgrd job
w_path TYPE string, " Upload path
w_lsind TYPE sy-lsind, " Index
wa_seltab TYPE rsparams,
i_seltab TYPE STANDARD TABLE OF rsparams,
wa_index1 TYPE indx, " For Index details
wa_index_key1 TYPE indx-srtfd VALUE 'PRG_TWO',
i_fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat LIKE LINE OF i_fieldcat.
CONSTANTS DECLARATION *
CONSTANTS :
c_a(1) TYPE c VALUE 'A',
c_m(1) TYPE c VALUE 'M',
c_l(1) TYPE c VALUE 'L',
c_c(1) TYPE c VALUE 'C',
c_zfdr(4) TYPE c VALUE 'ZFDR',
c_x(1) TYPE c VALUE 'X',
c_locl(4) TYPE c VALUE 'LOCL', " Destination is LOCAL
c_f(1) TYPE c VALUE 'F', " Job Status - Failed
c_s(1) TYPE c VALUE 'S',
c_p(1) TYPE c VALUE 'P'.
SELECTION SCREEN PARAMETERS
SELECT-OPTIONS : s_matnr FOR mara-matnr.
START-OF-SELECTION.
Before the export, fill the data fields before CLUSTR
wa_index-aedat = sy-datum.
wa_index-usera = sy-uname.
EXPORT s_matnr
TO DATABASE indx(st) FROM wa_index ID wa_index_key.
To Open the Job for background processing
PERFORM open_job.
To get the print parameters
PERFORM get_print_parameters.
Submit the job in background
PERFORM job_submit.
Close the background job
PERFORM job_close.
This is the output screen with the buttons ********
Create 3 buttons DISPLAY SPOOL, STATUS, JOBLOG
SET PF-STATUS 'ZS001'.
WRITE: / 'The program is submitted in Background'.
WRITE: / 'Press DISPLAY SPOOL to see the spool'.
WRITE: / 'Press STATUS to see the status of the background'.
AT USER-COMMAND.
If user presses the 'BACK' button
IF sy-ucomm = 'BAK'.
IF wa_jobhead-status = c_f OR
wa_jobhead-status = c_a.
LEAVE TO SCREEN 0.
ENDIF.
ENDIF.
If the user presses the 'DISPLAY SPOOL' Button
IF sy-ucomm = 'DISPLAY'.
PERFORM display_spool.
ENDIF.
If the user presses the 'JOB STATUS' Button
IF sy-ucomm = 'STATUS'.
PERFORM display_status.
ENDIF.
If the user presses the 'JOB LOG' Button
IF sy-ucomm = 'JOBLOG'.
PERFORM display_job_log.
ENDIF.
*& Form open_job
text
--> p1 text
<-- p2 text
FORM open_job .
This is to Create a new job which is to be submitted in background to
process sales order/delivery/invoice
Here we would get a unique id ( Jobcount ) which identifies our job
along with the job name which we have assigned to our job
CONCATENATE sy-uname
sy-datum
sy-uzeit
INTO w_jobname . " Assign unique jobname
CALL FUNCTION 'JOB_OPEN'
EXPORTING
DELANFREP = ' '
JOBGROUP = ' '
jobname = w_jobname
SDLSTRTDT = NO_DATE
SDLSTRTTM = NO_TIME
JOBCLASS =
IMPORTING
jobcount = w_jobcount
CHANGING
RET =
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " open_job
*& Form get_print_parameters
text
--> p1 text
<-- p2 text
FORM get_print_parameters .
DATA : l_valid TYPE c.
This is to get the Print Parameters for the job which is to be
submitted in background to process sales order/delivery/invoice
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
ARCHIVE_ID = C_CHAR_UNKNOWN
ARCHIVE_INFO = C_CHAR_UNKNOWN
ARCHIVE_MODE = C_CHAR_UNKNOWN
ARCHIVE_TEXT = C_CHAR_UNKNOWN
AR_OBJECT = C_CHAR_UNKNOWN
ARCHIVE_REPORT = C_CHAR_UNKNOWN
AUTHORITY = C_CHAR_UNKNOWN
COPIES = C_NUM3_UNKNOWN
COVER_PAGE = C_CHAR_UNKNOWN
DATA_SET = C_CHAR_UNKNOWN
DEPARTMENT = C_CHAR_UNKNOWN
destination = c_locl " LOCL
EXPIRATION = C_NUM1_UNKNOWN
immediately = space
IN_ARCHIVE_PARAMETERS = ' '
IN_PARAMETERS = ' '
LAYOUT = C_CHAR_UNKNOWN
LINE_COUNT = C_INT_UNKNOWN
LINE_SIZE = C_INT_UNKNOWN
LIST_NAME = C_CHAR_UNKNOWN
LIST_TEXT = C_CHAR_UNKNOWN
MODE = ' '
new_list_id = c_x
PROTECT_LIST = C_CHAR_UNKNOWN
no_dialog = c_x
RECEIVER = C_CHAR_UNKNOWN
RELEASE = C_CHAR_UNKNOWN
REPORT = C_CHAR_UNKNOWN
SAP_COVER_PAGE = C_CHAR_UNKNOWN
HOST_COVER_PAGE = C_CHAR_UNKNOWN
PRIORITY = C_NUM1_UNKNOWN
SAP_OBJECT = C_CHAR_UNKNOWN
TYPE = C_CHAR_UNKNOWN
user = sy-uname
USE_OLD_LAYOUT = ' '
UC_DISPLAY_MODE = C_CHAR_UNKNOWN
DRAFT = C_CHAR_UNKNOWN
ABAP_LIST = ' '
USE_ARCHIVENAME_DEF = ' '
DEFAULT_SPOOL_SIZE = C_CHAR_UNKNOWN
PO_FAX_STORE = ' '
NO_FRAMES = C_CHAR_UNKNOWN
IMPORTING
OUT_ARCHIVE_PARAMETERS =
out_parameters = wa_params
valid = l_valid
EXCEPTIONS
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 3
OTHERS = 4
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " get_print_parameters
*& Form job_submit
text
--> p1 text
<-- p2 text
FORM job_submit .
The job which we have created & the unique id ( jobcount ) which we
have got identifies our job. Hence those parameters are passed along
with the name of the background program "ZPROGRAM_TWO"
The job is submitted in background.
CALL FUNCTION 'JOB_SUBMIT'
EXPORTING
ARCPARAMS =
authcknam = sy-uname
COMMANDNAME = ' '
OPERATINGSYSTEM = ' '
EXTPGM_NAME = ' '
EXTPGM_PARAM = ' '
EXTPGM_SET_TRACE_ON = ' '
EXTPGM_STDERR_IN_JOBLOG = 'X'
EXTPGM_STDOUT_IN_JOBLOG = 'X'
EXTPGM_SYSTEM = ' '
EXTPGM_RFCDEST = ' '
EXTPGM_WAIT_FOR_TERMINATION = 'X'
jobcount = w_jobcount
jobname = w_jobname
LANGUAGE = SY-LANGU
priparams = wa_params
report = 'ZPROGRAM_TWO'
VARIANT = ' '
IMPORTING
STEP_NUMBER =
EXCEPTIONS
bad_priparams = 1
bad_xpgflags = 2
invalid_jobdata = 3
jobname_missing = 4
job_notex = 5
job_submit_failed = 6
lock_failed = 7
program_missing = 8
prog_abap_and_extpg_set = 9
OTHERS = 10
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " job_submit
*& Form job_close
text
--> p1 text
<-- p2 text
FORM job_close .
Once the job is submitted in background then the job is closed
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
AT_OPMODE = ' '
AT_OPMODE_PERIODIC = ' '
CALENDAR_ID = ' '
EVENT_ID = ' '
EVENT_PARAM = ' '
EVENT_PERIODIC = ' '
jobcount = w_jobcount
jobname = w_jobname
LASTSTRTDT = NO_DATE
LASTSTRTTM = NO_TIME
PRDDAYS = 0
PRDHOURS = 0
PRDMINS = 0
PRDMONTHS = 0
PRDWEEKS = 0
PREDJOB_CHECKSTAT = ' '
PRED_JOBCOUNT = ' '
PRED_JOBNAME = ' '
SDLSTRTDT = NO_DATE
SDLSTRTTM = NO_TIME
STARTDATE_RESTRICTION = BTC_PROCESS_ALWAYS
strtimmed = c_x
TARGETSYSTEM = ' '
START_ON_WORKDAY_NOT_BEFORE = SY-DATUM
START_ON_WORKDAY_NR = 0
WORKDAY_COUNT_DIRECTION = 0
RECIPIENT_OBJ =
TARGETSERVER = ' '
DONT_RELEASE = ' '
TARGETGROUP = ' '
DIRECT_START =
IMPORTING
JOB_WAS_RELEASED =
CHANGING
RET =
EXCEPTIONS
cant_start_immediate = 1
invalid_startdate = 2
jobname_missing = 3
job_close_failed = 4
job_nosteps = 5
job_notex = 6
lock_failed = 7
invalid_target = 8
OTHERS = 9
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " job_close
*& Form display_spool
text
--> p1 text
<-- p2 text
FORM display_spool .
To Read the Job to get the spool details
DATA : l_rqident TYPE tsp01-rqident, " Spool Number
l_spoolno TYPE tsp01_sp0r-rqid_char.
CLEAR : l_rqident,
w_lsind,
wa_jobsteplist.
REFRESH : i_jobsteplist.
SET PF-STATUS 'ZAR02'.
Get the Spool Number
CALL FUNCTION 'BP_JOB_READ'
EXPORTING
job_read_jobcount = w_jobcount
job_read_jobname = w_jobname
job_read_opcode = '20'
JOB_STEP_NUMBER =
IMPORTING
job_read_jobhead = wa_jobhead
TABLES
job_read_steplist = i_jobsteplist
CHANGING
RET =
EXCEPTIONS
invalid_opcode = 1
job_doesnt_exist = 2
job_doesnt_have_steps = 3
OTHERS = 4
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Read the Job Step list to get the spool number
READ TABLE i_jobsteplist INTO wa_jobsteplist INDEX 1.
CHECK wa_jobsteplist-listident <> space.
Spool Number
l_rqident = wa_jobsteplist-listident.
MOVE l_rqident TO l_spoolno.
Check the spool in TSP01
SELECT SINGLE * FROM tsp01 WHERE rqident = l_rqident.
IF sy-subrc = 0.
LEAVE TO LIST-PROCESSING.
CALL FUNCTION 'RSPO_R_RDELETE_SPOOLREQ'
EXPORTING
spoolid = l_spoolno
IMPORTING
RC =
STATUS =
PERFORM show_alv.
ENDIF.
w_lsind = sy-lsind.
IF sy-lsind GE 19.
sy-lsind = 1.
ENDIF.
ENDFORM. " display_spool
*& Form show_alv
text
--> p1 text
<-- p2 text
FORM show_alv .
Before the import, fill the data fields before CLUSTR.
wa_index1-aedat = sy-datum.
wa_index1-usera = sy-uname.
To Import the selection screen data from Calling Program
IMPORT i_mara
FROM DATABASE indx(st) ID wa_index_key1 TO wa_index1.
FREE MEMORY ID wa_index_key1.
This prepares the field-catalog for ALV.
PERFORM prepare_fieldcatalog.
This displays the output in ALV format .
PERFORM display_alv.
ENDFORM. " show_alv
*& Form display_status
text
--> p1 text
<-- p2 text
FORM display_status .
To Display the STATUS of the JOB which is exectued in background
CLEAR : wa_jobsteplist.
REFRESH : i_jobsteplist.
WRITE:/ 'DISPLAYING JOB STATUS'.
CALL FUNCTION 'BP_JOB_READ'
EXPORTING
job_read_jobcount = w_jobcount
job_read_jobname = w_jobname
job_read_opcode = '20'
JOB_STEP_NUMBER =
IMPORTING
job_read_jobhead = wa_jobhead
TABLES
job_read_steplist = i_jobsteplist
CHANGING
RET =
EXCEPTIONS
invalid_opcode = 1
job_doesnt_exist = 2
job_doesnt_have_steps = 3
OTHERS = 4
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
To Display the status text as per the status type
CASE wa_jobhead-status.
WHEN 'S'. WRITE: / 'Scheduled'.
WHEN 'R'. WRITE: / 'Released'.
WHEN 'F'. WRITE: / 'Completed'.
WHEN 'A'. WRITE: / 'Cancelled'.
WHEN OTHERS.
ENDCASE.
IF sy-lsind GE 19.
sy-lsind = 1.
ENDIF.
ENDFORM. " display_status
*& Form display_job_log
text
--> p1 text
<-- p2 text
FORM display_job_log .
To display the log of the background program
LEAVE TO LIST-PROCESSING.
CALL FUNCTION 'BP_JOBLOG_SHOW_SM37B'
EXPORTING
client = sy-mandt
jobcount = w_jobcount
joblogid = ' '
jobname = w_jobname
EXCEPTIONS
error_reading_jobdata = 1
error_reading_joblog_data = 2
jobcount_missing = 3
joblog_does_not_exist = 4
joblog_is_empty = 5
joblog_show_canceled = 6
jobname_missing = 7
job_does_not_exist = 8
no_joblog_there_yet = 9
no_show_privilege_given = 10
OTHERS = 11.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " display_job_log
*& Form prepare_fieldcatalog
text
--> p1 text
<-- p2 text
FORM prepare_fieldcatalog .
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'MATNR'.
wa_fieldcat-tabname = 'I_MARA'.
wa_fieldcat-reptext_ddic = 'Material no.'.
wa_fieldcat-outputlen = '18'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'ERSDA'.
wa_fieldcat-tabname = 'I_MARA'.
wa_fieldcat-reptext_ddic = 'Creation date'.
wa_fieldcat-outputlen = '10'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'ERNAM'.
wa_fieldcat-tabname = 'I_MARA'.
wa_fieldcat-reptext_ddic = 'Name of Person'.
wa_fieldcat-outputlen = '10'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'LAEDA'.
wa_fieldcat-tabname = 'I_MARA'.
wa_fieldcat-reptext_ddic = ' Last Change'.
wa_fieldcat-outputlen = '10'.
APPEND wa_fieldcat TO i_fieldcat.
ENDFORM. " prepare_fieldcatalog
*& Form display_alv
text
--> p1 text
<-- p2 text
FORM display_alv .
Call ABAP List Viewer (ALV)
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
it_fieldcat = i_fieldcat
tables
t_outtab = i_mara.
ENDFORM. " display_alv
ZPROGRAM_TWO: This is the 2nd program which would be called from program ZPROGRAM_ONE.
*& Report ZPROGRAM_TWO *
REPORT zprogram_two .
PRASHANT PATIL
TABLES : mara.
TYPE-POOLS:slis.
TYPES : BEGIN OF t_mara,
matnr TYPE mara-matnr,
ersda TYPE mara-ersda,
ernam TYPE mara-ernam,
laeda TYPE mara-laeda,
END OF t_mara.
DATA : i_mara TYPE STANDARD TABLE OF t_mara,
wa_mara TYPE t_mara,
wa_index TYPE indx, " For Index details
wa_index_key TYPE indx-srtfd VALUE 'PRG_ONE',
wa_index1 TYPE indx, " For Index details
wa_index_key1 TYPE indx-srtfd VALUE 'PRG_TWO',
i_fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat LIKE LINE OF i_fieldcat.
SELECT-OPTIONS : s_matnr FOR mara-matnr.
Before the import, fill the data fields before CLUSTR.
wa_index-aedat = sy-datum.
wa_index-usera = sy-uname.
To Import the selection screen data from Calling Program
IMPORT s_matnr
FROM DATABASE indx(st) ID wa_index_key TO wa_index.
FREE MEMORY ID wa_index_key.
SELECT matnr
ersda
ernam
laeda
FROM mara
INTO TABLE i_mara
WHERE matnr IN s_matnr.
PERFORM prepare_fieldcatalog.
PERFORM display_alv.
Before the export, fill the data fields before CLUSTR
wa_index1-aedat = sy-datum.
wa_index1-usera = sy-uname.
EXPORT i_mara
TO DATABASE indx(st) FROM wa_index1 ID wa_index_key1.
*& Form prepare_fieldcatalog
text
--> p1 text
<-- p2 text
FORM prepare_fieldcatalog .
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'MATNR'.
wa_fieldcat-tabname = 'I_MARA'.
wa_fieldcat-outputlen = '18'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'ERSDA'.
wa_fieldcat-tabname = 'I_MARA'.
wa_fieldcat-outputlen = '10'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'ERNAM'.
wa_fieldcat-tabname = 'I_MARA'.
wa_fieldcat-outputlen = '10'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'LAEDA'.
wa_fieldcat-tabname = 'I_MARA'.
wa_fieldcat-outputlen = '10'.
APPEND wa_fieldcat TO i_fieldcat.
ENDFORM. " prepare_fieldcatalog
*& Form display_alv
text
--> p1 text
<-- p2 text
FORM display_alv .
Call ABAP List Viewer (ALV)
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
it_fieldcat = i_fieldcat
TABLES
t_outtab = i_mara.
ENDFORM. " display_alv
its possible to display ALV Grid using OO ALV. Following code can be used instead of FM.
In the PBO, add following code
SET PF-STATUS 'ZSTAT'.
If program is executed in background
CALL METHOD cl_gui_alv_grid=>offline
RECEIVING
e_offline = off.
IF off IS INITIAL.
IF container1 IS INITIAL.
CREATE OBJECT container1
EXPORTING
container_name = 'CC_ALV1' .
ENDIF.
ENDIF.
CREATE OBJECT g_grid1
EXPORTING
i_parent = container1.
CALL METHOD g_grid1->set_table_for_first_display
EXPORTING
I_BUFFER_ACTIVE =
I_BYPASSING_BUFFER =
I_CONSISTENCY_CHECK =
I_STRUCTURE_NAME =
IS_VARIANT =
i_save = 'A'
i_default = ' '
is_layout =
is_print =
IT_SPECIAL_GROUPS =
it_toolbar_excluding =
IT_HYPERLINK =
IT_ALV_GRAPHICS =
IT_EXCEPT_QINFO =
CHANGING
it_outtab = i_output
it_fieldcatalog = i_fieldcatalog
IT_SORT =
IT_FILTER =
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Reward points if useful
Regards
Anji -
Please tell me the way to the run the interactive OO alv in the background.
please tell me the way to the run the interactive OO alv in the background. is there any thing to do with SAP GUI.
hi there...
regarding your query, i tried to do this but ended in a short dump. You can check the folowing link which i checked once i got this error.
http://www.sapfans.com/forums/viewtopic.php?t=19224
i think this will be of some help to you.
Do reward if helpful or get back if need further assistance/ -
Problem in alv report coumn header in the background while using salv
Hi all,
now i am working on alv report for this i have used salv i mean oops alv ,So here i am facing one issue while executing the report in background
the report column headers are not displaying properly as it is displaying in front end.
In the back ground it is always displaying column header as data element field label short text. i have written a code to pick the long text
but it is working fine if run the report in the frontend where as in the backgroiund it is always displaying short text but it is wrong.
here i am attaching the output screen shots in front end and background.Hi Satish,
I have tried this scenario with Reuse ALV grid 1st i found the same issue as u said in background job,
then i set in field catalog as,
wa_fcat-ddictxt = 'L'. Now its working fine. L stands for long text.
Before...
After...
For LVC u can try the below fields in fieldcatlog.
COLDDICTXT = 'L'.
SELDDICTXT = 'L' -
Headers getting repeated while running the report in background
Hi,
I have a report which uses ALV grid display for output display.
I have displayed a heder in the top_of_page option. while running the program in foregound the header gets displayed only once. but when executing in background the header is getting displayed for each and every page.
can any one tell me how to get the header displayed only once in the background also.REPORT ZBACKORD MESSAGE-ID VZ
NO STANDARD PAGE HEADING.
*& TABLES AND TYPE-POOLS *
Tables used
TABLES : VBAK, "Sales Document: Header Data
VBAP, "Sales Document: Item Data
VBPA. "Sales Document Partner
For ALV Display
TYPE-POOLS: SLIS. "Globale Typen für generische Listbausteine
*& CONSTANTS *
Constants Used
CONSTANTS:
C_X VALUE 'X', "Order status
C_TAPA(4) VALUE 'TAPA', "For Material Determination
C_0001(4) VALUE '0001', "Etenr value
C_A VALUE 'A', "Enable Save
C_US(3) VALUE 'US$', "US DOLLAR.
C_B VALUE 'B', "for Partially processed
C_E VALUE 'E', "Language
C_C VALUE 'C', "for completely processed
C_BLANK VALUE ' ', "Blank
C_IC1(4) VALUE '&IC1', "for user command
C_ZR(2) VALUE 'ZR', "Cs ReP No
C_BP(2) VALUE 'RE', "Bill to party
C_SH(2) VALUE 'WE', "Sold to party
C_6(6) VALUE '000000', "For item number
C_20(2) TYPE N VALUE '20', "For the length of the field
C_S(1) TYPE C VALUE 'S', "STOCK
C_H VALUE 'H', "Header
C_COL(1) TYPE C VALUE ':', " COLUMN FOR DATA AND TIME
C_TOP TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE',
"For TOP_OF_PAGE
C_USER TYPE SLIS_FORMNAME VALUE 'USER_COMMAND'.
" For USER_COMMAND
*& TYPE DEFINITIONS *
*FOR Sales Document: Header Data
TYPES: BEGIN OF TP_VBAK,
VBELN TYPE VBELN_VF, "Sales Document
ERDAT TYPE ERDAT, "Date on which the record was created
AUART TYPE AUART, "Sales document type
LIFSK TYPE LIFSK, "Delivery block
VKORG TYPE VKORG, "Sales organization
VTWEG TYPE VTWEG, "Distribution channel
END OF TP_VBAK.
*FOR Sales Document Business Data
TYPES :BEGIN OF TP_VBKD,
VBELN TYPE VBELN, "Sales and distribution document number
POSNR TYPE POSNR, "Item number of the SD document
INCO1 TYPE INCO1, "Incoterms
ZTERM TYPE DZTERM, "Terms of payment key
BSTKD TYPE BSTKD, "Customer purchase order number
END OF TP_VBKD.
TYPES : BEGIN OF TP_VBFA,
VBELV TYPE VBELN_VON,
POSNV TYPE POSNR_VON,
END OF TP_VBFA.
*FOR Sales Document: Partner
TYPES : BEGIN OF TP_VBPA,
VBELN TYPE VBELN, "Sales and distribution
PARVW TYPE PARVW, "Partner function
KUNNR TYPE KUNNR, "Customer Number 1
ADRNR TYPE ADRNR, "address
END OF TP_VBPA.
*FOR Addresses (Business Address Services)
TYPES : BEGIN OF TP_ADRC,
ADDRNUMBER TYPE AD_ADDRNUM, "Address
DATE_FROM TYPE AD_DATE_FR, "Date valid from
NATION TYPE AD_NATION, "International address
NAME1 TYPE AD_NAME1, "name
END OF TP_ADRC.
*FOR Sales Document: Item Data
TYPES: BEGIN OF TP_VBAP,
VBELN TYPE VBELN_VA, "Sales document
POSNR TYPE POSNR_VA, "Sales document item
MATNR TYPE MATNR, "Material Number
PSTYV TYPE PSTYV, "Sales document item category
KDMAT TYPE MATNR_KU, "Material number used by customer
VRKME TYPE VRKME, "Sales unit
WERKS TYPE WERKS_EXT, "Plant (Own or External)
VSTEL TYPE VSTEL, "Shipping point /Receiving point
NETPR TYPE NETPR, "Net p
NETWR TYPE NETWR_AP,
WAERK TYPE VBAP-WAERK,"Target outline doc currency
END OF TP_VBAP.
*for Sales Document: Schedule Line Data
TYPES: BEGIN OF TP_VBEP,
VBELN TYPE VBELN_VA, "Sales document
POSNR TYPE POSNR_VA, "Sales Document Item
ETENR TYPE ETENR, "Schedule line
EDATU TYPE EDATU, "Schedule line data
WMENG TYPE WMENG, "Order quantity in sales unit
BMENG TYPE BMENG, "Confirmed quantity
LMENG TYPE LMENG, "Required quantity
WADAT TYPE WADAT, "Goods issue date
LIFSP TYPE LIFSP_EP, "Schedule line blocked for delivery
END OF TP_VBEP.
*For Sales Document: Header Status and Administrative Data
TYPES : BEGIN OF TP_VBUK,
VBELN TYPE VBELN, "Sales and Distribution Document Number
SPSTG TYPE SPSTG, "Overall blocked status
CMGST TYPE CMGST,
END OF TP_VBUK.
TYPES : BEGIN OF TP_TVLST,
LIFSP TYPE LIFSP, "Default delivery block
VTEXT TYPE BEZEI_LIFSP, "Description
END OF TP_TVLST.
*FOR Sales Document: Item Status
TYPES : BEGIN OF TP_VBUP,
VBELN TYPE VBELN, "Sales and distribution
POSNR TYPE POSNR, "Item number of the SD
LFGSA TYPE LFGSA, "Overall delivery status of item
END OF TP_VBUP.
For ALV Display-if cs rep is checked
TYPES: BEGIN OF TP_DISPC,
VBELN TYPE VBELN, "Sales and distribution Doc
VKORG TYPE VKORG, "Sales organization
VTWEG TYPE VTWEG, "Distribution channel
AUART TYPE AUART, "Sales document type
BSTKD TYPE BSTKD, "Customer purchase order
KUNNR_1 TYPE KUNNR, "Cs Rep Number
NAME1_1 TYPE NAME1, "Cs Rep Name
KUNNR_2 TYPE KUNNR, "Bill to Number
NAME1_2 TYPE NAME1, "Bill to Party
KUNNR_3 TYPE KUNNR, "Ship to Number
NAME1_3 TYPE NAME1, "Ship to Party
POSNR TYPE POSNR_VA, "Item number of the SD
MATNR TYPE MATNR, "Material Number
KDMAT TYPE MATNR_KU, "Material number used by
VSTEL TYPE VSTEL, "Shipping point /Receiving
NETPR TYPE NETPR, "Net price
NETWR TYPE NETWR_AP,
WAERK TYPE WAERK, "Currency
ZTERM TYPE DZTERM, "Terms of payment key
WMENG TYPE WMENG, "Order quantity in sales unit
LOGIC_1 TYPE WMENG, "BackOrder Quantity
VRKME TYPE STRING, "Sales Unit
WADAT TYPE EDATU, "Goods issue date
WADAT1 TYPE EDATU,
EDATU TYPE EDATU, "Schedule line data
VRKME_1 TYPE STRING, "Sales Unit
INCO1 TYPE INCO1, "Incoterms
LFGSA TYPE STRING, "Overall delivery status of item
LIFSP TYPE STRING, "Line Item Block
LIFSK TYPE STRING, "Header block
SPSTG TYPE STRING, "Overall blocked status
END OF TP_DISPC.
For ALV Display-if plant is checked
TYPES: BEGIN OF TP_DISPP,
VBELN TYPE VBELN, "Sales and distribution Doc
VKORG TYPE VKORG, "Sales organization
VTWEG TYPE VTWEG, "Distribution channel
AUART TYPE AUART, "Sales document type
BSTKD TYPE BSTKD, "Customer purchase order
KUNNR_2 TYPE KUNNR, "Cs rep number
NAME1_2 TYPE NAME1, "Cs rep Name
KUNNR_3 TYPE KUNNR, "Ship to Number
NAME1_3 TYPE NAME1, "Ship to Party Name
POSNR TYPE POSNR_VA, "Item number of the SD
MATNR TYPE MATNR, "Material Number
KDMAT TYPE MATNR_KU, "Material number used by customer
VSTEL TYPE VSTEL, "Shipping point /Receiving point
NETPR TYPE NETPR, "Net price
NETWR TYPE NETWR_AP,
*}MOD02
WAERK TYPE WAERK, "Currency
ZTERM TYPE DZTERM, "Terms of payment key
WMENG TYPE WMENG, "Order quantity in sales unit
LOGIC_1 TYPE WMENG, "Backorder Quantity
VRKME TYPE STRING, "Sales unit
WADAT TYPE EDATU, "Goods issue date
WADAT1 TYPE EDATU,
EDATU TYPE EDATU, "Schedule line data
VRKME_1 TYPE STRING, "Sales Unit
INCO1 TYPE INCO1, "Incoterms
LFGSA TYPE STRING, "Overall delivery status of item
LIFSP TYPE STRING, "Line Item Block
LIFSK TYPE STRING, "Header block
SPSTG TYPE STRING, "Overall blocked status
WERKS TYPE WERKS_EXT, "Plant (Own or External)
END OF TP_DISPP.
For ALV Display-if cs rep and palnt is checked
TYPES: BEGIN OF TP_DISP,
VKORG TYPE VKORG, "Sales organization
VTWEG TYPE VTWEG, "Distribution channel
AUART TYPE AUART, "Sales document type
VBELN TYPE VBELN, "Sales and distribution Doc no
BSTKD TYPE BSTKD, "Customer purchase order number
KUNNR_1 TYPE KUNNR, "Cs Rep Number
NAME1_1 TYPE NAME1, "Cs Rep Name
KUNNR_2 TYPE KUNNR, "Bill to Number
NAME1_2 TYPE NAME1, "Bill to Name
KUNNR_3 TYPE KUNNR, "Ship to Number
NAME1_3 TYPE NAME1, "Ship to Name
POSNR TYPE POSNR_VA, "Item number of the SD
MATNR TYPE MATNR, "Material Number
KDMAT TYPE MATNR_KU, "Material number used
VSTEL TYPE VSTEL, "Shipping point /Receiving
NETPR TYPE NETPR, "Net price
NETWR TYPE NETWR_AP,
WAERK TYPE WAERK, "Currency
ZTERM TYPE DZTERM, "Terms of payment key
WMENG TYPE WMENG, "Order quantity in sales
LOGIC_1 TYPE WMENG, "Backorder Quantity
VRKME TYPE STRING, "Sales unit
WADAT TYPE EDATU, "Goods issue date
WADAT1 TYPE EDATU,
VRKME_1 TYPE STRING, "Sales Unit
EDATU TYPE EDATU, "Schedule line date
INCO1 TYPE INCO1, "Incoterms
LFGSA TYPE STRING, "Overall delivery status of
LIFSP TYPE STRING, "Line Item Block
LIFSK TYPE STRING, "Header block
SPSTG TYPE STRING, "Overall blocked status
WERKS TYPE WERKS_EXT, "Plant (Own or External)
END OF TP_DISP.
*& INTERNAL TABLES *
Internal Tables used for Data Selection
DATA: T_VBAK TYPE STANDARD TABLE OF TP_VBAK WITH HEADER LINE,
T_VBPA TYPE STANDARD TABLE OF TP_VBPA WITH HEADER LINE,
T_VBAP TYPE STANDARD TABLE OF TP_VBAP WITH HEADER LINE,
T_VBKD TYPE STANDARD TABLE OF TP_VBKD WITH HEADER LINE,
T_VBEP TYPE STANDARD TABLE OF TP_VBEP WITH HEADER LINE,
T_VBEP1 TYPE STANDARD TABLE OF TP_VBEP WITH HEADER LINE,
T_VBUP TYPE STANDARD TABLE OF TP_VBUP WITH HEADER LINE,
T_ADRC TYPE STANDARD TABLE OF TP_ADRC WITH HEADER LINE,
T_DISPC TYPE STANDARD TABLE OF TP_DISPC WITH HEADER LINE,
T_DISPP TYPE STANDARD TABLE OF TP_DISPP WITH HEADER LINE,
T_DISP TYPE STANDARD TABLE OF TP_DISP WITH HEADER LINE.
{23-8-2007
DATA: T_VBUK TYPE STANDARD TABLE OF TP_VBUK WITH HEADER LINE,
T_TVLST TYPE STANDARD TABLE OF TP_TVLST WITH HEADER LINE,
T_TVLST1 TYPE STANDARD TABLE OF TP_TVLST WITH HEADER LINE,
T_VBFA TYPE STANDARD TABLE OF TP_VBFA WITH HEADER LINE.
Variables used for ALV Display *
DATA:
W_REPID TYPE SY-REPID, " Report name
W_POS TYPE I VALUE 0, " Column position indicator
W_LAYOUT TYPE SLIS_LAYOUT_ALV, " Layout
W_DATUM(10) TYPE C, " Run date
W_TIME(8) TYPE C. " Run time
Tables used for ALV Display *
DATA : T_GROUP TYPE SLIS_T_SP_GROUP_ALV WITH HEADER LINE,
"Grouping of field
T_SORT TYPE SLIS_T_SORTINFO_ALV WITH HEADER LINE,
"sorting of the field
T_FIELDCATALOG TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
" Field description
T_TOP TYPE SLIS_T_LISTHEADER. " Header for the ALV
Work Area used for ALV Display
DATA : WA_TOP LIKE LINE OF T_TOP. " Work Area for Header
*& SELECTION SCREEN *
Selection
SELECTION-SCREEN BEGIN OF BLOCK B01 WITH FRAME TITLE TEXT-T01.
"Sales Organization details
SELECT-OPTIONS: S_VKORG FOR VBAK-VKORG OBLIGATORY.
"Sales Organization
SELECT-OPTIONS: S_VTWEG FOR VBAK-VTWEG .
"Distribution Channel
SELECT-OPTIONS: S_KUNNR1 FOR VBPA-KUNNR . "CS Rep Number
SELECT-OPTIONS: S_WERKS FOR VBAP-WERKS. "Plant
SELECTION-SCREEN END OF BLOCK B01.
SELECTION-SCREEN BEGIN OF BLOCK B02 WITH FRAME TITLE TEXT-T02.
"Additional Selections
SELECT-OPTIONS: S_KUNNR2 FOR VBPA-KUNNR . "Bill to party
SELECT-OPTIONS: S_KUNNR3 FOR VBPA-KUNNR . "Ship to party
SELECT-OPTIONS: S_VBELN FOR VBAK-VBELN . "Saler Order
SELECT-OPTIONS: S_MATNR FOR VBAP-MATNR . "Material Number
SELECT-OPTIONS: S_KDMAT FOR VBAP-KDMAT . "Customer Material Number
SELECT-OPTIONS: S_AUART FOR VBAK-AUART . "Sales Order Type
SELECTION-SCREEN END OF BLOCK B02.
SELECTION-SCREEN BEGIN OF BLOCK B03 WITH FRAME TITLE TEXT-T03.
"Date Selection
SELECT-OPTIONS: S_ERDAT FOR VBAK-ERDAT OBLIGATORY.
"Order Creation Date
PARAMETER: P_PLANT AS CHECKBOX. "Backorder Plant
PARAMETER: P_CSREP AS CHECKBOX. "Backorder CSREP number
SELECTION-SCREEN END OF BLOCK B03.
*& AT SELECTION SCREEN *
*Validation Sales Organisation
AT SELECTION-SCREEN ON S_VKORG.
IF NOT S_VKORG[] IS INITIAL.
SELECT VKORG UP TO 1 ROWS FROM TVKO
BYPASSING BUFFER
INTO S_VKORG
WHERE VKORG IN S_VKORG.
ENDSELECT.
IF SY-SUBRC NE 0.
MESSAGE E000 WITH TEXT-E01.
"Enter a valid Sales Organization
ENDIF.
ENDIF.
*Validation Distribution Channel
AT SELECTION-SCREEN ON S_VTWEG.
IF NOT S_VTWEG[] IS INITIAL.
SELECT VTWEG UP TO 1 ROWS FROM TVTW
BYPASSING BUFFER
INTO S_VTWEG
WHERE VTWEG IN S_VTWEG.
ENDSELECT.
IF SY-SUBRC NE 0.
MESSAGE E000 WITH TEXT-E02.
"Enter a valid Distribution channel
ENDIF.
ENDIF.
*Validation Customer service rep number
AT SELECTION-SCREEN ON S_KUNNR1.
IF NOT S_KUNNR1[] IS INITIAL.
SELECT KUNNR UP TO 1 ROWS FROM KNA1
INTO S_KUNNR1
WHERE KUNNR IN S_KUNNR1.
ENDSELECT.
IF SY-SUBRC NE 0.
MESSAGE E000 WITH TEXT-E03.
"Enter a valid Customer Service rep number
ENDIF.
ENDIF.
*Validation Plant
AT SELECTION-SCREEN ON S_WERKS.
IF NOT S_WERKS[] IS INITIAL.
SELECT WERKS UP TO 1 ROWS
FROM T001W
INTO S_WERKS
BYPASSING BUFFER
WHERE WERKS IN S_WERKS.
ENDSELECT.
IF SY-SUBRC NE 0.
MESSAGE E000 WITH TEXT-E04. "Enter a valid Plant
ENDIF.
ENDIF.
*Validation Bill to number
AT SELECTION-SCREEN ON S_KUNNR2.
IF NOT S_KUNNR2[] IS INITIAL.
SELECT KUNNR UP TO 1 ROWS FROM KNA1
INTO S_KUNNR2
WHERE KUNNR IN S_KUNNR2.
ENDSELECT.
IF SY-SUBRC NE 0.
MESSAGE E000 WITH TEXT-E05. "Enter a valid Bill to number
ENDIF.
ENDIF.
*Validation Ship to Number
AT SELECTION-SCREEN ON S_KUNNR3.
IF NOT S_KUNNR3[] IS INITIAL.
SELECT KUNNR UP TO 1 ROWS FROM KNA1
INTO S_KUNNR3
WHERE KUNNR IN S_KUNNR3.
ENDSELECT.
IF SY-SUBRC NE 0.
MESSAGE E000 WITH TEXT-E06. "Enter a valid Ship to number
ENDIF.
ENDIF.
*Validation Order Number
AT SELECTION-SCREEN ON S_VBELN.
IF NOT S_VBELN[] IS INITIAL.
SELECT VBELN UP TO 1 ROWS FROM VBUK
INTO S_VBELN
WHERE VBELN IN S_VBELN.
ENDSELECT.
IF SY-SUBRC NE 0.
MESSAGE E000 WITH TEXT-E07. "Enter a valid Order number
ENDIF.
ENDIF.
*Validation Material Number
AT SELECTION-SCREEN ON S_MATNR.
IF NOT S_MATNR[] IS INITIAL.
SELECT MATNR UP TO 1 ROWS FROM MARA
INTO S_MATNR
WHERE MATNR IN S_MATNR.
ENDSELECT.
IF SY-SUBRC NE 0.
MESSAGE E000 WITH TEXT-E08. "Enter a valid Material number
ENDIF.
ENDIF.
*Validation Customer Material Number
AT SELECTION-SCREEN ON S_KDMAT.
IF NOT S_KDMAT[] IS INITIAL.
SELECT KDMAT UP TO 1 ROWS
FROM KNMT
INTO S_KDMAT
WHERE VKORG IN S_VKORG AND
VTWEG IN S_VTWEG AND
KDMAT IN S_KDMAT.
ENDSELECT.
IF SY-SUBRC NE 0.
MESSAGE E000 WITH TEXT-E09.
"Enter a valid Customer Material number
ENDIF.
ENDIF.
*Validation Salea order type
AT SELECTION-SCREEN ON S_AUART.
IF NOT S_AUART[] IS INITIAL.
SELECT AUART UP TO 1 ROWS FROM TVAK
INTO S_AUART
BYPASSING BUFFER
WHERE AUART IN S_AUART.
ENDSELECT.
IF SY-SUBRC NE 0.
MESSAGE E000 WITH TEXT-E10.
"Enter a valid Sales Order type
ENDIF.
ENDIF.
*Validation for Plant / CS rep .
AT SELECTION-SCREEN .
IF NOT ( ( P_PLANT = C_X ) OR ( P_CSREP = C_X ) ).
MESSAGE E000 WITH TEXT-E12. "Choose the Plant or CSrep
ENDIF.
IF ( P_PLANT = C_X ) AND S_WERKS IS INITIAL.
MESSAGE E000 WITH TEXT-E13. "Enter Plant
ENDIF.
IF ( P_CSREP = C_X ) AND S_KUNNR1 IS INITIAL.
MESSAGE E000 WITH TEXT-E14. " Enter CSREP number
ENDIF.
*& START OF SELECTION *
START-OF-SELECTION.
Clear Work Areas/Variables and Clear/Refresh Internal Tables
PERFORM CLEAR_REFRESH.
Selection of Data as per inputs
PERFORM DATA_SELECTION.
Populate Internal table for display
PERFORM DATA_FILL_FOR_DISPLAY.
*& END OF SELECTION *
END-OF-SELECTION.
IF NOT T_DISP[] IS INITIAL.
*Populating the field catalog for ALV Display if plant and csrep is
*checked.
PERFORM POPULATE_FIELD_CATALOG.
PERFORM DISPLAY.
ELSEIF T_DISPP[] IS NOT INITIAL.
*Populating the field catalog for ALV Display if plant is checked.
PERFORM POPULATE_FIELD_CATALOG.
PERFORM DISPLAY.
ELSEIF T_DISPC[] IS NOT INITIAL.
*Populating the field catalog for ALV Display if csrep is checked.
PERFORM POPULATE_FIELD_CATALOG.
PERFORM DISPLAY.
ELSE.
MESSAGE I000 WITH TEXT-E15. "No Data found for Selection Criteria
ENDIF.
Clear Work Areas/Variables and Clear/Refresh Internal Tables
PERFORM CLEAR_REFRESH.
*& Form CLEAR_REFRESH
Clear Work Areas/Variables and Clear/Refresh Internal Tables
FORM CLEAR_REFRESH .
Clear Variables/Work Areas/Internal Tables
CLEAR: W_REPID,
W_POS,
W_LAYOUT,
W_DATUM,
W_TIME,
T_VBAK,
T_VBKD,
T_VBPA,
T_VBAP,
T_VBEP,
T_VBUP,
T_DISPC,
T_DISPP,
T_DISP,
T_VBUK,
T_TVLST,
T_TVLST1.
Refresh Internal Tables
REFRESH: T_VBAK,
T_VBKD,
T_VBPA,
T_VBAP,
T_VBEP,
T_VBUP,
T_DISPC,
T_DISPP,
T_DISP,
T_VBUK,
T_TVLST,
T_TVLST1.
ENDFORM. " CLEAR_REFRESH
*& Form DATA_SELECTION
Selection of Data as per inputs
FORM DATA_SELECTION .
*Obtain Sales and distribution document number,Date on which the record
*was created
*Sales document type,Delivery block,Sales organisation,
Distribution channel based on selection criteria
SELECT VBELN "Sales and distribution Doc no
ERDAT
"Date on which the record was created
AUART "Sales document type
LIFSK "Delivery block
VKORG "Sales organisation
VTWEG "Distribution channel
FROM VBAK
INTO TABLE T_VBAK
WHERE VBELN IN S_VBELN AND
ERDAT IN S_ERDAT AND
AUART IN S_AUART AND
VKORG IN S_VKORG AND
VTWEG IN S_VTWEG.
IF SY-SUBRC EQ 0.
SORT T_VBAK BY VBELN .
*Obtain Sales document ,Sales document item,Material Number,Material
*number used by customer
Safer point ,Plant (Own or External),Shipping point /Receiving point
Net price based on selection criteria
SELECT A~VBELN "Sales document
A~POSNR "Sales document item
MATNR "Material Number
PSTYV "Sales document item category
KDMAT "Material number used by customer
VRKME "Sales unit
WERKS "Plant (Own or External)
VSTEL "Shipping point /Receiving point
NETPR "Net price
*MOD02 {
NETWR
*}MOD02
WAERK "Target outline doc currency
FROM VBAP AS A JOIN VBUP AS B
ON ( AVBELN = BVBELN
AND APOSNR = BPOSNR )
INTO TABLE T_VBAP
FOR ALL ENTRIES IN T_VBAK
WHERE A~VBELN = T_VBAK-VBELN AND
A~MATNR IN S_MATNR AND
A~PSTYV NE C_TAPA AND
A~KDMAT IN S_KDMAT AND
A~WERKS IN S_WERKS AND
A~ABGRU EQ SPACE AND
B~LFSTA NE 'C'.
IF SY-SUBRC EQ 0.
SORT T_VBAP BY VBELN POSNR.
ENDIF.
SELECT VBELV
POSNV
FROM VBFA
INTO TABLE T_VBFA
FOR ALL ENTRIES IN T_VBAP
WHERE VBELV = T_VBAP-VBELN
AND POSNV = T_VBAP-POSNR
AND VBTYP_N = 'J'.
IF SY-SUBRC = 0.
SORT T_VBFA BY VBELV POSNV.
LOOP AT T_VBAP.
*READ TABLE T_VBFA WITH KEY VBELV = T_VBAP-VBELN POSNV = T_VBAP-POSNR.
IF SY-SUBRC = 0.
DELETE T_VBAP.
ENDIF.
ENDLOOP.
ENDIF.
{ 23-8-2007
SELECT LIFSP
VTEXT
FROM TVLST
INTO TABLE T_TVLST
FOR ALL ENTRIES IN T_VBAK
WHERE SPRAS EQ C_E AND
LIFSP = T_VBAK-LIFSK.
IF SY-SUBRC EQ 0.
SORT T_TVLST BY LIFSP.
ENDIF.
*Obtain Sales and distribution document number,Item number of the SD
*document ,Incoterms,Terms of payment key,Customer purchase order number
*based on selection criteria
SELECT VBELN "Sales and distribution document number
POSNR "Item number of the SD document
INCO1 "Incoterms
ZTERM "Terms of payment key
BSTKD "Customer purchase order number
FROM VBKD INTO TABLE T_VBKD
FOR ALL ENTRIES IN T_VBAK
WHERE VBELN = T_VBAK-VBELN.
IF SY-SUBRC EQ 0.
SORT T_VBKD BY VBELN .
ENDIF.
*Obtain Sales document,Sales Document Item,Schedule line,Schedule line
*data, Order quantity in sales unit,Confirmed quantity,Goods issue date,
*Schedule line blocked for delivery based on selection criteria
SELECT VBELN "Sales document
POSNR "Sales Document Item
ETENR "Schedule line
EDATU "Schedule line data
CMENG "Order quantity in sales unit
BMENG "Confirmed quantity
LMENG
WADAT "Goods issue date
LIFSP "Schedule line blocked for delivery
FROM VBEP INTO TABLE T_VBEP
FOR ALL ENTRIES IN T_VBAK
WHERE VBELN = T_VBAK-VBELN AND
ETENR = C_0001.
IF SY-SUBRC EQ 0.
SORT T_VBEP BY VBELN POSNR ETENR.
{ 23-8-2007
SELECT LIFSP
VTEXT
FROM TVLST
INTO TABLE T_TVLST1
FOR ALL ENTRIES IN T_VBEP
WHERE SPRAS EQ C_E AND
LIFSP = T_VBEP-LIFSP.
IF SY-SUBRC EQ 0.
SORT T_TVLST1 BY LIFSP.
ENDIF.
ENDIF.
SELECT VBELN "Sales document
POSNR "Sales Document Item
ETENR "Schedule line
EDATU "Schedule line data
CMENG "Order quantity in sales unit
BMENG "Confirmed quantity
LMENG
WADAT "Goods issue date
LIFSP
"Schedule line blocked for delivery
FROM VBEP INTO TABLE T_VBEP1
FOR ALL ENTRIES IN T_VBAK
WHERE VBELN = T_VBAK-VBELN .
IF SY-SUBRC EQ 0.
SORT T_VBEP1 BY VBELN POSNR .
ENDIF.
{ 23-8-2007
SELECT VBELN "Sales and Distribution Document Number
SPSTG "Overall blocked status
*MOD02 {
CMGST
*}MOD02
FROM VBUK
INTO TABLE T_VBUK
FOR ALL ENTRIES IN T_VBAK
WHERE VBELN = T_VBAK-VBELN
AND ( CMGST = 'A' OR CMGST = 'D' ).
IF SY-SUBRC EQ 0.
SORT T_VBUK BY VBELN .
ENDIF.
*Obtain Sales and distribution Doc no,Item number of the SD document
Overall delivery status of item
SELECT VBELN "Sales and distribution Doc no
POSNR "Item number of the SD document
LFGSA "Overall delivery status of item
FROM VBUP
INTO TABLE T_VBUP
FOR ALL ENTRIES IN T_VBAK
WHERE VBELN = T_VBAK-VBELN.
IF SY-SUBRC EQ 0.
SORT T_VBUP BY VBELN POSNR.
ENDIF.
*Obtain Sales and distribution document number,Partner function
Customer Number 1,address based on selection criteria
SELECT VBELN "Sales and distribution Doc no
PARVW " Patner function
KUNNR "Customer No1
ADRNR "address
FROM VBPA
INTO TABLE T_VBPA
FOR ALL ENTRIES IN T_VBAP
WHERE VBELN = T_VBAP-VBELN AND
( ( KUNNR IN S_KUNNR1 ) OR
( KUNNR IN S_KUNNR2 ) OR
( KUNNR IN S_KUNNR3 ) ) AND
( ( PARVW = C_ZR ) OR
( PARVW = C_BP ) OR
( PARVW = C_SH ) ).
IF SY-SUBRC EQ 0.
SORT T_VBPA BY VBELN PARVW.
IF NOT T_VBPA[] IS INITIAL.
*Obtain Address number ,name
SELECT ADDRNUMBER "Address number
DATE_FROM "Date valid from
NATION "International address version ID
NAME1 "name
FROM ADRC
INTO TABLE T_ADRC
FOR ALL ENTRIES IN T_VBPA
WHERE ADDRNUMBER = T_VBPA-ADRNR.
IF SY-SUBRC EQ 0.
SORT T_ADRC BY ADDRNUMBER.
ENDIF.
ENDIF.
ELSE.
MESSAGE I000 WITH TEXT-S02."No Data For the Entered CS rep number
STOP.
ENDIF.
ELSE.
MESSAGE I000 WITH TEXT-S01.
"No data found for the selection criteria
STOP.
ENDIF.
ENDFORM. " DATA_SELECTION
*& Form DATA_FILL_FOR_DISPLAY
Populate Internal table for display
FORM DATA_FILL_FOR_DISPLAY .
DATA: L_NETPR TYPE NETPR. "For net amount
DATA: L_DATE TYPE EDATU. "For Date Field
DATA: L_WMENG TYPE WMENG. "For Confirmed Quantity
DATA: L_BMENG TYPE BMENG. "For Delivered Quantity
DATA : L_LAST_DATE TYPE EDATU.
DATA : W_FG TYPE C.
DATA : L_TABIX TYPE SY-TABIX.
DATA: L_CNT TYPE I,
L_NETWR TYPE NETWR.
*If plant and csrep are selected.
IF ( ( P_PLANT = C_X ) AND ( P_CSREP = C_X ) ).
LOOP AT T_VBAP.
CLEAR W_FG.
CLEAR L_CNT.
*MOD02 {
READ TABLE T_VBUK WITH KEY VBELN = T_VBAP-VBELN.
IF SY-SUBRC = 0.
*}MOD02
LOOP AT T_VBEP1 WHERE VBELN = T_VBAP-VBELN AND POSNR =
T_VBAP-POSNR.
L_CNT = L_CNT + 1.
IF L_LAST_DATE IS NOT INITIAL AND W_FG NE 'X'.
IF L_LAST_DATE NE T_VBEP1-WADAT.
W_FG = 'X'.
ENDIF.
ENDIF.
L_LAST_DATE = T_VBEP1-WADAT.
ENDLOOP.
IF L_CNT = 1 AND T_VBEP1-BMENG = 0.
W_FG = 'X'.
ENDIF.
IF W_FG = 'X'.
READ TABLE T_VBEP WITH KEY VBELN = T_VBAP-VBELN
POSNR = T_VBAP-POSNR
BINARY SEARCH.
IF SY-SUBRC EQ 0.
*Move Order quantity in sales unit to final internal table
MOVE T_VBEP-WMENG TO T_DISP-WMENG.
MOVE T_VBEP-WADAT TO T_DISP-WADAT1.
*Move Goods issue date to final internal table
MOVE T_VBEP-EDATU TO T_DISP-WADAT.
{ 23-8-2007
READ TABLE T_TVLST1 WITH KEY LIFSP = T_VBEP-LIFSP
BINARY SEARCH.
IF SY-SUBRC EQ 0.
CONCATENATE T_VBEP-LIFSP
T_TVLST1-VTEXT
INTO T_DISP-LIFSP
SEPARATED BY SPACE.
ENDIF.
*Move the Schedule line blocked for delivery
to final internal table.
ENDIF.
*LOOP AT T_VBEP1 WHERE VBELN = T_VBAP-VBELN AND POSNR = T_VBAP-POSNR.
LOOP AT T_VBEP1 WHERE VBELN = T_VBAP-VBELN AND POSNR =
T_VBAP-POSNR.
L_WMENG = T_VBEP1-WMENG + L_WMENG.
L_BMENG = T_VBEP1-BMENG + L_BMENG.
IF NOT L_DATE IS INITIAL.
IF ( L_DATE < T_VBEP1-EDATU ).
L_DATE = T_VBEP1-EDATU.
ENDIF.
ELSE.
L_DATE = T_VBEP1-EDATU.
ENDIF.
AT END OF POSNR.
READ TABLE T_VBEP1 INDEX SY-TABIX.
IF SY-SUBRC = 0.
L_DATE = T_VBEP1-EDATU.
ENDIF.
ENDAT.
ENDLOOP.
IF T_VBEP1-WMENG EQ T_VBEP1-BMENG.
T_DISP-LOGIC_1 = 0.
T_DISP-EDATU = T_VBEP1-EDATU.
ELSEIF L_WMENG EQ L_BMENG .
T_DISP-EDATU = L_DATE.
T_DISP-LOGIC_1 = L_WMENG.
ELSE.
T_DISP-EDATU = C_BLANK.
T_DISP-LOGIC_1 = L_WMENG.
ENDIF.
*Move the Sales document item to final internal table.
MOVE T_VBAP-POSNR TO T_DISP-POSNR.
*Move the Material Number to final internal table.
MOVE T_VBAP-MATNR TO T_DISP-MATNR.
*Move the Material number used by customer to final internal table.
MOVE T_VBAP-KDMAT TO T_DISP-KDMAT.
*Move the Shipping point to final internal table.
MOVE T_VBAP-VSTEL TO T_DISP-VSTEL.
*Move the Sales unit to final internal table.
PERFORM UNIT1 USING T_VBAP-VRKME CHANGING T_VBAP-VRKME.
MOVE T_VBAP-VRKME TO T_DISP-VRKME.
MOVE T_VBAP-VRKME TO T_DISP-VRKME_1.
*Move the Plant (Own or External) to final internal table.
MOVE T_VBAP-WERKS TO T_DISP-WERKS.
MOVE T_VBAP-WAERK TO T_DISP-WAERK.
*Move the Net price to final internal table.
IF T_VBAP-WAERK = C_US .
L_NETPR = T_VBAP-NETPR.
L_NETPR = L_NETPR / 100.
T_DISP-NETPR = L_NETPR.
CLEAR L_NETPR.
ELSE.
MOVE T_VBAP-NETPR TO T_DISP-NETPR.
ENDIF.
CLEAR L_NETPR.
*MOD02{
IF T_VBAP-WAERK = C_US .
L_NETWR = T_VBAP-NETWR.
L_NETWR = L_NETWR / 100.
T_DISP-NETWR = L_NETWR.
CLEAR L_NETWR.
ELSE.
MOVE T_VBAP-NETWR TO T_DISP-NETWR.
ENDIF.
CLEAR L_NETWR.
*}MOD02
*READ THE TABLE VBAK TO FETCH Sales Order Number,sales
*organisation,distribution channel,Document type,Delivery block
READ TABLE T_VBAK WITH KEY VBELN = T_VBEP-VBELN BINARY SEARCH.
IF SY-SUBRC EQ 0.
*Move the Sales order number to final internal table.
MOVE T_VBAK-VBELN TO T_DISP-VBELN.
PERFORM DELETE_LEADING_ZEROES CHANGING T_DISP-VBELN.
*Move the Sales organisation to final internal table.
MOVE T_VBAK-VKORG TO T_DISP-VKORG.
*Move the Distribution channel to final internal table.
MOVE T_VBAK-VTWEG TO T_DISP-VTWEG.
*Move the Document type to final internal table.
MOVE T_VBAK-AUART TO T_DISP-AUART.
{23-8-2007
READ TABLE T_TVLST WITH KEY LIFSP = T_VBAK-LIFSK
BINARY SEARCH.
IF SY-SUBRC EQ 0.
CONCATENATE T_VBAK-LIFSK
T_TVLST-VTEXT
INTO T_DISP-LIFSK
SEPARATED BY SPACE.
ENDIF.
ENDIF.
*READ THE TABLE VBKD TO FETCH Incoterms,Terms of payment key,Customer
*purchase order number
READ TABLE T_VBKD WITH KEY VBELN = T_VBAP-VBELN
BINARY SEARCH.
IF SY-SUBRC EQ 0.
*Move the Customer purchase order number to final internal table.
MOVE T_VBKD-BSTKD TO T_DISP-BSTKD.
*Move the Incoterms to final internal table.
MOVE T_VBKD-INCO1 TO T_DISP-INCO1.
*Move the Terms of payment to final internal table.
MOVE T_VBKD-ZTERM TO T_DISP-ZTERM.
ENDIF.
{ 23-8-2007
READ TABLE T_VBUK WITH KEY VBELN = T_VBEP-VBELN
BINARY SEARCH.
IF SY-SUBRC EQ 0.
IF T_VBUK-SPSTG EQ SPACE.
T_DISP-SPSTG = TEXT-TE1. "Not Blocked
ELSEIF T_VBUK-SPSTG EQ C_C.
T_DISP-SP -
Page breaks appear in the spool output of report when run in the background
Hi All,
Report is using fm 'REUSE_ALV_GRID_DISPLAY' to display the report. parameters passed to this fm for display are :it_fieldcat,is_layout,it_events,t_outtab.
Page breaks appear in the spool output when report is run in the background.These page breaks needs to be removed. When executed in the background, the excel extract should be the same as if pulling directly from the report itself.
How to remove the page breaks in background?
Thanks & Regards,
Abhishek SinghHi
You can use the below code , which the reprt run in background. If you run the report in background thenyou need to use 'REUSE_ALV_LIST_DISPLAY'
if sy-batch = ' '.
call 'REUSE_ALV_GRID_DISPLAY'.
else.
call 'REUSE_ALV_LIST_DISPLAY'.
endif.
if you are using OO alv then write this code..
CALL METHOD cl_gui_alv_grid=>offline
RECEIVING e_offline = off.
IF off IS INITIAL.
CREATE OBJECT g_custom_container
EXPORTING container_name = g_container.
ENDIF.
Regards -
Run the SOST transaction in the Background with, or without, a BDC
Hello all,
I was trying to write a Z-Program that would create a BDC that executed Transaction SOST to resend fax messages. It turned out that I could not record the ALV Grid that contains most of the selection/filter criteria functions because those functions exist in the ALV Grid. Some fields exist above the ALV Grid and could be recorded. I record them and used them in my BDC to filter for the faxes I wished sent. I also used a saved layout for the filtering I would have applied if I cold have recorded the ALV Grid.
All seemed well in testing until I attempted to run my Z-Program in the Background. The Z-Program creates the BDC which in tern executes the resending of faxes. I did not realize that the SOST transaction had a completely different screen layout in the Background. That was something pointed out to me when I was instructed to Record the BDC in "Simulate Background Mode". It doesn't seem like I can enter selection criteria in the Background version of the screen at all.
Has anyone been able to run the SOST transaction in the Background with, or without, a BDC? If not has anyone ever automated the SOST functionality in a Z-Program? Can SOST run in the background at all?
ThanksHi,
try to resend it using program RSCONN01.
Regards,
Adrian -
Please tell me the way to the run the interactive OO alv in the backgrou
please tell me the way to the run the interactive OO alv in the background.
hi there...
regarding your query, i tried to do this but ended in a short dump. You can check the folowing link which i checked once i got this error.
http://www.sapfans.com/forums/viewtopic.php?t=19224
i think this will be of some help to you.
Do reward if helpful or get back if need further assistance/
Maybe you are looking for
-
Crystal Reports xi r2 integrating with vs2005
Hi, I'm having a problem getting these two integrated and working properly with all the functionality that I need. I installed vs2005 and then CRXIR2, and now in vs2005 when I have a report open, I have 2 Crystal Report tabs at the top and in each th
-
For the past week I have been getting emails as per below: You are currently using 14.5 GB of your total 15 GB of iCloud storage, which means that your iCloud storage is almost full. When your storage is full, device backups to iCloud will stop and a
-
Since last few months i am trying to update my ipad from iOS 3.2.2 to 4.1.2 or 5.1, but it always shows error 3002, 3194 etc. I have checked & resorted to all the given troubleshooting steps , but they didn't help. Somebody please help me
-
Hi All, I am not able to set up external numbering for documents to be raised in business one. Request help in doing this. Thanks, Srikanth
-
Finder opens a new window with tabs in the last closed window loaded automatically
As the title says, I've found this happens more than a few times for some change. Maybe every time, I didn't count. Say, I closed a window with 3 tabs opened, then next time when I click finder to open a new window, I will find the 3 tabs loaded in t