Check on bukrs
hello,
I am trying to implement check for the company code entered by the user.the company code entered should be a valid entry in table T001.The problem is when i enter '1' as company code then the query is not executed despite '0001' being present in t001.how do i tackle this problem?
SELECT SINGLE BUKRS FROM T001 INTO temp_companyc WHERE BUKRS =
COMPANYCIO.
IF SY-SUBRC EQ 4.
MESSAGE I008(ZGROUP16_MESSAGE).
endif.
Hi,
You got the problem right there. When SAP stores the company code internally in T001, it prefixes 0s to the company code hence 1 becomes 0001.
Hence before validating the company code COMPANYCIO use the conversion exit:
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = COMPANYCIO
IMPORTING
OUTPUT = COMPANYCIO.
What the above code does is converts the company code to internal compatible format. Then use COMPANYCIO for all your processing including validations.
To remove the 0s - you use function module CONVERSION_EXIT_ALPHA_OUTPUT.
Cheers.
Similar Messages
-
Duplicate Invoice Check for Transaction MIR7
Hi Experts,
My client requirment is .
Currenty system checks the BUKRS,LIFNR,WAERS,XBLNR,WRBTR,BLDAT for duplicate invoice this is a standard SAP functionality for T.code MIR7.
Logic needs to be changed
Duplicate Check in SAP for Vendor invoices to only check Vendor number (LIFNR) and Reference number (XBLNR).
I have found a function module which is used to through the error message CUSTOM_MESSAGE is the FM under MRM_FI_DOCUMENT_CHECK. advise what can be done for this.
Thanks,
vikasHi Nabheet,
BSIP is the table which is used for the Vendor Duplicate invoice check.I can do the validation based on xblnr and lifnr for my requirement but i am not sure where i have to do the validations. Please suggest.
Thanks,
Vikas -
How to create command button called 'Remarks' and Check box in ALV GRID?
Hi, Experts,
Requirement is: in the ALVE GRID report output, user select a record by clicking the check box and pressing the button 'Remarks' it will take me into other transaction from the output list.
Please help me out.
Reward points.
SekharHi Chandra Shekar,
Check the following sample program. 2 things to remember.
1. Check the callback subroutine PF_STATUS_SET and create PF status for the program.and also ur REMARKS button in the application tool. Comments are made every where wherever those are needed. After creating Pf status execute the report.
2.Once you select records by selecting checkboxes, u have to press on Refresh button( that is there on application toolbar), then only for selected records, CHECK field in the internal is updated. After that press on REMARKS button .
REPORT zvenkat_alv_grid.
TABLES:t001.
"Types
TYPES:
BEGIN OF t_1001,
check TYPE c,
bukrs TYPE t001-bukrs,
butxt TYPE t001-butxt,
ort01 TYPE t001-ort01,
land1 TYPE t001-land1,
END OF t_1001.
"Work area
DATA:
w_t001 TYPE t_1001.
"Internal table
DATA:
i_t001 TYPE STANDARD TABLE OF t_1001.
" ALV Declarations
* Types Pools
TYPE-POOLS:
slis.
* Types
TYPES:
t_fieldcat TYPE slis_fieldcat_alv,
t_events TYPE slis_alv_event,
t_layout TYPE slis_layout_alv.
* Workareas
DATA:
w_fieldcat TYPE t_fieldcat,
w_events TYPE t_events,
w_layout TYPE t_layout.
* Internal Tables
DATA:
i_fieldcat TYPE STANDARD TABLE OF t_fieldcat,
i_events TYPE STANDARD TABLE OF t_events.
*& start of selection
START-OF-SELECTION.
PERFORM get_data.
*& end-of-selection.
END-OF-SELECTION.
PERFORM build_fieldcatlog.
PERFORM build_events.
PERFORM build_layout.
PERFORM list_display.
*& Form get_data
FORM get_data .
SELECT bukrs
butxt
ort01
land1
FROM t001
INTO CORRESPONDING FIELDS OF TABLE i_t001
UP TO 30 ROWS.
ENDFORM. " get_data
*& Form build_fieldcatlog
FORM build_fieldcatlog .
CLEAR:w_fieldcat,i_fieldcat[].
PERFORM build_fcatalog USING:
'CHECK' 'I_T001' ' ',
'BUKRS' 'I_T001' 'BUKRS',
'BUTXT' 'I_T001' 'BUTXT',
'ORT01' 'I_T001' 'ORT01',
'LAND1' 'I_T001' 'LAND1'.
ENDFORM. "BUILD_FIELDCATLOG
*& Form BUILD_FCATALOG
FORM build_fcatalog USING l_field l_tab l_text.
w_fieldcat-fieldname = l_field.
w_fieldcat-tabname = l_tab.
w_fieldcat-seltext_m = l_text.
IF l_field = 'CHECK'..
w_fieldcat-checkbox = 'X'.
w_fieldcat-edit = 'X'.
ENDIF.
APPEND w_fieldcat TO i_fieldcat.
CLEAR w_fieldcat.
ENDFORM. " build_fieldcatlog
*& Form build_events
* text
FORM build_events.
CLEAR :
w_events, i_events[].
w_events-name = 'TOP_OF_PAGE'."Event Name
w_events-form = 'TOP_OF_PAGE'."Callback event subroutine
APPEND w_events TO i_events.
CLEAR w_events.
w_events-name = 'USER_COMMAND' .
w_events-form = 'USER_COMMAND' .
APPEND w_events TO i_events.
CLEAR w_events.
w_events-name = 'PF_STATUS_SET' .
w_events-form = 'PF_STATUS_SET' .
APPEND w_events TO i_events.
CLEAR w_events.
ENDFORM. "build_events
*& Form build_layout
FORM build_layout .
w_layout-colwidth_optimize = 'X'.
w_layout-zebra = 'X'.
ENDFORM. " build_layout
*& Form list_display
FORM list_display .
DATA:
l_program TYPE sy-repid.
l_program = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = l_program
is_layout = w_layout
it_fieldcat = i_fieldcat
it_events = i_events
TABLES
t_outtab = i_t001
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. " list_display
*& Form top_of_page
FORM top_of_page.
DATA :
li_header TYPE slis_t_listheader,
w_header LIKE LINE OF li_header.
DATA:
l_date TYPE char10.
WRITE sy-datum TO l_date.
w_header-typ = 'H'.
CONCATENATE sy-repid ':' 'From Date' l_date INTO w_header-info SEPARATED BY space.
APPEND w_header TO li_header.
CLEAR w_header.
w_header-typ = 'S'.
w_header-info = sy-title.
APPEND w_header TO li_header.
CLEAR w_header.
w_header-typ = 'A'.
w_header-info = sy-uname.
APPEND w_header TO li_header.
CLEAR w_header.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = li_header.
ENDFORM. "top_of_page
*& Form pf_status_set
FORM pf_status_set USING extab TYPE slis_t_extab.
"Procedure to set own pf-status.
"1.Goto Transaction code SE41
"2.give program = SAPLKKBL and status = STANDARD_FULLSCREEN.
"3.Click on Application toolbar STATUS button
"4.Give ur program name Status name that is to be used in the program using SET pf-status statement
"5.Create ur button REMARKS.
SET PF-STATUS 'STATUS1' EXCLUDING extab.
ENDFORM. "pf_status_set
*& Form user_command
FORM user_command USING ucomm LIKE sy-ucomm
selfield TYPE slis_selfield.
CASE ucomm .
WHEN 'REMARKS'."When u click on remarks button.
LOOP AT i_t001 INTO w_t001 WHERE check = 'X'.
WRITE :/ w_t001-bukrs, 'Checked'.
ENDLOOP.
ENDCASE.
ENDFORM. "user_command
I hope that it helps u .
Regards,
Venkat.O -
Authorization check for select-options field - Company code.
Hi experts,
i have company code field on the report selection screen and i have to validate the authorization check for BUKRS.
How to do authorization check for a select-options field?
Any function modules used to write the authorization check for a SELECT-OPTIONS FIELD?
Thanks.>
RNB wrote:
> Any function modules used to write the authorization check for a SELECT-OPTIONS FIELD?
Does it hurt to type a few lines of code? Why do you need an FM for this my friend?
Anyways can you please tell which SAP application area (viz. FI, SD etc.) do you want to run the report?
Suhas -
Prevent CO cross company postings - cobl-bukrs ?
Hi,
the last time I created a CO validation to prevent cross company CO postings is so long ago, that I can not remember. But i remeber something like "sender comp code <> receiv comp code".
I am trying to creat this again, but do not find the cobl field for receiving company code.
The I fould KM 0120025231 0000491809 2006 (KB21N does not check company code for intercompany posting)
where the solution is to be:
Prerequisite: "No precondition necessary" TRUE
Check: COBL-BUKRS <> COBL-BUKRS
Message: own created message ZZ 010 as a Message type 'E'
1. this prevents now all postings not only cross company
2. I dont get the idea of COBL-BUKRS <> COBL-BUKRS (like if 1 <> 1 which could never happen)
Hints highly appreciated
BjoernHi Bjoern,
Eli is right. I just had look at the old message. Basically she was right...you might have overlooked that she was refering to event "2"...hence the validation rule is:
COBL_RECEIVER-BUKRS < > COBL_SENDER-BUKRS
Regards
Karl
Edited by: Karl Helm on Mar 12, 2009 4:14 PM -
How to use pf-status u2018menuu2019 in ALV report ?
Hi Friends,
How to use pf-status u2018menuu2019 in ALV report ?
I want to use back button ( F3). whenever press it should show
another report.
I used subroutine
form SUB_ERROR_OUTPUT USING RT_EXTAB TYPE SLIS_T_EXTAB .
SET PF-STATUS 'ZMENU' EXCLUDING RT_EXTAB. u201C( the button name is u201C back u201C)
CASE SY-UCOMM.
*WHEN '&F03'.
WHEN 'BACK'
( my coding is there ).
endcase.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PF_STATUS_SET = 'SUB_ERROR_OUTPUT'
but it is executing, working the back button but not showing another report .
any other procedure to use back button in alv report ?
plz any idea .
For correct answer reword most.
Thanking you.Purchase day Book .
Data to be down loaded / printed for EDP dept. CGL.
CGL - Requirement .
WRITTEN BY : ADI.****
*CONSULTANT : SANJAY JAJOO..
AS PER DP REQUIREMENT.
-CHANGED BY : KRISHNA MOHAN (15/01/2002)--
-CHANGE REQ BY : JAJU S--
-DESCRIPTION : SUMMRY BY TAX CODE WISE & GL CODE WISE--
---MODIFIED LINES: -
---CHANGED BY : -
---CHANGE REQ BY : -
---DESCRIPTION : -
---MODIFIED LINES: -
*---changed by : sanjay jajoo on 23/08
*---changed req by: Ranka
*---Description : Inserting Range of period as sel field
changed by : krishna mohan
func. consultant: sanjay jajoo
REPORT ZMMPURDB MESSAGE-ID 00
LINE-SIZE 255
LINE-COUNT 60
NO STANDARD PAGE HEADING .
TABLES : MKPF , MSEG ,SKAT,
EKKO , EKPO , EKBE ,
BSEG , BKPF , BSET ,
T009B , T001 , T007S ,
T001W , T001K ,LFA1.
******Table deactivated on 30/8/2000------jaju
*tables : zcgltaxatn .
DATA : ZFILE1(65) VALUE '/DOWNLOAD/'.
DATA : ZFILE2(65) .
DATA : ZFILE(30) TYPE C VALUE '/DOWNLOAD/'.
DATA : ZMON(2).
DATA : ZTOTAL(11) TYPE N.
DATA: ZTOT1 TYPE P DECIMALS 2.
DATA: ZTXT LIKE SKAT-TXT50.
TYPES: BEGIN OF COMPANY ,
HKONT LIKE BSEG-HKONT,
TOTAL LIKE BSEG-DMBTR,
END OF COMPANY.
DATA: COMP TYPE COMPANY,
COMPTAB TYPE HASHED TABLE OF COMPANY WITH UNIQUE KEY HKONT
WITH HEADER LINE.
DATA : NEXT LIKE BSEG-BUZEI. "A.A. (28/03/2000)
DATA : DOC LIKE BSEG-BELNR. "A.A. (28/03/2000)
DATA S_GSBER.
DATA: CTR TYPE I.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-B01.
PARAMETERS : T_BUKRS LIKE T001-BUKRS OBLIGATORY MEMORY ID BUK .
***********CH--ID- ADI- 29 / 09 / 1999
SELECT-OPTIONS : ZGL FOR BSEG-HKONT OBLIGATORY.
***********CH--ID- ADI- 29 / 09 / 1999
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(9) TEXT-C01 .
PARAMETERS : POPER RADIOBUTTON GROUP RAD1 .
SELECTION-SCREEN COMMENT 13(7) TEXT-C02 .
PARAMETERS : MONTH RADIOBUTTON GROUP RAD1 .
SELECTION-SCREEN COMMENT 23(8) TEXT-C03 .
SELECTION-SCREEN POSITION 33 .
commented on 22/08 sanjay jajoo
*PARAMETERS : T_MONAT LIKE BKPF-MONAT .
SELECTION-SCREEN END OF LINE.
PARAMETERS : T_GJAHR LIKE BKPF-GJAHR OBLIGATORY .
SELECTION-SCREEN SKIP 1.
SELECT-OPTIONS : S_DOCTYP FOR BKPF-BLART,
S_VENDOR FOR LFA1-LIFNR MATCHCODE OBJECT KRED,
S_MATNR FOR BSEG-MATNR NO-DISPLAY,
T_BUDAT FOR MKPF-BUDAT NO-EXTENSION MODIF ID DAT,
p_gsber FOR bseg-gsber OBLIGATORY,
P_GSBER FOR BSEG-GSBER,
mod starts for inserting range of period - sanjay jajoo
T_MONAT FOR BKPF-MONAT OBLIGATORY.
mod ends
*SELECT-OPTIONS: br_blart FOR mkpf-blart.
*Select-options: br_blart for bkpf-blart.
SELECTION-SCREEN END OF BLOCK B1 .
Start of Delete by B.Elan on 23/12/2005
*PARAMETERS : errors AS CHECKBOX .
*PARAMETERS : summary AS CHECKBOX .
*PARAMETERS : nodetail AS CHECKBOX .
**selection-screen skip 2.
*SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-b03. "<<<
*Add
*PARAMETER : stax_reg RADIOBUTTON GROUP rad2 . "<<<
*Add
*PARAMETER : pur_db RADIOBUTTON GROUP rad2 . "<<<
*Add
*SELECTION-SCREEN END OF BLOCK b3 . "<<< Add
*SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-b02.
*PARAMETERS : display RADIOBUTTON GROUP grp1 ,
dload RADIOBUTTON GROUP grp1.
*PARAMETERS : fname1 LIKE rlgrap-filename .
*DATA : zdoc LIKE bseg-belnr.
*DATA : fname LIKE rlgrap-filename.
*SELECTION-SCREEN END OF BLOCK b2 .
End of Delete by B.Elan on 23/12/2005
Start of Insert by B.Elan on 23/12/2005
SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(5) TEXT-C01.
PARAMETER : PUR_DB RADIOBUTTON GROUP RAD2.
SELECTION-SCREEN COMMENT 10(25) TEXT-C06.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(5) TEXT-C01.
PARAMETERS : MAT_SM RADIOBUTTON GROUP RAD2.
SELECTION-SCREEN COMMENT 10(25) TEXT-C04.
SELECTION-SCREEN COMMENT 35(5) TEXT-C01.
PARAMETERS : VEN_SM RADIOBUTTON GROUP RAD2.
SELECTION-SCREEN COMMENT 44(20) TEXT-C05.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(5) TEXT-C01.
PARAMETERS : MAT_DT RADIOBUTTON GROUP RAD2.
SELECTION-SCREEN COMMENT 10(25) TEXT-C07.
SELECTION-SCREEN COMMENT 35(5) TEXT-C01.
PARAMETERS : VEN_DT RADIOBUTTON GROUP RAD2.
SELECTION-SCREEN COMMENT 44(20) TEXT-C08.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK B2.
End of Insert by B.Elan on 23/12/2005
Hard coded values used in the program
added by krishna mohan on 09/02/02
DATA : BEGIN OF IT_MSEG OCCURS 0,
BELNR LIKE BSEG-BELNR,
MBLNR LIKE MSEG-MBLNR,
EBELN LIKE BSEG-EBELN,
EBELP LIKE BSEG-EBELP,
END OF IT_MSEG.
mod ends
Start of Insert by B.Elan on 23/12/2005
*--vikky
DATA : BEGIN OF IT_FINAL OCCURS 0,
MATNR LIKE MARA-MATNR,
BLART LIKE BKPF-BLART, " doctype
BELNR LIKE BSEG-BELNR, "sr - nO 10
XBLNR LIKE BKPF-XBLNR , " Bill-no 16
NAME1_VENDOR(25),
"lfa1-name1, " Vendor Name 35
HKONT LIKE BSEG-HKONT , " Alloc-cd 10
MWSKZ LIKE EKPO-MWSKZ , " St-cd 2
BUDAT LIKE BKPF-BUDAT , " Bill-dt 10
DUE_DATE LIKE BSEG-ZFBDT , " Due date 10
PON LIKE EKKO-EBELN , " PON 10
MAKTX LIKE MAKT-MAKTX, "Material text 40
MBLNR LIKE MSEG-MBLNR,
QTY(8) TYPE P DECIMALS 2 , "Qty 11
RATE(9) TYPE P DECIMALS 2 , "Rate11
DISCOUNT(7) TYPE P DECIMALS 2, "DISCOUNT 11
PROD-AMT(9) TYPE P DECIMALS 2,
"AMOUNT 13
EXCISE(8) TYPE P DECIMALS 2 , "eXCISE TAX 11
SALES(5) TYPE P DECIMALS 2 , "SALES TAX 11
FREIGHT(9) TYPE P DECIMALS 2, "FREIGHT 11
OTHERS(11) TYPE P DECIMALS 2, " OTHERS 11
TOTAL(9) TYPE P DECIMALS 2, "TOTAL 17
END OF IT_FINAL.
*DATA : BEGIN OF IT_FINAL OCCURS 0,
MATNR LIKE MARA-MATNR,
BLART LIKE BKPF-BLART, " doctype
BELNR LIKE BSEG-BELNR, "sr - nO 10
XBLNR LIKE BKPF-XBLNR , " Bill-no 16
NAME1_VENDOR(25),
"lfa1-name1, " Vendor Name 35
HKONT LIKE BSEG-HKONT , " Alloc-cd 10
MWSKZ LIKE EKPO-MWSKZ , " St-cd 2
BUDAT LIKE BKPF-BUDAT , " Bill-dt 10
DUE_DATE LIKE BSEG-ZFBDT , " Due date 10
PON LIKE EKKO-EBELN , " PON 10
MAKTX LIKE MAKT-MAKTX, "Material text 40
MBLNR LIKE MSEG-MBLNR,
QTY(13) TYPE P DECIMALS 2 , "Qty 11
RATE(13) TYPE P DECIMALS 2 , "Rate 11
DISCOUNT(13) TYPE P DECIMALS 2, "DISCOUNT 11
PROD-AMT(13) TYPE P DECIMALS 2,
"AMOUNT 13
EXCISE(13) TYPE P DECIMALS 2 , "eXCISE TAX 11
SALES(13) TYPE P DECIMALS 2 , "SALES TAX 11
FREIGHT(13) TYPE P DECIMALS 2, "FREIGHT 11
OTHERS(13) TYPE P DECIMALS 2, " OTHERS 11
TOTAL(13) TYPE P DECIMALS 2, "TOTAL 17
END OF IT_FINAL.
*--vikky
DATA : BEGIN OF IT_FINAL_VN OCCURS 0,
NAME1_VENDOR(25),
"lfa1-name1, " Vendor Name 35
MATNR LIKE MARA-MATNR,
BLART LIKE BKPF-BLART, " doctype
BELNR LIKE BSEG-BELNR, "sr - nO 10
XBLNR LIKE BKPF-XBLNR , " Bill-no 16
HKONT LIKE BSEG-HKONT , " Alloc-cd 10
MWSKZ LIKE EKPO-MWSKZ , " St-cd 2
BUDAT LIKE BKPF-BUDAT , " Bill-dt 10
DUE_DATE LIKE BSEG-ZFBDT , " Due date 10
PON LIKE EKKO-EBELN , " PON 10
MAKTX LIKE MAKT-MAKTX, "Material text 40
MBLNR LIKE MSEG-MBLNR,
QTY(8) TYPE P DECIMALS 2 , "Qty 11
RATE(9) TYPE P DECIMALS 2 , "Rate 11
DISCOUNT(7) TYPE P DECIMALS 2, "DISCOUNT 11
PROD-AMT(9) TYPE P DECIMALS 2,
"AMOUNT 13
EXCISE(5) TYPE P DECIMALS 2 , "eXCISE TAX 11
SALES(5) TYPE P DECIMALS 2 , "SALES TAX 11
FREIGHT(5) TYPE P DECIMALS 2, "FREIGHT 11
OTHERS(9) TYPE P DECIMALS 2, " OTHERS 11
TOTAL(9) TYPE P DECIMALS 2, "TOTAL 17
END OF IT_FINAL_VN.
End of Insert by B.Elan on 23/12/2005
DATA: BEGIN OF ITAB_DISPLAY OCCURS 0,
BLART LIKE BKPF-BLART, " doctype
BELNR LIKE BSEG-BELNR, "sr - nO 10
XBLNR LIKE BKPF-XBLNR , " Bill-no 16
NAME1_VENDOR(25), "lfa1-name1, " Vendor Name 35
HKONT LIKE BSEG-HKONT , " Alloc-cd 10
MWSKZ LIKE EKPO-MWSKZ , " St-cd 2
BUDAT LIKE BKPF-BUDAT , " Bill-dt 10
DUE_DATE LIKE BSEG-ZFBDT , " Due date 10
PON LIKE EKKO-EBELN , " PON 10
MAKTX LIKE MAKT-MAKTX, "Material text 40
QTY(8) TYPE P DECIMALS 2 , "Qty 11
"qty 5
RATE(5) TYPE P DECIMALS 2 , "Rate 11
mod starts on 21/08 for inc size to 7
RATE(9) TYPE P DECIMALS 2 , "Rate 11
"Rate 7
mod ends - sanjay jajoo 21/08
DISCOUNT(7) TYPE P DECIMALS 2, "DISCOUNT 11
PROD-AMT(9) TYPE P DECIMALS 2, "AMOUNT 13
EXCISE(5) TYPE P DECIMALS 2 , "eXCISE TAX 11
SALES(5) TYPE P DECIMALS 2 , "SALES TAX 11
FREIGHT(5) TYPE P DECIMALS 2, "FREIGHT 11
OTHERS(9) TYPE P DECIMALS 2, " OTHERS 11 " added by vik on
*21.08.2008
TOTAL(9) TYPE P DECIMALS 2, "TOTAL 17
TOTAL1(9) TYPE P DECIMALS 2,
MATNR LIKE MARA-MATNR,
EBELN LIKE EKPO-EBELN,
EBELP LIKE EKPO-EBELP,
END OF ITAB_DISPLAY.
DATA: BEGIN OF ITAB_TOTAL1 OCCURS 0,
HKONT LIKE BSEG-HKONT,
TOTAL TYPE P DECIMALS 2,
TXT50 LIKE SKAT-TXT50,
END OF ITAB_TOTAL1.
DATA: BEGIN OF ITAB_KONV OCCURS 0,
KNUMV LIKE KONV-KNUMV,
KPOSN LIKE KONV-KPOSN,
STUNR LIKE KONV-STUNR,
ZAEHK LIKE KONV-ZAEHK,
KSCHL LIKE KONV-KSCHL,
KWERT LIKE KONV-KWERT,
END OF ITAB_KONV.
DATA:BEGIN OF ITAB_RATE_MODVAT OCCURS 0,
EBELN LIKE EKPO-EBELN,
EBELP LIKE EKPO-EBELP,
MENGE LIKE EKPO-MENGE,
BRTWR LIKE EKPO-BRTWR,
KZWI5 LIKE EKPO-KZWI5,
KNUMV LIKE EKKO-KNUMV,
MATNR LIKE EKPO-MATNR,
TXZ01 LIKE EKPO-TXZ01,
END OF ITAB_RATE_MODVAT.
DATA: BEGIN OF ITAB_PO OCCURS 0,
EBELN LIKE EKPO-EBELN,
EBELP LIKE EKPO-EBELP,
END OF ITAB_PO.
DATA: BEGIN OF ITAB_PO_ITEM OCCURS 0,
BELNR LIKE BSEG-BELNR,
EBELN LIKE BSEG-EBELN,
BUZID LIKE BSEG-BUZID,
XBLNR LIKE BKPF-XBLNR,
MATNR LIKE BSEG-MATNR,
EBELP LIKE BSEG-EBELP,
MENGE LIKE BSEG-MENGE,
WRBTR LIKE BSEG-WRBTR,
EXCISE LIKE BSEG-DMBTR, " ADDED ON 21/01/02 FOR 27500 EXCISE
SGTXT LIKE BSEG-SGTXT, " ADDED ON 24/01/02
FLAG,
END OF ITAB_PO_ITEM.
DATA:BEGIN OF I_LFA1 OCCURS 0,
LIFNR LIKE BSEG-LIFNR,
END OF I_LFA1.
DATA: BEGIN OF I_VENDOR OCCURS 0,
LIFNR LIKE LFA1-LIFNR,
NAME1 LIKE LFA1-NAME1,
END OF I_VENDOR.
DATA: BEGIN OF ITAB_PO_OTHERS OCCURS 0,
BELNR LIKE BSEG-BELNR,
MATNR LIKE BSEG-MATNR,
EBELN LIKE BSEG-EBELN,
EBELP LIKE BSEG-EBELP,
MENGE LIKE BSEG-MENGE,
WRBTR LIKE BSEG-WRBTR,
END OF ITAB_PO_OTHERS.
DATA: BEGIN OF ITAB_FINAL OCCURS 0,
BUKRS LIKE BSEG-BUKRS,
BELNR LIKE BSEG-BELNR,
GJAHR LIKE BSEG-GJAHR,
BUZEI LIKE BSEG-BUZEI,
BUZID LIKE BSEG-BUZID,
SHKZG LIKE BSEG-SHKZG,
EBELN LIKE BSEG-EBELN,
EBELP LIKE BSEG-EBELP,
MENGE LIKE BSEG-MENGE,
WRBTR LIKE BSEG-WRBTR,
MATNR LIKE BSEG-MATNR,
HKONT LIKE BSEG-HKONT, " ADDED ON 21/01/02 FOR 27500 EXCISE
SGTXT LIKE BSEG-SGTXT, " ADDED ON 24/01/02 FOR SALES TAX
END OF ITAB_FINAL.
DATA : BEGIN OF ITAB OCCURS 100 ,
MWSKZ LIKE EKPO-MWSKZ , " St-cd
HKONT LIKE BSEG-HKONT , " Alloc-cd
MBLNR LIKE MKPF-MBLNR , " Sr-No
LIFNR LIKE LFA1-LIFNR , " Supp-cd
XBLNR LIKE BKPF-XBLNR , " Bill-no
BUDAT LIKE BKPF-BUDAT , " Bill-dt
DUE_DATE LIKE BSEG-ZFBDT , " Due date
PON LIKE EKKO-EBELN , " PON
BELNR LIKE BKPF-BELNR , " CCI no
DMBTR LIKE BSEG-DMBTR , " Prod-amount
EXCISE LIKE BSEG-DMBTR , " Excise / ModVAT
ST_INV LIKE BSEG-DMBTR , " Sales Tax Loaded on Inv.
ST_SET LIKE BSEG-DMBTR , " Sales Tax setoff .
OCT_TOT LIKE BSEG-DMBTR , " A,A, (29/03/2000) Octroi chargs
PT_PABLE LIKE BSEG-DMBTR , " Purchase tax payable
ST_TOT LIKE BSEG-DMBTR , " Sales Tax total
OTHR_CHRG LIKE BSEG-DMBTR , " Other chagres
NEBTR LIKE BSEG-NEBTR, " Total-amount
NAME1_VENDOR LIKE LFA1-NAME1, " Vendor Name
END OF ITAB.
DATA: BEGIN OF ITAB_DOC OCCURS 0,
BELNR LIKE BKPF-BELNR,
BLART LIKE BKPF-BLART,
END OF ITAB_DOC.
DATA : BEGIN OF DOCTAB OCCURS 100 ,
MWSKZ LIKE BSEG-MWSKZ ,
HKONT LIKE BSEG-HKONT ,
BELNR LIKE BKPF-BELNR ,
Changed By Pankaj 19.03.99
Included field fiscal year
GJAHR LIKE BKPF-GJAHR ,
BUDAT LIKE BKPF-BUDAT ,
XBLNR LIKE BKPF-XBLNR ,
LIFNR LIKE LFA1-LIFNR ,
ZTERM LIKE BSEG-ZTERM ,
AMOUNT LIKE BSEG-DMBTR ,
DMBTR LIKE BSEG-DMBTR ,
OTHR_CHRG LIKE BSEG-DMBTR ,
MBLNR LIKE MKPF-MBLNR ,
MJAHR LIKE MSEG-MJAHR ,
DUE_DATE LIKE BSEG-ZFBDT ,
PON LIKE EKKO-EBELN ,
JMO1 LIKE BSEG-DMBTR ,
JMO2 LIKE BSEG-DMBTR ,
JIP1 LIKE BSEG-DMBTR ,
JIP2 LIKE BSEG-DMBTR ,
************CH-ID-ADI-START-28 / 09 / 1999
JIP4 LIKE BSEG-DMBTR ,
ZTUT LIKE BSEG-DMBTR ,
*****************ABEY
ZOCT LIKE BSEG-DMBTR ,
*****************END
************CH-ID-ADI-START-28 / 09 / 1999
ZSET LIKE BSEG-DMBTR ,
ZPTX LIKE BSEG-DMBTR ,
BLART LIKE BKPF-BLART ,
END OF DOCTAB .
Download for EDP "EDP
DATA : BEGIN OF DOWNLOAD OCCURS 100 ,
SIGN1(1) ,
TOT_VAL(11) TYPE N,
SIGN2(1) ,
TAXABLE(11) TYPE N ,
SIGN3(1) ,
TOT_TAX(11) TYPE N ,
SIGN4(1) ,
SURCHARG(9) TYPE N ,
SIGN5(1) ,
ST_AMT(9) TYPE N ,
SIGN6(1) ,
OTH_CHRG(9) TYPE N ,
******************************ch-adi-start-28 / 09 / 1999
SIGN7(1),
TOT(9) TYPE N,
******************************ch-adi-end-28 / 09 / 1999
TYPE(1) TYPE N ,
STKY1(1) TYPE N ,
STBR(2) ,
STDV(2) ,
STCC(1) ,
STKY(1) ,
STDC(2) TYPE N ,
STTYP(1) ,
STCODE(2) ,
STRATE(2) TYPE N ,
STRTT(2) TYPE N ,
SERIAL_NO(6) TYPE N ,
STACP(9) ,
BLANK1(3) ,
STYRMN(6) ,
BLANK2(7) TYPE C .
DATA : END OF DOWNLOAD .
DATA : BEGIN OF GLTAB OCCURS 5 ,
MWSKZ LIKE BSEG-MWSKZ, " << ADD A.A. (01.02.2000)
HKONT LIKE BSEG-HKONT ,
DMBTR LIKE BSEG-DMBTR , " Prod-amount
EXCISE LIKE BSEG-DMBTR , " Excise / ModVAT
ST_INV LIKE BSEG-DMBTR , " Sales Tax Loaded on Inv.
ST_SET LIKE BSEG-DMBTR , " Sales Tax setoff .
PT_PABLE LIKE BSEG-DMBTR , " Purchase tax payable
ST_TOT LIKE BSEG-DMBTR , " Sales Tax total
OTHR_CHRG LIKE BSEG-DMBTR , " Other Charges
NEBTR LIKE BSEG-NEBTR. " Total-amount
DATA : END OF GLTAB .
DATA : BEGIN OF ERRORTAB OCCURS 5 .
INCLUDE STRUCTURE ITAB .
DATA : END OF ERRORTAB .
*- Start of change by Raj on 3-Spet-05
DATA : V_TMPVAL TYPE P DECIMALS 2.
*- End of change by Raj on 3-Spet-05
DATA : STRING LIKE BKPF-AWKEY ,
V_NO TYPE I,
V_EBELN LIKE BSEG-EBELN,
V_MATNR LIKE BSEG-MATNR. " ADDED ON 21/01/02 FOR BUZID = 'S'
Start of Insert by B.Elan on 23/12/2005
WORK AREA
DATA : WA_DISPLAY LIKE ITAB_DISPLAY.
DATA : V_UCOMM TYPE SY-UCOMM.
CONSTANTS : C_X TYPE C VALUE 'X'.
End of Insert by B.Elan on 23/12/2005
AT SELECTION-SCREEN ON T_BUKRS.
SELECT SINGLE * FROM T001 WHERE BUKRS = T_BUKRS .
IF SY-SUBRC NE 0 .
MESSAGE E368 WITH T_BUKRS TEXT-M01 .
ENDIF .
AT SELECTION-SCREEN ON T_MONAT.
PERFORM check_period_year USING 'X'. " COMMENTED
AT SELECTION-SCREEN ON T_GJAHR.
PERFORM check_period_year USING ' '. "COMMENTED
Start of Delete by B.Elan on 23/12/2005
*AT SELECTION-SCREEN ON RADIOBUTTON GROUP grp1 .
CLEAR fname .
DATA : BEGIN OF xt247 OCCURS 12 .
INCLUDE STRUCTURE t247 .
DATA : END OF xt247 .
CHECK dload EQ 'X' .
REFRESH xt247 .
IF poper EQ 'X' .
MESSAGE e368 WITH text-m05 .
ENDIF .
CALL FUNCTION 'MONTH_NAMES_GET'
TABLES
month_names = xt247
EXCEPTIONS
month_names_not_found = 1
OTHERS = 2.
READ TABLE xt247 WITH KEY mnr = t_monat .
CONCATENATE 'STAXSUMM.' xt247-ktx INTO fname .
CONCATENATE '
DOWNLOAD\' fname INTO fname1.
CONCATENATE zfile1 fname INTO zfile2.
CONDENSE fname1 NO-GAPS.
CONDENSE zfile2 NO-GAPS.
CONCATENATE 'STAXSUMM.' xt247-ktx INTO fname .
End of Delete by B.Elan on 23/12/2005
AT SELECTION-SCREEN OUTPUT .
LOOP AT SCREEN .
IF SCREEN-NAME EQ 'FNAME' .
SCREEN-INPUT = 0.
MODIFY SCREEN .
ENDIF .
IF SCREEN-GROUP2 EQ 'DBS' .
SCREEN-ACTIVE = 0 .
MODIFY SCREEN .
IF SCREEN-NAME EQ 'BR_BLART-LOW' .
Form the select option for the LDB .
CLEAR BR_BLART . REFRESH BR_BLART .
BR_BLART-SIGN = 'I' .
BR_BLART-OPTION = 'EQ' .
BR_BLART-LOW = 'RE' .
APPEND BR_BLART .
BR_BLART-SIGN = 'I' .
BR_BLART-OPTION = 'EQ' .
BR_BLART-LOW = 'SR' .
APPEND BR_BLART .
BR_BLART-SIGN = 'I' .
BR_BLART-OPTION = 'EQ' .
BR_BLART-LOW = 'SP' .
APPEND BR_BLART . " ADD ON 11122003 JAJ
BR_BLART-SIGN = 'I' .
BR_BLART-OPTION = 'EQ' .
br_blart-low = 'VI' .
BR_BLART-LOW = 'ST'.
APPEND BR_BLART .
BR_BLART-LOW = 'S1'.
APPEND BR_BLART .
BR_BLART-LOW = 'P1'.
APPEND BR_BLART .
BR_BLART-LOW = 'PM'.
APPEND BR_BLART .
BR_BLART-LOW = 'R1'.
APPEND BR_BLART .
BR_BLART-SIGN = 'I' .
BR_BLART-OPTION = 'EQ' .
BR_BLART-LOW = 'KR' .
APPEND BR_BLART .
BR_BLART-SIGN = 'I' .
BR_BLART-OPTION = 'EQ' .
*************CH-ID-ADI---30 / 09 / 1999.
BR_BLART-LOW = 'RA'.
APPEND BR_BLART .
BR_BLART-SIGN = 'I' .
BR_BLART-OPTION = 'EQ' .
BR_BLART-LOW = 'EM'.
APPEND BR_BLART .
BR_BLART-SIGN = 'I' .
BR_BLART-OPTION = 'EQ' .
BR_BLART-LOW = 'EI' .
APPEND BR_BLART .
ENDIF .
ENDIF .
CHECK SCREEN-GROUP1 EQ 'DAT' .
SCREEN-INPUT = 0.
MODIFY SCREEN .
ENDLOOP .
START-OF-SELECTION .
Block 1 - Selection of accounting documents in the posting period
is done through the LDB
GET BKPF .
commented on 22/08
CHECK BKPF-MONAT = T_MONAT.
CHECK BKPF-MONAT IN T_MONAT.
CHECK BKPF-GJAHR = T_GJAHR.
CHECK BKPF-STBLG IS INITIAL . "<<<< Reversed
*CHECK bkpf-budat IN t_budat .
CHECK BKPF-BUKRS EQ T_BUKRS .
CHECK BKPF-BUKRS EQ T_BUKRS .
CHECK BKPF-BSTAT EQ SPACE . "<<< Sample docs
CHECK BKPF-BLART EQ 'RE' "MM-IV
OR BKPF-BLART EQ 'KR' "FI-IV
OR bkpf-blart EQ 'VI' "FI-IV Direct
*************CH-ID-ADI-30 / 09 / 1999
OR bkpf-blart EQ 'RA' "CASH CCI
OR bkpf-blart EQ 'EM' "MAINTAINANCE
OR bkpf-blart EQ 'EI' . "IDT
OR BKPF-BLART EQ 'P1'
OR BKPF-BLART EQ 'PM'
OR BKPF-BLART EQ 'R1'
OR BKPF-BLART EQ 'S1'
OR BKPF-BLART EQ 'ST'
OR BKPF-BLART EQ 'SR' " ADD ON 101203 JAJ
OR BKPF-BLART EQ 'SP'.
*************CH-ID-ADI-30 / 09 / 1999
CLEAR DOCTAB .
DOCTAB-BLART = BKPF-BLART .
DOCTAB-BELNR = BKPF-BELNR .
DOCTAB-BUDAT = BKPF-BUDAT .
DOCTAB-XBLNR = BKPF-XBLNR .
Added By Pankaj 19.03.99
Initializing fiscal year for document table
DOCTAB-GJAHR = BKPF-GJAHR .
APPEND DOCTAB.
Tax details
GET BSET . " Commented because LDB gives wrong BSET entries
" for some documents
CASE BSET-KSCHL .
WHEN 'JMO1' .
DOCTAB-JMO1 = DOCTAB-JMO1 + BSET-HWSTE .
WHEN 'JMO2' .
DOCTAB-JMO2 = DOCTAB-JMO2 + BSET-HWSTE .
WHEN 'JIP1' .
DOCTAB-JIP1 = DOCTAB-JIP1 + BSET-HWSTE .
WHEN 'JIP2' .
DOCTAB-JIP2 = DOCTAB-JIP2 + BSET-HWSTE .
WHEN 'ZSET' .
break deven .
DOCTAB-ZSET = DOCTAB-ZSET + BSET-HWSTE .
WHEN 'ZPTX' .
DOCTAB-ZPTX = DOCTAB-ZPTX + BSET-HWSTE .
ENDCASE .
DOCTAB-MWSKZ = BSET-MWSKZ.
MODIFY DOCTAB INDEX SY-TABIX.
Item details
*changed by srinivas yerra.
GET BSEG .
IF BSEG-KOART = 'K' . "<<< Vendor Line
IF BSEG-KOART = 'K' .
*end of chnages by srinivas yerra.
DOCTAB-LIFNR = BSEG-LIFNR .
IF NOT BSEG-ZTERM IS INITIAL .
DOCTAB-ZTERM = BSEG-ZTERM .
DOCTAB-DUE_DATE = BSEG-ZFBDT + BSEG-ZBD1T .
ENDIF .
IF BSEG-SHKZG EQ 'H' . "<< Add credits
DOCTAB-AMOUNT = DOCTAB-AMOUNT + BSEG-DMBTR .
ELSE . "<< Subtr debits
DOCTAB-AMOUNT = DOCTAB-AMOUNT - BSEG-DMBTR .
ENDIF .
ENDIF .
CASE BSEG-KTOSL .
WHEN 'WRX' .
DOCTAB-PON = BSEG-EBELN .
IF DOCTAB-MWSKZ IS INITIAL .
DOCTAB-MWSKZ = BSEG-MWSKZ .
ENDIF .
WHEN 'BSX' .
***********ABEY
IF NEXT = BSEG-BUZEI
AND
DOC = BSEG-BELNR
AND
( BSEG-BUZID = 'M'
OR
BSEG-HKONT = 50765 ).
DOCTAB-ZOCT = DOCTAB-ZOCT + BSEG-DMBTR.
IF BSEG-SHKZG EQ 'H' . "<< Subtr credits
DOCTAB-OTHR_CHRG = DOCTAB-OTHR_CHRG - BSEG-DMBTR .
ELSE . "<< Add debits
DOCTAB-OTHR_CHRG = DOCTAB-OTHR_CHRG + BSEG-DMBTR .
ENDIF .
ENDIF .
************END
IF BSEG-SHKZG EQ 'S' .
DOCTAB-DMBTR = DOCTAB-DMBTR + BSEG-DMBTR .
ELSE .
DOCTAB-DMBTR = DOCTAB-DMBTR - BSEG-DMBTR .
ENDIF .
WHEN 'OCT' OR 'FRE' OR 'FR1' OR SPACE .
*****CH-ID-ADI-30 / 09 /1999.
IF ( ( BKPF-BLART = 'EM' OR BKPF-BLART = 'RA' OR BKPF-BLART =
'EI')
AND BSEG-KTOSL = SPACE ) OR BSEG-MWSKZ = '9W' OR BSEG-MWSKZ =
'K9' OR
BSEG-MWSKZ =
'X9'.
DOCTAB-OTHR_CHRG = 0.
ELSE.
*********CH-ID-ADI--01 / 10 / 1999
Other Charges only for accounts other than vendor acc.
CHECK BSEG-BUZID NE 'T' .
CHECK BSEG-BUZID NE 'P' .
IF BSEG-KOART NE 'K' .
*********ABEY (25/02/2000), (21/02/2000)
IF BSEG-BUZID = 'F'
OR BSEG-HKONT = 75461.
NEXT = BSEG-BUZEI + 1.
DOC = BSEG-BELNR.
DOCTAB-ZOCT = DOCTAB-ZOCT + BSEG-DMBTR.
ENDIF.
IF BSEG-BUZEI = NEXT
AND
( BSEG-BUZID = 'M'
OR
BSEG-HKONT = 50765 ).
DOCTAB-ZOCT = DOCTAB-ZOCT + BSEG-DMBTR.
ENDIF.
*********END
IF BSEG-SHKZG EQ 'H' . "<< Subtr credits
DOCTAB-OTHR_CHRG = DOCTAB-OTHR_CHRG - BSEG-DMBTR .
ELSE . "<< Add debits
DOCTAB-OTHR_CHRG = DOCTAB-OTHR_CHRG + BSEG-DMBTR .
ENDIF .
ENDIF .
*****NEXT-LINE ADDED BY ADI
ENDIF .
*************END.
ENDCASE .
*CHANGED BY SRINIVAS YERRA
*MODIFY DOCTAB INDEX SY-TABIX.
APPEND DOCTAB.
*END OF CHANGES.
PO History
GET EKBE .
CHECK DOCTAB-BELNR EQ EKBE-BELNR .
DOCTAB-MBLNR = EKBE-LFBNR .
DOCTAB-MJAHR = EKBE-LFGJA .
MODIFY DOCTAB INDEX SY-TABIX .
PERFORM show_indicator USING text-m02 .
*PERFORM convert_data.
END-OF-SELECTION .
Data read from LDB is converted into printable format.
PERFORM SHOW_INDICATOR USING TEXT-M04 .
PERFORM CONVERT_DATA .
Start of Delete by B.Elan on 23/12/2005
IF stax_reg EQ 'X' . "<<< Add
SORT itab BY mwskz hkont belnr .
ELSE . "<<< Add
SORT itab BY belnr . "<<< Add
SORT itab BY pon.
ENDIF . "<<< Add
Perform further operation based on user input
IF display EQ 'X' .
PERFORM write_itab.
PERFORM write_data .
ELSE .
PERFORM download_data .
ENDIF .
End of Delete by B.Elan on 23/12/2005
Start of Insert by B.Elan on 23/12/2005
SORT ITAB BY BELNR.
PERFORM WRITE_DATA.
IF MAT_SM = C_X.
PERFORM WRITE_MATERIAL_SUMMARY.
ELSEIF MAT_DT = C_X.
PERFORM WRITE_MATERIAL_DETAILS.
ELSEIF VEN_SM = C_X.
PERFORM WRITE_VENDOR_SUMMARY.
ELSEIF VEN_DT = C_X.
PERFORM WRITE_VENDOR_DETAILS.
ENDIF.
End of Insert by B.Elan on 23/12/2005
Start of Insert by B.Elan on 23/12/2005
AT USER-COMMAND.
V_UCOMM = SY-UCOMM.
CASE V_UCOMM.
WHEN 'DETLS'.
NEW-PAGE.
PUR_DB = C_X.
PERFORM CLEAR_DETAILS.
PERFORM WRITE_DATA.
WHEN 'MSUMRY'.
PERFORM WRITE_MATERIAL_SUMMARY.
WHEN 'MDETL'.
PERFORM WRITE_MATERIAL_DETAILS.
WHEN 'VSUMRY'.
PERFORM WRITE_VENDOR_SUMMARY.
WHEN 'VDETL'.
PERFORM WRITE_VENDOR_DETAILS.
WHEN 'EXIT'.
LEAVE PROGRAM.
ENDCASE.
End of Insert by B.Elan on 23/12/2005
*- - - - - - - - - End Of Execution .- - - - - - - - - - - - - - - - - -
TOP-OF-PAGE .
IF PUR_DB = C_X.
PERFORM TOP_OF_PAGE.
PERFORM TOP_OF_PAGE_PUR_DB.
ELSEIF MAT_SM = C_X.
PERFORM TOP_OF_PAGE.
PERFORM TOP_OF_PAGE_MAT_SM.
ELSEIF MAT_DT = C_X.
PERFORM TOP_OF_PAGE.
PERFORM TOP_OF_PAGE_MAT_DT.
ELSEIF VEN_SM = C_X.
PERFORM TOP_OF_PAGE.
PERFORM TOP_OF_PAGE_VEN_SM.
ELSEIF VEN_DT = C_X.
PERFORM TOP_OF_PAGE.
PERFORM TOP_OF_PAGE_VEN_DT.
ENDIF.
TOP-OF-PAGE DURING LINE-SELECTION.
CASE V_UCOMM.
WHEN 'DETLS'.
PERFORM TOP_OF_PAGE.
PERFORM TOP_OF_PAGE_PUR_DB.
WHEN 'MSUMRY'.
PERFORM TOP_OF_PAGE.
PERFORM TOP_OF_PAGE_MAT_SM.
WHEN 'MDETL'.
PERFORM TOP_OF_PAGE.
PERFORM TOP_OF_PAGE_MAT_DT.
WHEN 'VSUMRY'.
PERFORM TOP_OF_PAGE.
PERFORM TOP_OF_PAGE_VEN_SM.
WHEN 'VDETL'.
PERFORM TOP_OF_PAGE.
PERFORM TOP_OF_PAGE_VEN_DT.
ENDCASE.
*& Form WRITE_DATA
text *
FORM WRITE_DATA.
DATA: V_SALES LIKE ITAB_DISPLAY-SALES,
V_RATE LIKE ITAB_DISPLAY-RATE,
V_DISCOUNT LIKE ITAB_DISPLAY-DISCOUNT,
V_PROD-AMT LIKE ITAB_DISPLAY-PROD-AMT,
V_EXCISE1 LIKE ITAB_DISPLAY-EXCISE,
V_EXCISE LIKE ITAB_DISPLAY-EXCISE,
V_PON LIKE ITAB_DISPLAY-PON,
V_OTHERS LIKE ITAB_DISPLAY-OTHERS,
V_FREIGHT LIKE ITAB_DISPLAY-FREIGHT.
CLEAR ITAB .
Write the correct data i.e. tax code and G/L code both available .
LOOP AT ITAB .
*************CH-ID-ADI-30 / 09 / 1999
IF ( ITAB-MWSKZ = '9W' OR ITAB-MWSKZ = 'K9' OR ITAB-MWSKZ = 'X9' )
AND ITAB-OTHR_CHRG NE 0 .
ITAB-DMBTR = ITAB-OTHR_CHRG.
ITAB-OTHR_CHRG = 0.
MODIFY ITAB.
ENDIF.
ENDLOOP.
LOOP AT ITAB.
I_LFA1-LIFNR = ITAB-LIFNR.
APPEND I_LFA1.
CLEAR I_LFA1.
ENDLOOP.
SORT I_LFA1.
DELETE ADJACENT DUPLICATES FROM I_LFA1 COMPARING ALL FIELDS.
SELECT LIFNR
NAME1
FROM LFA1 INTO TABLE I_VENDOR
FOR ALL ENTRIES IN I_LFA1 WHERE
LIFNR = I_LFA1-LIFNR.
FREE I_LFA1.
LOOP AT ITAB.
READ TABLE I_VENDOR WITH KEY LIFNR = ITAB-LIFNR .
IF SY-SUBRC EQ 0.
ITAB-NAME1_VENDOR = I_VENDOR-NAME1.
MODIFY ITAB TRANSPORTING NAME1_VENDOR.
ENDIF.
ENDLOOP.
LOOP AT ITAB.
IF NOT ITAB-LIFNR IN S_VENDOR.
DELETE ITAB.
ENDIF.
ENDLOOP.
SELECT BUKRS BELNR GJAHR BUZEI BUZID SHKZG EBELN EBELP ERFMG WRBTR
MATNR HKONT SGTXT " ERFMG for MENGE,HKONT,SGTXT Added by KrishnaMohan
INTO TABLE ITAB_FINAL
FROM BSEG FOR ALL ENTRIES IN ITAB
WHERE BUKRS = T_BUKRS AND "'1000' AND
BELNR = ITAB-BELNR AND
*added by srinivas
hkont in zgl and
*end
GJAHR = T_GJAHR AND
*- Start of change by Raj on 030905
buzid IN ('W', 'M', 'K', 'S', 'F' , 'P' ) AND
BUZID IN ('W', 'M', 'K', 'S', 'F' , 'P' , 'T', ' ') AND
" ADD T 090206 JAJ
KOART <> 'K' AND " mod by vik on 21.08.2008" sjaj si
*- End of change by Raj on 030905
BUZID = P Added on 21/01/02 by Krishna Mohan
GSBER IN P_GSBER AND
gsber IN p_gsber OR gsber = ' ' AND
MATNR IN S_MATNR.
SELECT BELNR BLART INTO TABLE ITAB_DOC FROM BKPF
FOR ALL ENTRIES IN ITAB_FINAL WHERE
BUKRS = T_BUKRS AND "'1000' AND
BELNR = ITAB_FINAL-BELNR AND
GJAHR = T_GJAHR AND
BLART NOT IN ('WA' , 'WE').
SORT ITAB_DOC BY BELNR BLART.
LOOP AT ITAB_DOC.
IF NOT ITAB_DOC-BLART IN S_DOCTYP .
DELETE ITAB_DOC.
ENDIF.
ENDLOOP.
LOOP AT ITAB_FINAL.
READ TABLE ITAB_DOC WITH KEY BELNR = ITAB_FINAL-BELNR BINARY SEARCH.
IF SY-SUBRC NE 0.
DELETE ITAB_FINAL.
ENDIF.
ENDLOOP.
DELETE ITAB_FINAL WHERE BUZID = 'K' AND BUZEI = '1'.
LOOP AT ITAB_FINAL WHERE SHKZG = 'H'.
ITAB_FINAL-WRBTR = ITAB_FINAL-WRBTR * ( -1 ).
MODIFY ITAB_FINAL TRANSPORTING WRBTR.
ENDLOOP.
LOOP AT ITAB_FINAL WHERE BUZID = 'M'.
IF ITAB_FINAL-SGTXT NE ' '.
TRANSLATE ITAB_FINAL-SGTXT TO UPPER CASE.
MODIFY ITAB_FINAL.
ENDIF.
ENDLOOP.
LOOP AT ITAB_FINAL .
IF ITAB_FINAL-BUZID = 'W'.
CLEAR V_MATNR.
V_EBELN = ITAB_FINAL-EBELN.
V_MATNR = ITAB_FINAL-MATNR.
ITAB_PO_ITEM-BELNR = ITAB_FINAL-BELNR.
ITAB_PO_ITEM-BUZID = ITAB_FINAL-BUZID.
ITAB_PO_ITEM-MATNR = ITAB_FINAL-MATNR.
ITAB_PO_ITEM-EBELN = ITAB_FINAL-EBELN.
ITAB_PO_ITEM-EBELP = ITAB_FINAL-EBELP.
ITAB_PO_ITEM-MENGE = ITAB_FINAL-MENGE.
ITAB_PO_ITEM-WRBTR = ITAB_FINAL-WRBTR.
COLLECT ITAB_PO_ITEM.
CLEAR ITAB_PO_ITEM.
ELSEIF ITAB_FINAL-BUZID = 'M' OR ITAB_FINAL-BUZID = 'K' OR
ITAB_FINAL-BUZID = 'S' OR
ITAB_FINAL-BUZID = 'P' OR " ADDED ON 21/01/02
*- Start of change by Raj on 030905
ITAB_FINAL-BUZID = ' ' OR
ITAB_FINAL-BUZID = 'T' OR " ADD BY JAJ ON 090206
*- End of change by Raj on 030905
ITAB_FINAL-BUZID = 'F'.
IF ITAB_FINAL-MATNR IS INITIAL.
ITAB_FINAL-MATNR = V_MATNR.
ENDIF.
CLEAR V_MATNR.
ITAB_PO_OTHERS-BELNR = ITAB_FINAL-BELNR.
ITAB_PO_OTHERS-MATNR = ITAB_FINAL-MATNR.
ITAB_PO_OTHERS-EBELN = ITAB_FINAL-EBELN.
ITAB_PO_OTHERS-EBELP = ITAB_FINAL-EBELP.
ITAB_PO_OTHERS-MENGE = ITAB_FINAL-MENGE.
ITAB_PO_OTHERS-WRBTR = ITAB_FINAL-WRBTR.
IF CONDITION,ADDED ON 21/01/02 FOR GETTING EXCISE WHEN CONDITION MEETS
ie TOTAL AMOUNT = EXCISE WHEN BUZID = S AND HKONT = 27500
*IF itab_final-buzid = 'S' AND ( itab_final-hkont = '0000027500' OR "
*COMM BY JAJ ON 090206
IF ITAB_FINAL-BUZID = 'S' OR ITAB_FINAL-BUZID = 'T' AND (
ITAB_FINAL-HKONT = '0000027500' OR
ITAB_FINAL-HKONT = '0000027515'
OR ITAB_FINAL-HKONT = '0000027550' " jaj on 090206
OR ITAB_FINAL-HKONT = '0000027507' OR
ITAB_FINAL-HKONT = '0000027508'). "Added on 050905 - Raj
ITAB_FINAL-EBELN = V_EBELN.
to get ebeln value into header so that when there are 2 po's
and 2 W's excise can go into only one po which is v_ebeln
Start of insert by B.Elan on 10/02/2006
READ TABLE ITAB_PO_ITEM WITH KEY BELNR = ITAB_FINAL-BELNR
EBELN = ITAB_FINAL-EBELN
MATNR = ITAB_FINAL-MATNR.
ITAB_PO_ITEM-EXCISE = ITAB_PO_ITEM-EXCISE + ITAB_FINAL-WRBTR.
End of insert by B.Elan on 10/02/2006
Start of delete by B.Elan on 10/02/2006
itab_po_item-excise = itab_final-wrbtr.
End of delete by B.Elan on 10/02/2006
MODIFY ITAB_PO_ITEM TRANSPORTING EXCISE
WHERE BELNR EQ ITAB_FINAL-BELNR AND
EBELN EQ ITAB_FINAL-EBELN.
CLEAR ITAB_PO_ITEM.
ELSE.
COLLECT ITAB_PO_OTHERS.
ENDIF.
CLEAR ITAB_PO_OTHERS.
ENDIF.
ENDLOOP.
sateesh
SORT ITAB_PO_ITEM BY BELNR EBELN.
LOOP AT ITAB_PO_ITEM.
AT NEW BELNR.
AT NEW EBELN.
READ TABLE ITAB_PO_ITEM INDEX SY-TABIX.
ITAB_PO_ITEM-FLAG = 'X'.
MODIFY ITAB_PO_ITEM INDEX SY-TABIX.
ENDAT.
ENDAT.
ENDLOOP.
LOOP AT ITAB_PO_ITEM.
ITAB_PO_ITEM-EXCISE = 0.
MODIFY ITAB_PO_ITEM TRANSPORTING EXCISE
WHERE EXCISE > 0
AND FLAG = SPACE.
ENDLOOP.
end
LOOP AT ITAB_PO_ITEM.
ITAB_PO-EBELN = ITAB_PO_ITEM-EBELN.
ITAB_PO-EBELP = ITAB_PO_ITEM-EBELP.
APPEND ITAB_PO.
CLEAR ITAB_PO.
ENDLOOP.
LOOP AT ITAB_PO_OTHERS.
ITAB_PO-EBELN = ITAB_PO_OTHERS-EBELN.
ITAB_PO-EBELP = ITAB_PO_OTHERS-EBELP.
APPEND ITAB_PO.
CLEAR ITAB_PO.
ENDLOOP.
SORT ITAB_PO.
DELETE ADJACENT DUPLICATES FROM ITAB_PO COMPARING ALL FIELDS.
SELECT EKPO~EBELN
EBELP
MENGE
BRTWR
KZWI5
EKKO~KNUMV
EKPO~MATNR
EKPO~TXZ01
INTO TABLE ITAB_RATE_MODVAT
FROM EKPO INNER JOIN EKKO
ON EKPO~EBELN = EKKO~EBELN
FOR ALL ENTRIES IN ITAB_PO WHERE
EKPO~EBELN = ITAB_PO-EBELN AND
EBELP = ITAB_PO-EBELP.
SELECT KNUMV KPOSN STUNR ZAEHK KSCHL KWERT
INTO TABLE ITAB_KONV
FROM KONV
FOR ALL ENTRIES IN ITAB_RATE_MODVAT
WHERE KNUMV = ITAB_RATE_MODVAT-KNUMV AND
KSCHL IN ('YT02', 'YF07', 'YOTH', 'YPF1', 'YD01', 'YD02', 'YD03' ) .
SORT ITAB_KONV BY KNUMV KSCHL.
SORT ITAB BY BELNR.
SORT ITAB_RATE_MODVAT BY EBELN EBELP.
SORT ITAB_PO_OTHERS BY BELNR MATNR.
LOOP AT ITAB_PO_ITEM.
ITAB_DISPLAY-BELNR = ITAB_PO_ITEM-BELNR.
READ TABLE ITAB_DOC WITH KEY BELNR = ITAB_PO_ITEM-BELNR BINARY
SEARCH.
IF SY-SUBRC EQ 0.
ITAB_DISPLAY-BLART = ITAB_DOC-BLART.
ENDIF.
READ TABLE ITAB WITH KEY BELNR = ITAB_PO_ITEM-BELNR BINARY SEARCH.
IF SY-SUBRC EQ 0.
ITAB_DISPLAY-XBLNR = ITAB-XBLNR.
ITAB_PO_ITEM-XBLNR = ITAB-XBLNR.
ITAB_DISPLAY-NAME1_VENDOR = ITAB-NAME1_VENDOR.
ITAB_DISPLAY-HKONT = ITAB-HKONT.
ITAB_DISPLAY-MWSKZ = ITAB-MWSKZ.
ITAB_DISPLAY-BUDAT = ITAB-BUDAT.
ITAB_DISPLAY-DUE_DATE = ITAB-DUE_DATE.
ITAB_DISPLAY-PON = ITAB_PO_ITEM-EBELN.
ENDIF.
ITAB_DISPLAY-QTY = ITAB_PO_ITEM-MENGE.
READ TABLE ITAB_RATE_MODVAT WITH KEY EBELN = ITAB_PO_ITEM-EBELN
EBELP = ITAB_PO_ITEM-EBELP
BINARY SEARCH.
IF SY-SUBRC EQ 0.
ITAB_DISPLAY-PON = ITAB_PO_ITEM-EBELN.
ITAB_DISPLAY-MATNR = ITAB_RATE_MODVAT-MATNR.
ITAB_DISPLAY-MAKTX = ITAB_RATE_MODVAT-TXZ01.
ITAB_DISPLAY-RATE = ITAB_RATE_MODVAT-BRTWR /
ITAB_RATE_MODVAT-MENGE.
ITAB_DISPLAY-PROD-AMT = ITAB_DISPLAY-RATE * ITAB_PO_ITEM-MENGE.
IF ITAB_PO_ITEM-EXCISE NE 0.
ITAB_DISPLAY-EXCISE = ITAB_PO_ITEM-EXCISE.
ELSE.
*ITAB_DISPLAY-EXCISE = ( ITAB_PO_ITEM-MENGE * ITAB_RATE_MODVAT-KZWI5 ) /
ITAB_RATE_MODVAT-MENGE.
*commentedon 210102 to get excise directly from BSEG - IV
ENDIF.
ENDIF.
READ TABLE ITAB_KONV WITH KEY KNUMV = ITAB_RATE_MODVAT-KNUMV
KPOSN = ITAB_RATE_MODVAT-EBELP
KSCHL = 'YT02' .
IF SY-SUBRC EQ 0.
ITAB_DISPLAY-SALES = ( ITAB_PO_ITEM-MENGE * ITAB_KONV-KWERT ) /
ITAB_RATE_MODVAT-MENGE.
READ TABLE ITAB_FINAL WITH KEY BELNR = ITAB_PO_ITEM-BELNR
BUZID = 'M'
SGTXT(9) = 'SALES TAX'.
IF SY-SUBRC EQ 0.
IF ITAB_FINAL-SGTXT(9) EQ 'SALES TAX'
OR ITAB_FINAL-SGTXT(9) EQ 'sales tax'.
ITAB_DISPLAY-SALES = ITAB_DISPLAY-SALES + ITAB_FINAL-WRBTR.
ENDIF.
ENDIF.
ENDIF.
READ TABLE ITAB_KONV WITH KEY KNUMV = ITAB_RATE_MODVAT-KNUMV
KPOSN = ITAB_RATE_MODVAT-EBELP
KSCHL = 'YF07'.
IF SY-SUBRC EQ 0.
ITAB_DISPLAY-FREIGHT = ( ITAB_PO_ITEM-MENGE * ITAB_KONV-KWERT ) /
ITAB_RATE_MODVAT-MENGE.
ENDIF.
READ TABLE ITAB_KONV WITH KEY KNUMV = ITAB_RATE_MODVAT-KNUMV
KPOSN = ITAB_RATE_MODVAT-EBELP
KSCHL = 'YD01' .
IF SY-SUBRC EQ 0.
ITAB_DISPLAY-DISCOUNT = ( ITAB_PO_ITEM-MENGE * ITAB_KONV-KWERT ) /
ITAB_RATE_MODVAT-MENGE.
ELSE.
READ TABLE ITAB_KONV WITH KEY KNUMV = ITAB_RATE_MODVAT-KNUMV
KPOSN = ITAB_RATE_MODVAT-EBELP
KSCHL = 'YD02' .
IF SY-SUBRC EQ 0.
ITAB_DISPLAY-DISCOUNT = ( ITAB_PO_ITEM-MENGE * ITAB_KONV-KWERT )
ITAB_RATE_MODVAT-MENGE.
ELSE.
READ TABLE ITAB_KONV WITH KEY KNUMV = ITAB_RATE_MODVAT-KNUMV
KPOSN = ITAB_RATE_MODVAT-EBELP
KSCHL = 'YD03' .
IF SY-SUBRC EQ 0.
ITAB_DISPLAY-DISCOUNT = ( ITAB_PO_ITEM-MENGE * ITAB_KONV-KWERT
ITAB_RATE_MODVAT-MENGE.
ENDIF.
ENDIF.
ENDIF.
LOOP AT ITAB_KONV WHERE KNUMV = ITAB_RATE_MODVAT-KNUMV AND KPOSN =
ITAB_RATE_MODVAT-EBELP AND
( KSCHL = 'YPF1' OR KSCHL = 'YOTH' ) .
ITAB_KONV-KWERT = ( ITAB_PO_ITEM-MENGE * ITAB_KONV-KWERT ) /
ITAB_RATE_MODVAT-MENGE.
ITAB_DISPLAY-OTHERS = ITAB_DISPLAY-OTHERS + ITAB_KONV-KWERT.
ENDLOOP.
READ TABLE ITAB_PO_OTHERS WITH KEY BELNR = ITAB_PO_ITEM-BELNR.
EBELN = ITAB_PO_ITEM-EBELN.
BINARY SEARCH.
sateesh as on 10092003
IF SY-SUBRC NE 0. CLEAR ITAB_PO_OTHERS. ENDIF.
end
IF NOT ITAB_PO_OTHERS-EBELN IS INITIAL.
READ TABLE ITAB_PO_OTHERS WITH KEY EBELN = ITAB_PO_ITEM-EBELN
EB -
Validation when posting a document using T. Code FB50 or F-02
Dear Experts
Please let me know on how to validate when posting a Cross Company Transaction using T. Codes FB50 or F-02. The requirement is to restrict Branches (each Branch is a Company Code in SAP) to post any Cross Company documents by selecting HO Company Code in Line Item, system has to stop the User by giving Error Message.
We can't control this using User level Authorizations because, here the Authorization is provided to the Users to post the Transactions using T. Codes FB50 and F-02.
To restrict this, I created a Validation as below:
Prerequisite:
BKPF-TCODE = 'FB50' OR BKPF-TCODE = 'F-02' AND
BKPF-BUKRS = 'Br. Company Code' AND
BSEG-BUKRS = 'HO Company Code'
Check:
FALSE
Message:
You Can't post Cross Company Transactions using T.Code FB50 or F-02
And I activated the above Validation in OB28 for HO and Branch Company Codes. But the Validation is not working properly. Can anybody help me on how to proceed further in this regard please.Hi,
I haven't tried to use a transaction code for Validation purpose. Instead, I have used document type as prerequisite and then check:
BKPF-BUKRS = 'Br. Company Code' AND
BSEG-BUKRS = 'HO Company Code'
If the condition is met, it displays an error (per the message in validation) while completing the line item details on posting a document.
Please let me know if that helps. If not, I can try to replicate your scenario and let you know if there is anything missing.
Thanks,
Ashish -
How to use ABAP objects in ALV
Can u give me the steps for doing ALV with ABAP objects
Hello Mohammed
Here are a few simplified version of the SAP sample reports that I have posted within SDN.
This is a variant of my previously posted report ZUS_SDN_ALVGRID_EVENTS. Both dynpros (100 & 200) do not contain any elements. For simplicity I used the same flow logic for both dynpros:
PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.
PROCESS AFTER INPUT.
MODULE USER_COMMAND_0100.
<b>&----
*& Report ZUS_SDN_ALVGRID_EVENTS_1
&----</b>
REPORT zus_sdn_alvgrid_events_1.
DATA:
gd_okcode TYPE ui_func,
gt_fcat TYPE lvc_t_fcat,
go_docking TYPE REF TO cl_gui_docking_container,
go_docking2 TYPE REF TO cl_gui_docking_container,
go_grid1 TYPE REF TO cl_gui_alv_grid,
go_grid2 TYPE REF TO cl_gui_alv_grid.
DATA:
gt_t001 TYPE STANDARD TABLE OF t001,
gt_knb1 TYPE STANDARD TABLE OF knb1.
* CLASS lcl_eventhandler DEFINITION
CLASS lcl_eventhandler DEFINITION.
PUBLIC SECTION.
CLASS-METHODS:
handle_double_click FOR EVENT double_click OF cl_gui_alv_grid
IMPORTING
e_row
e_column
es_row_no
sender.
ENDCLASS. "lcl_eventhandler DEFINITION
* CLASS lcl_eventhandler IMPLEMENTATION
CLASS lcl_eventhandler IMPLEMENTATION.
METHOD handle_double_click.
* define local data
DATA:
ls_t001 TYPE t001,
ls_col_id TYPE lvc_s_col.
CHECK ( sender = go_grid1 ).
READ TABLE gt_t001 INTO ls_t001 INDEX e_row-index.
CHECK ( ls_t001-bukrs IS NOT INITIAL ).
SELECT * FROM knb1 INTO TABLE gt_knb1
WHERE bukrs = ls_t001-bukrs.
IF ( syst-subrc NE 0 ).
MESSAGE 'No customers found' TYPE 'S'.
ELSE.
* Trigger PAI of dynpro '0100' and set new ok-code
CALL METHOD cl_gui_cfw=>set_new_ok_code( 'CALL_SCREEN_0200' ).
ENDIF.
ENDMETHOD. "handle_hotspot_click
ENDCLASS. "lcl_eventhandler IMPLEMENTATION
START-OF-SELECTION.
SELECT * FROM t001 INTO TABLE gt_t001.
REFRESH: gt_knb1.
* Create docking container
CREATE OBJECT go_docking
EXPORTING
parent = cl_gui_container=>screen0
ratio = 90
EXCEPTIONS
OTHERS = 6.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT go_docking2
EXPORTING
parent = cl_gui_container=>screen0
ratio = 90
EXCEPTIONS
OTHERS = 6.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Create ALV grid
CREATE OBJECT go_grid1
EXPORTING
i_parent = go_docking
EXCEPTIONS
OTHERS = 5.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT go_grid2
EXPORTING
i_parent = go_docking2
EXCEPTIONS
OTHERS = 5.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Set event handler
SET HANDLER:
lcl_eventhandler=>handle_double_click FOR go_grid1.
* Display data
CALL METHOD go_grid1->set_table_for_first_display
EXPORTING
i_structure_name = 'T001'
CHANGING
it_outtab = gt_t001
EXCEPTIONS
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.
CALL METHOD go_grid2->set_table_for_first_display
EXPORTING
i_structure_name = 'KNB1'
CHANGING
it_outtab = gt_knb1
EXCEPTIONS
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.
* Link the docking container to the target dynpro
CALL METHOD go_docking->link
EXPORTING
repid = syst-repid
dynnr = '0100'
* CONTAINER =
EXCEPTIONS
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.
CALL METHOD go_docking2->link
EXPORTING
repid = syst-repid
dynnr = '0200'
* CONTAINER =
EXCEPTIONS
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.
* ok-code field = GD_OKCODE
CALL SCREEN '0100'.
END-OF-SELECTION.
*& Module STATUS_0100 OUTPUT
* text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'STATUS_0100'.
* SET TITLEBAR 'xxx'.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
* text
MODULE user_command_0100 INPUT.
CASE gd_okcode.
WHEN 'BACK' OR
'END' OR
'CANC'.
SET SCREEN 0. LEAVE SCREEN.
WHEN 'CALL_SCREEN_0200'.
go_grid2->refresh_table_display( ). " necessary
CALL SCREEN '0200'.
WHEN OTHERS.
ENDCASE.
CLEAR: gd_okcode.
ENDMODULE. " USER_COMMAND_0100 INPUT
The following sample report ZUS_SDN_ALVGRID_EVENTS shows how to call a transaction when event HOTSPOT_CLICK was raised:
<b>&----
*& Report ZUS_SDN_TWO_ALV_GRIDS
&----</b>
REPORT ZUS_SDN_ALVGRID_EVENTS.
DATA:
gd_okcode TYPE ui_func,
gt_fcat TYPE lvc_t_fcat,
go_docking TYPE REF TO cl_gui_docking_container,
go_grid1 TYPE REF TO cl_gui_alv_grid.
DATA:
gt_knb1 TYPE STANDARD TABLE OF knb1.
PARAMETERS:
p_bukrs TYPE bukrs DEFAULT '1000' OBLIGATORY.
* CLASS lcl_eventhandler DEFINITION
CLASS lcl_eventhandler DEFINITION.
PUBLIC SECTION.
CLASS-METHODS:
handle_hotspot_click FOR EVENT hotspot_click OF cl_gui_alv_grid
IMPORTING
e_row_id
e_column_id
es_row_no
sender.
ENDCLASS. "lcl_eventhandler DEFINITION
* CLASS lcl_eventhandler IMPLEMENTATION
CLASS lcl_eventhandler IMPLEMENTATION.
METHOD handle_hotspot_click.
* define local data
DATA:
ls_knb1 TYPE knb1,
ls_col_id type lvc_s_col.
READ TABLE gt_knb1 INTO ls_knb1 INDEX e_row_id-index.
CHECK ( ls_knb1-kunnr IS NOT INITIAL ).
SET PARAMETER ID 'KUN' FIELD ls_knb1-kunnr.
SET PARAMETER ID 'BUK' FIELD ls_knb1-bukrs.
CALL TRANSACTION 'XD03' AND SKIP FIRST SCREEN.
* Set active cell to field BUKRS otherwise the focus is still on
* field KUNNR which will always raise event HOTSPOT_CLICK
ls_col_id-fieldname = 'BUKRS'.
CALL METHOD go_grid1->set_current_cell_via_id
EXPORTING
IS_ROW_ID = e_row_id
IS_COLUMN_ID = ls_col_id.
ENDMETHOD. "handle_hotspot_click
ENDCLASS. "lcl_eventhandler IMPLEMENTATION
START-OF-SELECTION.
SELECT * FROM knb1 INTO TABLE gt_knb1
WHERE bukrs = p_bukrs.
* Create docking container
CREATE OBJECT go_docking
EXPORTING
parent = cl_gui_container=>screen0
ratio = 90
EXCEPTIONS
OTHERS = 6.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Create ALV grid
CREATE OBJECT go_grid1
EXPORTING
i_parent = go_docking
EXCEPTIONS
OTHERS = 5.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Set event handler
SET HANDLER:
lcl_eventhandler=>handle_hotspot_click FOR go_grid1.
* Build fieldcatalog and set hotspot for field KUNNR
PERFORM build_fieldcatalog_knb1.
* Display data
CALL METHOD go_grid1->set_table_for_first_display
CHANGING
it_outtab = gt_knb1
it_fieldcatalog = gt_fcat
EXCEPTIONS
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.
* Link the docking container to the target dynpro
CALL METHOD go_docking->link
EXPORTING
repid = syst-repid
dynnr = '0100'
* CONTAINER =
EXCEPTIONS
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.
* ok-code field = GD_OKCODE
CALL SCREEN '0100'.
END-OF-SELECTION.
*& Module STATUS_0100 OUTPUT
* text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'STATUS_0100'.
* SET TITLEBAR 'xxx'.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
* text
MODULE user_command_0100 INPUT.
CASE gd_okcode.
WHEN 'BACK' OR
'END' OR
'CANC'.
SET SCREEN 0. LEAVE SCREEN.
WHEN OTHERS.
ENDCASE.
CLEAR: gd_okcode.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form BUILD_FIELDCATALOG_KNB1
* text
* --> p1 text
* <-- p2 text
FORM build_fieldcatalog_knb1 .
* define local data
DATA:
ls_fcat TYPE lvc_s_fcat.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
* I_BUFFER_ACTIVE =
i_structure_name = 'KNB1'
* I_CLIENT_NEVER_DISPLAY = 'X'
* I_BYPASSING_BUFFER =
* I_INTERNAL_TABNAME =
CHANGING
ct_fieldcat = gt_fcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
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 TABLE gt_fcat INTO ls_fcat
WITH KEY fieldname = 'KUNNR'.
IF ( syst-subrc = 0 ).
ls_fcat-hotspot = abap_true.
MODIFY gt_fcat FROM ls_fcat INDEX syst-tabix.
ENDIF.
ENDFORM. " BUILD_FIELDCATALOG_KNB1
Please note that the direct CALL TRANSACTION does not check the user's authority. To do so you could call the transaction using function module ABAP4_CALL_TRANSACTION.
Here is a sample program for OO-based ALV grids (CL_GUI_ALV_GRID) that simulates radio buttons by using icons with hotspots.
<b>PROGRAM ZUS_SDN_BCALV_GRID_DEMO_2.</b>
* Based on: BCALV_GRID_DEMO.
TYPE-POOLS: icon.
TYPES: BEGIN OF ty_s_sflight.
INCLUDE TYPE sflight.
TYPES: button1 TYPE lvc_emphsz.
TYPES: button2 TYPE lvc_emphsz.
TYPES: button3 TYPE lvc_emphsz.
TYPES: button4 TYPE lvc_emphsz.
TYPES: END OF ty_s_sflight.
DATA:
gt_sflight TYPE STANDARD TABLE OF ty_s_sflight,
gt_fcat TYPE lvc_t_fcat.
DATA: ok_code LIKE sy-ucomm,
* gt_sflight TYPE TABLE OF sflight,
g_container TYPE scrfname VALUE 'BCALV_GRID_DEMO_0100_CONT1',
grid1 TYPE REF TO cl_gui_alv_grid,
g_custom_container TYPE REF TO cl_gui_custom_container.
* CLASS lcl_eventhandler DEFINITION
CLASS lcl_eventhandler DEFINITION.
PUBLIC SECTION.
CLASS-DATA:
md_cnt TYPE i.
CLASS-METHODS:
handle_hotspot_click FOR EVENT hotspot_click OF cl_gui_alv_grid
IMPORTING
e_row_id
e_column_id
es_row_no
sender.
ENDCLASS. "lcl_eventhandler DEFINITION
* CLASS lcl_eventhandler IMPLEMENTATION
CLASS lcl_eventhandler IMPLEMENTATION.
METHOD handle_hotspot_click.
* define local data
FIELD-SYMBOLS:
<ls_entry> TYPE ty_s_sflight,
<ld_fld> TYPE ANY.
READ TABLE gt_sflight ASSIGNING <ls_entry> INDEX es_row_no-row_id.
CHECK ( <ls_entry> IS ASSIGNED ).
* Set all radio buttons "unselected"
<ls_entry>-button1 = icon_wd_radio_button_empty.
<ls_entry>-button2 = icon_wd_radio_button_empty.
<ls_entry>-button3 = icon_wd_radio_button_empty.
<ls_entry>-button4 = icon_wd_radio_button_empty.
ASSIGN COMPONENT e_column_id-fieldname OF STRUCTURE <ls_entry>
TO <ld_fld>.
IF ( <ld_fld> IS ASSIGNED ).
* Set selected radio button "selected".
<ld_fld> = icon_wd_radio_button.
ENDIF.
* Force PAI followed by refresh of table display in PBO
CALL METHOD cl_gui_cfw=>set_new_ok_code
EXPORTING
new_code = 'DUMMY'
* IMPORTING
* RC =
ENDMETHOD. "handle_hotspot_click
ENDCLASS. "lcl_eventhandler IMPLEMENTATION
START-OF-SELECTION.
* MAIN *
PERFORM select_data.
CALL SCREEN 100.
* MODULE PBO OUTPUT *
MODULE pbo OUTPUT.
SET PF-STATUS 'MAIN100'.
IF g_custom_container IS INITIAL.
CREATE OBJECT g_custom_container
EXPORTING container_name = g_container.
CREATE OBJECT grid1
EXPORTING i_parent = g_custom_container.
PERFORM build_fieldcatalog.
CALL METHOD grid1->set_table_for_first_display
* EXPORTING
* i_structure_name = 'SFLIGHT'
CHANGING
it_fieldcatalog = gt_fcat
it_outtab = gt_sflight.
* Set event handler for event TOOLBAR
SET HANDLER:
lcl_eventhandler=>handle_hotspot_click FOR grid1.
else.
CALL METHOD grid1->refresh_table_display
* EXPORTING
* IS_STABLE =
* I_SOFT_REFRESH =
EXCEPTIONS
FINISHED = 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.
ENDIF.
ENDMODULE. "PBO OUTPUT
* MODULE PAI INPUT *
MODULE pai INPUT.
* to react on oi_custom_events:
CALL METHOD cl_gui_cfw=>dispatch.
CASE ok_code.
WHEN 'EXIT'.
PERFORM exit_program.
WHEN OTHERS.
* do nothing
ENDCASE.
CLEAR ok_code.
ENDMODULE. "PAI INPUT
* FORM EXIT_PROGRAM *
FORM exit_program.
* CALL METHOD G_CUSTOM_CONTAINER->FREE.
* CALL METHOD CL_GUI_CFW=>FLUSH.
LEAVE PROGRAM.
ENDFORM. "EXIT_PROGRAM
*& Form BUILD_FIELDCATALOG
* text
* --> p1 text
* <-- p2 text
FORM build_fieldcatalog .
* define local data
DATA:
ls_fcat TYPE lvc_s_fcat,
ls_hype TYPE lvc_s_hype.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
* I_BUFFER_ACTIVE =
i_structure_name = 'LVC_S_FCAT'
* I_CLIENT_NEVER_DISPLAY = 'X'
* I_BYPASSING_BUFFER =
* I_INTERNAL_TABNAME =
CHANGING
ct_fieldcat = gt_fcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
DELETE gt_fcat WHERE ( fieldname <> 'EMPHASIZE' ).
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
* I_BUFFER_ACTIVE =
i_structure_name = 'SFLIGHT'
* I_CLIENT_NEVER_DISPLAY = 'X'
* I_BYPASSING_BUFFER =
* I_INTERNAL_TABNAME =
CHANGING
ct_fieldcat = gt_fcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
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 TABLE gt_fcat INTO ls_fcat
WITH KEY fieldname = 'EMPHASIZE'.
IF ( syst-subrc = 0 ).
DELETE gt_fcat INDEX syst-tabix.
ENDIF.
ls_fcat-fieldname = 'BUTTON4'.
ls_fcat-icon = 'X'.
ls_fcat-hotspot = 'X'.
INSERT ls_fcat INTO gt_fcat INDEX 4.
ls_fcat-fieldname = 'BUTTON3'.
INSERT ls_fcat INTO gt_fcat INDEX 4.
ls_fcat-fieldname = 'BUTTON2'.
INSERT ls_fcat INTO gt_fcat INDEX 4.
ls_fcat-fieldname = 'BUTTON1'.
INSERT ls_fcat INTO gt_fcat INDEX 4.
LOOP AT gt_fcat INTO ls_fcat.
ls_fcat-col_pos = syst-tabix.
MODIFY gt_fcat FROM ls_fcat INDEX syst-tabix.
ENDLOOP.
ENDFORM. " BUILD_FIELDCATALOG
*& Form SELECT_DATA
* text
* --> p1 text
* <-- p2 text
FORM select_data .
* define local data
DATA:
ls_sflight TYPE ty_s_sflight.
SELECT * FROM sflight INTO CORRESPONDING FIELDS OF TABLE gt_sflight.
ls_sflight-button1 = icon_wd_radio_button.
ls_sflight-button2 = icon_wd_radio_button_empty.
ls_sflight-button3 = icon_wd_radio_button_empty.
ls_sflight-button4 = icon_wd_radio_button_empty.
MODIFY gt_sflight FROM ls_sflight
TRANSPORTING button1 button2 button3 button4
WHERE ( carrid IS NOT INITIAL ).
ENDFORM. " SELECT_DATA
The various aspects of ALV list programming are collected within the reuse library (transaction <b>SE83</b>).
And do not miss to look at <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415907">Easy Reference to ALV Grid Control</a>
Regards
Uwe -
How can i show details in ALV GRID with double click in a row?
Hello, ich try to show the details of a row with double click in the line,
but it doesn't work!?
I have a eventhandler for doubleclick and the program run this code, but what i have to do, to show the details!?
I try it with some methods like cl_gui_cfw=>set_new_ok_code, ...
i think about the methods cl_gui_alv_grid->show_detail, but this method is private,
i can create a class with inheritance of the cl_gui_alv_grid class and try this method!?
Have anybody any ideas!?Hello Lars
The following sample reports shows an ALV list with company codes. Double-clicking on any company code will open a second ALV list displaying all customers.
*& Report ZUS_SDN_ALVGRID_EVENTS_1
REPORT zus_sdn_alvgrid_events_1.
DATA:
gd_okcode TYPE ui_func,
gt_fcat TYPE lvc_t_fcat,
go_docking TYPE REF TO cl_gui_docking_container,
go_docking2 TYPE REF TO cl_gui_docking_container,
go_grid1 TYPE REF TO cl_gui_alv_grid,
go_grid2 TYPE REF TO cl_gui_alv_grid.
DATA:
gt_t001 TYPE STANDARD TABLE OF t001,
gt_knb1 TYPE STANDARD TABLE OF knb1.
* CLASS lcl_eventhandler DEFINITION
CLASS lcl_eventhandler DEFINITION.
PUBLIC SECTION.
CLASS-METHODS:
handle_double_click FOR EVENT double_click OF cl_gui_alv_grid
IMPORTING
e_row
e_column
es_row_no
sender.
ENDCLASS. "lcl_eventhandler DEFINITION
* CLASS lcl_eventhandler IMPLEMENTATION
CLASS lcl_eventhandler IMPLEMENTATION.
METHOD handle_double_click.
* define local data
DATA:
ls_t001 TYPE t001,
ls_col_id TYPE lvc_s_col.
CHECK ( sender = go_grid1 ).
READ TABLE gt_t001 INTO ls_t001 INDEX e_row-index.
CHECK ( ls_t001-bukrs IS NOT INITIAL ).
SELECT * FROM knb1 INTO TABLE gt_knb1
WHERE bukrs = ls_t001-bukrs.
IF ( syst-subrc NE 0 ).
MESSAGE 'No customers found' TYPE 'S'.
ELSE.
* Trigger PAI of dynpro '0100' and set new ok-code
CALL METHOD cl_gui_cfw=>set_new_ok_code( 'CALL_SCREEN_0200' ).
ENDIF.
ENDMETHOD. "handle_hotspot_click
ENDCLASS. "lcl_eventhandler IMPLEMENTATION
START-OF-SELECTION.
SELECT * FROM t001 INTO TABLE gt_t001.
REFRESH: gt_knb1.
* Create docking container
CREATE OBJECT go_docking
EXPORTING
parent = cl_gui_container=>screen0
ratio = 90
EXCEPTIONS
OTHERS = 6.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT go_docking2
EXPORTING
parent = cl_gui_container=>screen0
ratio = 90
EXCEPTIONS
OTHERS = 6.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Create ALV grid
CREATE OBJECT go_grid1
EXPORTING
i_parent = go_docking
EXCEPTIONS
OTHERS = 5.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT go_grid2
EXPORTING
i_parent = go_docking2
EXCEPTIONS
OTHERS = 5.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Set event handler
SET HANDLER:
lcl_eventhandler=>handle_double_click FOR go_grid1.
* Display data
CALL METHOD go_grid1->set_table_for_first_display
EXPORTING
i_structure_name = 'T001'
CHANGING
it_outtab = gt_t001
EXCEPTIONS
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.
CALL METHOD go_grid2->set_table_for_first_display
EXPORTING
i_structure_name = 'KNB1'
CHANGING
it_outtab = gt_knb1
EXCEPTIONS
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.
* Link the docking container to the target dynpro
CALL METHOD go_docking->link
EXPORTING
repid = syst-repid
dynnr = '0100'
* CONTAINER =
EXCEPTIONS
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.
CALL METHOD go_docking2->link
EXPORTING
repid = syst-repid
dynnr = '0200'
* CONTAINER =
EXCEPTIONS
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.
* ok-code field = GD_OKCODE
CALL SCREEN '0100'.
END-OF-SELECTION.
*& Module STATUS_0100 OUTPUT
* text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'STATUS_0100'.
* SET TITLEBAR 'xxx'.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
* text
MODULE user_command_0100 INPUT.
CASE gd_okcode.
WHEN 'BACK' OR
'END' OR
'CANC'.
SET SCREEN 0. LEAVE SCREEN.
WHEN 'CALL_SCREEN_0200'.
go_grid2->refresh_table_display( ). " necessary
CALL SCREEN '0200'.
WHEN OTHERS.
ENDCASE.
CLEAR: gd_okcode.
ENDMODULE. " USER_COMMAND_0100 INPUT
Regards
Uwe -
suppose in a selection screen, there are 2 parameters. one for storage location & other for material. if one storage location is selected, then by clicking F4 help in material corresponding material related to storage location should come ?
hi,
try like this.
TYPES : BEGIN OF ty_kna1,
kunnr TYPE kna1-kunnr, "CUstomer Code
name1 TYPE kna1-name1, "Customer Code
END OF ty_kna1.
DATA : wa_value_tab TYPE ty_kna1.
DATA : value_tab LIKE wa_value_tab OCCURS 0 WITH HEADER LINE.
DATA : field_tab LIKE dfies OCCURS 0 WITH HEADER LINE.
DATA : return_tab LIKE ddshretval OCCURS 0 WITH HEADER LINE.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR kunnr-low.
CHECK NOT bukrs IS INITIAL .
SELECT kna1kunnr kna1name1
INTO TABLE i_kna1
FROM kna1 INNER JOIN vbrk
ON kna1kunnr = vbrkkunag
WHERE vbrk~bukrs = bukrs. "dyfields-fieldvalue.
SORT i_kna1 BY kunnr.
DELETE ADJACENT DUPLICATES FROM i_kna1.
CLEAR : value_tab,field_tab,return_tab.
REFRESH : value_tab,field_tab,return_tab.
field_tab-fieldname = 'KUNNR'.
field_tab-tabname = 'KNA1'.
APPEND field_tab.
field_tab-fieldname = 'NAME1'.
field_tab-tabname = 'KNA1'.
APPEND field_tab.
field_tab-fieldname = 'KUNNR'.
LOOP AT i_kna1 .
value_tab-kunnr = i_kna1-kunnr.
APPEND value_tab.
CLEAR value_tab.
value_tab-name1 = i_kna1-name1.
APPEND value_tab.
ENDLOOP.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = field_tab-fieldname
TABLES
value_tab = value_tab
field_tab = field_tab
return_tab = return_tab
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3.
IF sy-subrc = 0.
kunnr-low = return_tab-fieldval.
ENDIF.
here i entered BUKRS and according to that i want Customer name.
hope it will b helpful. -
ALV Row should apper in BOLD when order type is "ZSTP1" in the cloumn
Hi ,
CAn you please provide the solution ,
I am using ALV GRID function module.
When perticluar value like order type is 'ZSTP1', I need to bold that row (all the values in that row should be bold).
Thanks ,
veerendra.Hi veerendara,
1. BOLD is not possible.
2. However, We can CHANGE THE COLORS,
based upon the condition.
3. Not only the full row color,
we can also manipulate the color in each cell.
4.
IMPORTANT THINGS
a. Extra field in internal table
clr TYPE slis_t_specialcol_alv,
(this field will contain the colour codes)
b. assign fieldname to alv layout
alvly-coltab_fieldname = 'CLR'
c. work area for colour
DATA : clrwa TYPE slis_specialcol_alv.
d. Populating the color
Once again
Loop at ITAB.
*********logic
if itab-field < 0 "---negative
clrwa-fieldname = 'FIELDNAME'. "<--- FIELDNAME FOR COLOR
clrwa-color-col = 6. <------- COLOUR 0-9
APPEND clrwa TO itab-clr.
MODIFY ITAB.
endif.
ENDLOOP.
5. just copy paste in new program
6.
REPORT abc .
NECESSARY / MUST
TYPE-POOLS : slis.
DATA : alvfc TYPE slis_t_fieldcat_alv.
DATA : alvly TYPE slis_layout_alv.
ITAB DECLARATION
DATA : prg TYPE sy-repid.
DATA : BEGIN OF itab OCCURS 0.
INCLUDE STRUCTURE t001.
DATA : clname(3) TYPE c,
clr TYPE slis_t_specialcol_alv,
END OF itab.
DATA : clrwa TYPE slis_specialcol_alv.
PARAMETERS : a TYPE c.
DATA : flname TYPE slis_fieldname.
SELECT
START-OF-SELECTION.
SELECT * FROM t001
INTO CORRESPONDING FIELDS OF TABLE itab..
LOOP AT itab..
IF SY-TABIX <= 5.
itab-clname = 'C50'.
ELSE.
itab-clname = 'C30'.
ENDIF.
MODIFY itab.
ENDLOOP.
LOOP AT ITAB.
check itab-bukrs = '1000'
clrwa-fieldname = 'BUTXT'.
clrwa-color-col = 6.
APPEND clrwa TO itab-clr.
MODIFY ITAB.
clrwa-fieldname = 'LAND1'.
clrwa-color-col = 4.
APPEND clrwa TO itab-clr.
MODIFY ITAB.
ENDLOOP.
prg = sy-repid.
flname = 'CLNAME'.
alvly-info_fieldname = 'CLNAME'.
alvly-coltab_fieldname = 'CLR'.
LOOP AT ITAB.
if sy-tabix = 3.
clrwa-fieldname = 'BUTXT'.
clrwa-color-col = 6.
APPEND clrwa TO itab-clr.
MODIFY ITAB.
clrwa-fieldname = 'LAND1'.
clrwa-color-col = 1.
APPEND clrwa TO itab-clr.
MODIFY ITAB.
endif.
ENDLOOP
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = prg
i_internal_tabname = 'ITAB'
i_inclname = prg
CHANGING
ct_fieldcat = alvfc
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
minimum
*CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
it_fieldcat = alvfc
TABLES
t_outtab = itab
EXCEPTIONS
program_error = 1
OTHERS = 2
extra
sy-uname = 'XYZAB'.
prg = sy-repid.
Excluding
DATA : excl TYPE slis_t_extab.
DATA : exclwa TYPE slis_extab.
exclwa = '&OUP'.
APPEND exclwa TO excl.
exclwa = '&ODN'.
APPEND exclwa TO excl.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
it_fieldcat = alvfc
i_callback_program = sy-repid
is_layout = alvly
i_callback_user_command = 'ITAB_USER_COMMAND'
it_excluding =
excl
i_save = 'A'
TABLES
t_outtab = itab
EXCEPTIONS
program_error = 1
OTHERS = 2.
*& Form itab_user_command
text
-->WHATCOMM text
-->WHATROW text
FORM itab_user_command USING whatcomm TYPE sy-ucomm whatrow TYPE
slis_selfield.
BREAK-POINT.
ENDFORM. "itab_user_command
regards,
amit m. -
Segment wise Profit Center Reporting
Hi Gurus,
I would like to know how to customize Profit center accounting , so that i can take Balance sheet at Profit center Level.
if anybody can send me the configuration document ,It will be great help for me
[email protected]
Thanks in Advance,
Best Regards,
Ashish Jain.Hi
Check with your BASIS guy if authorization object is available for the field SEGMENT... There are some issues yet with this because it is not available in some T codes
If the same is not available, you can ask your ABAPer to create a Z authorization object for this field and write a small ABAP code in the exit RGGBR000 (FI validation)
Sample code is attached below to check auth for Plant in Internal order...ZCO_INTPORD was the Z auth object created...
CHECK i_aufk-bukrs IS NOT INITIAL.
CHECK i_aufk-werks IS NOT INITIAL.
AUTHORITY-CHECK OBJECT 'ZCO_INTORD'
ID 'BUKRS' FIELD i_aufk-bukrs
ID 'WERKS' FIELD i_aufk-werks
ID 'ACTVT' DUMMY.
IF sy-subrc = 4.
MESSAGE e398(00) WITH 'You do not have sufficent Authorization'.
ENDIF.
Regards
Ajay M -
Guys,
I want to display the colour in the ALV output for some records.
please help.
reg,
vijayHi vijay,
1. Not only the full row color,
we can also manipulate the color in each cell.
2.
IMPORTANT THINGS
a. Extra field in internal table
clr TYPE slis_t_specialcol_alv,
(this field will contain the colour codes)
b. assign fieldname to alv layout
alvly-coltab_fieldname = 'CLR'
c. work area for colour
DATA : clrwa TYPE slis_specialcol_alv.
d. Populating the color
Once again
Loop at ITAB.
*********logic
if itab-field < 0 "---negative
clrwa-fieldname = 'FIELDNAME'. "<--- FIELDNAME FOR COLOR
clrwa-color-col = 6. <------- COLOUR 0-9
APPEND clrwa TO itab-clr.
MODIFY ITAB.
endif.
ENDLOOP.
5. just copy paste in new program
6.
REPORT abc .
NECESSARY / MUST
TYPE-POOLS : slis.
DATA : alvfc TYPE slis_t_fieldcat_alv.
DATA : alvly TYPE slis_layout_alv.
ITAB DECLARATION
DATA : prg TYPE sy-repid.
DATA : BEGIN OF itab OCCURS 0.
INCLUDE STRUCTURE t001.
DATA : clname(3) TYPE c,
clr TYPE slis_t_specialcol_alv,
END OF itab.
DATA : clrwa TYPE slis_specialcol_alv.
PARAMETERS : a TYPE c.
DATA : flname TYPE slis_fieldname.
SELECT
START-OF-SELECTION.
SELECT * FROM t001
INTO CORRESPONDING FIELDS OF TABLE itab..
LOOP AT itab..
IF SY-TABIX <= 5.
itab-clname = 'C50'.
ELSE.
itab-clname = 'C30'.
ENDIF.
MODIFY itab.
ENDLOOP.
LOOP AT ITAB.
check itab-bukrs = '1000'
clrwa-fieldname = 'BUTXT'.
clrwa-color-col = 6.
APPEND clrwa TO itab-clr.
MODIFY ITAB.
clrwa-fieldname = 'LAND1'.
clrwa-color-col = 4.
APPEND clrwa TO itab-clr.
MODIFY ITAB.
ENDLOOP.
prg = sy-repid.
flname = 'CLNAME'.
alvly-info_fieldname = 'CLNAME'.
alvly-coltab_fieldname = 'CLR'.
LOOP AT ITAB.
if sy-tabix = 3.
clrwa-fieldname = 'BUTXT'.
clrwa-color-col = 6.
APPEND clrwa TO itab-clr.
MODIFY ITAB.
clrwa-fieldname = 'LAND1'.
clrwa-color-col = 1.
APPEND clrwa TO itab-clr.
MODIFY ITAB.
endif.
ENDLOOP
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = prg
i_internal_tabname = 'ITAB'
i_inclname = prg
CHANGING
ct_fieldcat = alvfc
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
minimum
*CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
it_fieldcat = alvfc
TABLES
t_outtab = itab
EXCEPTIONS
program_error = 1
OTHERS = 2
extra
sy-uname = 'XYZAB'.
prg = sy-repid.
Excluding
DATA : excl TYPE slis_t_extab.
DATA : exclwa TYPE slis_extab.
exclwa = '&OUP'.
APPEND exclwa TO excl.
exclwa = '&ODN'.
APPEND exclwa TO excl.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
it_fieldcat = alvfc
i_callback_program = sy-repid
is_layout = alvly
i_callback_user_command = 'ITAB_USER_COMMAND'
it_excluding =
excl
i_save = 'A'
TABLES
t_outtab = itab
EXCEPTIONS
program_error = 1
OTHERS = 2.
*& Form itab_user_command
text
-->WHATCOMM text
-->WHATROW text
FORM itab_user_command USING whatcomm TYPE sy-ucomm whatrow TYPE
slis_selfield.
BREAK-POINT.
ENDFORM. "itab_user_command
regards,
amit m. -
Hi Gurus,
I am facing with a wierd issue.I am not getting VPRS cost to Billing.It is there in order and it is not copying to Billing.That too it is for some materials.The item categories of the materials are the same.I know that VPRS in billing is not going to affect any entries and generally the consept of cost ends at creation of goods issue COGS is triggered.
Even for some materials ( Line items ) VPRS is copied and for some materials it is not copied.In conditions it is showing requirement 004 is not fulfilled.How come this happen for some line items when all the configuration is same ( The item categories order types billing types Delivery types are same for all the line items)
Can any one help.
Regards
Narayana.Manam
Edited by: manam narayana on May 2, 2008 5:00 PMHi
Requirement 4 is as follows
Determine costs according to item category configuration (TVAP)
form kobed_004.
sy-subrc = 4.
if komp-kposn ne 0.
check: t001-bukrs = t001k-bukrs.
check: komp-werks ne space.
check: komp-evrwr = 'X'.
check: komp-fareg na '45'.
endif.
sy-subrc = 0.
endform.
Prestep
form kobev_004.
sy-subrc = 0.
endform.
check: t001-bukrs = t001k-bukrs. this line indicates that company code in company Codes table , should be be same as valuation area table, so check the valuation area from the material master and check that valuation area in T001K if it is in same company code.
check: komp-werks ne space this checks if plant is populated 99% it will be.
check: komp-evrwr = 'X'., this is for determine cost indicator, please check first in item category definition if cost indicator is checked then in item table of sales order als, it may happen at time of sales order creation this was not checked.
check: komp-fareg na '45' Rule in billing plan/invoice plan, please check if it is configured.
you can put a breakpoint and check
Regards
Jitesh -
How to edit o/p fields in hierarchical list?
how to make output fields as input enabled, displayed in the hierarchical list?
i.e. to make them as editable?Is it possible in list display?Please refer this....
*& Report ZFIR_WRITE_OFF
REPORT zfir_write_off
NO STANDARD PAGE HEADING
MESSAGE-ID zles.
TYPE-POOLS
TYPE-POOLS:slis.
TABLES
TABLES: kna1, t001, zdunning_data, bsid, t052.
INTERNAL TABLES
To check for bukrs in selection screen
DATA: BEGIN OF t_t001 OCCURS 0,
bukrs TYPE t001-bukrs,
END OF t_t001.
To check for the customer in selection screen
DATA: BEGIN OF t_kna1 OCCURS 0,
kunnr TYPE kna1-kunnr,
name1 TYPE kna1-name1,
END OF t_kna1.
*Data from BSID table
DATA: BEGIN OF t_bsid OCCURS 0,
bukrs LIKE bsid-bukrs,
budat LIKE bsid-budat,
kunnr LIKE bsid-kunnr,
belnr LIKE bsid-belnr,
zfbdt LIKE bsid-zfbdt,
zterm LIKE bsid-zterm,
dmbtr LIKE bsid-dmbtr,
waers LIKE bsid-waers,
vbeln LIKE bsid-vbeln,
END OF t_bsid.
*Data from ZDunning_data
DATA: BEGIN OF t_zdunning OCCURS 0,
belnr LIKE zdunning_data-belnr,
kunnr LIKE zdunning_data-kunnr,
zdef_notice_flg LIKE zdunning_data-zdef_notice_flg,
zterm_notice_flg LIKE zdunning_data-zterm_notice_flg,
END OF t_zdunning.
*Data from t052 for base line days
DATA: BEGIN OF t_t052 OCCURS 0,
zterm LIKE t052-zterm,
ztag1 LIKE t052-ztag1,
END OF t_t052.
*with duedate and date for write off calculation
DATA: BEGIN OF t_data OCCURS 0,
belnr LIKE bsid-belnr,
kunnr LIKE bsid-kunnr,
zterm LIKE bsid-zterm,
zfbdt LIKE bsid-zfbdt,
ztag1 LIKE t052-ztag1,
duedate LIKE bsid-zfbdt,
wdate LIKE bsid-zfbdt,
vbeln LIKE bsid-vbeln,
dmbtr LIKE bsid-dmbtr,
waers LIKE bsid-waers,
budat LIKE bsid-budat,
vbelv like vbfa-vbelv,
Name1 like kna1-name1,
END OF t_data.
*Output display in ALV report
DATA: BEGIN OF t_output OCCURS 0,
Flag type C,
bukrs LIKE bsid-bukrs,
kunnr LIKE bsid-kunnr,
vbeln LIKE bsid-vbeln, "Invoice
posnv like vbfa-posnv,
wdate LIKE bsid-zfbdt,
belnr LIKE bsid-belnr,
dmbtr LIKE bsid-dmbtr,
waers LIKE bsid-waers,
budat LIKE bsid-budat,
vbelv like vbfa-vbelv, "Contract
name1 like kna1-name1,
duedate like bsid-zfbdt,
END OF t_output.
To get contract number for the billing document number
DATA: BEGIN OF t_vbfa OCCURS 0,
vbelv LIKE vbfa-vbelv,
vbeln LIKE vbfa-vbeln,
POSNV like vbfa-POSNV,
END OF t_vbfa.
data: begin of t_cust occurs 0,
KUNNR like kna1-kunnr,
name1 like kna1-name1,
end of t_cust.
data: begin of t_head occurs 0,
VBELv like vbfa-vbelv,
posnv like vbfa-posnv,
VKUEGRU type ZLIST_WO_RCANCEL,
end of t_head.
data: begin of it_veda occurs 0,
VBELn LIKE Veda-VBELN,
POSNR LIKE Veda-VPOSN,
VKUEGRU LIKE Veda-VKUEGRU,
end of it_veda.
VARIABLE DECLARATION
DATA: l_duedate LIKE bsid-zfbdt,
l_wdate LIKE bsid-zfbdt.
VARIABLE FOR ALV DISPLAY
DATA: t_fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat TYPE slis_fieldcat_alv.
DATA: t_fieldcat1 TYPE slis_t_fieldcat_alv WITH HEADER LINE,
wa_fieldcat1 TYPE slis_fieldcat_alv.
DATA: t_layout TYPE slis_layout_alv.
DATA: g_repid LIKE sy-repid.
SELECTION-SCREEN
*Selection Screen Parameters for user input
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS:
*Company Code
p_bukrs LIKE t001-bukrs OBLIGATORY.
SELECT-OPTIONS:
*Customer Number
s_kunnr FOR kna1-kunnr OBLIGATORY DEFAULT '0' TO 'ZZZZZZZZZZ'.
PARAMETERS:
*Write Off Date
p_wodate TYPE sy-datum OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b1 .
AT SELECTION-SCREEN
*Selection Screen validation for Company code
AT SELECTION-SCREEN ON p_bukrs.
SELECT SINGLE bukrs FROM t001 "#EC *
INTO t_t001
WHERE bukrs = p_bukrs.
IF sy-subrc NE 0.
*Error message for Invalid Company Code
MESSAGE e000 WITH text-002.
ENDIF.
*Selection Screen Validation for Customer
AT SELECTION-SCREEN ON s_kunnr.
IF NOT s_kunnr IS INITIAL.
SELECT SINGLE kunnr name1
FROM kna1 "#EC *
INTO t_kna1
WHERE kunnr IN s_kunnr.
IF sy-subrc NE 0.
*Error message for Invalid Customer Number
MESSAGE e000 WITH text-003.
ENDIF.
ENDIF.
AT SELECTION-SCREEN ON p_wodate.
IF p_wodate IS INITIAL.
p_wodate = sy-datum.
ENDIF.
INITIALIZATION
INITIALIZATION.
PERFORM clear_data.
START-OF-SELECTION
START-OF-SELECTION.
*Get the Accounting Document Number and base line date from BSID
SELECT bukrs kunnr belnr budat zfbdt zterm dmbtr waers vbeln
FROM bsid
INTO corresponding fields of TABLE t_bsid
WHERE kunnr IN s_kunnr AND
bukrs = p_bukrs.
IF NOT t_bsid[] IS INITIAL.
*Get the Dunning data based on the Accounting Document Number from BSID
SELECT belnr kunnr zdef_notice_flg zterm_notice_flg
FROM zdunning_data
INTO TABLE t_zdunning
FOR ALL ENTRIES IN t_bsid
WHERE kunnr = t_bsid-kunnr AND
belnr = t_bsid-belnr AND
zdef_notice_flg = 'Y' AND
zterm_notice_flg = 'Y'.
*Get the base line days from t052 table based on BSID data
SELECT zterm ztag1
FROM t052
INTO TABLE t_t052
FOR ALL ENTRIES IN t_bsid
WHERE zterm = t_bsid-zterm.
*Calculate the due date(bse line date BSID-ZFBDT + base line days
*T052-ZTAG )
IF NOT t_zdunning[] IS INITIAL.
Get the customer name
Select KUNNR NAME1 from KNA1
INTO table t_cust
for all entries in t_zdunning
where kunnr = t_zdunning-kunnr.
LOOP AT t_zdunning.
LOOP AT t_bsid.
CLEAR t_zdunning.
READ TABLE t_zdunning WITH KEY belnr = t_bsid-belnr
kunnr = t_bsid-kunnr.
CHECK sy-subrc = 0.
CLEAR t_t052.
READ TABLE t_t052 WITH KEY zterm = t_bsid-zterm.
IF sy-subrc = 0 .
t_data-belnr = t_zdunning-belnr.
t_data-kunnr = t_zdunning-kunnr.
Clear t_cust.
read table t_cust with key kunnr = t_zdunning-kunnr.
if sy-subrc = 0.
t_data-name1 = t_cust-name1.
endif.
t_data-zterm = t_bsid-zterm.
t_data-zfbdt = t_bsid-zfbdt.
t_data-ztag1 = t_t052-ztag1.
t_data-vbeln = t_bsid-vbeln.
t_data-dmbtr = t_bsid-dmbtr.
t_data-waers = t_bsid-waers.
t_data-budat = t_bsid-budat.
*calculate duedate
CLEAR l_duedate.
l_duedate = t_bsid-zfbdt + t_t052-ztag1.
t_data-duedate = l_duedate.
*calculate date for write off
CLEAR l_wdate.
l_wdate = l_duedate + 180.
t_data-wdate = l_wdate.
APPEND t_data.
CLEAR l_wdate.
CLEAR l_duedate.
ENDIF.
ENDLOOP.
ELSE.
MESSAGE s000 WITH text-005.
ENDIF.
*Check the wdate with write off date in the selection screen value.
*If this calculated date is Greater than value enetred in selection
*screen, display the corresponding data in ALV report.
IF NOT t_data[] IS INITIAL.
SELECT vbelv vbeln
POSNV
FROM vbfa
INTO TABLE t_vbfa
FOR ALL ENTRIES IN t_data
WHERE vbeln = t_data-vbeln.
and
VBTYP_V = 'G'.
*If reason for cancelation is there, no writeoff.
Select VBELn VPOSN VKUEGRU from Veda
into table it_veda
for all entries in t_vbfa
where vbeln = t_vbfa-vbelv.
SELECT vbelv
POSNV
FROM vbfa
INTO TABLE t_Head
FOR ALL ENTRIES IN t_data
WHERE vbeln = t_data-vbeln
and
VBTYP_V = 'G'.
loop at t_head.
clear it_veda.
Read table it_veda with key vbeln = t_head-vbelv
posnr = t_head-posnv.
if not it_veda-VKUEGRU is initial.
Delete t_head where vbelv = it_veda-vbeln and
posnv = it_veda-posnr.
endif.
endloop.
LOOP AT t_data.
IF t_data-wdate LE p_wodate.
t_output-bukrs = p_bukrs.
t_output-kunnr = t_data-kunnr.
CLEAR t_vbfa.
READ TABLE t_vbfa WITH KEY vbeln = t_data-vbeln.
read table t_head with key vbelv = t_vbfa-vbelv
posnv = t_vbfa-posnv.
if sy-subrc = 0.
t_output-vbelv = t_vbfa-vbelv.
t_output-posnv = t_vbfa-posnv.
t_output-name1 = t_data-name1.
t_output-wdate = t_data-wdate.
t_output-belnr = t_data-belnr.
t_output-dmbtr = t_data-dmbtr.
t_output-waers = t_data-waers.
t_output-budat = t_data-budat.
t_output-vbeln = t_data-vbeln.
t_output-duedate = t_data-duedate .
APPEND t_output.
ENDIF.
clear t_output.
ENDIF.
ENDLOOP.
ELSE.
MESSAGE s000 WITH text-006.
ENDIF.
*ALV display for the output records
IF NOT t_output[] IS INITIAL.
PERFORM alv_display.
ELSE.
MESSAGE s000 WITH text-006.
ENDIF.
ELSE.
MESSAGE s000 WITH text-004.
ENDIF.
*& Form clear_data
text
--> p1 text
<-- p2 text
FORM clear_data .
CLEAR:t_t001,
t_kna1,
t_bsid,
t_zdunning,
t_t052,
t_data,
t_output,
wa_fieldcat,
t_layout,
t_fieldcat,
t_vbfa.
REFRESH:t_t001,
t_kna1,
t_bsid,
t_zdunning,
t_t052,
t_data,
t_output,
t_fieldcat,
t_vbfa.
clear:t_head,
it_veda.
Refresh:t_head,
it_veda.
Clear T_cust.
Refresh t_data.
ENDFORM. " clear_data
*& Form alv_display
text
--> p1 text
<-- p2 text
FORM alv_display .
*To build the field catalogue
PERFORM build_fieldcatalog1.
PERFORM build_fieldcatalog.
*To build the ALV layout
PERFORM build_layout.
*To displayt the data in ALV report
PERFORM display_alv_report.
ENDFORM. " alv_display
*& Form build_fieldcatalog
text
--> p1 text
<-- p2 text
FORM build_fieldcatalog1 .
REFRESH t_fieldcat1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = '1'.
wa_fieldcat-fieldname = 'VBELV'.
wa_fieldcat-tabname = 'T_HEAD'.
wa_fieldcat-seltext_l = 'Contract Number'.
wa_fieldcat-Checkbox = 'X'.
wa_fieldcat-edit = 'X'.
wa_fieldcat-no_out = 'X'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO t_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = '2'.
wa_fieldcat-fieldname = 'POSNV'.
wa_fieldcat-tabname = 'T_HEAD'.
wa_fieldcat-seltext_l = 'Item Number'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO t_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = '3'.
wa_fieldcat-fieldname = 'VKUEGRU'.
wa_fieldcat-edit = 'X'.
wa_fieldcat-input = 'X'.
wa_fieldcat-tabname = 'T_HEAD'.
wa_fieldcat-drdn_hndl = '1'.
wa_fieldcat-seltext_l = 'Reason for Cancel'.
wa_fieldcat-outputlen = '25'.
APPEND wa_fieldcat TO t_fieldcat.
CLEAR wa_fieldcat.
endform.
FORM build_fieldcatalog .
REFRESH t_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = '4'.
wa_fieldcat-fieldname = 'KUNNR'.
wa_fieldcat-tabname = 'T_OUTPUT'.
wa_fieldcat-seltext_l = 'Customer Number'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO t_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = '5'.
wa_fieldcat-fieldname = 'NAME1'.
wa_fieldcat-tabname = 'T_OUTPUT'.
wa_fieldcat-seltext_l = 'Customer Name'.
wa_fieldcat-outputlen = '30'.
APPEND wa_fieldcat TO t_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = '6'.
wa_fieldcat-fieldname = 'VBELV'.
wa_fieldcat-tabname = 'T_OUTPUT'.
wa_fieldcat-seltext_l = 'Contract Number'.
wa_fieldcat-outputlen = '20'.
APPEND wa_fieldcat TO t_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = '7'.
wa_fieldcat-fieldname = 'VBELN'.
wa_fieldcat-tabname = 'T_OUTPUT'.
wa_fieldcat-seltext_l = 'Invoice No.'.
wa_fieldcat-outputlen = '10'.
APPEND wa_fieldcat TO t_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = '8'.
wa_fieldcat-fieldname = 'BELNR'.
wa_fieldcat-tabname = 'T_OUTPUT'.
wa_fieldcat-seltext_l = 'Acc doc Number'.
wa_fieldcat-outputlen = '20'.
APPEND wa_fieldcat TO t_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = '9'.
wa_fieldcat-fieldname = 'WAERS'.
wa_fieldcat-tabname = 'T_OUTPUT'.
wa_fieldcat-seltext_l = 'Currency'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO t_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = '10'.
wa_fieldcat-fieldname = 'DMBTR'.
wa_fieldcat-tabname = 'T_OUTPUT'.
wa_fieldcat-do_sum = 'X'. "SUM UPON DISPLAY
wa_fieldcat-datatype = 'CURR'.
wa_fieldcat-seltext_l = 'Amount'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO t_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = '11'.
wa_fieldcat-fieldname = 'DUEDATE'.
wa_fieldcat-tabname = 'T_OUTPUT'.
wa_fieldcat-seltext_l = 'Due Date'.
wa_fieldcat-outputlen = '20'.
APPEND wa_fieldcat TO t_fieldcat.
data: lt_dropdown type lvc_t_drop,
ls_dropdown type lvc_s_drop.
First listbox (handle '1').
ls_dropdown-handle = '1'.
ls_dropdown-value = 'KG'.
append ls_dropdown to lt_dropdown.
ls_dropdown-handle = '1'.
ls_dropdown-value = 'G'.
append ls_dropdown to lt_dropdown.
call method g_grid->set_drop_down_table
exporting it_drop_down = lt_dropdown.
ENDFORM. " build_fieldcatalog
*& Form build_layout
text
--> p1 text
<-- p2 text
FORM build_layout .
t_layout-no_input = 'X'.
t_layout-colwidth_optimize = 'X'.
ENDFORM. " build_layout
*& Form display_alv_report
text
--> p1 text
<-- p2 text
FORM display_alv_report .
g_repid = sy-repid.
data g_keyinfo type SLIS_KEYINFO_ALV.
g_keyinfo-HEADER01 = 'VBELV'.
g_keyinfo-ITEM01 = 'VBELV'.
g_keyinfo-HEADER02 = 'POSNV'.
g_keyinfo-ITEM02 = 'POSNV'.
CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
EXPORTING
i_interface_check = 'I'
i_callback_program = g_repid
i_callback_pf_status_set = 'SET_STATUS'
i_callback_user_command = 'USER_COMMAND'
is_layout = gs_layout
it_fieldcat = t_fieldcat[]
i_default = ' '
i_save = 'A'
i_tabname_header = 'T_HEAD'
i_tabname_item = 'T_OUTPUT'
i_structure_name_header = v_headers_table
i_structure_name_item = v_items_table
is_keyinfo = g_keyinfo
i_bypassing_buffer = 'X'
TABLES
t_outtab_header = t_head[]
t_outtab_item = i_result
t_outtab_item = t_output[]
EXCEPTIONS
program_error = 1
OTHERS = 2.
REFRESH: t_fieldcat[].
refresh t_fieldcat1[].
ENDFORM. " display_alv_report
form SET_STATUS using extab TYPE slis_t_extab.
SET PF-STATUS 'ZEO_S1' .
endform.
*& Form Top_Of_Page
Top_Of_Page event in ALV
FORM top_of_page .
DATA: t_header TYPE slis_t_listheader,
wa_header TYPE slis_listheader.
Title
wa_header-typ = 'H'.
wa_header-info = ' Write Off Worklist'.
APPEND wa_header TO t_header.
CLEAR wa_header.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = t_header.
ENDFORM. "Top_Of_Page
*User Command for the button
form user_command using r_ucomm type syucomm
ls_selfield type SLIS_SELFIELD.
Break-point.
case r_ucomm.
when 'EXEC'.
data: begin of lt_cancel occurs 0.
include structure ZCANCEL.
data end of lt_cancel.
Clear lt_cancel.
Refresh lt_cancel.
Data: ref1 type ref to cl_gui_alv_grid.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
E_GRID = ref1.
call method ref1->check_changed_data.
loop at t_Head where VKUEGRU is not initial.
if ( t_HEAD-VKUEGRU NE '1' ) or
( t_Head-VKUEGRU NE '2' ) or
( t_head-VKUEGRU NE '3' ).
Clear t_head-vkuegru.
message e000 with text-110.
endif.
lt_cancel-vbeln = t_head-vbelv.
lt_cancel-posnr = t_head-posnv.
lt_cancel-VKUEGRU = t_head-VKUEGRU.
Append lt_cancel.
Clear lt_cancel.
Endloop.
CALL FUNCTION 'ZSD_CNTR_CANCEL'
TABLES
zcancel = lt_cancel.
message s000 .
endcase.
endform.
Regards
vasu
Maybe you are looking for
-
An encrypted connection to your mail server is not available.
I've seen various people that have experienced the issue of having the following message appear when setting up an email account in Outlook 2013 "An encrypted connection to your mail server is not available" however none of the solutions i've came ac
-
Is it possible to use Acrobat 9 sdk to check accessibility?
Is it possible to use Acrobat 9 sdk to check accessibility of a pdf and get whether the pdf is accessible or not? I've found InvokeAccessibilityCheckerCmdSnip.cpp that seems to call accessibility validator, but I don't know if that will make what I n
-
File to JDBC Scenario using stored procedure Question
Does anyone have an aswer (or have you seen a Blog that covers it) to the problem of having to do a table refresh before doing inserts in a file 2 jdbc scenario? Essentially the details are as follows: I have an input file that has all the data for a
-
PowerBook - Powerbook 17 LCD, Inverter and Video LCD Cable
Hi, I have the following issue: My Video LCD Cable is broken (Some of the little cables inside are broken) and i need to replace it. But i'm not sure if the Inverter is also broken. Is there a way to know that so i can buy both of them or only the LC
-
Compressed table using oracle advanced compression but space is not release
Dear Experts, I am using oracle 11.2.0.2 with sap as application I have compressed one of my largest indetified table "SWWCNTP0" as per below statement Alter table sapsr3.SWWCNTP0 compress for oltp; After this i have performed reorg for the above tab