Alv out put error
Hi,
iam getting out put by alv
but when i caluclate totlal on quntity field iam getting runtime error like this
plz tell the solution for correct it.
error is:
What happened?
The current application program detected a situation which really
should not occur. Therefore, a termination with a short dump was
triggered on purpose by the key word MESSAGE (type X).
Short text of error message:
Long text of error message:
Technical information about the messag
Message class....... "0K"
Number.............. 000
Variable 1.......... " "
Variable 2.......... " "
Variable 3.......... " "
Variable 4.......... " "
Hi sivaram,
after you got a solution to your question you should close the thread and let us know what the solution was.
Regards,
Clemens
Similar Messages
-
How to get default lay out set in my ALV out put.
I need to have default layout in my ALV output.
My functional consultant idea was to make sure they have an ALV variant selected.
When he first run the program, how will need to get a "/DEFAULT" variant created.
How can I do that ?
Initialization - For ALV variant
INITIALIZATION.
ws_repid = sy-repid.
g_save = 'A'.
CLEAR g_variant.
g_variant-report = ws_repid.
Get default variant.
gx_variant = g_variant.
gx_variant = g_variant.
CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
EXPORTING
i_save = g_save
CHANGING
cs_variant = gx_variant
EXCEPTIONS
not_found = 2.
IF sy-subrc = 0.
p_vari = gx_variant-variant.
ENDIF.
&--F4 HELP - FOR ALV VARIANT GET--
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
is_variant = g_variant
i_save = g_save
IMPORTING
e_exit = g_exit
es_variant = gx_variant
EXCEPTIONS
not_found = 2.
IF sy-subrc = 2.
MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
IF g_exit = space.
p_vari = gx_variant-variant.
ENDIF.
ENDIF.
&--AT SELECTION-SCREEN.- For ALV Variant--
AT SELECTION-SCREEN.
*Getting variant Existence
PERFORM get_exist_variant.
*& Form GET_EXIST_VARIANT *
text *
FORM get_exist_variant .
IF NOT p_vari IS INITIAL.
MOVE g_variant TO gx_variant.
MOVE p_vari TO gx_variant-variant.
CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
EXPORTING
i_save = g_save
CHANGING
cs_variant = gx_variant.
g_variant = gx_variant.
ELSE.
CLEAR g_variant.
g_variant-report = ws_repid.
ENDIF.
ENDFORM. " GET_EXIST_VARIANT
*& Form alv_display *
This subroutine is to display the out put in ALV. *
FORM alv_display .
Local data
DATA: y_x LIKE boole VALUE 'X'.
DATA: lh_index LIKE lf_fieldcat-col_pos.
For variant
DATA: ws_repid LIKE sy-repid,
g_save TYPE c VALUE 'A',
g_exit TYPE c,
g_variant LIKE disvariant,
gx_variant LIKE disvariant.
For 1st field.( RPT_LOC )
CLEAR lf_fieldcat.
lf_fieldcat-fieldname = 'RPT_LOC'.
lf_fieldcat-tabname = 'GT_ZGXMIT_L'.
lf_fieldcat-ref_tabname = 'ZGXMIT'.
lf_fieldcat-ref_fieldname = 'RPT_LOC'.
lh_index = lh_index + 1.
lf_fieldcat-col_pos = lh_index.
lf_fieldcat-key = y_x.
lf_fieldcat-no_sum = y_x.
APPEND lf_fieldcat TO lt_fieldcat.
For 2nd field.( BAL_XMIT )
CLEAR lf_fieldcat.
lf_fieldcat-fieldname = 'BAL_XMIT'.
lf_fieldcat-tabname = 'GT_ZGXMIT_L'.
lf_fieldcat-ref_tabname = 'ZGXMIT'.
lf_fieldcat-ref_fieldname = 'BAL_XMIT'.
lh_index = lh_index + 1.
lf_fieldcat-col_pos = lh_index.
lf_fieldcat-key = y_x.
lf_fieldcat-no_sum = y_x.
APPEND lf_fieldcat TO lt_fieldcat.
4,5,....fields appening
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = ws_repid
I_CALLBACK_PF_STATUS_SET = ' '
i_callback_user_command = 'USER_COMMAND'
I_CALLBACK_TOP_OF_PAGE = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT = v_alv_layout
it_fieldcat = lt_fieldcat
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
i_save = 'A'
IS_VARIANT =
it_events = events[]
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
TABLES
t_outtab = gt_zgxmit_l
EXCEPTIONS
program_error = 1
OTHERS = 2.
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. " alv_displayHello SAm,
U have to set like DATA: IT_VARIANT LIKE DISVARIANT,
G_S_SORT LIKE LINE OF IT_SORT.
DATA : G_R_DISP_VARIANT TYPE DISVARIANT.
SORT G_T_OUTTAB BY PSPID POSID.
CLEAR: G_R_DISP_VARIANT.
For storing the variant layout
IT_VARIANT-REPORT = SY-REPID.
IF NOT P_VARIAN IS INITIAL.
G_R_DISP_VARIANT-VARIANT = P_VARIAN.
ELSE.
IT_VARIANT-VARIANT = '/Z48M'.
ENDIF.
CLEAR G_T_OUTTAB.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = IT_VARIANT-REPORT
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IT_FIELDCAT = IT_FIELDCAT
I_SAVE = 'A'
IS_VARIANT = IT_VARIANT
IS_LAYOUT = IT_LAYOUT
IT_SORT = IT_SORT[]
TABLES
T_OUTTAB = G_T_OUTTAB
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
If u want F4 help in the selection screen then do like this.
SELECTION-SCREEN BEGIN OF BLOCK VARIANT WITH FRAME TITLE TEXT-013.
PARAMETERS: P_VARIAN LIKE DISVARIANT-VARIANT DEFAULT '/STANDARD'.
SELECTION-SCREEN END OF BLOCK VARIANT.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_VARIAN.
PERFORM SHOW_EXISTING_DISPLAY_VARIANTS.
FORM SHOW_EXISTING_DISPLAY_VARIANTS.
DATA: G_R_DISP_VARIANT TYPE DISVARIANT.
G_R_DISP_VARIANT-REPORT = SY-REPID.
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
IS_VARIANT = G_R_DISP_VARIANT
I_SAVE = 'A'
IMPORTING
ES_VARIANT = G_R_DISP_VARIANT
EXCEPTIONS
NOT_FOUND = 1
PROGRAM_ERROR = 2
OTHERS = 3.
IF SY-SUBRC = 0.
P_VARIAN = G_R_DISP_VARIANT-VARIANT.
ENDIF.
ENDFORM. " SHOW_EXISTING_DISPLAY_VARIANTS
If useful reward.
Vasanth -
Alv out put was truncated while giving print
hi,
I have developed one alv report.
while giving out put for print last columns are truncating.
How to handle this?
Thanks in advance,Hi,
There can be many reasons. What is the width of your output list? Many printers takes 255 characters width. Check the printer settings in T-code SPAD to see howmuch width you can print.
Other option could be, print in landscape format.
Thanks,
Vinod. -
Creation of pf-status functionality in ALV out put
Hi experts,
i created pf-status and made one button to save the ccontents displayed in ALV grid out put.
But i could not find that button in out put. Is it possible to create custom functionality in ALV output.
thank you
regards
vijayHi Viajay,
find the below steps to create the PF-STATUS..
PF-Status
1. How to set pf-status
2. How to set pf-status excluding/including single menu items
3. How to set pf-status excluding/including several menu items
4. Setting PF status to the (SAP) system default
5. How to check for pf-status
6. Use of SY-PFKEY
1. How to set pf-status
set pf-status 'ZZBILSTA'.
2. How to set pf-status excluding/including single menu items
You can exclude menus by using exclude :
set pf-status 'ZZBILSTA' excluding 'PST'.
Note: Can also be used with include instead of exclude
3. How to set pf-status excluding/including several menu items
You have to use an internal table to store the status you wan't to ex- or include:
DATA: BEGIN OF I_PF_STATUS_TAB OCCURS 10,
FCODE(4),
END OF I_PF_STATUS_TAB.
FORM SET_PF_STATUS_POSTER.
REFRESH I_PF_STATUS_TAB.
MOVE 'PST' TO I_PF_STATUS_TAB.
APPEND I_PF_STATUS_TAB.
MOVE 'ART' TO I_PF_STATUS_TAB.
APPEND I_PF_STATUS_TAB.
SET PF-STATUS 'ZZBILSTA' EXCLUDING I_PF_STATUS_TAB.
ENDFORM.
4. Setting PF status to the (SAP) system default
set pf-status 'BASIC'.
5. How to check for pf-status
AT USER-COMMAND.
CASE SY-UCOMM.
WHEN 'ART'.
PERFORM STYR_ARTSKONTI.
WHEN 'PST'.
PERFORM STYR_POSTER.
WHEN 'BIL'.
PERFORM VIS_BILAG.
ENDCASE.
6. Use of SY-PFKEY
You can use the system variable sy-pfkey to retrieve the name of the current pf status
Regards,
Prabhudas -
PO E-Mail Out Put Error ( E-mail address incorrect or non-existent )
Hi Gurus,
I'M getting the error " E-mail address incorrect or non-existent" when i process the out put type for email of PO.
I maintained all the settings which are mentioned below ,
Goto NACE .
u2022 Select EF and click on OUTPUT TYPES.
u2022 Then select Output Type NEU and click on processing routines .
u2022 In that you have to add a new entry - medium 5 .
u2022 Then you need to assign a program, form routine and form.
u2022 You can use the standard program i.e. SAPFM06P, FORM routine is always ENTRY_NEU and standard MEDRUCK.
u2022 Then in PARTNER FUNCTION you need to add a new entry : medium - 5 and function - VN .
u2022 For subject of the mail goto Mail Title and Texts. In title give PO No. &EKKO-EBELN& .
u2022 Under General data -> Replacement of text symbols give programm as SAPMM06E and Form Routine as TEXT_SYMBOL_REPLACE .
u2022 You need to maintain your email id in tcode SU01 and also the vendor's email id.
u2022 Now while creating a new purchase order , change the medium to External Send .
u2022 Then goto Communication Method and select CS01 . ALSO make sure that the Cover Page Text has value PO No. &EKKO-EBELN& .
u2022 Goto tcode ME9F .
u2022 Execute.
Still I'm getting the same error " E-mail address incorrect or non-existent". could any body help me in this issue?
Regards,
Sri.........Hi Deepak
I have gone through the notes which u have mentioned, but it is not helping to my query,
I had maintained SMTP port in the tcode SCOT.Then I'm getting the message "MAIl request 000000000002 created" when I run tcode ME9F for email out put.But I'm not getting the out put in the email address which I specified in the vendor master record. I can see one error in the transaction code SCOT. should i run transaction SCOT manually every time ?
Regards,
Sri........... -
GR out put error :No messages for initial processing exist
Hi All
When Im process the out put for GR using T-Code MB90, the following message appears and I'm able to see the out put "No messages for initial processing exist".I have checked the three processing modes even it is giving the same mesaage.Can any body help to how to see the GR out put.
thanks and regards,
Sri.........Hi ,
I think the necessary condition records might not exist.
You can maintain the same using MN21.
Also check whether the necessary customising is done using Transaction NACE and by selecting application ME.
Regards
Ramesh Ch -
HI
WHEN I AM EXECUTING THE FOLLOWING PROG I AM GETTING AN ERROR "MAXIMUM NUMBER OF INTERNAL SESSIONS REACHED".
DOES ANY ONE HAS ANY IDEA ABT IT.
REPORT ZSPOOL14.
TABLES:TSP01.
PARAMETERS: P_EMAIL1 LIKE SOMLRECI1-RECEIVER,
P_EMAIL2 LIKE SOMLRECI1-RECEIVER,
P_EMAIL3 LIKE SOMLRECI1-RECEIVER,
P_SENDER LIKE SOMLRECI1-RECEIVER,
P_DELSPL AS CHECKBOX.
*DATA DECLARATION
DATA: GD_RECSIZE TYPE I.
Spool IDs
TYPES: BEGIN OF T_TBTCP.
INCLUDE STRUCTURE TBTCP.
TYPES: END OF T_TBTCP.
DATA: IT_TBTCP TYPE STANDARD TABLE OF T_TBTCP INITIAL SIZE 0,
WA_TBTCP TYPE T_TBTCP.
Job Runtime Parameters
DATA: GD_EVENTID LIKE TBTCM-EVENTID,
GD_EVENTPARM LIKE TBTCM-EVENTPARM,
GD_EXTERNAL_PROGRAM_ACTIVE LIKE TBTCM-XPGACTIVE,
GD_JOBCOUNT LIKE TBTCM-JOBCOUNT,
GD_JOBNAME LIKE TBTCM-JOBNAME,
GD_STEPCOUNT LIKE TBTCM-STEPCOUNT,
GD_ERROR TYPE SY-SUBRC,
GD_RECIEVER TYPE SY-SUBRC.
DATA: W_RECSIZE TYPE I.
DATA: GD_SUBJECT LIKE SODOCCHGI1-OBJ_DESCR,
IT_MESS_BOD LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
IT_MESS_ATT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
GD_SENDER_TYPE LIKE SOEXTRECI1-ADR_TYP,
GD_ATTACHMENT_DESC TYPE SO_OBJ_NAM,
GD_ATTACHMENT_NAME TYPE SO_OBJ_DES.
Spool to PDF conversions
DATA: GD_SPOOL_NR LIKE TSP01-RQIDENT,
GD_DESTINATION LIKE RLGRAP-FILENAME,
GD_BYTECOUNT LIKE TST01-DSIZE,
GD_BUFFER TYPE STRING.
Binary store for PDF
DATA: BEGIN OF IT_PDF_OUTPUT OCCURS 0.
INCLUDE STRUCTURE TLINE.
DATA: END OF IT_PDF_OUTPUT.
CONSTANTS:C_DEV LIKE SY-SYSID VALUE 'DEV',
C_NO(1) TYPE C VALUE ' ',
C_DEVICE(4) TYPE C VALUE 'LOCL'.
print parameters
DATA:PARAMS LIKE PRI_PARAMS,
DAYS(1) TYPE N VALUE 2,
COUNT(3) TYPE N VALUE 1,
VALID TYPE C,
SPOOL_REQUEST_NAME LIKE PRI_PARAMS-PLIST.
*INITIALIZATION.
P_EMAIL1 = '[email protected]'.
*START-OF-SELECTION.
START-OF-SELECTION.
Write statement to represent report output. Spool request is created
if write statement is executed in background. This could also be an
ALV grid which would be converted to PDF without any extra effort
WRITE 'HAI EVERYONE'.
NEW-PAGE.
COMMIT WORK.
NEW-PAGE PRINT OFF.
CONCATENATE SY-REPID+0(8)
SY-UNAME+0(3)
INTO SPOOL_REQUEST_NAME SEPARATED BY '_'.
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
ARCHIVE_MODE = '1'
ARCHIVE_TEXT = C_CHAR_UNKNOWN
AR_OBJECT = C_CHAR_UNKNOWN
ARCHIVE_REPORT = C_CHAR_UNKNOWN
AUTHORITY = C_CHAR_UNKNOWN
COPIES = COUNT
COVER_PAGE = ''
DATA_SET = C_CHAR_UNKNOWN
DEPARTMENT = C_CHAR_UNKNOWN
DESTINATION = 'HR04'
EXPIRATION = DAYS
IMMEDIATELY = ''
IN_ARCHIVE_PARAMETERS = ' '
IN_PARAMETERS = ' '
LAYOUT = 'X_65_32'
LINE_COUNT = 65
LINE_SIZE = 132
LIST_NAME = SPOOL_REQUEST_NAME
LIST_TEXT = C_CHAR_UNKNOWN
MODE = 'BATCH'
NEW_LIST_ID = 'X'
PROTECT_LIST = C_CHAR_UNKNOWN
NO_DIALOG = 'X'
RECEIVER = ''
RELEASE = ''
REPORT = ''
SAP_COVER_PAGE = 'D'
HOST_COVER_PAGE = 'D'
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 = PARAMS
VALID = VALID
VALID_FOR_SPOOL_CREATION =
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.
IF VALID <> SPACE.
SUBMIT ZSPOOL14 TO SAP-SPOOL
SPOOL PARAMETERS PARAMS
WITHOUT SPOOL DYNPRO AND RETURN.
ENDIF.
IF SY-BATCH EQ 'X'.
PERFORM GET_JOB_DETAILS.
PERFORM OBTAIN_SPOOL_ID.
Alternative way could be to submit another program and store spool
id into memory.
*submit ZSPOOLTOPDF2
to sap-spool
spool parameters %_print
archive parameters %_print
without spool dynpro
and return.
Get spool id from program called above
IMPORT w_spool_nr FROM MEMORY ID 'SPOOLTOPDF'.
PERFORM CONVERT_SPOOL_TO_PDF.
PERFORM PROCESS_EMAIL.
IF P_DELSPL EQ 'X'.
PERFORM DELETE_SPOOL.
ENDIF.
IF SY-SYSID = C_DEV.
WAIT UP TO 5 SECONDS.
SUBMIT RSCONN01 WITH MODE = 'INT'
WITH OUTPUT = 'X'
AND RETURN.
ENDIF.
ELSE.
PERFORM FCONVERT_SPOOL_TO_PDF.
PERFORM PROCESS_EMAIL.
IF P_DELSPL EQ 'X'.
PERFORM DELETE_SPOOL.
ENDIF.
IF SY-SYSID = C_DEV.
WAIT UP TO 5 SECONDS.
SUBMIT RSCONN01 WITH MODE = 'INT'
WITH OUTPUT = 'X'
AND RETURN.
ENDIF.
SKIP.
WRITE:/ 'Program must be executed in background in-order for spool'
'request to be created.'.
ENDIF.
FORM obtain_spool_id *
FORM OBTAIN_SPOOL_ID.
CHECK NOT ( GD_JOBNAME IS INITIAL ).
CHECK NOT ( GD_JOBCOUNT IS INITIAL ).
SELECT * FROM TBTCP
INTO TABLE IT_TBTCP
WHERE JOBNAME = GD_JOBNAME
AND JOBCOUNT = GD_JOBCOUNT
AND STEPCOUNT = GD_STEPCOUNT
AND LISTIDENT <> '0000000000'
ORDER BY JOBNAME
JOBCOUNT
STEPCOUNT.
READ TABLE IT_TBTCP INTO WA_TBTCP INDEX 1.
IF SY-SUBRC = 0.
MESSAGE S004(ZDD) WITH GD_SPOOL_NR.
GD_SPOOL_NR = WA_TBTCP-LISTIDENT.
MESSAGE S004(ZDD) WITH GD_SPOOL_NR.
ELSE.
MESSAGE S005(ZDD).
ENDIF.
ENDFORM. "obtain_spool_id
FORM get_job_details *
FORM GET_JOB_DETAILS.
Get current job details
CALL FUNCTION 'GET_JOB_RUNTIME_INFO'
IMPORTING
EVENTID = GD_EVENTID
EVENTPARM = GD_EVENTPARM
EXTERNAL_PROGRAM_ACTIVE = GD_EXTERNAL_PROGRAM_ACTIVE
JOBCOUNT = GD_JOBCOUNT
JOBNAME = GD_JOBNAME
STEPCOUNT = GD_STEPCOUNT
EXCEPTIONS
NO_RUNTIME_INFO = 1
OTHERS = 2.
ENDFORM. "get_job_details
FORM convert_spool_to_pdf *
FORM CONVERT_SPOOL_TO_PDF.
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
SRC_SPOOLID = GD_SPOOL_NR
NO_DIALOG = C_NO
DST_DEVICE = C_DEVICE
IMPORTING
PDF_BYTECOUNT = GD_BYTECOUNT
TABLES
PDF = IT_PDF_OUTPUT
EXCEPTIONS
ERR_NO_ABAP_SPOOLJOB = 1
ERR_NO_SPOOLJOB = 2
ERR_NO_PERMISSION = 3
ERR_CONV_NOT_POSSIBLE = 4
ERR_BAD_DESTDEVICE = 5
USER_CANCELLED = 6
ERR_SPOOLERROR = 7
ERR_TEMSEERROR = 8
ERR_BTCJOB_OPEN_FAILED = 9
ERR_BTCJOB_SUBMIT_FAILED = 10
ERR_BTCJOB_CLOSE_FAILED = 11
OTHERS = 12.
CHECK SY-SUBRC = 0.
Transfer the 132-long strings to 255-long strings
LOOP AT IT_PDF_OUTPUT.
TRANSLATE IT_PDF_OUTPUT USING ' ~'.
CONCATENATE GD_BUFFER IT_PDF_OUTPUT INTO GD_BUFFER.
ENDLOOP.
TRANSLATE GD_BUFFER USING '~ '.
DO.
IT_MESS_ATT = GD_BUFFER.
APPEND IT_MESS_ATT.
SHIFT GD_BUFFER LEFT BY 255 PLACES.
IF GD_BUFFER IS INITIAL.
EXIT.
ENDIF.
ENDDO.
ENDFORM. "convert_spool_to_pdf
FORM process_email *
FORM PROCESS_EMAIL.
DESCRIBE TABLE IT_MESS_ATT LINES GD_RECSIZE.
CHECK GD_RECSIZE > 0.
PERFORM SEND_EMAIL USING P_EMAIL1 P_EMAIL2 P_EMAIL3.
perform send_email using p_email2.
ENDFORM. "process_email
FORM send_email *
--> p_email *
FORM SEND_EMAIL USING P_EMAIL P_EMAIL4 P_EMAIL5.
CHECK NOT ( P_EMAIL IS INITIAL ).
CHECK NOT ( P_EMAIL4 IS INITIAL ).
CHECK NOT ( P_EMAIL5 IS INITIAL ).
REFRESH IT_MESS_BOD.
Default subject matter
GD_SUBJECT = 'Subject'.
GD_ATTACHMENT_DESC = 'Attachname'.
CONCATENATE 'ebdit' ' ' INTO GD_ATTACHMENT_NAME.
IT_MESS_BOD = 'Message Body text, line 1'.
APPEND IT_MESS_BOD.
IT_MESS_BOD = 'Message Body text, line 2...'.
APPEND IT_MESS_BOD.
If no sender specified - default blank
IF P_SENDER EQ SPACE.
GD_SENDER_TYPE = SPACE.
ELSE.
GD_SENDER_TYPE = 'INT'.
ENDIF.
Send file by email as .xls speadsheet
PERFORM SEND_FILE_AS_EMAIL_ATTACHMENT
TABLES IT_MESS_BOD
IT_MESS_ATT
USING P_EMAIL
P_EMAIL4
P_EMAIL5
'ebdit output'
'PDF'
GD_ATTACHMENT_NAME
GD_ATTACHMENT_DESC
P_SENDER
GD_SENDER_TYPE
CHANGING GD_ERROR
GD_RECIEVER.
ENDFORM. "send_email
FORM delete_spool *
FORM DELETE_SPOOL.
DATA: LD_SPOOL_NR TYPE TSP01_SP0R-RQID_CHAR.
LD_SPOOL_NR = GD_SPOOL_NR.
CHECK P_DELSPL <> C_NO.
CALL FUNCTION 'RSPO_R_RDELETE_SPOOLREQ'
EXPORTING
SPOOLID = LD_SPOOL_NR.
ENDFORM. "delete_spool
*& Form SEND_FILE_AS_EMAIL_ATTACHMENT
Send email
FORM SEND_FILE_AS_EMAIL_ATTACHMENT TABLES IT_MESSAGE
IT_ATTACH
USING P_EMAIL
P_EMAIL4
P_EMAIL5
P_MTITLE
P_FORMAT
P_FILENAME
P_ATTDESCRIPTION
P_SENDER_ADDRESS
P_SENDER_ADDRES_TYPE
CHANGING P_ERROR
P_RECIEVER.
DATA: LD_ERROR TYPE SY-SUBRC,
LD_RECIEVER TYPE SY-SUBRC,
LD_MTITLE LIKE SODOCCHGI1-OBJ_DESCR,
LD_EMAIL1 LIKE SOMLRECI1-RECEIVER,
LD_EMAIL2 LIKE SOMLRECI1-RECEIVER,
LD_EMAIL3 LIKE SOMLRECI1-RECEIVER,
LD_FORMAT TYPE SO_OBJ_TP ,
LD_ATTDESCRIPTION TYPE SO_OBJ_NAM ,
LD_ATTFILENAME TYPE SO_OBJ_DES ,
LD_SENDER_ADDRESS LIKE SOEXTRECI1-RECEIVER,
LD_SENDER_ADDRESS_TYPE LIKE SOEXTRECI1-ADR_TYP,
LD_RECEIVER LIKE SY-SUBRC.
DATA: T_PACKING_LIST LIKE SOPCKLSTI1 OCCURS 0 WITH HEADER LINE,
T_CONTENTS LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
T_RECEIVERS LIKE SOMLRECI1 OCCURS 0 WITH HEADER LINE,
T_ATTACHMENT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
T_OBJECT_HEADER LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
W_CNT TYPE I,
W_SENT_ALL(1) TYPE C,
W_DOC_DATA LIKE SODOCCHGI1.
LD_EMAIL1 = P_EMAIL.
LD_EMAIL2 = P_EMAIL4.
LD_EMAIL3 = P_EMAIL5.
LD_MTITLE = P_MTITLE.
LD_FORMAT = P_FORMAT.
LD_ATTDESCRIPTION = P_ATTDESCRIPTION.
LD_ATTFILENAME = P_FILENAME.
LD_SENDER_ADDRESS = P_SENDER_ADDRESS.
LD_SENDER_ADDRESS_TYPE = P_SENDER_ADDRES_TYPE.
Fill the document data.
W_DOC_DATA-DOC_SIZE = 1.
Populate the subject/generic message attributes
W_DOC_DATA-OBJ_LANGU = SY-LANGU.
W_DOC_DATA-OBJ_NAME = 'SAPRPT'.
W_DOC_DATA-OBJ_DESCR = LD_MTITLE .
W_DOC_DATA-SENSITIVTY = 'F'.
Fill the document data and get size of attachment
CLEAR W_DOC_DATA.
READ TABLE IT_ATTACH INDEX W_CNT.
W_DOC_DATA-DOC_SIZE =
( W_CNT - 1 ) * 255 + STRLEN( IT_ATTACH ).
W_DOC_DATA-OBJ_LANGU = SY-LANGU.
W_DOC_DATA-OBJ_NAME = 'SAPRPT'.
W_DOC_DATA-OBJ_DESCR = LD_MTITLE.
W_DOC_DATA-SENSITIVTY = 'F'.
CLEAR T_ATTACHMENT.
REFRESH T_ATTACHMENT.
T_ATTACHMENT[] = IT_ATTACH[].
Describe the body of the message.
CLEAR T_PACKING_LIST.
REFRESH T_PACKING_LIST.
T_PACKING_LIST-TRANSF_BIN = SPACE.
T_PACKING_LIST-HEAD_START = 1.
T_PACKING_LIST-HEAD_NUM = 0.
T_PACKING_LIST-BODY_START = 1.
DESCRIBE TABLE IT_MESSAGE LINES T_PACKING_LIST-BODY_NUM.
T_PACKING_LIST-DOC_TYPE = 'RAW'.
APPEND T_PACKING_LIST.
Create attachment notification
T_PACKING_LIST-TRANSF_BIN = 'X'.
T_PACKING_LIST-HEAD_START = 1.
T_PACKING_LIST-HEAD_NUM = 1.
T_PACKING_LIST-BODY_START = 1.
DESCRIBE TABLE T_ATTACHMENT LINES T_PACKING_LIST-BODY_NUM.
T_PACKING_LIST-DOC_TYPE = LD_FORMAT.
T_PACKING_LIST-OBJ_DESCR = LD_ATTDESCRIPTION.
T_PACKING_LIST-OBJ_NAME = LD_ATTFILENAME.
T_PACKING_LIST-DOC_SIZE = T_PACKING_LIST-BODY_NUM * 255.
APPEND T_PACKING_LIST.
Add the recipients email address
CLEAR T_RECEIVERS.
REFRESH T_RECEIVERS.
T_RECEIVERS-RECEIVER = LD_EMAIL1.
T_RECEIVERS-REC_TYPE = 'U'.
T_RECEIVERS-COM_TYPE = 'INT'.
T_RECEIVERS-NOTIF_DEL = 'X'.
T_RECEIVERS-NOTIF_NDEL = 'X'.
APPEND T_RECEIVERS.
CLEAR T_RECEIVERS.
REFRESH T_RECEIVERS.
T_RECEIVERS-RECEIVER = LD_EMAIL2.
T_RECEIVERS-REC_TYPE = 'U'.
T_RECEIVERS-COM_TYPE = 'INT'.
T_RECEIVERS-NOTIF_DEL = 'X'.
T_RECEIVERS-NOTIF_NDEL = 'X'.
APPEND T_RECEIVERS.
CLEAR T_RECEIVERS.
REFRESH T_RECEIVERS.
T_RECEIVERS-RECEIVER = LD_EMAIL3.
T_RECEIVERS-REC_TYPE = 'U'.
T_RECEIVERS-COM_TYPE = 'INT'.
T_RECEIVERS-NOTIF_DEL = 'X'.
T_RECEIVERS-NOTIF_NDEL = 'X'.
APPEND T_RECEIVERS.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
DOCUMENT_DATA = W_DOC_DATA
PUT_IN_OUTBOX = 'X'
SENDER_ADDRESS = LD_SENDER_ADDRESS
SENDER_ADDRESS_TYPE = LD_SENDER_ADDRESS_TYPE
COMMIT_WORK = 'X'
IMPORTING
SENT_TO_ALL = W_SENT_ALL
TABLES
PACKING_LIST = T_PACKING_LIST
CONTENTS_BIN = T_ATTACHMENT
CONTENTS_TXT = IT_MESSAGE
RECEIVERS = T_RECEIVERS
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
DOCUMENT_TYPE_NOT_EXIST = 3
OPERATION_NO_AUTHORIZATION = 4
PARAMETER_ERROR = 5
X_ERROR = 6
ENQUEUE_ERROR = 7
OTHERS = 8.
Populate zerror return code
LD_ERROR = SY-SUBRC.
Populate zreceiver return code
LOOP AT T_RECEIVERS.
LD_RECEIVER = T_RECEIVERS-RETRN_CODE.
ENDLOOP.
ENDFORM. "send_file_as_email_attachment
*& Form FCONVERT_SPOOL_TO_PDF
text
--> p1 text
<-- p2 text
FORM FCONVERT_SPOOL_TO_PDF .
SELECT *
FROM TSP01
WHERE RQOWNER EQ SY-UNAME
ORDER BY RQCRETIME ASCENDING.
ENDSELECT.
GD_SPOOL_NR = TSP01-RQIDENT.
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
SRC_SPOOLID = GD_SPOOL_NR
NO_DIALOG = C_NO
DST_DEVICE = C_DEVICE
IMPORTING
PDF_BYTECOUNT = GD_BYTECOUNT
TABLES
PDF = IT_PDF_OUTPUT
EXCEPTIONS
ERR_NO_ABAP_SPOOLJOB = 1
ERR_NO_SPOOLJOB = 2
ERR_NO_PERMISSION = 3
ERR_CONV_NOT_POSSIBLE = 4
ERR_BAD_DESTDEVICE = 5
USER_CANCELLED = 6
ERR_SPOOLERROR = 7
ERR_TEMSEERROR = 8
ERR_BTCJOB_OPEN_FAILED = 9
ERR_BTCJOB_SUBMIT_FAILED = 10
ERR_BTCJOB_CLOSE_FAILED = 11
OTHERS = 12.
CHECK SY-SUBRC = 0.
FREE GD_BUFFER.
Transfer the 132-long strings to 255-long strings
LOOP AT IT_PDF_OUTPUT.
TRANSLATE IT_PDF_OUTPUT USING ' ~'.
CONCATENATE GD_BUFFER IT_PDF_OUTPUT INTO GD_BUFFER.
ENDLOOP.
TRANSLATE GD_BUFFER USING '~ '.
FREE IT_MESS_ATT.
DO.
IT_MESS_ATT = GD_BUFFER.
APPEND IT_MESS_ATT.
SHIFT GD_BUFFER LEFT BY 255 PLACES.
IF GD_BUFFER IS INITIAL.
EXIT.
ENDIF.
ENDDO.
*clear:
ENDFORM. " FCONVERT_SPOOL_TO_PDFHi,
I think problem is in this code :-->
IF SY-SYSID = C_DEV.
WAIT UP TO 5 SECONDS.
SUBMIT RSCONN01 WITH MODE = 'INT' " << Here session created internally
WITH OUTPUT = 'X'
AND RETURN.
ENDIF.
ELSE.
PERFORM FCONVERT_SPOOL_TO_PDF.
PERFORM PROCESS_EMAIL.
IF P_DELSPL EQ 'X'.
PERFORM DELETE_SPOOL.
ENDIF.
IF SY-SYSID = C_DEV.
WAIT UP TO 5 SECONDS.
SUBMIT RSCONN01 WITH MODE = 'INT' " << Here sessions created internally
WITH OUTPUT = 'X'
AND RETURN.
ENDIF. -
Hi
Following is my Final internal table
vbeln matnr posnr Flax
123 23 10 X
124 24 10
125 25 10 X
126 26 10
I want to display the records in Red colour where Flag = X
how to do this. Pls help meHi Sunil,
Check out with the demo program. Just copy and paste it you will see the coloring is tehre and do some modificatio based on your logic it will defiantly work.
&************Reward point if helpful***************&
report zuseofhashedtables.
** Program: ZUseOfHashedTables **
** Author: Horacio Zapettini **
** Versions: 4.6b - 4.6c **
** Notes: **
** this program shows how we can use hashed tables to improve **
** the responce time. **
** It shows, **
** 1. how to declare hashed tables **
** 2. a cache-like technique to improve access to master data **
** 3. how to collect data using hashed tables **
** 4. how to avoid deletions of unwanted data **
** Results: the test we run read about 31000 rows from mkpf, 150000 **
** rows from mseg, 500 rows from makt and 400 from lfa1. **
** it filled ht_lst with 24500 rows and displayed them in **
** alv grid format. **
** It took about 65 secodns to perform this task (first time **
** we run it when all the db buffers are empty. **
** The same program with standard tables needed 140 seconds **
** to run with the same recordset and with buffers filled in **
** A simmilar test over more than a million rows
** Objetive: show a list that consists of all the material movements **
** '101' - '901' for a certain range of dates in mkpf-budat. **
** the columns to be displayed are: **
** mkpf-budat, **
** mkpf-mblnr, **
** mseg-lifnr, **
** lfa1-name1, **
** mkpf-xblnr, **
** mseg-zeile **
** mseg-charg, **
** mseg-matnr, **
** makt-maktx, **
** mseg-erfmg, **
** mseg-erfme. **
** or show a sumary list by matnr - menge **
** You'll have to create a pf-status called vista - **
** See form set_pf_status for details **
** tables used -
tables: mkpf,
mseg,
lfa1,
makt.
** global hashed tables used
data: begin of wa_mkpf, "header
mblnr like mkpf-mblnr,
mjahr like mkpf-mjahr,
budat like mkpf-budat,
xblnr like mkpf-xblnr,
end of wa_mkpf.
data: ht_mkpf like hashed table of wa_mkpf
with unique key mblnr mjahr
with header line.
data: st_mkpf like standard table of wa_mkpf
with header line.
data: begin of wa_mseg, " line items
mblnr like mseg-mblnr,
mjahr like mseg-mjahr,
zeile like mseg-zeile,
bwart like mseg-bwart,
charg like mseg-charg,
matnr like mseg-matnr,
lifnr like mseg-lifnr,
erfmg like mseg-erfmg,
erfme like mseg-erfme,
end of wa_mseg.
data ht_mseg like hashed table of wa_mseg
with unique key mblnr mjahr zeile
with header line.
data st_mseg like standard table of wa_mseg
with header line.
** cache structure for lfa1 records
data: begin of wa_lfa1,
lifnr like lfa1-lifnr,
name1 like lfa1-name1,
end of wa_lfa1.
data ht_lfa1 like hashed table of wa_lfa1
with unique key lifnr
with header line.
** cache structure for material related data
data: begin of wa_material,
matnr like makt-matnr,
maktx like makt-maktx,
end of wa_material.
data: ht_material like hashed table of wa_material
with unique key matnr
with header line.
** result table
data: begin of wa_lst, "
budat like mkpf-budat,
mblnr like mseg-mblnr,
lifnr like mseg-lifnr,
name1 like lfa1-name1,
xblnr like mkpf-xblnr,
zeile like mseg-zeile,
charg like mseg-charg,
matnr like mseg-matnr,
maktx like makt-maktx,
erfmg like mseg-erfmg,
erfme like mseg-erfme,
mjahr like mseg-mjahr,
end of wa_lst.
data: ht_lst like hashed table of wa_lst
with unique key mblnr mjahr zeile
with header line.
data: begin of wa_lst1, " sumary by material
matnr like mseg-matnr,
maktx like makt-maktx,
erfmg like mseg-erfmg,
erfme like mseg-erfme,
color_line(4) TYPE c, " Line color
color_cell TYPE lvc_t_scol, " Cell color
celltab type LVC_T_STYL,
end of wa_lst1.
data: ht_lst1 like hashed table of wa_lst1
with unique key matnr
with header line.
** structures for alv grid display.
** itabs
type-pools: slis.
data: it_lst like standard table of wa_lst with header line,
it_fieldcat_lst type slis_t_fieldcat_alv with header line,
it_sort_lst type slis_t_sortinfo_alv,
it_lst1 like standard table of wa_lst1 with header line,
it_fieldcat_lst1 type slis_t_fieldcat_alv with header line,
it_sort_lst1 type slis_t_sortinfo_alv.
** structures
data: wa_sort type slis_sortinfo_alv,
ls_layout type slis_layout_alv.
** color management.
DATA : wa_color TYPE lvc_s_scol.
* Internal table for color management.
DATA : it_color TYPE TABLE OF lvc_s_scol.
* itab for input enabling.
DATA: lt_celltab TYPE lvc_t_styl. "
** global varialbes
data: g_lines type i.
data: g_repid like sy-repid,
ok_code like sy-ucomm.
** selection-screen
"text: Dates:
select-options: so_budat for mkpf-budat default sy-datum.
"text: Material numbers.
select-options: so_matnr for mseg-matnr.
selection-screen uline.
selection-screen skip 1.
"Text: show summary by material.
parameters: gp_bymat as checkbox default ''.
parameters: gp_hier as checkbox default 'X'.
start-of-selection.
perform get_data.
perform show_data.
end-of-selection.
* FORM get_data *
form get_data.
select mblnr mjahr budat xblnr
into table ht_mkpf
from mkpf
where budat in so_budat. " make use of std index.
** have we retrieved data from mkpf?
describe table ht_mkpf lines g_lines.
if g_lines > 0.
** if true then retrieve all related records from mseg.
** Doing this way we make sure that the access is by primary key
** of mseg.
** The reason is that is faster to filter them in memory
** than to allow the db server to do it.
select mblnr mjahr zeile bwart charg
matnr lifnr erfmg erfme
into table ht_mseg
from mseg
for all entries in ht_mkpf
where mblnr = ht_mkpf-mblnr
and mjahr = ht_mkpf-mjahr.
endif.
** fill t_lst or t_lst1 according to user's choice.
if gp_bymat = ' '.
perform fill_ht_lst.
else.
perform fill_ht_lst1.
endif.
endform.
form fill_ht_lst.
refresh ht_lst.
** Example: how to discard unwanted data in an efficient way.
loop at ht_mseg.
* filter unwanted data
check ht_mseg-bwart = '101' or ht_mseg-bwart = '901'.
check ht_mseg-matnr in so_matnr.
* read header line.
read table ht_mkpf with table key mblnr = ht_mseg-mblnr
mjahr = ht_mseg-mjahr.
clear ht_lst.
* * note : this may be faster if you specify field by field.
move-corresponding ht_mkpf to ht_lst.
move-corresponding ht_mseg to ht_lst.
perform read_lfa1 using ht_mseg-lifnr changing ht_lst-name1.
perform read_material using ht_mseg-matnr changing ht_lst-maktx.
insert table ht_lst.
endloop.
endform.
form fill_ht_lst1.
data: colorear.
refresh ht_lst1.
** Example: how to discard unwanted data in an efficient way.
** hot to simulate a collect in a faster way
loop at ht_mseg.
* filter unwanted data
check ht_mseg-bwart = '101' or ht_mseg-bwart = '901'.
check ht_mseg-matnr in so_matnr.
* * note : this may be faster if you specify field by field.
read table ht_lst1 with table key matnr = ht_mseg-matnr
transporting erfmg.
if sy-subrc <> 0. " if matnr doesn't exist in sumary table
" insert a new record
clear ht_lst1.
ht_lst1-matnr = ht_mseg-matnr.
perform read_material using ht_mseg-matnr changing ht_lst1-maktx.
ht_lst1-erfmg = ht_mseg-erfmg.
ht_lst1-erfme = ht_mseg-erfme.
if colorear = ''.
colorear = 'X'.
refresh it_color.
ht_lst1-color_cell[] = it_color[].
MOVE 'C410' TO ht_lst1-color_line.
else.
colorear = ' '.
refresh it_color. clear it_color.
MOVE 'MATNR' TO wa_color-fname.
MOVE '6' TO wa_color-color-col.
MOVE '1' TO wa_color-color-int.
MOVE '1' TO wa_color-color-inv.
APPEND wa_color TO it_color.
MOVE 'MAKTX' TO wa_color-fname.
MOVE '3' TO wa_color-color-col.
MOVE '1' TO wa_color-color-int.
MOVE '1' TO wa_color-color-inv.
APPEND wa_color TO it_color.
MOVE 'ERFMG' TO wa_color-fname.
MOVE '5' TO wa_color-color-col.
MOVE '1' TO wa_color-color-int.
MOVE '1' TO wa_color-color-inv.
APPEND wa_color TO it_color.
ht_lst1-color_cell[] = it_color[].
clear ht_lst1-color_line.
endif.
insert table ht_lst1.
else." a record was found.
" collect erfmg. To do so, fill in the unique key and add
" the numeric fields.
ht_lst1-matnr = ht_mseg-matnr.
add ht_mseg-erfmg to ht_lst1-erfmg.
modify table ht_lst1 transporting erfmg.
endif.
endloop.
endform.
** implementation of cache for lfa1.
form read_lfa1 using p_lifnr changing p_name1.
read table ht_lfa1 with table key lifnr = p_lifnr
transporting name1.
if sy-subrc <> 0.
clear ht_lfa1.
ht_lfa1-lifnr = p_lifnr.
select single name1
into ht_lfa1-name1
from lfa1
where lifnr = p_lifnr.
if sy-subrc <> 0. ht_lfa1-name1 = 'n/a in lfa1'. endif.
insert table ht_lfa1.
endif.
p_name1 = ht_lfa1-name1.
endform.
** implementation of cache for material data
form read_material using p_matnr changing p_maktx.
read table ht_material with table key matnr = p_matnr
transporting maktx.
if sy-subrc <> 0.
ht_material-matnr = p_matnr.
select single maktx into ht_material-maktx
from makt
where spras = sy-langu
and matnr = p_matnr.
if sy-subrc <> 0. ht_material-maktx = 'n/a in makt'. endif.
insert table ht_material.
endif.
p_maktx = ht_material-maktx.
endform.
form show_data.
if gp_hier = 'X'. "no anda.
* perform show_hierarchicalALV.
else.
if gp_bymat = ' '.
perform show_ht_lst.
else.
perform show_ht_lst1.
endif.
endif.
endform.
form show_hierarchicalALV.
st_mkpf[] = ht_mkpf[].
st_mseg[] = ht_mseg[].
call function 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
* exporting
* I_INTERFACE_CHECK = ' '
* I_CALLBACK_PROGRAM =
* I_CALLBACK_PF_STATUS_SET = ' '
* I_CALLBACK_USER_COMMAND = ' '
* IS_LAYOUT =
* IT_FIELDCAT =
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
* IT_SORT =
* IT_FILTER =
* IS_SEL_HIDE =
* I_SCREEN_START_COLUMN = 0
* I_SCREEN_START_LINE = 0
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
* I_DEFAULT = 'X'
* I_SAVE = ' '
* IS_VARIANT =
* IT_EVENTS =
* IT_EVENT_EXIT =
* i_tabname_header =
* i_tabname_item =
* I_STRUCTURE_NAME_HEADER =
* I_STRUCTURE_NAME_ITEM =
* is_keyinfo =
* IS_PRINT =
* IS_REPREP_ID =
* I_BUFFER_ACTIVE =
* I_BYPASSING_BUFFER =
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
tables
t_outtab_header = st_mkpf
t_outtab_item = st_mseg
* EXCEPTIONS
* PROGRAM_ERROR = 1
* OTHERS = 2
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.
form show_ht_lst.
"needed because the FM can't use a hashed table.
it_lst[] = ht_lst[].
perform fill_layout using 'full display'
changing ls_layout.
perform fill_columns_lst.
* perform sort_lst.
g_repid = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = g_repid
i_callback_pf_status_set = 'SET_PF_STATUS'
is_layout = ls_layout
it_fieldcat = it_fieldcat_lst[]
* it_sort = it_sort_lst
tables
t_outtab = it_lst
exceptions
program_error = 1
others = 2.
endform.
form show_ht_lst1.
"needed because the FM can't use a hashed table.
it_lst1[] = ht_lst1[].
perform fill_layout using 'Sumary by matnr'
changing ls_layout.
perform fill_columns_lst1.
* perform sort_lst.
g_repid = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = g_repid
i_callback_pf_status_set = 'SET_PF_STATUS'
is_layout = ls_layout
it_fieldcat = it_fieldcat_lst1[]
* it_sort = it_sort_lst
tables
t_outtab = it_lst1
exceptions
program_error = 1
others = 2.
endform.
form fill_layout using p_window_titlebar
changing cs_layo type slis_layout_alv.
clear cs_layo.
cs_layo-window_titlebar = p_window_titlebar.
cs_layo-edit = 'X'.
cs_layo-edit_mode = space.
MOVE 'COLOR_LINE' TO cs_layo-info_fieldname.
* Field that identify cell color in inetrnal table
MOVE 'COLOR_CELL' TO cs_layo-coltab_fieldname.
* move 'CELLTAB' TO cs_layo-stylefname.
endform. " armar_layout_stock
form set_pf_status using rt_extab type slis_t_extab.
** create a new status
** and then select extras -> adjust template -> listviewer
set pf-status 'VISTA'.
endform. "set_pf_status
define add_lst.
clear it_fieldcat_lst.
it_fieldcat_lst-fieldname = &1.
it_fieldcat_lst-outputlen = &2.
it_fieldcat_lst-ddictxt = 'L'.
it_fieldcat_lst-seltext_l = &1.
it_fieldcat_lst-seltext_m = &1.
it_fieldcat_lst-seltext_m = &1.
if &1 = 'MATNR'.
it_fieldcat_lst-emphasize = 'C111'.
endif.
append it_fieldcat_lst.
end-of-definition.
define add_lst1.
clear it_fieldcat_lst.
it_fieldcat_lst1-fieldname = &1.
it_fieldcat_lst1-outputlen = &2.
it_fieldcat_lst1-ddictxt = 'L'.
it_fieldcat_lst1-seltext_l = &1.
it_fieldcat_lst1-seltext_m = &1.
it_fieldcat_lst1-seltext_m = &1.
append it_fieldcat_lst1.
end-of-definition.
form fill_columns_lst.
* set columns for output.
refresh it_fieldcat_lst.
add_lst 'BUDAT' 10.
add_lst 'MBLNR' 10.
add_lst 'LIFNR' 10.
add_lst 'NAME1' 35.
add_lst 'XBLNR' 15.
add_lst 'ZEILE' 5.
add_lst 'CHARG' 10.
add_lst 'MATNR' 18.
add_lst 'MAKTX' 30.
add_lst 'ERFMG' 17.
add_lst 'ERFME' 5.
add_lst 'MJAHR' 4.
endform.
form fill_columns_lst1.
* set columns for output.
refresh it_fieldcat_lst1.
add_lst1 'MATNR' 18.
add_lst1 'MAKTX' 30.
add_lst1 'ERFMG' 17.
add_lst1 'ERFME' 5..
endform.
Horacio Zapettini
Program to Calculate FI Opening Balance
How to find the Opening balance for a given period in FI Module for a Particular GL A/c.
I was calculated opening balance, code is below maybe it will be helpful.
*find period.
CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
EXPORTING
i_date = s_budat-low
i_periv = i_tab-periv "'K4'
IMPORTING
e_buper = v_donem
e_gjahr = v_gjahr
EXCEPTIONS
input_false = 1
t009_notfound = 2
t009b_notfound = 3
OTHERS = 4.
*calc opening balance hesabý
SELECT * FROM knc1 WHERE kunnr = i_tab-kunnr
AND bukrs = i_tab-bukrs " s_bukrs
AND gjahr EQ v_gjahr.
v_dnm = v_donem.
* opening balance first calc > old year ,
WHILE v_dnm > 1.
v_dnm = v_dnm - 1.
CONCATENATE 'knc1-um' v_dnm 's' INTO v_field_name_borc.
CONCATENATE 'knc1-um' v_dnm 'h' INTO v_field_name_alacak.
ASSIGN (v_field_name_borc) TO <fs1> .
ASSIGN (v_field_name_alacak) TO <fs2> .
i_tab-dmbtr_s = i_tab-dmbtr_s + ( <fs1> ). " borc
i_tab-dmbtr_h = i_tab-dmbtr_h + ( <fs2> ). " borc
ENDWHILE.
*opening balance last calc> old
* add days which is from selected date-low month
IF v_donem > 1.
v_dnm = v_donem - 1.
ELSE.
v_dnm = v_donem.
ENDIF.
SELECT SINGLE * FROM t009b WHERE periv = i_tab-periv "'K4'
AND bdatj = s_budat-low+0(4)
AND poper = v_dnm.
t009b-butag = t009b-butag + 1.
IF s_budat-low+6(2) NE t009b-butag.
v_date_high = s_budat-low - 1.
IF v_donem = 1.
v_date_low = s_budat-low.
v_date_low+4(4) = '0101'.
ELSE.
CONCATENATE t009b-bdatj t009b-bumon t009b-butag INTO
v_date_low.
ENDIF.
SELECT * FROM bsad WHERE bukrs EQ i_tab-bukrs "IN s_bukrs
AND kunnr = i_tab-kunnr
AND budat BETWEEN v_date_low AND
v_date_high
AND umskz = space
AND blart IN s_blart.
IF bsad-shkzg = 'S'.
i_tab-dmbtr_s = i_tab-dmbtr_s + ( bsad-dmbtr ).
ELSEIF bsad-shkzg = 'H'.
i_tab-dmbtr_h = i_tab-dmbtr_h + ( bsad-dmbtr ).
ENDIF.
ENDSELECT.
SELECT * FROM bsid WHERE bukrs EQ i_tab-bukrs "IN s_bukrs
AND kunnr = i_tab-kunnr
AND budat BETWEEN v_date_low AND
v_date_high
AND umskz = space
AND blart IN s_blart.
* AND gsber IN gsber.
IF bsid-shkzg = 'S'.
i_tab-dmbtr_s = i_tab-dmbtr_s + ( bsid-dmbtr ).
ELSEIF bsid-shkzg = 'H'.
i_tab-dmbtr_h = i_tab-dmbtr_h + ( bsid-dmbtr ).
ENDIF.
ENDSELECT.
ENDIF.
"opening balance ( þirket bazlý )z1 degeri
i_tab-z1 = i_tab-z1 + ( knc1-umsav + i_tab-dmbtr_s - i_tab-dmbtr_h ).
* for israel
i_tab-dmbtril_s = i_tab-dmbtr_s .
i_tab-dmbtril_h = i_tab-dmbtr_h .
ENDSELECT. -
hi
i have a internal table with the following structure
TYPES: begin of ty_final.
types: b_bseg type bseg.
types: k_kna1 type kna1.
types: l_lfa1 type lfa1.
types: s_ska1 type ska1.
types: a_anlu type anlu.
TYPES: End of ty_final.
DATA: lt_final TYPE STANDARD TABLE OF ty_final ,
wa_final TYPE ty_final.
after i fill my final internal table i need to get the output in ALV grid , i tried to pass the internal table to ALv Grid function module but I am getting shortdump .
is it possible to to get the output with this complex structure?
Moderator message: please choose more descriptive subject lines for your posts.
Edited by: Thomas Zloch on Jun 8, 2011 4:38 PMhere is the short dump , I think the ALV program doesnt get the internal table value , because the value resides in deep structure . if i am wrong correct me.
Short text
Field symbol has not yet been assigned.
What happened?
Error in the ABAP Application Program
The current ABAP program "SAPLSLVC" had to be terminated because it has
come across a statement that unfortunately cannot be executed.
Error analysis
You attempted to access an unassigned field symbol
(data segment 32821).
This error may occur if
- You address a typed field symbol before it has been set with
ASSIGN
- You address a field symbol that pointed to the line of an
internal table that was deleted
- You address a field symbol that was previously reset using
UNASSIGN or that pointed to a local field that no
longer exists
- You address a global function interface, although the
respective function module is not active - that is, is
not in the list of active calls. The list of active calls
can be taken from this short dump.
Trigger Location of Runtime Error
Program SAPLSLVC
Include LSLVCF36
Row 3.267
Module type (FORM)
Module Name FILL_DATA_TABLE
Source Code Extract
Line
SourceCde
3237
alv_style_align_center_top.
3238
endif.
3239
3240
append ls_lvc_data to ct_lvc_data.
3241
endif.
3242
3243
3244
Column per Fieldcat Entry
3245
3246
loop at it_fcat_local assigning <ls_fcat>.
3247
clear: ls_lvc_data-href_hndl,
3248
ls_lvc_data-drdn_hndl,
3249
ls_lvc_data-style,
3250
ls_lvc_data-style2,
3251
ls_lvc_data-style3,
3252
ls_lvc_data-style4,
3253
ls_lvc_data-maxlen.
3254
3255
clear: lt_color_lvc, lt_color_slis.
3256
3257
add 1 to ls_lvc_data-col_pos.
3258
3259
if not <ls_fcat>-indx_field is initial.
3260
assign component <ls_fcat>-indx_field
3261
of structure <ls_data> to <l_field_value>.
3262
else.
3263
assign component <ls_fcat>-fieldname
3264
of structure <ls_data> to <l_field_value>.
3265
endif.
3266
>>>>>
macro_cell_data_get
3268
<ls_fcat>
3269
<ls_data>
3270
<l_field_value>
3271
ls_lvc_data-value.
3272
3273
*>>> new API
3274
if ir_salv_adapter is bound.
3275
clear ls_lvc_data-style.
3276
3277
color
3278
if g_gui_type ne 1.
3279
if <ls_fcat>-key eq abap_true.
3280
ls_lvc_data-style = alv_style_color_int_key.
3281
elseif l_style_color is initial
3282
and ( <ls_fcat>-emphasize is initial or
3283
<ls_fcat>-emphasize = '$' ).
3284
if <ls_stin>-counter is initial.
3285
ls_lvc_data-style = alv_style_color_normal.
3286
else. -
Reg: display the warning message in alv out put
Hi All,
i am uloading the flat file data ,display in the alv grid in the edit mode. when i am trying to change the output data in grid, for which are having the blank (no value for the field) , i want to display warning message the selected cell is blank.
could u help me on this please.
Thanks,
KumarFor editing the ALV cell .. you would be writing some code .. which is mandt rite ?
So before that code u check the filed value ..initial or not .. -
Hi,
In alv i like to show one row should be high lighted or colored that row. can you tell me how?
Please send piece of code.
thanks®ards
vHi,
To mke your row bold
In that case, u gave to set a condition while appending rows in the following internal table (for which you want to do a field bold). Now for making bold, for that perticular field pass 'C410' instead of 'C410'. It control the field Intensified. I guess it will solve ur purpose.
code*Populate field with color attributes
loop at it_ekko into wa_ekko.
Populate color variable with colour properties
Char 1 = C (This is a color property)
Char 2 = 3 (Color codes: 1 - 7)
Char 3 = Intensified on/off ( 1 or 0 )
Char 4 = Inverse display on/off ( 1 or 0 )
i.e. wa_ekko-line_color = 'C410'
ld_color = ld_color + 1.
Only 7 colours so need to reset color value
if ld_color = 8.
ld_color = 1.
endif.
concatenate 'C' ld_color '10' into wa_ekko-line_color.
wa_ekko-line_color = 'C410'.
modify it_ekko from wa_ekko.
endloop.[/code] -
ALV out put to be downloaded in Background to apps server
Hello All,
I want to download ALV output to APPL Server in TAB delimited format.
I am able to get the internal table values usinf open record set and transfering.
But the real issue is they are having diffrent layouts and according to layout i need to down the file.
Is it possible ? if please suggest.
Rgds,
OHi,
I have an old code that I have wrote to transform ALV in HTML in background to send the result by email. Maybe that could help you (don't be rude, it's one of my first ALV program ).
The comments are in french, but, you could understand.
I hope that could help you
Rgd
Frédéric
* Complete.
call function 'LVC_FIELDCATALOG_MERGE'
exporting
i_structure_name = 'ZGRE000_S2'
i_bypassing_buffer = ' '
i_buffer_active = ' '
changing
ct_fieldcat = itab_fieldcatalog.
call function 'LVC_FIELDCAT_COMPLETE'
EXPORTING
* I_COMPLETE =
IS_LAYOUT = v_es_layout
I_REFRESH_BUFFER = ''
I_BUFFER_ACTIVE = ''
* IMPORTING
* E_EDIT =
changing
ct_fieldcat = itab_fieldcatalog.
call function 'LVC_SORT_COMPLETE'
exporting
it_fieldcat = itab_fieldcatalog
changing
ct_sort = itab_mt_sort.
call function 'ALV_DATA_EXPORT'
exporting
i_report = ''
IT_FIELDCAT = itab_fieldcatalog
tables
it_data = itab_zgre000_s2.
* Recherche de la variante d'affichage.
move : sy-repid to struct_variant-report ,
sy-uname to struct_variant-username ,
'2' to struct_variant-handle.
if p_vgrid ne space.
move p_vgrid to struct_variant-variant.
endif.
* Ne pas demander d'explication, merci :)
get reference of itab_zgre000_s2 into mt_outtab.
* Créé l'objet variant.
create object m_cl_variant
exporting
it_outtab = mt_outtab
it_fieldcatalog = itab_fieldcatalog
it_sort = itab_mt_sort
it_filter = itab_mt_filter
is_variant = struct_variant
is_layout = v_es_layout
i_variant_save = v_e_var_save
i_variant_default = v_e_var_def.
move : 'A' to v_e_var_save ,
'X' to v_e_var_def .
call method m_cl_variant->set_values
exporting it_outtab = mt_outtab
it_fieldcatalog = itab_fieldcatalog
it_sort = itab_mt_sort
it_filter = itab_mt_filter
is_variant = struct_variant
is_layout = v_es_layout
i_variant_save = v_e_var_save
i_variant_default = v_e_var_def.
loop at itab_fieldcatalog into tmp_fieldcatalog
where tabname ne space.
exit.
endloop.
* Recherche de la variante.
call method m_cl_variant->load_variant
exporting i_tabname = tmp_fieldcatalog-tabname
i_bypassing_buffer = 'X'
i_dialog = space.
create data mt_ct00 like itab_zgre000_s2.
create data mt_ct01 like itab_zgre000_s2.
create data mt_ct02 like itab_zgre000_s2.
create data mt_ct03 like itab_zgre000_s2.
create data mt_ct04 like itab_zgre000_s2.
create data mt_ct05 like itab_zgre000_s2.
create data mt_ct06 like itab_zgre000_s2.
create data mt_ct07 like itab_zgre000_s2.
create data mt_ct08 like itab_zgre000_s2.
create data mt_ct09 like itab_zgre000_s2.
assign mt_ct00->* to <lt_ct00>.
assign mt_ct01->* to <lt_ct01>.
assign mt_ct02->* to <lt_ct02>.
assign mt_ct03->* to <lt_ct03>.
assign mt_ct04->* to <lt_ct04>.
assign mt_ct05->* to <lt_ct05>.
assign mt_ct06->* to <lt_ct06>.
assign mt_ct07->* to <lt_ct07>.
assign mt_ct08->* to <lt_ct08>.
assign mt_ct09->* to <lt_ct09>.
* Recherche des valeurs à partir de la variante sélectionnée.
call method m_cl_variant->get_values
importing es_variant = struct_variant
et_fieldcatalog = itab_fieldcatalog
et_sort = itab_mt_sort
et_filter = itab_mt_filter
es_layout = v_es_layout
et_grouplevels_filter = mt_grouplevels_filter
e_variant_save = v_e_var_save
e_variant_default = v_e_var_def.
call function 'LVC_SORT_APPLY'
exporting
it_sort = itab_mt_sort
* I_AS_TEXT = 'X'
* I_STABLE = 'X'
tables
ct_data = itab_zgre000_s2.
call function 'LVC_TRANSFER_TO_KKBLO'
exporting
it_sort_lvc = itab_mt_sort
it_grouplevels_lvc = mt_grouplevels_filter
importing
et_sort_kkblo = itab_lt_sort
et_grouplevels_kkblo = itab_lt_grouplevels
exceptions
it_data_missing = 1
it_fieldcat_lvc_missing = 2
others = 3.
call function 'ALV_GROUPLEVELS_GET'
exporting
i_subtotals_only = 'X'
it_sort = itab_lt_sort
i_subtract_counter = 'X'
importing
et_groups = itab_lt_grouplevels
tables
t_outtab = itab_zgre000_s2.
call function 'LVC_TRANSFER_FROM_KKBLO'
exporting
it_grouplevels_kkblo = itab_lt_grouplevels
importing
et_grouplevels_lvc = mt_grouplevels_filter
exceptions
it_data_missing = 1
others = 2.
* Recupération des totaux.
call function 'LVC_TOTALS_GET'
exporting
it_sort = itab_mt_sort
is_layout = v_es_layout
it_filter_index = itab_mt_filter_i
tables
it_data = itab_zgre000_s2
et_collect00 = <lt_ct00>
et_collect01 = <lt_ct01>
et_collect02 = <lt_ct02>
et_collect03 = <lt_ct03>
et_collect04 = <lt_ct04>
et_collect05 = <lt_ct05>
et_collect06 = <lt_ct06>
et_collect07 = <lt_ct07>
et_collect08 = <lt_ct08>
et_collect09 = <lt_ct09>
changing
cs_total_options = ms_total_options
* ct_fieldcat = mt_fieldcatalog
ct_fieldcat = itab_fieldcatalog
ct_grouplevels = mt_grouplevels_filter
c_calculate_totals = m_calculate_totals
c_sumlevel = m_sumlevel .
* Converti dans un language comprehensible par SAP.
call function 'LVC_TABLE_FOR_DISPLAY'
exporting
it_fieldcat = itab_fieldcatalog
it_sort = itab_mt_sort
it_filter = itab_mt_filter
is_total_options = ms_total_options
is_layout = v_es_layout
importing
et_lvc_data = itab_mt_data
et_lvc_info = itab_mt_info
tables
it_data = itab_zgre000_s2
it_collect00 = <lt_ct00>
it_collect01 = <lt_ct01>
it_collect02 = <lt_ct02>
it_collect03 = <lt_ct03>
it_collect04 = <lt_ct04>
it_collect05 = <lt_ct05>
it_collect06 = <lt_ct06>
it_collect07 = <lt_ct07>
it_collect08 = <lt_ct08>
it_collect09 = <lt_ct09>
changing
ct_grouplevels = mt_grouplevels_filter
exceptions
fieldcat_not_complete = 1
others = 2.
if sy-subrc ne space.
write : /1 'Probleme de convertion.'.
stop.
endif.
* Convertie en HTML.
call function 'LVC_ALV_CONVERT_TO_HTML'
exporting
it_data = itab_mt_data
it_info = itab_mt_info
i_file_dialog = ' '
importing
et_html = itab_html. -
hi gurus,
in our delivery challan output the item is not printed.
please show me the possible solutions asap.
because we have to go to golive we shortly.
thankyou.Hello Friend,
Dont panic these things are common at go live period. Ask your Abaper to debug that output as to why it is not picking up the material number.Best of Luck. -
Alv and excel sheet out put.
hi friends,
now i am working on sales and purchase order report. For this i have created three radio button on selection screen one for sales 2nd for purchase and 3rd for both. when i click sales radio button it is going to display only sales data in ALV out put list as well as in EXCEL sheet.
problem:-
Some layout fileds (out put fields) i am storing in VARIENT and when i have passed this VARIANT in a SELECTION-SCREEN so here the output is ok for me, and i am unable to display these same fields in EXCEL sheet for this Please could u tell that how we do this. please send the logic for this.
thands and regards.
sagi.Hi Amol,
you are not getting me ...
see your itab will have all the fields irrespective of variant used. so you can directly use itab to download.
i guess you are using alv tool bar option to download.
but i am telling to use your own button to download the report using your own button with GUI_DOWNLOAD Fm.
for this you pass your ITAB and and then give the file name then this will save all the fields to excel file.
Regards
vijay -
Reduce out put field length of alv output in back ground
Hi all,
Is there a way to reduce the output length of the field in back groundfor ALV out put
Its back ground
I have thsi things in my field catalog
wa_fieldcat-outputlen = 10.
wa_fieldcat-ddic_outputlen = 10.
If the field has value of length 10 characters its ok
but when the field has lenth of more than 10 characters
(say 20 char). in fore ground it displays 10 characters and then we can move the column to see full thing , but in back ground it displays 20 char.
In fact that is what i have to see because in background you cannot drag the column to see entire thing , but i want to cut short to 12 char even if i don't see the remaining thing its ok
ThanksHi Vasu,
WHAT EXACTLY SY-BATCH DOES .
I tried reducing wa_fieldcat-outputlen = 10. and then i tried
wa_fieldcat-outputlen = 5., but it doesnot really changed anything in back ground but it did in fore ground . I haven't used any called sy-batch
Let me know
This is how my field catalog looks for mATNR
clear wa_fieldcat.
wa_fieldcat-fieldname = 'MATNR'.
wa_fieldcat-seltext_l = ' Material #'.
wa_fieldcat-seltext_m = 'Material #'.
wa_fieldcat-seltext_s = ' Material #'.
wa_fieldcat-reptext_ddic = 'Material #'.
wa_fieldcat-ddictxt = 'L'.
wa_fieldcat-col_pos = 4.
wa_fieldcat-outputlen = 18.
wa_fieldcat-intlen = 18.
wa_fieldcat-ddic_outputlen = 18.
wa_fieldcat-tabname = '1'.
append wa_fieldcat to fieldcat.
NEXT TIME I COMMENTED THIS AND HAD
wa_fieldcat-fieldname = 'MATNR'.
wa_fieldcat-seltext_l = ' Material #'.
wa_fieldcat-seltext_m = 'Material #'.
wa_fieldcat-seltext_s = ' Material #'.
wa_fieldcat-reptext_ddic = 'Material #'.
wa_fieldcat-ddictxt = 'L'.
wa_fieldcat-col_pos = 4.
wa_fieldcat-outputlen = 10.
wa_fieldcat-intlen = 10.
wa_fieldcat-ddic_outputlen = 10.
wa_fieldcat-tabname = '1'.
append wa_fieldcat to fieldcat.
BUT I DID SEE DIFFERENCE IN FOREBROUND BUT NOT IN BACK GROUND
Let me know
Thanks
Maybe you are looking for
-
I have a Date variable with the following format: yyyy-MM-d HH:mm:ss And I have a method that returns me the year: public int getPtYear(Date d){ int y = d.getYear(); return y; *d is the Date variable. But something is wrong because I keep getting the
-
Chapter - Heading - Graphics Background
I'm trying to figure out how to create a different Page background and different text "header or footer" located on the page. In either case the background page and text header are dependant on the Chapter #. For example) 1. a page which is part of C
-
JTextField information retrieval
Hi, I�m a new Java programmer, I have one problem trying to assign the content of a JTextField to a char variable. To assign an integer I�m using: side = Integer.parseInt (sideField.getText ( ) ); How can in assign the symbolField content to char var
-
Sending multiple faxes to multiple recipients
I have to fax permit applications to juridictions for processing. Sometimes I have four or five faxes to send out to the different recepients. I need an all-in-one that will scan outgoing faxes to memory while one fax is sending, to be sent when the
-
How do i remove an app from my iPad?
How do I remove unwanted apps from my iPad?