Alv/radiobuttons
Hello Experts,
I am having a requirement to show radio button group as a coloumn in ABAP WEB DYNPRO ALV and capture the 'Yes' , 'No' values of the row .Could you pls provide some examples
Thanks in Advance.....
Best Regards,
Kumar
Hi,
1. SY-UNAME contains values only at run time :-). You cannot change the value of that field. even if you change it, the system will will restore it to the correct value at the beginning of the next dialog step.
2. ALV -> <b>A</b>BAP <b>L</b>ist <b>V</b>iewer. Just like you cannot have a radiobutton on a list, you cannot have it in ALV either.
Regards,
Anand Mandalika.
Similar Messages
-
Hi Experts ,
I want to know where exactly the ALV GRID DISPLAY Function Module has been called in the program of T.code ME55(RM06BF00) , Actually my requirement is to add one more field (available stock of the material ) in the ALV Output of the T.code ME55 . I tried to find the field catalogue in the prog. RM06BF00 , but could'nt find it anywhere in the prog. Then I copied the prog. into a Z Report and after executing the Z report in the Selection screen I entered Release Code = G3 and Scope of List = ALV .
But an exit message comes saying ' Scope of list ALV not defined (please correct)' . However for another scope of list it is coming . Plese help .
Thanks ,
Suvendu*& Report ZBREAKDOWN
REPORT ZBREAKDOWN NO STANDARD PAGE HEADING..
tables: CRHD, QMEL, QMFE, QMIH, QMUR, TQ80_T, TQ15T, QPGT, QPGR, t001w.
type-pools slis.
data : it_list type slis_t_listheader with header line,
gt_evnt type slis_t_event with header line.
data : begin of outstand_wa occurs 0,
********Work Center Header
OBJTY LIKE CRHD-OBJTY , " Object types of the CIM resource
OBJID LIKE CRHD-OBJID , " Object ID of the resource
ARBPL LIKE CRHD-ARBPL , " Work center
WERKS like CRHD-WERKS , " Plant
VERWE LIKE CRHD-VERWE , " Work center cat.
VERAN LIKE CRHD-VERAN , " Person responsible for the work center
*********Quality Notification
CROBJTY LIKE QMEL-CROBJTY , " Object types of the CIM resource
ARBPLn LIKE QMEL-ARBPL , " Object ID of the Work Center
QMNUM LIKE QMEL-QMNUM , " Notification No
QMART LIKE QMEL-QMART , " Notification Type
QMTXT LIKE QMEL-QMTXT , " Short Text
QMDAT LIKE QMEL-QMDAT , " Date of Notification
AUFNR LIKE QMEL-AUFNR , " Order Number
**********Notification type texts
QMARTX LIKE TQ80_T-QMARTX , " Notification Type Texts
*********Quality notification - items
FEKAT LIKE QMFE-FEKAT , " Catalog Type - Problems/Defects
FEGRP LIKE QMFE-FEGRP , " Code Group - Problem
FECOD LIKE QMFE-FECOD , " Problem or Damage Code
OTKAT LIKE QMFE-OTKAT , " Catalog Type - Object Parts
OTGRP LIKE QMFE-OTGRP , " Code Group - Object Parts
KOSTL LIKE QMFE-KOSTL , " Cost Center
FETXT LIKE QMFE-FETXT , " Notification Item Short Text
ERNAM LIKE QMFE-ERNAM , " Name of Person who Created the Object
ERDAT LIKE QMFE-ERDAT , " Date on Which Record Was Created
AENAM LIKE QMFE-AENAM , " Name of Person Who Changed Object
AEDAT LIKE QMFE-AEDAT , " Changed On
*****Inspection catalog type index
SPRACHE LIKE TQ15T-SPRACHE , " Language Key
KATALOGART LIKE TQ15T-KATALOGART , " Catalog
KATALOGTXT LIKE TQ15T-KATALOGTXT , " Catalog Text
**********Code group texts
CODEGRUPPE LIKE QPGT-CODEGRUPPE , " Code Group
KURZTEXT LIKE QPGT-KURZTEXT , " Short Description of the Code Group
**********Inspection catalog code groups
*KURZTEX LIKE QPGR-KURZTEXT , "
*********Quality message - maintenance data excerpt
MSAUS LIKE QMIH-MSAUS , " Breakdown Indicator
AUSVN LIKE QMIH-AUSVN , " Start of Malfunction (Date)
AUSBS LIKE QMIH-AUSBS , " End of Malfunction (Date)
AUZTV LIKE QMIH-AUZTV , " Start of Malfunction (Time)
AUZTB LIKE QMIH-AUZTB , " End of Malfunction (Time)
AUSZT LIKE QMIH-AUSZT , " Breakdown Duration
INGRP LIKE QMIH-INGRP , " Planner Group for Customer Service and Plant Maintenance
*********Quality notification - causes
URTXT LIKE QMUR-URTXT , " Cause Text
URKAT LIKE QMUR-URKAT , " Catalog Type - Causes
URGRP LIKE QMUR-URGRP , " Code Group - Causes
URCOD LIKE QMUR-URCOD , " Cause Code
*********Person responsible for the work center
KTEXT LIKE TC24-KTEXT , " NAME OF THE PERSON RESP.
*****Plants/Branches
stras like t001w-stras ,
pstlz like t001w-pstlz ,
adrnr like t001w-adrnr ,
ort01 LIKE t001w-ort01 ,
BIND(3),
KATALOG(40),
ddiff TYPE p,
tdiff TYPE p DECIMALS 2,
d3 type p,
t3 type minutes,
m_break type sy-uzeit,
t4(16) type p,
t6 type sy-tabix,
t7 type swl_pm_cvh-duration,
t5 type swl_pm_cvh-duration,
end of outstand_wa.
*data : outstand_hd type standard table of outstand_wa initial size 0 with header line.
data : tab_etab type standard table of etab,
wa_etab type etab.
DATA: is_layout TYPE slis_layout_alv.
DATA: M_TIME TYPE SY-UZEIT VALUE 24.
data: l_start type t,
l_end type t,
l_startdate type d,
l_enddate type d,
l_hours type p decimals 2.
*DATA : DATE1 TYPE SY-DATUM,
TIME1 TYPE SY-UZEIT,
DATE2 TYPE SY-DATUM,
TIME2 TYPE SY-UZEIT.
selection-screen begin of block plant with frame title text-001.
select-options : m_plant for CRHD-WERKS obligatory . " Plant
select-options : m_work for CRHD-ARBPL . " Work center
select-options : m_catg for CRHD-VERWE . " Work center cat.
select-options : m_pern for CRHD-VERAN . " Person responsible for the work center
select-options : m_type for QMEL-QMART . " Notification Type
select-options : m_date for QMEL-QMDAT obligatory. " Date of Notification
select-options : m_ordr for QMEL-AUFNR . " Order Number
select-options : m_cost for QMFE-KOSTL . " Cost Center
selection-screen end of block plant.
selection-screen begin of block radi with frame title text-004.
*parameters list radiobutton group rad1.
parameters grid radiobutton group rad1.
parameters alv radiobutton group rad1.
selection-screen end of block radi.
data: fieldcat type slis_t_fieldcat_alv .
select CRHDOBJTY CRHDOBJID CRHDARBPL CRHDWERKS CRHDVERWE CRHDVERAN
QMELCROBJTY QMELARBPL QMELQMNUM QMELQMART QMELQMTXT QMELQMDAT QMEL~AUFNR
TQ80_T~QMARTX
QMFEFEKAT QMFEFEGRP QMFEFECOD QMFEOTKAT QMFEOTGRP QMFEKOSTL QMFEFETXT QMFEERNAM QMFEERDAT QMFEAENAM QMFE~AEDAT
TQ15TSPRACHE TQ15TKATALOGART TQ15T~KATALOGTXT
QPGTCODEGRUPPE QPGTKURZTEXT
QMIHMSAUS QMIHAUSVN QMIHAUSBS QMIHAUZTV QMIHAUZTB QMIHAUSZT QMIH~INGRP
QMURURTXT QMURURKAT QMURURGRP QMURURCOD
TC24~KTEXT
T001WSTRAS T001WPSTLZ T001WADRNR T001WORT01
into table outstand_wa
from CRHD
INNER JOIN QMEL ON CRHDOBJID = QMELARBPL
INNER JOIN QMFE ON QMELQMNUM = QMFEQMNUM
INNER JOIN QMIH ON QMFEQMNUM = QMIHQMNUM
INNER JOIN QMUR ON QMIHQMNUM = QMURQMNUM
INNER JOIN TC24 ON CRHDVERAN = TC24VERAN
INNER JOIN T001W ON CRHDWERKS = T001WWERKS
INNER JOIN TQ80_T ON QMELQMART = TQ80_TQMART
INNER JOIN TQ15T ON QMFEFEKAT = TQ15TKATALOGART
INNER JOIN QPGT ON QMFEFEGRP = QPGTCODEGRUPPE
WHERE CRHDWERKS IN m_plant AND CRHDARBPL IN m_work AND CRHDVERWE IN m_catg AND CRHDVERAN IN m_pern
AND QMELQMART IN m_type AND QMELAUFNR IN m_ordr AND QMFEKOSTL IN m_cost AND TQ15TSPRACHE = 'E' AND QMEL~QMDAT IN m_date.
*AND QMEL~QMDAT IN m_date
**AND CRHDARBPL IN m_work AND CRHDVERWE IN m_catg AND CRHD~VERAN IN m_pern
**AND QMELQMART IN m_type AND QMELQMDAT IN m_date AND QMELAUFNR IN m_ordr AND QMFEKOSTL IN m_cost AND TQ15T~SPRACHE = 'E'.
*AND QPGTCODEGRUPPE = QMFEOTGRP.
if sy-subrc = 0.
LOOP AT outstand_wa.
if outstand_wa-MSAUS = 'X'.
outstand_wa-BIND = 'YES'.
modify outstand_wa transporting BIND.
endif.
if outstand_wa-MSAUS = ' '.
outstand_wa-BIND = 'NO'.
modify outstand_wa transporting BIND.
endif.
if outstand_wa-URKAT = '1'.
outstand_wa-KATALOG = 'Characteristic Attributes'.
MODIFY outstand_wa TRANSPORTING KATALOG.
ENDIF.
if outstand_wa-URKAT = '2'.
outstand_wa-KATALOG = 'Tasks'.
MODIFY outstand_wa TRANSPORTING KATALOG.
ENDIF.
if outstand_wa-URKAT = '3'.
outstand_wa-KATALOG = 'Usage Decisions'.
MODIFY outstand_wa TRANSPORTING KATALOG.
ENDIF.
if outstand_wa-URKAT = '4'.
outstand_wa-KATALOG = 'Events'.
MODIFY outstand_wa TRANSPORTING KATALOG.
ENDIF.
if outstand_wa-URKAT = '5'.
outstand_wa-KATALOG = 'Causes'.
MODIFY outstand_wa TRANSPORTING KATALOG.
ENDIF.
if outstand_wa-URKAT = '6'.
outstand_wa-KATALOG = 'Results of Defects'.
MODIFY outstand_wa TRANSPORTING KATALOG.
ENDIF.
if outstand_wa-URKAT = '8'.
outstand_wa-KATALOG = 'Activities(QM)'.
MODIFY outstand_wa TRANSPORTING KATALOG.
ENDIF.
if outstand_wa-URKAT = '9'.
outstand_wa-KATALOG = 'Defect Types'.
MODIFY outstand_wa TRANSPORTING KATALOG.
ENDIF.
if outstand_wa-URKAT = 'A'.
outstand_wa-KATALOG = 'Activities(PM)'.
MODIFY outstand_wa TRANSPORTING KATALOG.
ENDIF.
if outstand_wa-URKAT = 'B'.
outstand_wa-KATALOG = 'Object Parts'.
MODIFY outstand_wa TRANSPORTING KATALOG.
ENDIF.
if outstand_wa-URKAT = 'C'.
outstand_wa-KATALOG = 'Overview of Damage'.
MODIFY outstand_wa TRANSPORTING KATALOG.
ENDIF.
if outstand_wa-URKAT = 'D'.
outstand_wa-KATALOG = 'Coding'.
MODIFY outstand_wa TRANSPORTING KATALOG.
ENDIF.
if outstand_wa-URKAT = 'E'.
outstand_wa-KATALOG = 'Defect Locations'.
MODIFY outstand_wa TRANSPORTING KATALOG.
ENDIF.
if outstand_wa-URKAT = 'F'.
outstand_wa-KATALOG = 'Decision(SPM Returns)'.
MODIFY outstand_wa TRANSPORTING KATALOG.
ENDIF.
if outstand_wa-URKAT = 'G'.
outstand_wa-KATALOG = 'Defect(SPM Returns)'.
MODIFY outstand_wa TRANSPORTING KATALOG.
ENDIF.
if outstand_wa-URKAT = 'H'.
outstand_wa-KATALOG = 'Effort(SPM Returns)'.
MODIFY outstand_wa TRANSPORTING KATALOG.
ENDIF.
if outstand_wa-URKAT = 'I'.
outstand_wa-KATALOG = 'Follow-Up Activity(SPM Returns)'.
MODIFY outstand_wa TRANSPORTING KATALOG.
ENDIF.
ENDLOOP.
ENDIF.
IF outstand_wa-MSAUS = 'X'.
BIND = 'YES'.
ELSEIF outstand_wa-MSAUS = ' '.
BIND ='NO'.
ENDIF.
*ENDLOOP.
*ENDIF.
case 'X'.
WHEN LIST.
PERFORM SIMPLE_LIST.
when grid.
perform writ_list.
perform calculation.
when alv.
perform writ_alv.
perform calculation.
DATA: layout TYPE slis_layout_alv.
PERFORM build_field_catalog.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
is_layout = layout
it_fieldcat = fieldcat
i_callback_top_of_page = 'TOP_OF_PAGE'
it_events = gt_evnt[]
TABLES
t_outtab = outstand_wa.
endcase.
*& Form BUILD_LAYOUT
Build layout for ALV grid report
*form build_layout.
gd_layout-no_input = 'X'.
gd_layout-colwidth_optimize = 'X'.
gd_layout-totals_text = 'Totals'(201).
*gd_layout-totals_text = 'Totals'.
Set layout field for row attributes(i.e. color)
gd_layout-info_fieldname = 'LINE_COLOR'.
gd_layout-totals_only = 'X'.
gd_layout-f2code = 'DISP'. "Sets fcode for when double
"click(press f2)
gd_layout-zebra = 'X'.
gd_layout-group_change_edit = 'X'.
gd_layout-header_text = 'helllllo'. -
What is % in a Abap code?
i have a report which uses % everywhere.
No idea what that means?
part of the code is like this..
DATA %data_selected(1).
DATA %glframe(1) VALUE 'X' .
DATA %uflag(1).
DATA %ustflag(1).
SELECTION-SCREEN: BEGIN OF LINE.
PARAMETERS: %alv RADIOBUTTON GROUP func USER-COMMAND outbut
DEFAULT 'X' .
SELECTION-SCREEN: COMMENT 4(26) text-f72 FOR FIELD %alv.
PARAMETERS: %alvl TYPE slis_vari.
SELECTION-SCREEN: PUSHBUTTON 72(4) pb%exco USER-COMMAND expcol.
SELECTION-SCREEN: END OF LINE.Hi,
This kind of reports are generated by the System itself.
Thats y it contains % everywhere. I think this report is related with Select Query(SQ01).
Regards,
Ramya. -
Really urgent: seperation of dates for displaying the stock
hi,
I am modifying a report in which i have to display the stock in the following way:-
1.) If P_DATE(15.03.2008) then it should display the stock of previous month as the stock it stored on always on the last date of each month.
2.) If P_DATE(16.03.2008) then it should display the stock of this month as the stock it stored on always on the last date of each month.
my requierment is how to display it?
plzz help me out as help will be deifnately rewarded.
Edited by: ric .s on Mar 15, 2008 6:09 AM
Edited by: ric .s on Mar 15, 2008 6:15 AMHI,
plz go through the code and try to analyze it ,u will not be abel to run dis code as it consist of the table which is made by the programmers.
*& Report ZPP_INV_COPY1
REPORT ZPP_INV_COPY1 NO STANDARD PAGE HEADING LINE-SIZE 150.
TABLES : MARA, MAKT, MARD, MKPF, MSEG, T001L,ZSTOCKSUM.
TYPE-POOLS : SLIS.
**DATA : BEGIN OF STIT OCCURS 0,
BUDAT LIKE MKPF-BUDAT,
MATNR LIKE MSEG-MATNR,
WERKS LIKE MSEG-WERKS,
LGORT LIKE MSEG-LGORT,
MENGE LIKE MSEG-MENGE,
MEINS LIKE MSEG-MEINS,
ERFMG LIKE MSEG-ERFMG,
ERFME LIKE MSEG-ERFME,
SHKZG LIKE MSEG-SHKZG,
BWART LIKE MSEG-BWART,
DATA : BEGIN OF STIT OCCURS 0,
STLDATE LIKE ZSTOCKSUM-STLDATE,
MATNR LIKE ZSTOCKSUM-MATNR,
WERKS LIKE ZSTOCKSUM-WERKS,
LGORT LIKE ZSTOCKSUM-LGORT,
STSTOCK LIKE ZSTOCKSUM-STSTOCK,
STDEBIT LIKE ZSTOCKSUM-STDEBIT,
STCREDIT LIKE ZSTOCKSUM-STCREDIT,
MEINS LIKE MARA-MEINS,
MTART LIKE MARA-MTART,
MATKL LIKE MARA-MATKL,
NTGEW LIKE MARA-NTGEW,
GEWEI LIKE MARA-GEWEI,
WTKG LIKE MARA-NTGEW,
STOCK TYPE P LENGTH 10 DECIMALS 3,
WT TYPE P LENGTH 12 DECIMALS 3,
END OF STIT.
DATA : BEGIN OF SLIT OCCURS 0,
LGORT LIKE T001L-LGORT,
LGOBE LIKE T001L-LGOBE,
ROH TYPE P LENGTH 12 DECIMALS 3,
ZBOP TYPE P LENGTH 12 DECIMALS 3,
FERT TYPE P LENGTH 12 DECIMALS 3,
HALB TYPE P LENGTH 12 DECIMALS 3,
ZSCR TYPE P LENGTH 12 DECIMALS 3,
TOT TYPE P LENGTH 12 DECIMALS 3,
crrow type P length 3,
END OF SLIT.
DATA : ITAB LIKE STIT OCCURS 0 WITH HEADER LINE.
DATA : BEGIN OF ITAB1 OCCURS 0,
MTART LIKE MARA-MTART,
END OF ITAB1.
******************OLD ITAB2****************
**DATA : BEGIN OF ITAB2 OCCURS 0,
LGORT LIKE MSEG-LGORT,
END OF ITAB2.
*************NEW ITAB2**********************
DATA : BEGIN OF ITAB2 OCCURS 0,
LGORT LIKE ZSTOCKSUM-LGORT,
END OF ITAB2.
DATA : V_QTY TYPE P LENGTH 12 DECIMALS 3,
V_QTY1 TYPE P LENGTH 12 DECIMALS 3,
V_ALV TYPE C,
V_MAXROW TYPE P LENGTH 3.
AT LINE-SELECTION.
DATA : V_COL TYPE N LENGTH 3,
V_ROW TYPE N LENGTH 3,
V_RHDR LIKE T001L-LGORT,
V_CHDR LIKE MARA-MTART,
w_msg TYPE string.
IF SY-LSIND = 1.
V_COL = SY-CUCOL.
V_ROW = SY-CUROW.
V_RHDR = ''.
V_CHDR = ''.
PERFORM GET_PARM.
IF V_ROW <> 999.
PERFORM PRN_ITSTOCK.
ENDIF.
endif.
start-of-selection.
selection-screen begin of block par1 WITH FRAME TITLE TEXT-001.
*PARAMETERS : P_DATE LIKE MKPF-BUDAT OBLIGATORY DEFAULT sy-datum.
*PARAMETERS : P_WERKS LIKE MSEG-WERKS DEFAULT 'MFPL'.
PARAMETERS : P_DATE LIKE ZSTOCKSUM-STLDATE OBLIGATORY DEFAULT sy-datum.
PARAMETERS : P_WERKS LIKE ZSTOCKSUM-WERKS DEFAULT 'MFPL'.
SELECT-OPTIONS : MAT_TYPE FOR MARA-MTART.
****SELECT-OPTIONS : P_MATNR FOR MSEG-MATNR.
****SELECT-OPTIONS : P_STLOC FOR MSEG-LGORT.
SELECT-OPTIONS : P_MATNR FOR ZSTOCKSUM-MATNR.
SELECT-OPTIONS : P_STLOC FOR ZSTOCKSUM-LGORT.
SELECTION-SCREEN END OF BLOCK par1.
***SELECTION-SCREEN BEGIN OF BLOCK OPSC
***WITH FRAME TITLE TEXT-002.
***SELECTION-SCREEN BEGIN OF LINE.
***PARAMETERS ALV RADIOBUTTON GROUP OP.
***SELECTION-SCREEN COMMENT 4(13) TEXT-011 FOR FIELD ALV.
***SELECTION-SCREEN END OF LINE.
***SELECTION-SCREEN BEGIN OF LINE.
***PARAMETERS SCR RADIOBUTTON GROUP OP DEFAULT 'X'.
***SELECTION-SCREEN COMMENT 4(13) TEXT-012 FOR FIELD SCR.
***SELECTION-SCREEN END OF LINE.
***SELECTION-SCREEN END OF BLOCK OPSC.
AUTHORITY-CHECK OBJECT 'ZPLANT1'
ID 'WERKS' FIELD P_WERKS.
IF sy-subrc <> 0.
MESSAGE e045(zmsg) WITH P_WERKS.
ENDIF.
PERFORM GET_INI_DATA.
PERFORM GET_GRP_DATA.
V_ALV ='N'.
PERFORM PRN_SMSTOCK_TXT.
*& Form GET_INI_DATA
text
--> p1 text
<-- p2 text
form GET_INI_DATA .
******************ORG******************************************
SELECT AMATNR BWERKS BLGORT AMEINS AMTART AMATKL ANTGEW AGEWEI A~NTGEW
FROM MARA AS A INNER JOIN MSEG AS B ON AMATNR = BMATNR
INTO TABLE ITAB
WHERE B~WERKS = P_WERKS
AND A~MATNR IN P_MATNR
AND ( MTART = 'FERT' OR MTART = 'HALB' OR MTART = 'ZBOP' OR MTART = 'ZSCR' OR MTART = 'ROH' )
AND MTART IN MAT_TYPE
GROUP BY AMATNR BWERKS BLGORT AMEINS AMTART AMATKL ANTGEW AGEWEI A~NTGEW.
***************************PREV CHANGE***********************************
SELECT BBUDAT AMATNR AWERKS ALGORT AMENGE AMEINS AERFMG AERFME ASHKZG ABWART
CMTART CMATKL CNTGEW CGEWEI C~NTGEW
FROM MSEG AS A INNER JOIN MKPF AS B ON AMBLNR = BMBLNR AND AMJAHR = BMJAHR
INNER JOIN MARA AS C ON AMATNR = CMATNR
INTO TABLE STIT
WHERE AWERKS = P_WERKS AND AMATNR IN P_MATNR AND BUDAT <= P_DATE
AND MTART IN MAT_TYPE
AND ( MTART = 'FERT' OR MTART = 'HALB' OR MTART = 'ZBOP' OR MTART = 'ZSCR' OR MTART = 'ROH' )
AND A~LGORT IN P_STLOC.
*****************************NEW CHANGE AS ON 26.02.2008*********************************
*AERFMG AERFME ASHKZG ABWART
SELECT ASTLDATE AMATNR AWERKS ALGORT ASTSTOCK ASTDEBIT A~STCREDIT
CMEINS CMTART CMATKL CNTGEW C~GEWEI
FROM ZSTOCKSUM AS A
INNER JOIN MARA AS C ON AMATNR = CMATNR
INTO TABLE STIT
WHERE AWERKS = P_WERKS AND MTART IN MAT_TYPE AND AMATNR IN P_MATNR AND STLDATE <= P_DATE
AND ( MTART = 'FERT' OR MTART = 'HALB' OR MTART = 'ZBOP' OR MTART = 'ZSCR' OR MTART = 'ROH' )
AND A~LGORT IN P_STLOC.
AND
ITAB[] = STIT[].
SORT ITAB BY MATNR WERKS LGORT MEINS MTART MATKL NTGEW GEWEI NTGEW.
DELETE ADJACENT DUPLICATES FROM ITAB COMPARING MATNR WERKS LGORT MEINS MTART MATKL NTGEW GEWEI NTGEW.
SORT STIT BY MATNR LGORT.
*SHKZG
SORT ITAB BY MATNR LGORT.
LOOP AT ITAB.
V_QTY = 0.
V_QTY1 = 0.
*************************PREVIOUS**********************s*
LOOP AT STIT WHERE MATNR = ITAB-MATNR AND LGORT = ITAB-LGORT.
IF STIT-SHKZG = 'S'.
V_QTY = V_QTY + STIT-MENGE.
V_QTY1 = V_QTY1 + STIT-ERFMG.
ELSE.
V_QTY = V_QTY - STIT-MENGE.
V_QTY1 = V_QTY1 - STIT-ERFMG.
ENDIF.
ENDLOOP.
*************************NEW*****************************
LOOP AT STIT WHERE MATNR = ITAB-MATNR AND LGORT = ITAB-LGORT.
V_QTY = V_QTY + STIT-STDEBIT - STIT-STCREDIT.
ENDLOOP.
IF V_QTY <> 0.
ITAB-STOCK = V_QTY.
IF ITAB-NTGEW <> 0 AND ITAB-GEWEI <> 'KG'.
CALL FUNCTION 'ZGET_ITEM_WEIGHT'
EXPORTING
P_BUID = ITAB-WERKS
P_ITEMID = ITAB-MATNR
P_QTY = ITAB-NTGEW
P_UOM = ITAB-GEWEI
P_UOM1 = 'KG'
IMPORTING
P_RETVAL = ITAB-WTKG.
ENDIF.
ENDIF.
CONVERTING ITEM QTY IN KG
ITAB-WT = ITAB-STOCK.
IF ITAB-MEINS = 'G'.
ITAB-WT = ITAB-STOCK / 1000000.
ELSEIF ITAB-MEINS = 'KG'.
ITAB-WT = ITAB-STOCK / 1000.
ELSEIF ITAB-MEINS <> 'TO'.
ITAB-WT = ITAB-STOCK * ITAB-WTKG / 1000.
ENDIF.
MODIFY ITAB.
ENDIF.
ENDLOOP.
endform. " GET_INI_DATA
*& Form GET_GRP_DATA
text
--> p1 text
<-- p2 text
form GET_GRP_DATA .
SELECT LGORT LGOBE FROM T001L INTO TABLE SLIT WHERE WERKS = P_WERKS.
SORT SLIT BY LGORT.
SORT ITAB BY LGORT MTART.
LOOP AT SLIT.
LOOP AT ITAB WHERE MTART = 'ROH' AND LGORT = SLIT-LGORT AND STOCK <> 0.
SLIT-ROH = SLIT-ROH + ITAB-WT.
ENDLOOP.
LOOP AT ITAB WHERE MTART = 'ZBOP' AND LGORT = SLIT-LGORT AND STOCK <> 0.
SLIT-ZBOP = SLIT-ZBOP + ITAB-WT.
ENDLOOP.
LOOP AT ITAB WHERE MTART = 'HALB' AND LGORT = SLIT-LGORT AND STOCK <> 0.
SLIT-HALB = SLIT-HALB + ITAB-WT.
ENDLOOP.
LOOP AT ITAB WHERE MTART = 'FERT' AND LGORT = SLIT-LGORT AND STOCK <> 0.
SLIT-FERT = SLIT-FERT + ITAB-WT.
ENDLOOP.
LOOP AT ITAB WHERE MTART = 'ZSCR' AND LGORT = SLIT-LGORT AND STOCK <> 0.
SLIT-ZSCR = SLIT-ZSCR + ITAB-WT.
ENDLOOP.
SLIT-TOT = SLIT-ROH + SLIT-ZBOP + SLIT-HALB + SLIT-FERT + SLIT-ZSCR.
IF SLIT-TOT = 0.
DELETE SLIT.
ELSE.
MODIFY SLIT.
ENDIF.
ENDLOOP.
endform. " GET_GRP_DATA
*& Form PRN_ITSTOCK
text
--> p1 text
<-- p2 text
form PRN_ITSTOCK .
Data : hdr type c length 100,
V_PTYPE LIKE MARA-MTART,
V_PSTLOC LIKE MSEG-LGORT,
V_ITEM LIKE MAKT-MAKTX,
T_QTY1 TYPE P LENGTH 12 DECIMALS 3,
T_QTY2 TYPE P LENGTH 12 DECIMALS 3,
T_QTY3 TYPE P LENGTH 12 DECIMALS 3,
T_WT1 TYPE P LENGTH 12 DECIMALS 3,
T_WT2 TYPE P LENGTH 12 DECIMALS 3,
T_WT3 TYPE P LENGTH 12 DECIMALS 3.
hdr = 'INVENTORY REPORT '.
IF V_CHDR = 'ROH'.
CONCATENATE HDR '(RAW MATERIAL) ' INTO HDR.
ELSEIF V_CHDR = 'ZBOP'.
CONCATENATE HDR '(BOP) ' INTO HDR.
ELSEIF V_CHDR = 'HALB'.
CONCATENATE HDR '(SEMI-FININSHED GOODS) ' INTO HDR.
ELSEIF V_CHDR = 'FERT'.
CONCATENATE HDR '(FINISHED GOODS) ' INTO HDR.
ELSEIF V_CHDR = 'ZSCR'.
CONCATENATE HDR '(SCRAP) ' INTO HDR.
ENDIF.
WRITE : / HDR.
uline.
*WRITE : / ' ITEM ID DESCRIPTION UOM GRP ITEM WT (KG.) STOCK QTY. STOCK TONS'.
WRITE : / ' ITEM ID DESCRIPTION UOM GROUP NET.WT. STOCK QTY. STOCK (TONS)'.
ULINE.
SORT ITAB BY MTART LGORT MATNR.
T_QTY1 = 0.
T_WT1 = 0.
LOOP AT ITAB1.
WRITE : / 'MATERIAL TYPE : ', ITAB1-MTART.
T_QTY2 = 0.
T_WT2 = 0.
LOOP AT ITAB2.
WRITE : / ' STORAGE LOCATION : ' , ITAB2-LGORT.
T_QTY3 = 0.
T_WT3 = 0.
LOOP AT ITAB WHERE MTART = ITAB1-MTART AND LGORT = ITAB2-LGORT.
SELECT SINGLE MAKTX FROM MAKT INTO V_ITEM WHERE MATNR = ITAB-MATNR.
WRITE : / ' ' ,(8) ITAB-MATNR,(40) V_ITEM,(3) ITAB-MEINS,' ', ITAB-MATKL, ' ',(10) ITAB-WTKG,(13) ITAB-STOCK, (13) ITAB-WT.
T_QTY3 = T_QTY3 + ITAB-STOCK.
T_WT3 = T_WT3 + ITAB-WT.
ENDLOOP.
T_QTY2 = T_QTY2 + T_QTY3.
T_WT2 = T_WT2 + T_WT3.
WRITE : / ' -
WRITE : / ' TOTAL : ',(13) T_QTY3, (13) T_WT3.
WRITE : / ' -
ENDLOOP.
T_QTY1 = T_QTY1 + T_QTY2.
T_WT1 = T_WT1 + T_WT2.
WRITE : / ' ----------------------------'.
WRITE : / ' TOTAL : ',(13) T_QTY2, (13) T_WT2.
WRITE : / ' -
ENDLOOP.
*WRITE : / ' -
WRITE : / ' GRAND TOTAL : ',(13) T_QTY1, (13) T_WT1.
WRITE : / ' -
endform. " PRN_ITSTOCK
*& Form PRN_SMSTOCK
text
--> p1 text
<-- p2 text
form PRN_SMSTOCK_TXT .
DATA : Q TYPE P LENGTH 12 DECIMALS 3,
TROH TYPE P LENGTH 12 DECIMALS 3,
TBOP TYPE P LENGTH 12 DECIMALS 3,
THALB TYPE P LENGTH 12 DECIMALS 3,
TFERT TYPE P LENGTH 12 DECIMALS 3,
TSCR TYPE P LENGTH 12 DECIMALS 3,
TSL TYPE P LENGTH 12 DECIMALS 3.
WRITE : / 'INVENTORY REPORT AS ON : ', P_DATE, ' PLANT : ', P_WERKS, ' PRINTING DATE : ', SY-DATUM, ' CONTROL NO.: FM 888 REV-00'.
WRITE : / '(in Tons)', 121 'DATE : 20.11.07'.
ULINE.
FORMAT COLOR COL_GROUP ON.
WRITE : / SY-VLINE,(10) 'ST.LOC.', SY-VLINE, (25) 'ST. LOCATION ', SY-VLINE, (15) 'RAW MATERIAL', SY-VLINE, (15) ' BOP', SY-VLINE, (15) 'FIN. GOODS',
SY-VLINE, (15) 'WIP GOODS', SY-VLINE, (15) 'SCRAPS', SY-VLINE, (15) ' TOTAL ', SY-VLINE.
ULINE.
TROH = 0.
TBOP = 0.
THALB = 0.
TFERT = 0.
TSCR = 0.
FORMAT COLOR COL_NORMAL ON.
LOOP AT SLIT.
Q = SLIT-ROH + SLIT-ZBOP + SLIT-FERT + SLIT-HALB + SLIT-ZSCR.
IF Q <> 0.
TSL = SLIT-ROH + SLIT-ZBOP + SLIT-HALB + SLIT-FERT + SLIT-ZSCR.
WRITE : / SY-VLINE,(10) SLIT-LGORT, SY-VLINE, (25) SLIT-LGOBE, SY-VLINE, (13) SLIT-ROH,' ', SY-VLINE, (13) SLIT-ZBOP, ' ', SY-VLINE, (13) SLIT-FERT, ' ',
SY-VLINE,(13) SLIT-HALB, ' ', SY-VLINE,(13) SLIT-ZSCR, ' ',SY-VLINE,(13) SLIT-TOT, ' ',SY-VLINE.
ULINE.
TROH = TROH + SLIT-ROH.
TBOP = TBOP + SLIT-ZBOP.
THALB = THALB + SLIT-HALB.
TFERT = TFERT + SLIT-FERT.
TSCR = TSCR + SLIT-ZSCR.
SLIT-CRROW = SY-LINNO - 2.
MODIFY SLIT.
V_MAXROW = SLIT-CRROW.
WRITE : SLIT-FERT, SLIT-HALB, SLIT-ZSCR.
ENDIF.
ENDLOOP.
TSL = TROH + TBOP + THALB + TFERT + TSCR.
WRITE : / SY-VLINE, (38) 'T O T A L ', SY-VLINE, (13) TROH,' ', SY-VLINE, (13) TBOP, ' ', SY-VLINE, (13) TFERT, ' ',
SY-VLINE,(13) THALB, ' ', SY-VLINE,(13) TSCR, ' ',SY-VLINE,(13) TSL, ' ',SY-VLINE.
ULINE.
endform. " PRN_SMSTOCK
*& Form PRN_SMSTOCK_ALV
text
--> p1 text
<-- p2 text
form PRN_SMSTOCK_ALV .
endform.
form user_command using r_ucomm like sy-ucomm
rs_selfield type slis_selfield.
Example Code
Executes a command considering the sy-ucomm.
CASE r_ucomm.
WHEN '&IC1'.
DATA: w_msg TYPE string,
w_row(4) TYPE n,
ITID LIKE MARA-MATNR.
w_row = rs_selfield-tabindex.
ITID = rs_selfield-value.
IF W_ROW <> 0.
CONCATENATE 'You have clicked row' w_row
'field' rs_selfield-fieldname
'with value' rs_selfield-value
INTO w_msg SEPARATED BY space.
MESSAGE w_msg TYPE 'S'.
PERFORM PRN_ITSTOCK.
ENDIF.
ENDCASE.
ENDFORM.
*& Form GET_PARM
text
--> p1 text
<-- p2 text
form GET_PARM .
CLEAR ITAB1.
REFRESH ITAB1.
IF V_COL > 44.
IF V_COL >= 44 AND V_COL <= 60.
V_CHDR = 'ROH'.
ITAB1-MTART = V_CHDR.
APPEND ITAB1.
ELSEIF V_COL >= 62 AND V_COL <= 78.
V_CHDR = 'ZBOP'.
ITAB1-MTART = V_CHDR.
APPEND ITAB1.
ELSEIF V_COL >= 80 AND V_COL <= 96.
V_CHDR = 'FERT'.
ITAB1-MTART = V_CHDR.
APPEND ITAB1.
ELSEIF V_COL >= 98 AND V_COL <= 114.
V_CHDR = 'HALB'.
ITAB1-MTART = V_CHDR.
APPEND ITAB1.
ELSEIF V_COL >= 116 AND V_COL <= 132.
V_CHDR = 'ZSCR'.
ITAB1-MTART = V_CHDR.
APPEND ITAB1.
ELSEIF V_COL >= 134 AND V_COL <= 160.
V_CHDR = 'TOT'.
ITAB1-MTART = 'ROH'.
APPEND ITAB1.
ITAB1-MTART = 'ZBOP'.
APPEND ITAB1.
ITAB1-MTART = 'FERT'.
APPEND ITAB1.
ITAB1-MTART = 'HALB'.
APPEND ITAB1.
ITAB1-MTART = 'ZSCR'.
APPEND ITAB1.
ENDIF.
CLEAR ITAB2.
REFRESH ITAB2.
READ TABLE SLIT WITH KEY CRROW = V_ROW.
IF SY-SUBRC = 0.
V_RHDR = SLIT-LGORT.
ITAB2-LGORT = V_RHDR.
APPEND ITAB2.
ELSE.
IF V_ROW > V_MAXROW.
IF V_CHDR <> 'TOT'.
DATA : PTXT LIKE MSEG-LGORT.
SORT ITAB BY MTART LGORT.
PTXT = ''.
LOOP AT ITAB WHERE MTART = V_CHDR AND STOCK <> 0.
IF PTXT <> ITAB-LGORT.
ITAB2-LGORT = ITAB-LGORT.
APPEND ITAB2.
PTXT = ITAB-LGORT.
ENDIF.
ENDLOOP.
ELSE.
V_ROW = 999.
ENDIF.
ELSE.
V_ROW = 999.
CLEAR ITAB1.
REFRESH ITAB1.
ENDIF.
ENDIF.
ELSE.
V_CHDR = ''.
V_RHDR = ''.
ENDIF.
endform. " GET_PARM
Edited by: ric .s on Mar 15, 2008 7:26 AM -
Abap program causing MEMORY_NO_MORE_PAGING
Please help me to crack the code, which is causing the dump MEMORY_NO_MORE_PAGING.
============================================================
report AQA0ZFINAPP=====ZFINAPP_ARINV=
line-size 255 no standard page heading line-count 000(001).
include <symbol>.
include <icon>.
selection-screen: begin of block prog
with frame title text-f58.
tables BKPF.
data %count-BKPF(4) type x.
data %linr-BKPF(2).
tables BSEG.
data %count-BSEG(4) type x.
data %linr-BSEG(2).
tables T001.
data %count-T001(4) type x.
data %linr-T001(2).
tables aqldb.
include rsaqexcd.
data: begin of %st_liste occurs 100,
head(1),
tab(3),
line(6) type n,
cont(1) type n,
fint(1),
finv(1),
fcol(1) type n,
text(0255),
end of %st_liste.
data %data_selected(1).
data %glframe(1) value 'X' .
data %uflag(1).
data %ustflag(1).
data %grst_text(255).
data %glline type i.
data %tabix like sy-tabix.
data %prflag(1) type x value '02'.
data: %textpool_read(1),
%textpool_langu type textpool occurs 0,
%textpool_langu_line type textpool.
data: %txt1 type textpool-entry,
%txt2 type textpool-entry,
%txt3 type textpool-entry,
%txtkey type textpool-key,
%txt_unknown type textpool-entry value 'UNKNOWN TEXT'.
data TEXT_BKPF_BLART like T003T-LTEXT.
data TEXT_BKPF_BUKRS like T001-BUTXT.
data TEXT_BKPF_USNAM like ADDR3_VAL-NAME_TEXT.
data TEXT_BSEG_BUKRS like T001-BUTXT.
data TEXT_BSEG_KUNNR like KNA1-NAME1.
data TEXT_BSEG_SEGMENT like FAGL_SEGMT-NAME.
data TEXT_BSEG_SHKZG like DD07D-DDTEXT.
data TEXT_BSEG_ZZCOMM_CD like ZCOMMODITY-ZZCOMM_DS.
data TEXT_BSEG_ZZMFG_CD like ZMFG-ZZMFG_DS.
data TEXT_EKKO_LIFNR like LFA1-NAME1.
data %perc(4) type p decimals 3.
data %p100(4) type p decimals 3 value '100.000'.
data %rangct type i.
data %rangcc(8).
select-options SP$00001 for BKPF-BLART memory id BAR.
select-options SP$00002 for BKPF-BLDAT.
select-options SP$00003 for BKPF-BUDAT.
select-options SP$00005 for BKPF-BUKRS memory id BUK.
select-options SP$00004 for BKPF-GJAHR memory id GJR.
selection-screen skip 1.
selection-screen: begin of block direct
with frame title text-f59.
selection-screen: begin of line.
*selection-screen: comment 1(12) text-f57.
selection-screen: pushbutton 75(18) pb%exco user-command expcol
modif id new.
selection-screen: end of line.
selection-screen: begin of line.
parameters: %alv radiobutton group func user-command outbut
modif id new default 'X' .
selection-screen: comment 4(26) text-f72 for field %alv
modif id new.
parameters: %alvl type slis_vari modif id new.
selection-screen: end of line.
selection-screen: begin of line.
parameters: %nofunc radiobutton group func modif id old.
selection-screen: comment 4(26) text-f66 for field %nofunc
modif id old.
parameters: %tview radiobutton group func modif id old.
selection-screen: comment 34(26) text-f68 for field %tview
modif id old,
end of line.
selection-screen: begin of line.
parameters: %graph radiobutton group func modif id old.
selection-screen: comment 4(26) text-f61 for field %graph
modif id old.
parameters: %text radiobutton group func modif id old.
selection-screen: comment 34(26) text-f69 for field %text
modif id old,
end of line.
selection-screen: begin of line.
parameters: %abc radiobutton group func modif id old.
selection-screen: comment 4(26) text-f70 for field %abc
modif id old.
parameters: %excel radiobutton group func modif id old.
selection-screen: comment 34(26) text-f60 for field %excel
modif id old,
end of line.
selection-screen: begin of line.
selection-screen: end of line.
selection-screen: begin of line.
parameters: %xint radiobutton group func modif id xin.
selection-screen: comment 4(26) text-f73 for field %xint
modif id xin.
parameters: %xintk like AQXINT-XIKEY lower case modif id xin.
selection-screen: end of line.
selection-screen: begin of line.
parameters: %down radiobutton group func modif id old.
selection-screen: comment 4(26) text-f64 for field %down
modif id old.
parameters: %path type AQ_FILENAME lower case modif id old.
selection-screen: end of line.
selection-screen: begin of line.
parameters: %save radiobutton group func modif id lis.
selection-screen: comment 4(26) text-f62 for field %save
modif id lis.
parameters: %listid like AQCAQL-TEXT visible length 40
lower case modif id lis.
selection-screen: end of line.
selection-screen: end of block direct.
selection-screen: end of block prog.
data: begin of %g00 occurs 100,
BKPF-BUKRS like BKPF-BUKRS,
BKPF-BELNR like BKPF-BELNR,
BKPF-BLART like BKPF-BLART,
BKPF-BLDAT like BKPF-BLDAT,
BKPF-BUDAT like BKPF-BUDAT,
BKPF-WWERT like BKPF-WWERT,
BKPF-XBLNR like BKPF-XBLNR,
BKPF-BKTXT like BKPF-BKTXT,
BKPF-AWKEY like BKPF-AWKEY,
BSEG-XREF1 like BSEG-XREF1,
BSEG-XREF2 like BSEG-XREF2,
BSEG-BUKRS like BSEG-BUKRS,
BSEG-BUZEI like BSEG-BUZEI,
BSEG-HKONT like BSEG-HKONT,
BSEG-SEGMENT like BSEG-SEGMENT,
BSEG-PRCTR like BSEG-PRCTR,
BSEG-KOSTL like BSEG-KOSTL,
BSEG-ZZCOMM_CD like BSEG-ZZCOMM_CD,
BSEG-ZZMFG_CD like BSEG-ZZMFG_CD,
TEXT_BSEG_SHKZG like TEXT_BSEG_SHKZG,
BSEG-WRBTR like BSEG-WRBTR,
BKPF-WAERS-0121 like BKPF-WAERS,
BSEG-DMBTR like BSEG-DMBTR,
T001-WAERS-0122 like T001-WAERS,
BSEG-DMBE2 like BSEG-DMBE2,
BKPF-HWAE2-0123 like BKPF-HWAE2,
BSEG-DMBE3 like BSEG-DMBE3,
BKPF-HWAE3-0124 like BKPF-HWAE3,
BSEG-KUNNR like BSEG-KUNNR,
TEXT_BSEG_KUNNR like TEXT_BSEG_KUNNR,
end of %g00.
data: begin of %%g00,
BKPF-BUKRS(004),
BKPF-BELNR(010),
BKPF-BLART(002),
BKPF-BLDAT(010),
BKPF-BUDAT(010),
BKPF-WWERT(010),
BKPF-XBLNR(016),
BKPF-BKTXT(025),
BKPF-AWKEY(020),
BSEG-XREF1(012),
BSEG-XREF2(012),
BSEG-BUKRS(004),
BSEG-BUZEI(003),
BSEG-HKONT(010),
BSEG-SEGMENT(010),
BSEG-PRCTR(010),
BSEG-KOSTL(010),
BSEG-ZZCOMM_CD(003),
BSEG-ZZMFG_CD(004),
TEXT_BSEG_SHKZG(060),
BSEG-WRBTR(016),
BKPF-WAERS-0121 like BKPF-WAERS,
BSEG-DMBTR(016),
T001-WAERS-0122 like T001-WAERS,
BSEG-DMBE2(016),
BKPF-HWAE2-0123 like BKPF-HWAE2,
BSEG-DMBE3(016),
BKPF-HWAE3-0124 like BKPF-HWAE3,
BSEG-KUNNR(010),
TEXT_BSEG_KUNNR(035),
end of %%g00.
data %znr type i.
data %lznr type i value 99999.
field-groups header.
field-groups %fg01.
data %any-01.
controls tview100 type tableview using screen 100.
AT SELECTION-SCREEN.
perform alvl_check(rsaqexce) using %alvl 'G00'.
perform testmode(rsaqexce).
perform check_expcol(rsaqexce) using %alv.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR %ALVL.
perform alvl_value_request(rsaqexce) using %alvl 'G00'.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR %XINTK.
perform xint_value_request(rsaqexce).
AT SELECTION-SCREEN OUTPUT.
perform save_initial_sscr(rsaqexce).
perform rinit(rsaqbrst).
perform set_expcol(rsaqexce) using %alv pb%exco.
perform alvl_set_invisible(rsaqexce).
perform set_xint_params(rsaqexce).
INITIALIZATION.
perform init_xint(rsaqexce).
perform set_www_flags(rsaqexce).
perform init_print_params(rsaqexce).
if %textpool_read is initial.
read textpool sy-repid into %textpool_langu language sy-langu.
%textpool_read = 'X'.
endif.
START-OF-SELECTION.
insert %count-BKPF into header.
insert %linr-BKPF into header.
insert %count-BSEG into header.
insert %linr-BSEG into header.
insert BKPF-BUKRS into %fg01.
insert BKPF-BELNR into %fg01.
insert BKPF-BLART into %fg01.
insert BKPF-BLDAT into %fg01.
insert BKPF-BUDAT into %fg01.
insert BKPF-WWERT into %fg01.
insert BKPF-XBLNR into %fg01.
insert BKPF-BKTXT into %fg01.
insert BKPF-AWKEY into %fg01.
insert BSEG-XREF1 into %fg01.
insert BSEG-XREF2 into %fg01.
insert BSEG-BUKRS into %fg01.
insert BSEG-BUZEI into %fg01.
insert BSEG-HKONT into %fg01.
insert BSEG-SEGMENT into %fg01.
insert BSEG-PRCTR into %fg01.
insert BSEG-KOSTL into %fg01.
insert BSEG-ZZCOMM_CD into %fg01.
insert BSEG-ZZMFG_CD into %fg01.
insert TEXT_BSEG_SHKZG into %fg01.
insert BSEG-WRBTR into %fg01.
insert BKPF-WAERS into %fg01.
insert BSEG-DMBTR into %fg01.
insert T001-WAERS into %fg01.
insert BSEG-DMBE2 into %fg01.
insert BKPF-HWAE2 into %fg01.
insert BSEG-DMBE3 into %fg01.
insert BKPF-HWAE3 into %fg01.
insert BSEG-KUNNR into %fg01.
insert TEXT_BSEG_KUNNR into %fg01.
perform init_texthandling(rsaqexce) using 'CL_TEXT_IDENTIFIER' ' ' 'ZFINAPP_BRM'.
"webgui
data: %ret type i.
if sy-subrc is initial and %excel is not initial.
perform check_wingui(rsaqsyst) using %ret.
if %ret <> 0.
message e842(aq).
endif.
endif.
"webgui
perform %comp_ldesc.
GET BKPF .
%dbacc = %dbacc - 1.
if %dbacc = 0.
stop.
endif.
check SP$00001.
check SP$00002.
check SP$00003.
check SP$00005.
check SP$00004.
add 1 to %count-BKPF.
%linr-BKPF = '99'.
GET BSEG .
%dbacc = %dbacc - 1.
if %dbacc = 0.
perform %_get_BKPF_late in program (sy-cprog) if found
using %selected BKPF.
stop.
endif.
perform textfield_refresh(rsaqexce).
perform textfield_context(rsaqexce) using 'BSEG' BSEG.
perform textfield_context(rsaqexce) using 'BKPF' BKPF.
perform textfield_call(rsaqexce) using BSEG 'BSEG' 'KUNNR' TEXT_BSEG_KUNNR.
perform textfield_call(rsaqexce) using BSEG 'BSEG' 'SHKZG' TEXT_BSEG_SHKZG.
add 1 to %count-BSEG.
%linr-BSEG = '01'.
extract %fg01.
%linr-BSEG = '99'.
END-OF-SELECTION.
sort as text.
%diact = space.
%printon = space.
%batch = sy-batch.
if %batch <> space.
if %alv <> space.
%diact = 'V'.
%printon = 'X'.
%alv_layout = %alvl.
new-page print on destination 'NULL' no dialog
line-size 0255 line-count 0065.
endif.
if %save <> space.
%diact = 'S'.
%printon = 'X'.
new-page print on destination 'NULL' no dialog
line-size 0255 line-count 0065.
endif.
elseif %called_by_www <> space.
%diact = space.
elseif %called_by_www_alv <> space.
%diact = 'V'.
else.
perform init_print_params(rsaqexce).
if %save <> space. %diact = 'S'. endif.
if %xint <> space. %diact = 'I'. endif.
if %tview <> space. %diact = 'T'. endif.
if %alv <> space. %diact = 'V'. endif.
if %down <> space. %diact = 'D'. endif.
if %graph <> space. %diact = 'G'. endif.
if %excel <> space. %diact = 'X'. endif.
if %text <> space. %diact = 'W'. endif.
if %abc <> space. %diact = 'A'. endif.
if %diact <> space and %diact <> 'S' and %diact <> 'W'.
%printon = 'X'.
new-page print on destination 'NULL' no dialog
line-size 0255 line-count 0065.
endif.
%pathname = %path.
if %diact = 'I'.
%functionkey = %xintk.
endif.
if %diact = 'V'.
%alv_layout = %alvl.
endif.
endif.
free memory id 'AQLISTDATA'.
if %memmode <> space.
if %batch <> space and %printon = space.
%printon = 'X'.
new-page print on destination 'NULL' no dialog
line-size 0255 line-count 0065.
endif.
%diact = '1'.
endif.
%titel = ' '.
if sy-subty o %prflag and %titel = space.
new-page with-title.
endif.
%tvsize = 0200.
%pline = 1.
%pzgr = 1.
%first = 'X'.
perform %output.
%first = space.
if %diact <> space and %diact <> 'S'.
if %batch = space.
new-page print off.
if not ( %diact = 'V' and %ucomm = 'PRIN' ).
new-page no-heading no-title.
write space.
endif.
endif.
else.
perform pf-status(rsaqexce) using 'XX '.
endif.
clear: %tab, %line, %cont.
if %data_selected = space.
if %diact = '1'.
export empty from %empty to memory id 'AQLISTDATA'.
leave.
else.
if %batch = space and
%called_by_www = space and
%called_by_www_alv = space.
message s260(aq).
leave list-processing.
else.
if %called_by_www_alv = space.
%diact = space.
endif.
endif.
endif.
endif.
if %diact = 'S'.
perform %save_list.
leave list-processing.
endif.
if %diact = 'V' and %batch <> space.
new-page print off.
perform set_print_params(rsaqexce).
perform %download using 'ALV'.
leave.
endif.
if %diact = 'V' and %called_by_www_alv <> space.
perform %download using 'ALV'.
leave.
endif.
*if %diact = 'V' and ( %ucomm = 'PRIN' or sy-subty = '07' ).
data %is_submit_to_spool type c.
if %diact = 'V'.
CALL FUNCTION 'IS_SUBMIT_TO_SPOOL'
IMPORTING FLAG = %is_submit_to_spool.
if ( %ucomm = 'PRIN' or %is_submit_to_spool = 'X' ).
perform set_print_params(rsaqexce).
perform %download using 'ALV'.
set parameter id 'SPI' field sy-spono.
leave list-processing.
endif.
endif.
if %diact = 'P' and %batch <> space.
perform %download using '+DAT'.
leave list-processing.
endif.
if %diact = 'E' and %batch <> space.
perform %download using 'EIS'.
leave list-processing.
endif.
if %diact = '1'.
perform %download using '+MEM'.
leave.
endif.
if %diact = 'X'.
set user-command 'XXL'.
elseif %diact = 'W'.
set user-command 'TEXT'.
elseif %diact = 'V'.
set user-command 'ALV'.
elseif %diact = 'T'.
set user-command 'VIEW'.
elseif %diact = 'G'.
set user-command 'GRAF'.
elseif %diact = 'A'.
set user-command 'ABCA'.
elseif %diact = 'E'.
set user-command 'EIS'.
elseif %diact = 'D'.
set user-command 'DOWN'.
elseif %diact = 'I'.
set user-command 'XINT'.
elseif %diact = 'P'.
set user-command '+DAT'.
endif.
TOP-OF-PAGE.
perform %top-of-page.
END-OF-PAGE.
perform page_foot(rsaqexce).
perform %save_page.
TOP-OF-PAGE DURING LINE-SELECTION.
perform %top-of-page.
AT USER-COMMAND.
case sy-ucomm.
when 'EXIT'.
leave program.
when 'RETN'.
perform return(rsaqexce).
when 'CANC'.
perform return(rsaqexce).
when 'WEIT'.
perform return(rsaqexce).
when 'INHA'.
perform catalogue(rsaqexce).
when 'AUSL'.
perform pickup(rsaqexce).
when 'AUSW'.
perform pickup(rsaqexce).
when 'RCAA'.
perform rchain(rsaqbrst).
when 'RCAL'.
perform rcall(rsaqbrst).
when 'VGLI'.
perform change(rsaqexce).
when 'VGLE'.
perform change(rsaqexce).
when 'TOTO'.
perform change(rsaqexce).
when 'VSTA'.
perform change(rsaqexce).
when 'VSTE'.
perform return(rsaqexce).
when 'SAVL'.
perform %save_list.
when 'ODRU'.
perform print_list(rsaqexce).
when 'COPA'.
perform print_cover_page(rsaqexce).
when 'TEXT'.
perform %download using 'TEXT'.
when 'ALV'.
perform %download using 'ALV'.
when 'VIEW'.
perform %view.
when 'XXL'.
perform %download using 'XXL'.
when 'GRAF'.
perform %download using 'GRAF'.
when 'ABCA'.
perform %download using 'ABCA'.
when 'DOWN'.
perform %download using 'DOWN'.
when 'XINT'.
perform %download using 'XINT'.
endcase.
clear: %cline, %zgr.
clear: %tab, %line, %cont.
if %diact <> space.
leave list-processing.
endif.
form %comp_ldesc.
refresh %ldesc.
refresh %gdesc.
read table %textpool_langu into %textpool_langu_line
with key ID = 'I' key = 'A00'.
if sy-subrc is initial. %txt1 = %textpool_langu_line-entry.
else. %txt1 = %txt_unknown.
endif.
read table %textpool_langu into %textpool_langu_line
with key key = 'B00'.
if sy-subrc is initial. %txt2 = %textpool_langu_line-entry.
else. %txt2 = %txt_unknown.
endif.
read table %textpool_langu into %textpool_langu_line
with key key = 'H00'.
if sy-subrc is initial. %txt3 = %textpool_langu_line-entry.
else. %txt3 = %txt_unknown.
endif.
perform ldesc(rsaqexce) using 'G00010000X004 00 01'
%txt1 %txt2 %txt3 'BKPF-BUKRS' BKPF-BUKRS 'BKPF-BUKRS'.
read table %textpool_langu into %textpool_langu_line
with key ID = 'I' key = 'A01'.
if sy-subrc is initial. %txt1 = %textpool_langu_line-entry.
else. %txt1 = %txt_unknown.
endif.
read table %textpool_langu into %textpool_langu_line
with key key = 'B01'.
if sy-subrc is initial. %txt2 = %textpool_langu_line-entry.
else. %txt2 = %txt_unknown.
endif.
read table %textpool_langu into %textpool_langu_line
with key key = 'H00'.
if sy-subrc is initial. %txt3 = %textpool_langu_line-entry.
else. %txt3 = %txt_unknown.
endif.
perform ldesc(rsaqexce) using 'G00020000X010 00 01'
%txt1 %txt2 %txt3 'BKPF-BELNR' BKPF-BELNR 'BKPF-BELNR'.
read table %textpool_langu into %textpool_langu_line
with key ID = 'I' key = 'A02'.
if sy-subrc is initial. %txt1 = %textpool_langu_line-entry.
else. %txt1 = %txt_unknown.
endif.
read table %textpool_langu into %textpool_langu_line
with key key = 'B02'.
if sy-subrc is initial. %txt2 = %textpool_langu_line-entry.
else. %txt2 = %txt_unknown.
endif.
read table %textpool_langu into %textpool_langu_line
with key key = 'H00'.
if sy-subrc is initial. %txt3 = %textpool_langu_line-entry.
else. %txt3 = %txt_unknown.
endif.
perform ldesc(rsaqexce) using 'G00030000X002 00 01'
%txt1 %txt2 %txt3 'BKPF-BLART' BKPF-BLART 'BKPF-BLART'.
read table %textpool_langu into %textpool_langu_line
with key ID = 'I' key = 'A03'.
if sy-subrc is initial. %txt1 = %textpool_langu_line-entry.
else. %txt1 = %txt_unknown.
endif.
read table %textpool_langu into %textpool_langu_line
with key key = 'B03'.
if sy-subrc is initial. %txt2 = %textpool_langu_line-entry.
else. %txt2 = %txt_unknown.
endif.
read table %textpool_langu into %textpool_langu_line
with key key = 'H00'.
if sy-subrc is initial. %txt3 = %textpool_langu_line-entry.
else. %txt3 = %txt_unknown.
endif.
perform ldesc(rsaqexce) using 'G00040000X010 00 01'
%txt1 %txt2 %txt3 'BKPF-BLDAT' BKPF-BLDAT 'BKPF-BLDAT'.
read table %textpool_langu into %textpool_langu_line
with key ID = 'I' key = 'A04'.
if sy-subrc is initial. %txt1 = %textpool_langu_line-entry.
else. %txt1 = %txt_unknown.
endif.
read table %textpool_langu into %textpool_langu_line
with key key = 'B04'.
if sy-subrc is initial. %txt2 = %textpool_langu_line-entry.
else. %txt2 = %txt_unknown.
endif.
read table %textpool_langu into %textpool_langu_line
with key key = 'H00'.
if sy-subrc is initial. %txt3 = %textpool_langu_line-entry.
else. %txt3 = %txt_unknown.
endif.
perform ldesc(rsaqexce) using 'G00050000X010 00 01'
%txt1 %txt2 %txt3 'BKPF-BUDAT' BKPF-BUDAT 'BKPF-BUDAT'.
read table %textpool_langu into %textpool_langu_line
with key ID = 'I' key = 'A05'.
if sy-subrc is initial. %txt1 = %textpool_langu_line-entry.
else. %txt1 = %txt_unknown.
endif.
read table %textpool_langu into %textpool_langu_line
with key key = 'B05'.
if sy-subrc is initial. %txt2 = %textpool_langu_line-entry.
else. %txt2 = %txt_unknown.
endif.
read table %textpool_langu into %textpool_langu_line
with key key = 'H00'.
if sy-subrc is initial. %txt3 = %textpool_langu_line-entry.
else. %txt3 = %txt_unknown.
endif.
perform ldesc(rsaqexce) using 'G00060000X010 00 01'
%txt1 %txt2 %txt3 'BKPF-WWERT' BKPF-WWERT 'BKPF-WWERT'.
read table %textpool_langu into %textpool_langu_line
with key ID = 'I' key = 'A06'.
if sy-subrc is initial. %txt1 = %textpool_langu_line-entry.
else. %txt1 = %txt_unknown.
endif.
read table %textpool_langu into %textpool_langu_line
with key key = 'B06'.
if sy-subrc is initial. %txt2 = %textpool_langu_line-entry.
else. %txt2 = %txt_unknown.
endif.
read table %textpool_langu into %textpool_langu_line
with key key = 'H00'.
if sy-subrc is initial. %txt3 = %textpool_langu_line-entry.
else. %txt3 = %txt_unknown.
endif.
perform ldesc(rsaqexce) using 'G00070000X016 00 01'
%txt1 %txt2 %txt3 'BKPF-XBLNR' BKPF-XBLNR 'BKPF-XBLNR'.
read table %textpool_langu into %textpool_langu_line
with key ID = 'I' key = 'A07'.
if sy-subrc is initial. %txt1 = %textpool_langu_line-entry.
else. %txt1 = %txt_unknown.
endif.
read table %textpool_langu into %textpool_langu_line
with key key = 'B07'.
if sy-subrc is initial. %txt2 = %textpool_langu_line-entry.
else. %txt2 = %txt_unknown.
endif.
read table %textpool_langu into %textpool_langu_line
with key key = 'H00'.
if sy-subrc is initial. %txt3 = %textpool_langu_line-entry.
else. %txt3 = %txt_unknown.
endif.
perform ldesc(rsaqexce) using 'G00080000X025 00 01'
%txt1 %txt2 %txt3 'BKPF-BKTXT' BKPF-BKTXT 'BKPF-BKTXT'.
read table %textpool_langu into %textpool_langu_line
with key ID = 'I' key = 'A08'.
if sy-subrc is initial. %txt1 = %textpool_langu_line-entry.
else. %txt1 = %txt_unknown.
endif.
read table %textpool_langu into %textpool_langu_line
with key key = 'B08'.
if sy-subrc is initial. %txt2 = %textpool_langu_line-entry.
else. %txt2 = %txt_unknown.
endif.
read table %textpool_langu into %textpool_langu_line
with key key = 'H00'.
if sy-subrc is initial. %txt3 = %textpool_langu_line-entry.
else. %txt3 = %txt_unknown.
endif.
perform ldesc(rsaqexce) using 'G00090000X020 00 01'
%txt1 %txt2 %txt3 'BKPF-AWKEY' BKPF-AWKEY 'BKPF-AWKEY'.
read table %textpool_langu into %textpool_langu_line
with key ID = 'I' key = 'A09'.
if sy-subrc is initial. %txt1 = %textpool_langu_line-entry.
else. %txt1 = %txt_unknown.
endif.
read table %textpool_langu into %textpool_langu_line
with key key = 'B09'.
if sy-subrc is initial. %txt2 = %textpool_langu_line-entry.
else. %txt2 = %txt_unknown.
endif.
read table %textpool_langu into %textpool_langu_line
with key key = 'H00'.
if sy-subrc is initial. %txt3 = %textpool_langu_line-entry.
else. %txt3 = %txt_unknown.
endif.
perform ldesc(rsaqexce) using 'G00100000X012 00 01'
%txt1 %txt2 %txt3 'BSEG-XREF1' BSEG-XREF1 'BSEG-XREF1'.
read table %textpool_langu into %textpool_langu_line
with key ID = 'I' key = 'A10'.
if sy-subrc is initial. %txt1 = %textpool_langu_line-entry.
else. %txt1 = %txt_unknown.
endif.
read table %textpool_langu into %textpool_langu_line
with key key = 'B10'.
if sy-subrc is initial. %txt2 = %textpool_langu_line-entry.
else. %txt2 = %txt_unknown.
endif.
read table %textpool_langu into %textpool_langu_line
with key key = 'H00'.
if sy-subrc is initial. %txt3 = %textpool_langu_line-entry.
else. %txt3 = %txt_unknown.
endif.
perform ldesc(rsaqexce) using 'G00110000X012 00 01'
%txt1 %txt2 %txt3 'BSEG-XREF2' BSEG-XREF2 'BSEG-XREF2'.
read table %textpool_langu into %textpool_langu_line
with key ID = 'I' key = 'A11'.
if sy-subrc is initial. %txt1 = %textpool_langu_line-entry.
else. %txt1 = %txt_unknown.
endif.
read table %textpool_langu into %textpool_langu_line
with key key = 'B11'.
if sy-subrc is initial. %txt2 = %textpool_langu_line-entry.
else. %txt2 = %txt_unknown.
endif.
read table %textpool_langu into %textpool_langu_line
with key key = 'H01'.
if sy-subrc is initial. %txt3 = %textpool_langu_line-entry.
else. %txt3 = %txt_unknown.
endif.
perform ldesc(rsaqexce) using 'G00120000X004 00 02'
%txt1 %txt2 %txt3 'BSEG-BUKRS' BSEG-BUKRS 'BSEG-BUKRS'.
read table %textpool_langu into %textpool_langu_line
with key ID = 'I' key = 'A12'.
if sy-subrc is initial. %txt1 = %textpool_langu_line-entry.
else. %txt1 = %txt_unknown.
endif.
read table %textpool_langu into %textpool_langu_line
with key key = 'B12'.
if sy-subrc is initial. %txt2 = %textpool_langu_line-entry.
else. %txt2 = %txt_unknown.
endif.
read table %textpool_langu into %textpool_langu_line
with key key = 'H01'.
if sy-subrc is initial. %txt3 = %textpool_langu_line-entry.
else. %txt3 = %txt_unknown.
endif.
perform ldesc(rsaqexce) using 'G00130000X003 00 02'
%txt1 %txt2 %txt3 'BSEG-BUZEI' BSEG-BUZEI 'BSEG-BUZEI'.
read table %textpool_langu into %textpool_langu_line
with key ID = 'I' key = 'A13'.
if sy-subrc is initial. %txt1 = %textpool_langu_line-entry.
else. %txt1 = %txt_unknown.
endif.
read table %textpool_langu into %textpool_langu_line
with key key = 'B13'.
if sy-subrc is initial. %txt2 = %textpool_langu_line-entry.
else. %txt2 = %txt_unknown.
endif.
read table %textpool_langu into %textpool_langu_line
with key key = 'H01'.
if sy-subrc is initial. %txt3 = %textpool_langu_line-entry.
else. %txt3 = %txt_unknown.
endif.
perform ldesc(rsaqexce) using 'G00140000X010 00 02'
%txt1 %txt2 %txt3 'BSEG-HKONT' BSEG-HKONT 'BSEG-HKONT'.
read table %textpool_langu into %textpool_langu_line
with key ID = 'I' key = 'A14'.
if sy-subrc is initial. %txt1 = %textpool_langu_line-entry.
else. %txt1 = %txt_unknown.
endif.
read table %textpool_langu into %textpool_langu_line
with key key = 'B14'.
if sy-subrc is initial. %txt2 = %textpool_langu_line-entry.
else. %txt2 = %txt_unknown.
endif.
read table %textpool_langu into %textpool_langu_line
with key key = 'H01'.
if sy-subrc is initial. %txt3 = %textpool_langu_line-entry.
else. %txt3 = %txt_unknown.
endif.
perform ldesc(rsaqexce) using 'G00150000X010 00 02'
%txt1 %txt2 %txt3 'BSEG-SEGMENT' BSEG-SEGMENT 'BSEG-SEGMENT'.
read table %textpool_langu into %textpool_langu_line
with key ID = 'I' key = 'A15'.
if sy-subrc is initial. %txt1 = %textpool_langu_line-entry.
else. %txt1 = %txt_unknown.
endif.
read table %textpool_langu into %textpool_langu_line
with key key = 'B15'.
if sy-subrc is initial. %txt2 = %textpool_langu_line-entry.
else. %txt2 = %txt_unknown.
endif.
read table %textpool_langu into %textpool_langu_line
with key key = 'H01'.
if sy-subrc is initial. %txt3 = %textpool_langu_line-entry.
else. %txt3 = %txt_unknown.
endif.
perform ldesc(rsaqexce) using 'G00160000X010 00 02'
%txt1 %txt2 %txt3 'BSEG-PRCTR' BSEG-PRCTR 'BSEG-PRCTR'.
read table %textpool_langu into %textpool_langu_line
with key ID = 'I' key = 'A16'.
if sy-subrc is initial. %txt1 = %textpool_langu_line-entry.
else. %txt1 = %txt_unknown.
endif.
read table %textpool_langu into %textpool_langu_line
with key key = 'B16'.
if sy-subrc is initial. %txt2 = %textpool_langu_line-entry.
else. %txt2 = %txt_unknown.
endif.
read table %textpool_langu into %textpool_langu_line
with key key = 'H01'.
if sy-subrc is initial. %txt3 = %textpool_langu_line-entry.
else. %txt3 = %txt_unknown.
endif.
perform ldesc(rsaqexce) using 'G00170000X010 00 02'
%txt1 %txt2 %txt3 'BSEG-KOSTL' BSEG-KOSTL 'BSEG-KOSTL'.
read table %textpool_langu into %textpool_langu_line
with key ID = 'I' key = 'A17'.
if sy-subrc is initial. %txt1 = %textpool_langu_line-entry.
else. %txt1 = %txt_unknown.
endif.
read table %textpool_langu into %textpool_langu_line
with key key = 'B17'.
if sy-subrc is initial. %txt2 = %textpool_langu_line-entry.
else. %txt2 = %txt_unknown.
endif.
read table %textpool_langu into %textpool_langu_line
with key key = 'H01'.
if sy-subrc is initial. %txt3 = %textpool_langu_line-entry.
else. %txt3 = %txt_unknown.
endif.
perform ldesc(rsaqexce) using 'G00180000X003 00 02'
%txt1 %txt2 %txt3 'BSEG-ZZCOMM_CD' BSEG-ZZCOMM_CD 'BSEG-ZZCOMM_CD'.
read table %textpool_langu into %textpool_langu_line
with key ID = 'I' key = 'A18'.
if sy-subrc is initial. %txt1 = %textpool_langu_line-entry.
else. %txt1 = %txt_unknown.
endif.
read table %textpool_langu into %textpool_langu_line
with key key = 'B18'.
if sy-subrc is initial. %txt2 = %textpool_langu_line-entry.
else. %txt2 = %txt_unknown.
endif.
read table %textpool_langu into %textpool_langu_line
with key key = 'H01'.
if sy-subrc is initial. %txt3 = %textpool_langu_line-entry.
else. %txt3 = %txt_unknown.
endif.
perform ldesc(rsaqexce) using 'G00190000X004 00 02'
%txt1 %txt2 %txt3 'BSEG-ZZMFG_CD' BSEG-ZZMFG_CD 'BSEG-ZZMFG_CD'.
read table %textpool_langu into %textpool_langu_line
with key ID = 'I' key = 'A19'.
if sy-subrc is initial. %txt1 = %textpool_langu_line-entry.
else. %txt1 = %txt_unknown.
endif.
read table %textpool_langu into %textpool_langu_line
with key key = 'B19'.
if sy-subrc is initial. %txt2 = %textpool_langu_line-entry.
else. %txt2 = %txt_unknown.
endif.
read table %textpool_langu into %textpool_langu_line
with key key = 'H01'.
if sy-subrc is initial. %txt3 = %textpool_langu_line-entry.
else. %txt3 = %txt_unknown.
endif.
perform ldesc(rsaqexce) using 'G00201000X060 00 02'
%txt1 %txt2 %txt3 'TEXT_BSEG_SHKZG' TEXT_BSEG_SHKZG 'TEXT_BSEG_SHKZG'.
read table %textpool_langu into %textpool_langu_line
with key ID = 'I' key = 'A20'.
if sy-subrc is initial. %txt1 = %textpool_langu_line-entry.
else. %txt1 = %txt_unknown.
endif.
read table %textpool_langu into %textpool_langu_line
with key key = 'B20'.
if sy-subrc is initial. %txt2 = %textpool_langu_line-entry.
else. %txt2 = %txt_unknown.
endif.
read table %textpool_langu into %textpool_langu_line
with key key = 'H01'.
if sy-subrc is initial. %txt3 = %textpool_langu_line-entry.
else. %txt3 = %txt_unknown.
endif.
perform ldesc(rsaqexce) using 'G00211063 016F 00 02'
%txt1 %txt2 %txt3 'BSEG-WRBTR' BSEG-WRBTR 'BSEG-WRBTR'.
read table %textpool_langu into %textpool_langu_line
with key ID = 'I' key = 'A21'.
if sy-subrc is initial. %txt1 = %textpool_langu_line-entry.
else. %txt1 = %txt_unknown.
endif.
read table %textpool_langu into %textpool_langu_line
with key key = 'B21'.
if sy-subrc is initial. %txt2 = %textpool_langu_line-entry.
else. %txt2 = %txt_unknown.
endif.
read table %textpool_langu into %textpool_langu_line
with key key = 'H01'.
if sy-subrc is initial. %txt3 = %textpool_langu_line-entry.
else. %txt3 = %txt_unknown.
endif.
perform ldesc(rsaqexce) using 'G00221000 005W 00 02'
%txt1 %txt2 %txt3 'BKPF-WAERS' BKPF-WAERS 'BKPF-WAERS-0121'.
read table %textpool_langu into %textpool_langu_line
with key ID = 'I' key = 'A22'.
if sy-subrc is initial. %txt1 = %textpool_langu_line-entry.
else. %txt1 = %txt_unknown.
endif.
read table %textpool_langu into %textpool_langu_line
with key key = 'B22'.
if sy-subrc is initial. %txt2 = %textpool_langu_line-entry.
else. %txt2 = %txt_unknown.
endif.
read table %textpool_langu into %textpool_langu_line
with key key = 'H01'.
if sy-subrc is initial. %txt3 = %textpool_langu_line-entry.
else. %txt3 = %txt_unknown.
endif.
perform ldesc(rsaqexce) using 'G00231086 016F 00 02'
%txt1 %txt2 %txt3 'BSEG-DMBTR' BSEG-DMBTR 'BSEG-DMBTR'.
read table %textpool_langu into %textpool_langu_line
with key ID = 'I' key = 'A23'.
if sy-subrc is initial. %txt1 = %textpool_langu_line-entry.
else. %txt1 = %txt_unknown.
endif.
read table %textpool_langu into %textpool_langu_line
with key key = 'B23'.
if sy-subrc is initial. %txt2 = %textpool_langu_line-entry.
else. %txt2 = %txt_unknown.
endif.
read table %textpool_langu into %textpool_langu_line
with key key = 'H01'.
if sy-subrc is initial. %txt3 = %textpool_langu_line-entry.
else. %txt3 = %txt_unknown.
endif.
perform ldesc(rsaqexce) using 'G00241000 005W 00 02'
%txt1 %txt2 %txt3 'T001-WAERS' T001-WAERS 'T001-WAERS-0122'.
read table %textpool_langu into %textpool_langu_line
with key ID = 'I' key = 'A24'.
if sy-subrc is initial. %txt1 = %textpool_langu_line-entry.
else. %txt1 = %txt_unknown.
endif.
read table %textpool_langu into %textpool_langu_line
with key key = 'B24'.
if sy-subrc is initial. %txt2 = %textpool_langu_line-entry.
else. %txt2 = %txt_unknown.
endif.
read table %textpool_langu into %textpool_langu_line
with key key = 'H01'.
if sy-subrc is initial. %txt3 = %textpool_langu_line-entry.
else. %txt3 = %txt_unknown.
endif.
perform ldesc(rsaqexce) using 'G00251109 016F 00 02'
%txt1 %txt2 %txt3 'BSEG-DMBE2' BSEG-DMBE2 'BSEG-DMBE2'.
read table %textpool_langu into %textpool_langu_line
with key ID = 'I' key = 'A25'.
if sy-subrc is initial. %txt1 = %textpool_langu_line-entry.
else. %txt1 = %txt_unknown.
endif.
read table %textpool_langu into %textpool_langu_line
with key key = 'B25'.
if sy-subrc is initial. %txt2 = %textpool_langu_line-entry.
else. %txt2 = %txt_unknown.
endif.
read table %textpool_langu into %textpool_langu_line
with key key = 'H01'.
if sy-subrc is initial. %txt3 = %textpool_langu_line-entry.
else. %txt3 = %txt_unknown.
endif.
perform ldesc(rsaqexce) using 'G00261000 005W 00 02'
%txt1 %txt2 %txt3 'BKPF-HWAE2' BKPF-HWAE2 'BKPF-HWAE2-0123'.
read table %textpool_langu into %textpool_langu_line
with key ID = 'I' key = 'A26'.
if sy-subrc is initial. %txt1 = %textpool_langu_line-entry.
else. %txt1 = %txt_unknown.
endif.
read table %textpool_langu into %textpool_langu_line
with key key = 'B26'.
if sy-subrc is initial. %txt2 = %textpool_langu_line-entry.
else. %txt2 = %txt_unknown.
endif.
read table %textpool_langu into %textpool_langu_line
with key key = 'H01'.
if sy-subrc is initial. %txt3 = %textpool_langu_line-entry.
else. %txt3 = %txt_unknown.
endif.
perform ldesc(rsaqexce) using 'G00271132 016F 00 02'
%txt1 %txt2 %txt3 'BSEG-DMBE3' BSEG-DMBE3 'BSEG-DMBE3'.
read table %textpool_langu into %textpool_langu_line
with key ID = 'I' key = 'A27'.
if sy-subrc is initial. %txt1 = %textpool_langu_line-entry.
else. %txt1 = %txt_unknown.
endif.
read table %textpool_langu into %textpool_langu_line
with key key = 'B27'.
if sy-subrc is initial. %txt2 = %textpool_langu_line-entry.
else. %txt2 = %txt_unknown.
endif.
read table %textpool_langu into %textpool_langu_line
with key key = 'H01'.
if sy-subrc is initial. %txt3 = %textpool_langu_line-entry.
else. %txt3 = %txt_unknown.
endif.
perform ldesc(rsaqexce) using 'G00281000 005W 00 02'
%txt1 %txt2 %txt3 'BKPF-HWAE3' BKPF-HWAE3 'BKPF-HWAE3-0124'.
read table %textpool_langu into %textpool_langu_line
with key ID = 'I' key = 'A28'.
if sy-subrc is initial. %txt1 = %textpool_langu_line-entry.
else. %txt1 = %txt_unknown.
endif.
read table %textpool_langu into %textpool_langu_line
with key key = 'B28'.
if sy-subrc is initial. %txt2 = %textpool_langu_line-entry.
else. %txt2 = %txt_unknown.
endif.
read table %textpool_langu into %textpool_langu_line
with key key = 'H01'.
if sy-subrc is initial. %txt3 = %textpool_langu_line-entry.
else. %txt3 = %txt_unknown.
endif.
perform ldesc(rsaqexce) using 'G00291000X010 00 02'
%txt1 %txt2 %txt3 'BSEG-KUNNR' BSEG-KUNNR 'BSEG-KUNNR'.
read table %textpool_langu into %textpool_langu_line
with key ID = 'I' key = 'A29'.
if sy-subrc is initial. %txt1 = %textpool_langu_line-entry.
else. %txt1 = %txt_unknown.
endif.
read table %textpool_langu into %textpool_langu_line
with key key = 'B29'.
if sy-subrc is initial. %txt2 = %textpool_langu_line-entry.
else. %txt2 = %txt_unknown.
endif.
read table %textpool_langu into %textpool_langu_line
with key key = 'H01'.
if sy-subrc is initial. %txt3 = %textpool_langu_line-entry.
else. %txt3 = %txt_unknown.
endif.
perform ldesc(rsaqexce) using 'G00301000X035 00 02'
%txt1 %txt2 %txt3 'TEXT_BSEG_KUNNR' TEXT_BSEG_KUNNR 'TEXT_BSEG_KUNNR'.
perform gdesc(rsaqexce) using 'G00' 1 20 ' ' ' ' 'X'.
perform complete_ldesc(rsaqexce) tables %ldesc.
endform.
form %read_ldesc using p_lid type aql_lid
p_ldesc type rsaqtldesc.
p_lid = 'G00'.
perform %comp_ldesc.
p_ldesc[] = %ldesc[].
endform.
form %output.
describe table %prlist lines %max_prlist.
%head = 'AAA'.
%keyempty = space.
new-page.
perform %output_gl.
perform complete_page(rsaqexce).
%head = 'ZZZ'.
perform last_ptab_entry(rsaqexce).
new-page.
if %keyempty <> space.
message s894(aq).
endif.
endform.
form %top-of-page.
if sy-ucomm = 'INHA'. exit. endif.
if sy-ucomm = 'COPA'. exit. endif.
if %head = space. exit. endif.
if %head = 'DDD'.
perform tviewpage(rsaqexce).
exit.
endif.
if %head = 'GGG'.
perform page(rsaqexce) using 'G00' text-grl 205 %glframe 001.
set left scroll-boundary column 002.
perform set_scroll_boundary(rsaqexce) using 002.
if %toto <> space. exit. endif.
else.
case %head.
when others.
endcase.
endif.
endform.
form %newline.
data: %llen type i.
%llen = 205.
%uflag = space.
new-line.
write: '|', 205 '|'.
position 2.
endform.
form %skip using count.
if sy-linno > 1.
%uflag = space.
do count times.
new-line.
format reset.
write: '|', 205 '|'.
enddo.
endif.
endform.
form %uline.
if %uflag = space.
if sy-linno > 1.
uline /1(205).
endif.
%uflag = 'X'.
endif.
endform.
form %hide.
if %batch <> space and %diact = 'S'.
perform hide(rsaqexce).
else.
hide: %tab, %line, %cont.
endif.
endform.
form %hide_color.
if %batch <> space and %diact = 'S'.
perform hide_color(rsaqexce).
else.
hide: %fint, %fcol.
endif.
endform.
form %rcall using name value.
field-symbols <field>.
assign (name) to <field>.
if sy-subrc <> 0.
value = space.
exit.
endif.
read current line field value <field> into value.
if value = space and %tab = 'G00' and %ldesc-fcur na 'FM'.
read table %g00 index %line.
if sy-subrc = 0.
assign component %ldesc-fnameint of structure %g00
to <field>.
if sy-subrc = 0.
write <field> to value(%ldesc-folen).
endif.
endif.
endif.
endform.
form %save_page.
if %batch <> space and %diact = 'S'.
perform save_page(rsaqexce) tables %st_liste.
endif.
endform.
form %replace_var using text.
field-symbols <var>.
assign text+1(*) to <var>.
endform.
form %save_list.
data: %sflag,
qreport like sy-repid.
if %diact = 'S'. %sflag = 'X'. endif.
qreport = sy-repid.
perform save_list(rsaqexce) tables %st_liste
using qreport %sflag %listid.
if %ql_id <> space.
%dlflag = 'X'.
%listsize = 0255.
perform comp_selection_screen(rsaqexce).
export %st_liste %ptab %ldesc %gdesc %dlflag %listsize
%selections
%g00
to database aqldb(aq) id %ql_id.
endif.
endform.
form %refresh.
case %tab.
when 'G00'.
import %g00 from database aqldb(aq) id %ql_id.
endcase.
endform.
form %download using code.
data: qreport like sy-repid.
perform init_download(rsaqexce).
qreport = sy-repid.
case %tab.
when 'G00'.
perform download(rsaqexce)
tables %g00 using code qreport text-grl.
when others.
message s860(aq).
endcase.
endform.
form %set_data changing l_lines type i.
import ldata to %g00 from memory id 'AQLISTDATA'.
describe table %g00 lines l_lines.
free memory id 'AQLISTDATA'.
endform.
form %get_data tables datatab structure %g00
using first type i
last type i.
append lines of %g00 from first to last to datatab.
endform.
form %get_ref_to_table using lid like rsaqldesc-lid
ref_to_itab type ref to data
subrc like sy-subrc.
subrc = 0.
case lid.
when 'G00'.
create data ref_to_itab like %g00[].
when others.
subrc = 4.
message s860(aq).
endcase.
endform.
form %view.
data: ret type i.
perform check_wingui(rsaqsyst) using ret.
if ret <> 0.
message s841(aq).
perform %download using 'ALV'.
exit.
endif.
data: anz type i,
prog like sy-repid.
prog = sy-repid.
perform init_download(rsaqexce).
case %tab.
when 'G00'.
perform generate_view_dynpro(rsaqexce)
using prog text-grl.
describe table %g00 lines anz.
tview100-lines = anz.
perform init_view(rsaqexce) tables %g00 using tview100.
call screen 100.
perform reset_view_dynpro(rsaqexce).
when others.
message s860(aq).
endcase.
endform.
form %colhead_print changing lines like sy-linno
hflag type c.
data: l_text(255).
if %textpool_read is initial.
read textpool sy-cprog into %textpool_langu language sy-langu.
%textpool_read = 'X'.
endif.
lines = lines + 2.
if 2 = 0. clear hflag. else. hflag = 'X'. endif.
write at (1) '|' no-gap.
read table %textpool_langu into %textpool_langu_line
with key ID = 'I' key = 'B001'.
if sy-subrc is initial.
l_text = %textpool_langu_line-entry.
else.
clear l_text.
endif.
perform replace_vars(rsaqexce) using l_text 'X'.
write at 000(004) l_text(004) no-gap.
write at (1) '|' no-gap.
read table %textpool_langu into %textpool_langu_line
with key ID = 'I' key = 'B011'.
if sy-subrc is initial.
l_text = %textpool_langu_line-entry.
else.
clear l_text.
endif.
perform replace_vars(rsaqexce) using l_text 'X'.
write at 000(010) l_text(010) no-gap.
write at (1) '|' no-gap.
read table %textpool_langu into %textpool_langu_line
with key ID = 'I' key = 'B021'.
if sy-subrc is initial.
l_text = %textpool_langu_line-entry.
else.
clear l_text.
endif.
perform replace_vars(rsaqexce) using l_text 'X'.
write at 000(002) l_text(002) no-gap.
write at (1) '|' no-gap.
read table %textpool_langu into %textpool_langu_line
with key ID = 'I' key = 'B031'.
Hi Vijay,
The code is not developed, this is automatically generated code, when you create a SAP query using SQ01 this code get generated. There is no need to change the code. When you execute this program, then on selection screen give less entries to select.
Regards,
Atish -
How to add radiobuttons in ALV Grid
Hi,
I refered the threads in SDN but i am not able to get proper solution for my requirement.
I am displaying output in ALV Grid format. After displaying the output i mean in the output screen i need few buttons and radio buttons . when user selects the record and clicks the radio button accordingly my logic should work. Anybody can tell me how to add the radiobuttons in the output of the screen. Please find the below output format for the requirement is
Push button1 Pushbutton2 Radiobutton1 Radio button2
MY program output in Grid format.
Anybody can suggest me how to approach.
Regards,
MaheedharCheck if this link helps..
http://wiki.sdn.sap.com/wiki/display/Snippets/ABAP-RadioButtonsinALVGRIDREPORT -
Show normal report or alv report for the radiobutton that was selected
Hello... i'm a begginer on Abap, so I hope to writly espose my question...
I'm trying to modifie an report i have to, when the user choose the values for selection, he also can choose if the output is shown as a normal view or as an alv. I want to do it by using radiobuttons, but I don´t no how to organise my code for the selected radiobutton...
ThanksHi,
Copy and paste this code. undestand the logic.
TABLES: vbrp.
TYPE-POOLS: slis.
TYPES: BEGIN OF gs_vbrp,
vbeln TYPE vbrp-vbeln, "sales order
matnr TYPE vbrp-matnr, "material no
arktx TYPE vbrp-arktx, "material description
ntgew TYPE vbrp-ntgew, "quantity
gewei TYPE vbrp-gewei, "quantity unit
netwr TYPE vbrp-netwr, "currency
werks TYPE vbrp-werks, "plant
END OF gs_vbrp.
DATA: it_vbrp TYPE STANDARD TABLE OF gs_vbrp,
wa_vbrp TYPE gs_vbrp.
DATA: fcat TYPE slis_t_fieldcat_alv,
wa_fcat TYPE slis_fieldcat_alv.
DATA: lyout TYPE slis_layout_alv,
event TYPE slis_t_event,
wa_event TYPE slis_alv_event.
select-options: s_vbeln for vbrp-vbeln.
parameters: p_alv type c radiobutton group AA,
P_NORMAL TYPE C RADIOBUTTON GROUP AA.
SELECT vbeln
matnr
arktx
ntgew
gewei
netwr
werks
FROM vbrp
INTO TABLE it_vbrp
FOR ALL ENTRIES IN IT_VBRP
WHERE vbeln EQ IT_VBRP-VBELN.
IF P_ALV = 'X'.
define imacro.
wa_fcat-fieldname = &1.
wa_fcat-tabname = &2.
wa_fcat-reptext_ddic = &3.
wa_fcat-col_pos = &4.
append wa_fcat to fcat.
clear wa_fcat.
end-of-definition.
imacro 'VBELN' 'it_vbrk' 'PO Document' '1'.
imacro 'MATNR' 'it_vbrk' 'material no.' '2'.
imacro 'ARKTX' 'it_vbrk' 'Mat. description' '3'.
imacro 'NTGEW' 'it_vbrk' 'quantity' '4'.
imacro 'GEWEI' 'it_vbrk' 'quantity unit' '5'.
imacro 'NETWR' 'it_vbrk' 'net price' '6'.
imacro 'WERKS' 'it_vbrk' 'plant' '7'.
****************DEFINE LAYOUT
lyout-zebra = 'X'.
lyout-colwidth_optimize = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = sy-cprog
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = 'USER'
I_CALLBACK_TOP_OF_PAGE = 'MY NAME'
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE = 'I M THAT'
I_GRID_SETTINGS =
IS_LAYOUT = lyout
IT_FIELDCAT = fcat
TABLES
T_OUTTAB = IT_VBRP
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
ELSE.
LOOP AT IT_VBRP INTO WA_VBRP.
WRITE: /5 WA_VBRP-VBELN, WA_VBRP-MATNR.
ENDLOOP.
ENDIF.
Cheers,
Rudhir -
Radiobutton in alv by step by step
is there any method we can display and update with the same screen output from the same table .????
1st thing is can we add up any thing in output screen and
how can we use radiobutton with the help of Alv, i am new to alv so pls give me step by step instructions.
thanks in advance
my mail id is [email protected]hi
good
go through these link
http://www.sap-img.com/abap/what-are-the-events-in-alv.htm
hope this will help you to solve your problem.
thanks
mrutyun^ -
Display fields based on radiobutton in ALV
hi friends,
I have two radio buttons. Depending upon the radiobutton that is checked only a certain fields should be displayed in the ALVoutput. Could any one help me to solve this issue.
Thanks and regards,
RamineniHi,
Better to create two internale tables n if check box is checked then display data from first internal table n if not checked then display data from second internal table.
Regards,
Prashant -
ALV Totals , Subtotals for a particular field in ALV Grid report
Hi,
I have an issue in ALV totals and subtotals.
Scenario is like this.
i have a vendor data to be pulled out of SAP and to be shown in the form of report.
i am populating all the data and doing do_sum based on Vendor ( has expansin & collapse option ) and display the number of reports .
Vendor -
100
Vendor1 -
1
Vendor2----
2.
Vendor100----
100.
but my problem is in the same report i have a date field .
if i have a five vendors created on 03/03/2008. in the same report for the date field having ( expansion & collapse ) , when i expand based on that date can i be able to sum up all the vendors created on 03/03/2008 and display in the same report along with the vendor count.
Let me know . Thank you in advance
Regards,
RyHi Roby,
Have a look at this sample code
It will help u,
REPORT ZIN_FI_AGEING
message-id zbdc
no standard page heading.
Title : For Ageing Details
Author :
Date : 22/11/2004
Transport/Correction Id :
Clarify case ID :
Application : FI
Program Type :
Frequency :
Purpose :
Comments :
Request No :
TABLES DELCARATIONS
Tables: zzgeinz9a, "Actual line item table
t001. "Plants/Branches
ALV TTPE DELCARATIONS
type-pools: slis.
*Type Declarations for Field Catalog
data : i_fldcat_head type slis_t_fieldcat_alv,
wa_fldcat_head type slis_fieldcat_alv.
*Type Declarations for ALV Events
data : i_events type slis_t_event,
wa_event like line of i_events.
*Type Declarations for Layout Design
data : wa_layout type slis_layout_alv.
*Type Declarations for Sorting Fields
data: it_sort type slis_sortinfo_alv occurs 0 with header line.
*Type Declarations for Displaying Images on Grid
data : i_comment type slis_t_listheader,
wa_comment type slis_listheader.
*Type Declarations for Grouping fields
data : wa_group type slis_sp_group_alv,
i_group type slis_t_sp_group_alv.
DATA DELCARATIONS
data: v_flag, "Status Flag
v_repid like sy-repid, "Program Name
p_year(4) type c, "Year
v_due_days type i. "To hold the due days
CONSTANTS DELCARATIONS
constants: c_x type c value 'X',
c_bukrs(4) type c value '0373'.
INTERNAL TABLES DELCARATIONS
*--Internal table to hold the required data
data: begin of it_final_vendor occurs 0,
rzzlifnr like zzgeinz9a-rzzlifnr, "Vendor
name1 like lfa1-name1, "Vendor Name
docnr like zzgeinz9a-DOCNR, "Accounting Doc No
refdocnr like zzgeinz9a-REFDOCNR, "Reference document no
belnr like bkpf-belnr, "FI Doc No
doc_date like bkpf-awkey, "Document Date
zbd1t like bsik-zbd1t, "Cash discount days 1
bldat like bkpf-bldat, "Document Date
due_date like bkpf-bldat, "Due Date
due_days type i, "Due Days
rzz_ebeln like zzgeinz9a-rzz_ebeln, "P.O. Ref No
not_due like zzgeinz9a-hsl, "Not Yet Due
hsl like zzgeinz9a-hsl, "local currency
found type c, "Existance Flag
end of it_final_vendor.
data: begin of it_final_vendor_temp occurs 0,
rzzlifnr like zzgeinz9a-rzzlifnr, "Vendor
name1 like lfa1-name1, "Vendor Name
belnr like bkpf-belnr, "FI Doc No
bldat like bkpf-bldat, "Document Date
rzz_ebeln like zzgeinz9a-rzz_ebeln, "P.O. Ref No
hsl like zzgeinz9a-hsl, "local currency
due_date like bkpf-bldat, "Due Date
due_days type i, "Due Days
not_due like zzgeinz9a-hsl, "Not Yet Due
buck_0_30 like zzgeinz9a-hsl, "Invoiceamt in localcurr
buck_31_60 like zzgeinz9a-hsl, "Invoiceamt in localcurr
buck_61_90 like zzgeinz9a-hsl, "Invoiceamt in localcurr
buck_91_180 like zzgeinz9a-hsl, "Invoiceamt in localcurr
buck_180 like zzgeinz9a-hsl, "Invoiceamt in localcurr
docnr like zzgeinz9a-DOCNR, "Accounting Doc No
refdocnr like zzgeinz9a-REFDOCNR, "Reference document no
doc_date like bkpf-awkey, "Document Date
found type c, "Existance Flag
end of it_final_vendor_temp.
data: begin of it_final_customer occurs 0,
rzzkunnr like zzgeinz9a-rzzkunnr, "Customer
name1 like kna1-name1, "Customer Name
docnr like zzgeinz9a-DOCNR, "Accounting Doc No
refdocnr like zzgeinz9a-REFDOCNR, "Reference document no
belnr like bkpf-belnr, "FI Doc No
doc_date like bkpf-awkey, "Document Date
zbd1t like bsik-zbd1t, "Cash discount days 1
bldat like bkpf-bldat, "Document Date
due_date like bkpf-bldat, "Due Date
due_days type i, "Due Days
rzz_ebeln like zzgeinz9a-rzz_ebeln, "P.O. Ref No
not_due like zzgeinz9a-hsl, "Not Yet Due
hsl like zzgeinz9a-hsl, "local currency
found type c, "Existance Flag
end of it_final_customer.
data: begin of it_final_customer_temp occurs 0,
rzzkunnr like zzgeinz9a-rzzkunnr, "Customer
name1 like kna1-name1, "Customer Name
belnr like bkpf-belnr, "FI Doc No
bldat like bkpf-bldat, "Document Date
rzz_ebeln like zzgeinz9a-rzz_ebeln, "P.O. Ref No
hsl like zzgeinz9a-hsl, "local currency
due_date like bkpf-bldat, "Due Date
due_days type i, "Due Days
not_due like zzgeinz9a-hsl, "Not Yet Due
buck_0_30 like zzgeinz9a-hsl, "Invoiceamt in localcurr
buck_31_60 like zzgeinz9a-hsl, "Invoiceamt in localcurr
buck_61_90 like zzgeinz9a-hsl, "Invoiceamt in localcurr
buck_91_180 like zzgeinz9a-hsl, "Invoiceamt in localcurr
buck_180 like zzgeinz9a-hsl, "Invoiceamt in localcurr
docnr like zzgeinz9a-DOCNR, "Accounting Doc No
refdocnr like zzgeinz9a-REFDOCNR, "Reference document no
doc_date like bkpf-awkey, "Document Date
found type c, "Existance Flag
end of it_final_customer_temp.
*--Internal Table to hold the Cash discount days 1 for Vendors
data: begin of it_final_bsik occurs 0,
belnr like bsik-belnr,
zbd1t like bsik-zbd1t,
end of it_final_bsik.
*--Internal Table to hold the Cash discount days 1 for Customers
data: begin of it_final_bsid occurs 0,
belnr like bsid-belnr,
zbd1t like bsid-zbd1t,
end of it_final_bsid.
INITIALIZATION
v_repid = sy-repid.
SELECTION SCREEN
selection-screen: begin of block b1 with frame title text-h01.
selection-screen skip.
select-options: s_vendor for zzgeinz9a-rzzlifnr modif id ven.
parameters: p_comp1 like t001-bukrs modif id ven.
parameters: p_rundt1 like bkpf-bldat modif id ven.
select-options: s_cust for zzgeinz9a-rzzkunnr modif id cst.
parameters: p_comp2 like t001-bukrs modif id cst.
parameters: p_rundt2 like bkpf-bldat modif id cst.
selection-screen skip.
selection-screen: begin of block b2 with frame title text-h02.
parameters : p_vendor radiobutton group gr1 default 'X'
user-command test,
p_cust radiobutton group gr1.
selection-screen: end of block b2.
selection-screen: end of block b1.
**************************AT Selection Screen OutPut ******************
at selection-screen output.
loop at screen.
if p_cust = 'X'.
if screen-group1 = 'VEN'.
screen-active = '0'.
screen-input = '0'.
screen-output = '0'.
screen-invisible = '0'.
endif.
elseif p_vendor = 'X'.
if screen-group1 = 'CST'.
screen-active = '0'.
screen-input = '0'.
screen-output = '0'.
screen-invisible = '0'.
endif.
endif.
modify screen.
endloop.
SELECTION SCREEN ON
at selection-screen on s_vendor.
*--Validating Vendor
if not s_vendor[] is initial.
perform validate_s_vendor.
endif.
at selection-screen on s_cust.
*--Validating Customer
if not s_cust[] is initial.
perform validate_s_cust.
endif.
at selection-screen on p_comp1.
*--Validating Company Code.
if not p_comp1 is initial.
perform validate_p_comp1.
endif.
at selection-screen on p_comp2.
*--Validating Company Code.
if not p_comp2 is initial.
perform validate_p_comp2.
endif.
START OF SELECTION
start-of-selection.
if p_vendor = 'X'.
perform get_vendor_data.
elseif p_cust = 'X'.
perform get_customer_data.
endif.
END OF SELECTION
end-of-selection.
if p_vendor = 'X'.
*--Generating the output for vendor
perform generate_field_catalog_vendor.
perform get_events_vendor.
perform generate_layout_vendor.
perform generate_sort_vendor.
perform generate_group_vendor.
perform disp_alv_grid_vendor.
elseif p_cust = 'X'.
*--Generating the output for customer
perform generate_field_catalog_cust.
perform get_events_customer.
perform generate_layout_customer.
perform generate_sort_customer.
perform generate_group_customer.
perform disp_alv_grid_customer.
endif.
*& Form validate_s_vendor
Validating the Vendor
form validate_s_vendor.
select rzzlifnr up to 1 rows
into (zzgeinz9a-rzzlifnr)
from zzgeinz9a
where rzzlifnr in s_vendor.
endselect.
if sy-subrc ne 0.
message e004 with 'Invalid Range of Vendor'(002)
s_vendor-low 'To'(006) s_vendor-high.
endif.
endform. " validate_s_vendor
*& Form validate_s_cust
Validating the Customer
form validate_s_cust.
select rzzkunnr up to 1 rows
into (zzgeinz9a-rzzkunnr)
from zzgeinz9a
where rzzkunnr in s_cust.
endselect.
if sy-subrc ne 0.
message e004 with 'Invalid Range of Customer'(005)
s_cust-low 'To'(006) s_cust-high.
endif.
endform. " validate_s_cust
*& Form validate_p_comp1
Validating the Company Code
form validate_p_comp1.
select single bukrs
into (t001-bukrs)
from t001
where bukrs eq p_comp1.
if sy-subrc ne 0.
message e004 with 'Company Code'(004) p_comp1 'Does not Exists'(003)
endif.
endform. " validate_p_comp1
*& Form validate_p_comp2
Validating the Company Code
form validate_p_comp2.
select single bukrs
into (t001-bukrs)
from t001
where bukrs eq p_comp2.
if sy-subrc ne 0.
message e004 with 'Company Code'(004) p_comp2 'Does not Exists'(003)
endif.
endform. " validate_p_comp2
*& Form get_vendor_data
Getting the Vendor Related Docs
form get_vendor_data.
select a~rzzlifnr
b~name1
a~docnr
a~refdocnr
a~rzz_ebeln
a~hsl
into corresponding fields of table it_final_vendor
from zzgeinz9a as a
inner join lfa1 as b
on arzzlifnr = blifnr
where rzzlifnr in s_vendor
and rbukrs eq p_comp1.
if sy-subrc eq 0.
v_flag = 'X'.
p_year = sy-datum+0(4).
perform get_doc_date using p_comp1
p_year.
perform move_records.
sort it_final_vendor by rzzlifnr.
perform generate_data.
else.
v_flag = space.
endif.
endform. " get_vendor_data
*& Form get_customer_data
Getting the Customer Related Docs
form get_customer_data.
select a~rzzkunnr
b~name1
a~docnr
a~refdocnr
a~rzz_ebeln
a~hsl
into corresponding fields of table it_final_customer
from zzgeinz9a as a
inner join kna1 as b
on arzzkunnr = bkunnr
where rzzkunnr in s_cust
and rbukrs eq p_comp2.
if sy-subrc eq 0.
v_flag = 'X'.
p_year = sy-datum+0(4).
perform get_doc_date_cust using p_comp2
p_year.
perform move_records_cust.
sort it_final_customer by rzzkunnr.
perform generate_data_cust.
else.
v_flag = space.
endif.
endform. " get_customer_data
*& Form get_doc_date
Getting the Document Date and FI Doc No
-->P_P_COMP1 Company Code
-->P_P_YEAR Fiscal Year
form get_doc_date using p_p_comp1
p_p_year.
loop at it_final_vendor.
concatenate it_final_vendor-refdocnr '*' into
it_final_vendor-doc_date.
modify it_final_vendor index sy-tabix.
endloop.
clear it_final_vendor.
data: v_doc_date(11) type c,
v_belnr like bkpf-belnr,
v_bldat like bkpf-bldat.
loop at it_final_vendor.
concatenate it_final_vendor-refdocnr '%' into v_doc_date.
select single belnr
bldat
into corresponding fields of it_final_vendor
from bkpf
where bukrs eq p_p_comp1
and gjahr eq p_p_year
and awkey like v_doc_date.
modify it_final_vendor.
endloop.
clear:it_final_vendor.
endform. " get_doc_date
*& Form move_records
Moving records to final internal table
form move_records.
*--Checking the existance of belnr in bsik
clear it_final_vendor.
select belnr
zbd1t
into table it_final_bsik
from bsik
for all entries in it_final_vendor
where belnr eq it_final_vendor-belnr
and bukrs eq c_bukrs.
clear it_final_bsik.
loop at it_final_vendor.
read table it_final_bsik with key belnr = it_final_vendor-belnr.
if sy-subrc eq 0.
it_final_vendor-zbd1t = it_final_bsik-zbd1t.
it_final_vendor-due_date = it_final_vendor-bldat +
it_final_bsik-zbd1t.
it_final_vendor-found = 'X'.
modify it_final_vendor.
endif.
endloop.
endform. " move_records
*& Form generate_data
Segregating the records based on due_date
form generate_data.
delete it_final_vendor[] where found ne 'X'.
sort it_final_vendor by belnr.
loop at it_final_vendor.
if it_final_vendor-due_date > p_rundt1.
move-corresponding it_final_vendor to it_final_vendor_temp.
move it_final_vendor-hsl to it_final_vendor_temp-not_due.
elseif it_final_vendor-due_date < p_rundt1.
it_final_vendor-due_days = p_rundt1 - it_final_vendor-DUE_DATE.
endif.
*--filling 0-30 bucket.
if it_final_vendor-due_days ge 0 AND it_final_vendor-due_days le 30.
move-corresponding it_final_vendor to it_final_vendor_temp.
move it_final_vendor-hsl to it_final_vendor_temp-buck_0_30.
*--filling 31-60 bucket.
elseif it_final_vendor-due_days ge 31 AND it_final_vendor-due_days le 60
move-corresponding it_final_vendor to it_final_vendor_temp.
move it_final_vendor-hsl to it_final_vendor_temp-buck_31_60.
*--filling 61-90 bucket.
elseif it_final_vendor-due_days ge 61 AND it_final_vendor-due_days le 90
move-corresponding it_final_vendor to it_final_vendor_temp.
move it_final_vendor-hsl to it_final_vendor_temp-buck_61_90.
*--filling 91-180 bucket.
elseif it_final_vendor-due_days ge 91 AND it_final_vendor-due_days
le 180.
move-corresponding it_final_vendor to it_final_vendor_temp.
move it_final_vendor-hsl to it_final_vendor_temp-buck_91_180.
*--filling 180 bucket.
elseif it_final_vendor-due_days gt 180.
move-corresponding it_final_vendor to it_final_vendor_temp.
move it_final_vendor-hsl to it_final_vendor_temp-buck_180.
endif.
append it_final_vendor_temp.
clear it_final_vendor_temp.
endloop.
endform. " generate_data
*& Form DISP_ALV_GRID_VENDOR
Displaying the output in grid For Vendor
form DISP_ALV_GRID_VENDOR.
*--Generating the OUTPUT GRID FOR VENDOR
call function 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = v_repid
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT = wa_layout
IT_FIELDCAT = i_fldcat_head
IT_EXCLUDING =
IT_SPECIAL_GROUPS = i_group
IT_SORT = it_sort[]
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS = i_events
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IT_ALV_GRAPHICS =
IT_ADD_FIELDCAT =
IT_HYPERLINK =
I_HTML_HEIGHT_TOP =
I_HTML_HEIGHT_END =
IT_EXCEPT_QINFO =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
tables
t_outtab = it_final_vendor_temp
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. " DISP_ALV_GRID
*& Form get_doc_date_cust
text
-->P_P_COMP2 Company Code
-->P_P_YEAR Fiscal Year
form get_doc_date_cust using p_p_comp2
p_p_year.
loop at it_final_customer.
concatenate it_final_customer-refdocnr '*' into
it_final_customer-doc_date.
modify it_final_customer index sy-tabix.
endloop.
clear it_final_customer.
data: v_doc_date(11) type c,
v_belnr like bkpf-belnr,
v_bldat like bkpf-bldat.
loop at it_final_customer.
concatenate it_final_customer-refdocnr '%' into v_doc_date.
select single belnr
bldat
into corresponding fields of it_final_customer
from bkpf
where bukrs eq p_p_comp2
and gjahr eq p_p_year
and awkey like v_doc_date.
modify it_final_customer.
endloop.
clear:it_final_customer.
endform. " get_doc_date_cust
*& Form move_records_cust
Moving Customer Data to Final Internal Table
form move_records_cust.
*--Checking the existance of belnr in bsid
select belnr
zbd1t
into table it_final_bsid
from bsid
for all entries in it_final_customer
where belnr eq it_final_customer-belnr
and bukrs eq c_bukrs.
clear it_final_bsid.
loop at it_final_customer.
read table it_final_bsid with key belnr = it_final_customer-belnr.
if sy-subrc eq 0.
it_final_customer-zbd1t = it_final_bsid-zbd1t.
it_final_customer-due_date = it_final_customer-bldat +
it_final_bsid-zbd1t.
it_final_customer-found = 'X'.
modify it_final_customer.
endif.
endloop.
endform. " move_records_cust
*& Form generate_data_cust
Generating the Customer Output
form generate_data_cust.
delete it_final_customer[] where found ne 'X'.
sort it_final_customer by belnr.
loop at it_final_customer.
if it_final_customer-due_date > p_rundt2.
move-corresponding it_final_customer to it_final_customer_temp.
move it_final_customer-hsl to it_final_customer_temp-not_due.
elseif it_final_customer-due_date < p_rundt2.
it_final_customer-due_days = p_rundt2 - it_final_customer-DUE_DATE.
endif.
*--filling 0-30 bucket.
if it_final_customer-due_days ge 0 AND it_final_customer-due_days le 30
move-corresponding it_final_customer to it_final_customer_temp.
move it_final_customer-hsl to it_final_customer_temp-buck_0_30.
*--filling 31-60 bucket.
elseif it_final_customer-due_days ge 31 AND it_final_customer-due_days
le 60
move-corresponding it_final_customer to it_final_customer_temp.
move it_final_customer-hsl to it_final_customer_temp-buck_31_60.
*--filling 61-90 bucket.
elseif it_final_customer-due_days ge 61 AND it_final_customer-due_days
le 90
move-corresponding it_final_customer to it_final_customer_temp.
move it_final_customer-hsl to it_final_customer_temp-buck_61_90.
*--filling 91-180 bucket.
elseif it_final_customer-due_days ge 91 AND
it_final_customer-due_days
le 180.
move-corresponding it_final_customer to it_final_customer_temp.
move it_final_customer-hsl to it_final_customer_temp-buck_91_180.
*--filling 180 bucket.
elseif it_final_customer-due_days gt 180.
move-corresponding it_final_customer to it_final_customer_temp.
move it_final_customer-hsl to it_final_customer_temp-buck_180.
endif.
append it_final_customer_temp.
clear it_final_customer_temp.
endloop.
endform. " generate_data_cust
*& Form generate_field_catalog_vendor
Generating the Field Catalog for Vendor
form generate_field_catalog_vendor.
call function 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = v_repid
I_INTERNAL_TABNAME = 'IT_FINAL_VENDOR_TEMP'
I_STRUCTURE_NAME =
I_CLIENT_NEVER_DISPLAY = 'X'
I_INCLNAME = v_repid
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
changing
ct_fieldcat = i_fldcat_head
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.
if not i_fldcat_head[] is initial.
loop at i_fldcat_head into wa_fldcat_head.
case wa_fldcat_head-fieldname.
when 'RZZLIFNR'.
wa_fldcat_head-col_pos = '1'.
wa_fldcat_head-ref_tabname = ' '.
wa_fldcat_head-seltext_m = 'Vendor No'(001).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '12'.
when 'NAME1'.
wa_fldcat_head-col_pos = '2'.
wa_fldcat_head-seltext_m = 'Vendor Name'(007).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '35'.
when 'BELNR'.
wa_fldcat_head-col_pos = '3'.
wa_fldcat_head-seltext_m = 'Invoice No'(008).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '12'.
wa_fldcat_head-KEY = ' '.
when 'BLDAT'.
wa_fldcat_head-col_pos = '4'.
wa_fldcat_head-seltext_m = 'Document Date'(009).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '13'.
wa_fldcat_head-ref_tabname = ' '.
when 'RZZ_EBELN'.
wa_fldcat_head-col_pos = '5'.
wa_fldcat_head-seltext_m = 'PO.Ref.No'(010).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '13'.
wa_fldcat_head-ref_tabname = ' '.
when 'HSL'.
wa_fldcat_head-col_pos = '6'.
wa_fldcat_head-seltext_m = 'Invoice Amount'(011).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '16'.
wa_fldcat_head-do_sum = 'X'.
when 'DUE_DATE'.
wa_fldcat_head-col_pos = '7'.
wa_fldcat_head-seltext_m = 'Due Date'(012).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '12'.
wa_fldcat_head-ref_tabname = ' '.
when 'DUE_DAYS'.
wa_fldcat_head-col_pos = '8'.
wa_fldcat_head-seltext_m = 'Due Days'(013).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '9'.
when 'NOT_DUE'.
wa_fldcat_head-col_pos = '9'.
wa_fldcat_head-seltext_m = 'Not Due'(014).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '16'.
wa_fldcat_head-do_sum = 'X'.
when 'BUCK_0_30'.
wa_fldcat_head-col_pos = '10'.
wa_fldcat_head-seltext_m = '0 To 30'(015).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '16'.
wa_fldcat_head-do_sum = 'X'.
when 'BUCK_31_60'.
wa_fldcat_head-col_pos = '11'.
wa_fldcat_head-seltext_m = '31 To 60'(016).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '16'.
wa_fldcat_head-do_sum = 'X'.
when 'BUCK_61_90'.
wa_fldcat_head-col_pos = '12'.
wa_fldcat_head-seltext_m = '61 To 90'(017).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '16'.
wa_fldcat_head-do_sum = 'X'.
when 'BUCK_91_180'.
wa_fldcat_head-col_pos = '13'.
wa_fldcat_head-seltext_m = '91 To 180'(018).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '16'.
wa_fldcat_head-do_sum = 'X'.
when 'BUCK_180'.
wa_fldcat_head-col_pos = '14'.
wa_fldcat_head-seltext_m = 'Beyond 180'(019).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '16'.
wa_fldcat_head-do_sum = 'X'.
when 'DOCNR'.
wa_fldcat_head-no_out = 'X'.
when 'REFDOCNR'.
wa_fldcat_head-no_out = 'X'.
when 'DOC_DATE'.
wa_fldcat_head-no_out = 'X'.
when 'FOUND'.
wa_fldcat_head-no_out = 'X'.
endcase.
modify i_fldcat_head from wa_fldcat_head index sy-tabix.
endloop.
endif.
endform. " generate_field_catalog_vendor
*& Form get_events_vendor
Getting ALV Events
form get_events_vendor.
call function 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
importing
et_events = i_events
exceptions
list_type_wrong = 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 not i_events[] is initial.
read table i_events into wa_event with key name = 'TOP_OF_PAGE'(024)
wa_event-form = 'GENERATE_USERCOMMAND'.
modify i_events from wa_event index sy-tabix.
read table i_events into wa_event with key name = 'END_OF_LIST'(025)
wa_event-form = 'GENERATE_USERCOMMAND_FOOTER'.
modify i_events from wa_event index sy-tabix.
endif.
endform. " get_events_vendor
*& Form GENERATE_USERCOMMAND
Displaying Header-Text and Logo on Grid
form generate_usercommand .
clear i_comment[].
wa_comment-typ = 'H'.
wa_comment-info = 'Vendor Ageing Report'(026).
append wa_comment to i_comment.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = i_comment
i_logo = 'ENJOYSAP_LOGO'
I_END_OF_LIST_GRID = 'X'
endform. " GENERATE_USERCOMMAND
*& Form GENERATE_USERCOMMAND_FOOTER
Displaying Footer-Text on Grid
form generate_usercommand_footer.
clear i_comment[].
clear wa_comment.
wa_comment-typ = 'S'.
wa_comment-key = 'GE-Betz'(027).
append wa_comment to i_comment.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = i_comment
I_LOGO = ''
i_end_of_list_grid = 'X'.
endform. " GENERATE_USERCOMMAND_FOOTER
*& Form generate_layout_vendor
Generating the ALV Layout
form generate_layout_vendor.
WA_LAYOUT-COLWIDTH_OPTIMIZE = 'X'. "OPTIMIZING FIELD WIDTH
wa_layout-zebra = 'X'. "PUTTING ZEBRA COLORS
wa_layout-confirmation_prompt = 'X'. "DISPLAYS CONFIRMATION DIALOG
wa_layout-totals_text = 'Totals'(028). "DISPLAYS TOTALS TEXT
wa_layout-subtotals_text = 'Sub Totals'(029)."DISPLAYS SUBTOTALS TEXT
endform. " generate_layout_vendor
*& Form generate_sort_vendor
Sorting the Internal Table by Vendor
form generate_sort_vendor.
it_sort-fieldname = 'RZZLIFNR'.
it_sort-tabname = 'IT_FINAL_VENDOR_TEMP'.
it_sort-up = 'X'.
it_sort-subtot = 'X'.
append it_sort.
endform. " generate_sort_vendor
*& Form generate_group_vendor
Grouping the Data
form generate_group_vendor.
clear i_group.
wa_group-sp_group = 'A'.
wa_group-text = 'RZZLIFNR'.
append wa_group to i_group.
endform. " generate_group_vendor
*& Form GENERATE_FIELD_CATALOG_CUST
Generating Field Catalog for Customer
form GENERATE_FIELD_CATALOG_CUST.
call function 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = v_repid
I_INTERNAL_TABNAME = 'IT_FINAL_CUSTOMER_TEMP'
I_STRUCTURE_NAME =
I_CLIENT_NEVER_DISPLAY = 'X'
I_INCLNAME = v_repid
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
changing
ct_fieldcat = i_fldcat_head
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.
if not i_fldcat_head[] is initial.
loop at i_fldcat_head into wa_fldcat_head.
case wa_fldcat_head-fieldname.
when 'RZZKUNNR'.
wa_fldcat_head-col_pos = '1'.
wa_fldcat_head-ref_tabname = ' '.
wa_fldcat_head-seltext_m = 'Customer No'(020).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '12'.
when 'NAME1'.
wa_fldcat_head-col_pos = '2'.
wa_fldcat_head-seltext_m = 'Customer Name'(021).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '35'.
when 'BELNR'.
wa_fldcat_head-col_pos = '3'.
wa_fldcat_head-seltext_m = 'Invoice No'(008).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '12'.
wa_fldcat_head-KEY = ' '.
when 'BLDAT'.
wa_fldcat_head-col_pos = '4'.
wa_fldcat_head-seltext_m = 'Document Date'(009).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '13'.
wa_fldcat_head-ref_tabname = ' '.
when 'RZZ_EBELN'.
wa_fldcat_head-col_pos = '5'.
wa_fldcat_head-seltext_m = 'PO.Ref.No'(010).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '13'.
wa_fldcat_head-ref_tabname = ' '.
when 'HSL'.
wa_fldcat_head-col_pos = '6'.
wa_fldcat_head-seltext_m = 'Invoice Amount'(011).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '16'.
wa_fldcat_head-do_sum = 'X'.
when 'DUE_DATE'.
wa_fldcat_head-col_pos = '7'.
wa_fldcat_head-seltext_m = 'Due Date'(012).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '12'.
wa_fldcat_head-ref_tabname = ' '.
when 'DUE_DAYS'.
wa_fldcat_head-col_pos = '8'.
wa_fldcat_head-seltext_m = 'Due Days'(013).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '9'.
when 'NOT_DUE'.
wa_fldcat_head-col_pos = '9'.
wa_fldcat_head-seltext_m = 'Not Due'(014).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '16'.
wa_fldcat_head-do_sum = 'X'.
when 'BUCK_0_30'.
wa_fldcat_head-col_pos = '10'.
wa_fldcat_head-seltext_m = '0 To 30'(015).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '16'.
wa_fldcat_head-do_sum = 'X'.
when 'BUCK_31_60'.
wa_fldcat_head-col_pos = '11'.
wa_fldcat_head-seltext_m = '31 To 60'(016).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '16'.
wa_fldcat_head-do_sum = 'X'.
when 'BUCK_61_90'.
wa_fldcat_head-col_pos = '12'.
wa_fldcat_head-seltext_m = '61 To 90'(017).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '16'.
wa_fldcat_head-do_sum = 'X'.
when 'BUCK_91_180'.
wa_fldcat_head-col_pos = '13'.
wa_fldcat_head-seltext_m = '91 To 180'(018).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '16'.
wa_fldcat_head-do_sum = 'X'.
when 'BUCK_180'.
wa_fldcat_head-col_pos = '14'.
wa_fldcat_head-seltext_m = 'Beyond 180'(019).
wa_fldcat_head-ddictxt = 'M'.
wa_fldcat_head-outputlen = '16'.
wa_fldcat_head-do_sum = 'X'.
when 'DOCNR'.
wa_fldcat_head-no_out = 'X'.
when 'REFDOCNR'.
wa_fldcat_head-no_out = 'X'.
when 'DOC_DATE'.
wa_fldcat_head-no_out = 'X'.
when 'FOUND'.
wa_fldcat_head-no_out = 'X'.
endcase.
modify i_fldcat_head from wa_fldcat_head index sy-tabix.
endloop.
endif.
endform. " GENERATE_FIELD_CATALOG_CUST
*& Form get_events_customer
Getting ALV Events
form get_events_customer.
call function 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
importing
et_events = i_events
exceptions
list_type_wrong = 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 not i_events[] is initial.
read table i_events into wa_event with key name = 'TOP_OF_PAGE'(024)
wa_event-form = 'GENERATE_USERCOMMAND_CUST'.
modify i_events from wa_event index sy-tabix.
read table i_events into wa_event with key na -
Regd: Calculation of TOTAL field in ALV report
Hi All,
We have a scenario that we are not getting the total value for numeric fields in ALV report.
Below i have given the code used for it.
G_KEY = 'X'.
G_NOKEY = SPACE.
G_SUM = 'X'.
G_NOSUM = SPACE.
PERFORM BUILD_FIELDCAT USING 'VBELN' G_KEY G_NOSUM.
PERFORM BUILD_FIELDCAT USING 'BLDAT' G_NOKEY G_NOSUM.
PERFORM BUILD_FIELDCAT USING 'VGBEL' G_KEY G_NOSUM.
PERFORM BUILD_FIELDCAT USING 'POSNR' G_KEY G_NOSUM.
PERFORM BUILD_FIELDCAT USING 'MATNR' G_KEY G_NOSUM..
PERFORM BUILD_FIELDCAT USING 'LFIMG' G_NOKEY G_NOSUM.
PERFORM BUILD_FIELDCAT USING 'VRKME' G_NOKEY G_NOSUM.
PERFORM BUILD_FIELDCAT USING 'NETPR' G_NOKEY G_NOSUM.
PERFORM BUILD_FIELDCAT USING 'BRTWR' G_NOKEY G_NOSUM.
PERFORM BUILD_FIELDCAT USING 'VALUE_INR' G_NOKEY G_SUM.
PERFORM BUILD_FIELDCAT USING 'B_DUTY' G_NOKEY G_SUM.
PERFORM BUILD_FIELDCAT USING 'S_TOTAL1' G_NOKEY G_SUM.
PERFORM BUILD_FIELDCAT USING 'CV_DUTY' G_NOKEY G_SUM.
PERFORM BUILD_FIELDCAT USING 'C_CVD' G_NOKEY G_SUM.
PERFORM BUILD_FIELDCAT USING 'S_TOTAL2' G_NOKEY G_SUM.
PERFORM BUILD_FIELDCAT USING 'C_DUTY' G_NOKEY G_SUM.
PERFORM BUILD_FIELDCAT USING 'S_TOTAL3' G_NOKEY G_SUM.
PERFORM BUILD_FIELDCAT USING 'A_DUTY' G_NOKEY G_SUM.
PERFORM BUILD_FIELDCAT USING 'T_DUTY' G_NOKEY G_SUM.
PERFORM BUILD_LAYOUT.
PERFORM BUILD_DISPLAY.
*& Form DISPLAY
text
FORM BUILD_DISPLAY.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = ' '
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE = TEXT-000
I_GRID_SETTINGS =
IS_LAYOUT = IG_LAYOUT
IT_FIELDCAT = IG_FIELDCAT
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = 'A'
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
IR_SALV_FULLSCREEN_ADAPTER =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = IG_INBOUND
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. "DISPLAY
*& Form BUILD_FIELDCAT
text
-->G_FIELDNAME text
-->L_KEY text
-->L_SUM text
FORM BUILD_FIELDCAT USING L_FIELDNAME LIKE DD03L-FIELDNAME L_KEY TYPE C L_SUM TYPE C.
CLEAR WG_FIELDCAT_LN.
ADD 1 TO G_COL_POS.
WG_FIELDCAT_LN-REF_TABNAME = 'IG_INBOUND'.
WG_FIELDCAT_LN-FIELDNAME = L_FIELDNAME.
WG_FIELDCAT_LN-KEY = L_KEY.
WG_FIELDCAT_LN-DO_SUM = L_SUM.
WG_FIELDCAT_LN-COL_POS = G_COL_POS.
WG_FIELDCAT_LN-NO_OUT = SPACE.
WG_FIELDCAT_LN-QFIELDNAME = SPACE.
WG_FIELDCAT_LN-HOTSPOT = SPACE.
APPEND WG_FIELDCAT_LN TO IG_FIELDCAT.
ENDFORM. "BUILD_FIELDCAT
*& Form BUILD_LAYOUT
text
FORM BUILD_LAYOUT.
IG_LAYOUT-TOTALS_TEXT = 'Total Amount'.
*IG_LAYOUT-SUBTOTALS_TEXT = 'A'.
IG_LAYOUT-ZEBRA = 'X'.
ENDFORM.
Help and Sugesstions will be much appreciated.
Thanks & Regds.
Ramesh.This is sample program for the same
REPORT Z_50657_ALV_EX2
NO STANDARD PAGE HEADING
LINE-COUNT 65(3)
LINE-SIZE 220
MESSAGE-ID ZZ.
* Type Pools *
TYPE-POOLS: SLIS, ICON.
* Tables *
TABLES: VBAK. "Sales Document Data
* Internal Tables *
* TABLE TO HOLD DATA OF SALES DOCUMENT
DATA: BEGIN OF IT_VBAK OCCURS 0,
VBELN LIKE VBAK-VBELN, "Sales Document
VBTYP LIKE VBAK-VBTYP, "SD document category
AUDAT LIKE VBAK-AUDAT, "Document date (date received/sent)
AUGRU LIKE VBAK-AUGRU, "Order reason (reason for the business)
AUART LIKE VBAK-AUART, "Sales Document Type
NETWR LIKE VBAK-NETWR, "Net Sales Order in Doc. Currency
WAERK LIKE VBAK-WAERK, "SD document currency
ICON TYPE ICON-ID, "traffic lights
END OF IT_VBAK.
* Work Areas *
*WORK AREAS DEFINED FOR ALV'S
DATA: WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV, "field catalog
IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV, "field catalog ITAB
WA_SORT TYPE SLIS_SORTINFO_ALV, "SORT work area
IT_SORT TYPE SLIS_T_SORTINFO_ALV, "SORT ITAB
LAYOUT TYPE SLIS_LAYOUT_ALV, "LAYOUT
WA_FCODE TYPE SLIS_EXTAB, "FUN CODE
I_FCODE_EXTAB TYPE SLIS_T_EXTAB,
WA_EVENTS TYPE SLIS_ALV_EVENT,
IT_EVENTS TYPE SLIS_T_EVENT.
* Selection-Screen *
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME.
SELECT-OPTIONS: S_VBELN FOR VBAK-VBELN.
PARAMETERS: P_VBTYP LIKE VBAK-VBTYP DEFAULT 'C'.
SELECTION-SCREEN END OF BLOCK B1.
SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME.
PARAMETERS: LIST RADIOBUTTON GROUP G1,
GRID RADIOBUTTON GROUP G1.
SELECTION-SCREEN END OF BLOCK B2.
* At Selection-Screen *
*VALIDATION
* Start of Selection *
START-OF-SELECTION.
*POPULATION OF DATA INTO INTERNAL TABLE ITAB
PERFORM GET_DATA.
*DEFINE USER DEFINED FIELDCATALOG
PERFORM DEFINE_FIELDCATALOG.
*SUBTOTALS AND TOTALS DISPLAY USING SORT
PERFORM SORT_LIST.
*CHANGE FCODE OF STATUS
PERFORM CHANGE_FCODE.
*CHECK RADIOBUTTON OPTION AND ACCORDINGLY FINAL DISPLAY
PERFORM CHECK_OPTION.
*& Form GET_DATA
* text
FORM GET_DATA.
SELECT VBELN
VBTYP
AUDAT
AUGRU
AUART
NETWR
WAERK FROM VBAK INTO TABLE IT_VBAK
WHERE VBELN IN S_VBELN AND VBTYP = P_VBTYP
AND ERDAT > '01.01.2004' AND NETWR > 0.
LOOP AT IT_VBAK.
IF IT_VBAK-NETWR < 10000.
IT_VBAK-ICON = '@08@'.
ELSEIF IT_VBAK-NETWR > 100000.
IT_VBAK-ICON = '@0A@'.
ELSE.
IT_VBAK-ICON = '@09@'.
ENDIF.
MODIFY IT_VBAK INDEX SY-TABIX.
ENDLOOP.
ENDFORM. "GET_DATA
*& Form CHECK_OPTION
* text
FORM CHECK_OPTION.
WA_EVENTS-NAME = 'TOP_OF_PAGE'.
WA_EVENTS-FORM = 'TOP'.
APPEND WA_EVENTS TO IT_EVENTS.
CLEAR WA_EVENTS.
WA_EVENTS-NAME = 'END_OF_LIST'.
WA_EVENTS-FORM = 'END_LIST'.
APPEND WA_EVENTS TO IT_EVENTS.
CLEAR WA_EVENTS.
IF LIST = 'X'.
PERFORM LIST_DISP.
ENDIF.
IF GRID = 'X'.
PERFORM GRID_DISP.
ENDIF.
ENDFORM. "CHECK_OPTION
*& Form DEFINE_FIELDCATALOG
* text
FORM DEFINE_FIELDCATALOG.
WA_FIELDCAT-COL_POS = 1.
WA_FIELDCAT-FIELDNAME = 'ICON'.
WA_FIELDCAT-SELTEXT_L = 'ICON'.
WA_FIELDCAT-ICON = 'X'.
WA_FIELDCAT-OUTPUTLEN = 8.
WA_FIELDCAT-TABNAME = 'IT_VBAK'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = 2.
WA_FIELDCAT-FIELDNAME = 'VBELN'.
WA_FIELDCAT-SELTEXT_L = 'SALES DOC NO.'.
WA_FIELDCAT-OUTPUTLEN = 10.
WA_FIELDCAT-TABNAME = 'IT_VBAK'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = 3.
WA_FIELDCAT-FIELDNAME = 'AUDAT'.
WA_FIELDCAT-SELTEXT_L = 'CREATED ON'.
WA_FIELDCAT-OUTPUTLEN = 10.
WA_FIELDCAT-TABNAME = 'IT_VBAK'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = 4.
WA_FIELDCAT-FIELDNAME = 'VBTYP'.
WA_FIELDCAT-SELTEXT_L = 'CATEGORY'.
WA_FIELDCAT-OUTPUTLEN = 1.
WA_FIELDCAT-TABNAME = 'IT_VBAK'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = 6.
WA_FIELDCAT-FIELDNAME = 'AUGRU'.
WA_FIELDCAT-SELTEXT_L = 'REASON'.
WA_FIELDCAT-OUTPUTLEN = 3.
WA_FIELDCAT-TABNAME = 'IT_VBAK'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = 5.
WA_FIELDCAT-FIELDNAME = 'AUART'.
WA_FIELDCAT-SELTEXT_L = 'DOC TYPE'.
WA_FIELDCAT-OUTPUTLEN = 4.
WA_FIELDCAT-TABNAME = 'IT_VBAK'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = 7.
WA_FIELDCAT-FIELDNAME = 'NETWR'.
WA_FIELDCAT-SELTEXT_L = 'NET VALUE'.
WA_FIELDCAT-OUTPUTLEN = 17.
WA_FIELDCAT-DECIMALS_OUT = 2.
* WA_FIELDCAT-DO_SUM = 'X'.
WA_FIELDCAT-TABNAME = 'IT_VBAK'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = 8.
WA_FIELDCAT-FIELDNAME = 'WAERK'.
WA_FIELDCAT-SELTEXT_L = 'UNIT'.
WA_FIELDCAT-OUTPUTLEN = 50.
WA_FIELDCAT-TABNAME = 'IT_VBAK'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
ENDFORM. "DEFINE_FIELDCATALOG
*& Form DEFINE_LAYOUT
* text
FORM DEFINE_LAYOUT.
LAYOUT-ZEBRA = 'X'.
LAYOUT-SUBTOTALS_TEXT = 'SUBTOTAL SUM'.
LAYOUT-WINDOW_TITLEBAR = 'EXERCISE 2'.
LAYOUT-TOTALS_TEXT = 'TOTAL'.
ENDFORM. "DEFINE_LAYOUT
*& Form SORT_LIST
* text
FORM SORT_LIST.
WA_SORT-FIELDNAME = 'VBELN'.
WA_SORT-TABNAME = 'IT_VBAK'.
WA_SORT-SPOS = 1.
WA_SORT-UP = 'X'.
WA_SORT-SUBTOT = 'X'.
APPEND WA_SORT TO IT_SORT.
CLEAR WA_SORT.
WA_SORT-FIELDNAME = 'NETWR'.
WA_SORT-TABNAME = 'IT_VBAK'.
WA_SORT-UP = 'X'.
WA_SORT-SPOS = 2.
WA_SORT-SUBTOT = 'X'.
APPEND WA_SORT TO IT_SORT.
CLEAR WA_SORT.
ENDFORM. "SORT_LIST
*& Form LIST_DISP
* text
FORM LIST_DISP.
PERFORM DEFINE_LAYOUT.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IT_FIELDCAT = IT_FIELDCAT
IS_LAYOUT = LAYOUT
IT_SORT = IT_SORT
I_CALLBACK_PF_STATUS_SET = 'STATUS'
IT_EXCLUDING = I_FCODE_EXTAB
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IT_EVENTS = IT_EVENTS[]
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = IT_VBAK
* 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_DISP
*& Form GRID_DISP
* text
FORM GRID_DISP.
PERFORM DEFINE_LAYOUT.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IS_LAYOUT = LAYOUT
IT_FIELDCAT = IT_FIELDCAT
IT_SORT = IT_SORT
I_CALLBACK_PF_STATUS_SET = 'STATUS'
IT_EXCLUDING = I_FCODE_EXTAB
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IT_EVENTS = IT_EVENTS[]
TABLES
T_OUTTAB = IT_VBAK.
* 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. "GRID_DISP
*& Form STATUS
* text
* -->P_EXTAB text
FORM STATUS USING P_EXTAB TYPE SLIS_T_EXTAB.
SET PF-STATUS 'STATUS' EXCLUDING P_EXTAB.
ENDFORM. "STATUS
*& Form USER_COMMAND
* text
* -->R_UCOMM text
* -->RS_SELFIELD text
FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
CASE R_UCOMM.
WHEN 'BACK' OR 'CANC' OR 'EXIT'.
LEAVE TO SCREEN 0.
WHEN '&IC1'.
SET PARAMETER ID 'AUN' FIELD RS_SELFIELD-VALUE.
CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
ENDCASE.
ENDFORM. "USER_COMMAND
*& Form CHANGE_FCODE
* text
FORM CHANGE_FCODE.
WA_FCODE = 'PRNT'.
APPEND WA_FCODE TO I_FCODE_EXTAB.
WA_FCODE = '&OAD'.
APPEND WA_FCODE TO I_FCODE_EXTAB.
WA_FCODE = '&AVE'.
APPEND WA_FCODE TO I_FCODE_EXTAB.
WA_FCODE = '&EB9'.
APPEND WA_FCODE TO I_FCODE_EXTAB.
WA_FCODE = '&SUM'.
APPEND WA_FCODE TO I_FCODE_EXTAB.
WA_FCODE = '&UMC'.
APPEND WA_FCODE TO I_FCODE_EXTAB.
WA_FCODE = '&XPA'.
APPEND WA_FCODE TO I_FCODE_EXTAB.
WA_FCODE = '&OMP'.
APPEND WA_FCODE TO I_FCODE_EXTAB.
ENDFORM. "CHANGE_FCODE
*& Form TOP
* text
FORM TOP.
IF LIST = 'X'.
WRITE:/ SY-ULINE.
WRITE:/ 'DATE:', SY-DATUM,55 'INTELLIGROUP ASIA PVT LTD'.
WRITE:/ 'TIME:', SY-UZEIT.
WRITE:/ 'USER NAME:', SY-UNAME,60 SY-TITLE.
WRITE:/ 'PAGE', SY-PAGNO.
WRITE:/ SY-ULINE.
ENDIF.
IF GRID = 'X'.
DATA: LS_LINE TYPE SLIS_LISTHEADER,
E04_LT_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER.
* Listenüberschrift: Typ H
CLEAR LS_LINE.
LS_LINE-TYP = 'H'.
* LS_LINE-KEY: not used for this type
LS_LINE-INFO = 'Summary'.
APPEND LS_LINE TO E04_LT_TOP_OF_PAGE.
* Kopfinfo: Typ S
CLEAR LS_LINE.
LS_LINE-TYP = 'S'.
LS_LINE-KEY = 'Intelligroup'.
LS_LINE-INFO = ''.
APPEND LS_LINE TO E04_LT_TOP_OF_PAGE.
LS_LINE-KEY = 'ASIA'.
LS_LINE-INFO = 'PVT LTD'.
APPEND LS_LINE TO E04_LT_TOP_OF_PAGE.
* Aktionsinfo: Typ A
CLEAR LS_LINE.
LS_LINE-TYP = 'A'.
* LS_LINE-KEY: not used for this type
LS_LINE-INFO = 'truman'.
APPEND LS_LINE TO E04_LT_TOP_OF_PAGE.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = E04_LT_TOP_OF_PAGE
I_LOGO = 'ENJOY_SAP_LOGO'.
ENDIF.
ENDFORM. "TOP
*& Form END_LIST
* text
FORM END_LIST.
IF LIST = 'X'.
SKIP 2.
WRITE:/60 'END OF PAGE'.
ENDIF.
IF GRID = 'X'.
DATA: LS_LINE TYPE SLIS_LISTHEADER,
E04_LT_END_OF_LIST TYPE SLIS_T_LISTHEADER.
* Listenüberschrift: Typ H
CLEAR LS_LINE.
LS_LINE-TYP = 'H'.
* LS_LINE-KEY: not used for this type
LS_LINE-INFO = 'Summary'.
APPEND LS_LINE TO E04_LT_END_OF_LIST.
* Kopfinfo: Typ S
CLEAR LS_LINE.
LS_LINE-TYP = 'S'.
LS_LINE-KEY = 'Intelligroup'.
LS_LINE-INFO = ''.
APPEND LS_LINE TO E04_LT_END_OF_LIST.
LS_LINE-KEY = 'ASIA'.
LS_LINE-INFO = 'PVT LTD'.
APPEND LS_LINE TO E04_LT_END_OF_LIST.
* Aktionsinfo: Typ A
CLEAR LS_LINE.
LS_LINE-TYP = 'A'.
* LS_LINE-KEY: not used for this type
LS_LINE-INFO = TEXT-105.
APPEND LS_LINE TO E04_LT_END_OF_LIST.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = E04_LT_END_OF_LIST.
ENDIF.
ENDFORM. "END_LIST -
Double click on field in ALV Report
hi everyone
i have written a program which displays data in an alv grid report, now i need to extend my program a bit more.
when i double click on any field value the corresponding record should be displayed
can anyone suggest if i need to call any fn module for this, if so wht's the fn module
if anyone can give an example that would be fine
Cheers,
ramaHi,
*& Report Z_REPORTFROMKNA1ANDT005T
REPORT Z_REPORTFROMKNA1ANDT005T
LINE-SIZE 180
MESSAGE-ID ZZ.
TABLES:EKKO.
TYPE-POOLS : SLIS.
Internal table for ALV
DATA : IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV, "Field catalog
WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV, "WA for Field catalog
IT_EVENT TYPE SLIS_T_EVENT, "events
WA_EVENT TYPE SLIS_ALV_EVENT, "WA for events
IT_COMMENT TYPE SLIS_T_LISTHEADER, "Header details
WA_COMMENT TYPE SLIS_LISTHEADER, "WA for header details
WA_LAYOUT TYPE SLIS_LAYOUT_ALV, "Layout
IT_SORT TYPE SLIS_T_SORTINFO_ALV, "Sort table
WA_SORT TYPE SLIS_SORTINFO_ALV, "WA for sort table
IT_KEYINFO TYPE SLIS_KEYINFO_ALV. "Pass key value
DATA : V_REPID LIKE SY-REPID.
V_REPID = SY-REPID.
DATA : V_DATE LIKE SY-DATUM.
color management.
DATA : IT_COLOR TYPE TABLE OF LVC_S_SCOL. "Color management.
Internal table declearation
DATA:BEGIN OF IT_EKKO OCCURS 0,
EBELN LIKE EKKO-EBELN,
BUKRS LIKE EKKO-BUKRS,
AEDAT LIKE EKKO-AEDAT,
END OF IT_EKKO.
DATA : BEGIN OF IT_EKPO OCCURS 0,
EBELN LIKE EKPO-EBELN,
EBELP LIKE EKPO-EBELP,
MATNR LIKE EKPO-MATNR,
MENGE LIKE EKPO-MENGE,
MEINS LIKE EKPO-MEINS,
NETPR LIKE EKPO-NETPR,
NETWR LIKE EKPO-MENGE,
chk(1) type c,
END OF IT_EKPO.
DATA : BEGIN OF IT_EKBE OCCURS 0,
EBELN LIKE EKBE-EBELN,
EBELP LIKE EKBE-EBELP,
BELNR LIKE EKBE-BELNR,
MENGE LIKE EKBE-MENGE,
MATNR LIKE EKBE-MATNR,
END OF IT_EKBE.
DATA : BEGIN OF IT_FINAL OCCURS 0,
EBELN LIKE EKPO-EBELN,
EBELP LIKE EKPO-EBELP,
MATNR LIKE EKPO-MATNR,
MENGE LIKE EKPO-MENGE,
MEINS LIKE EKPO-MEINS,
NETPR LIKE EKPO-NETPR,
NETWR LIKE EKPO-NETWR,
LINE_COLOR(4) TYPE C, "Used to store row color attributes
END OF IT_FINAL.
SELECTION-SCREEN BEGIN OF BLOCK BLK WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS:S_EBELN FOR EKKO-EBELN.
PARAMETERS : RB1 RADIOBUTTON GROUP G1 MODIF ID Z1,
RB2 RADIOBUTTON GROUP G1 MODIF ID Z2,
RB3 RADIOBUTTON GROUP G1 MODIF ID Z3.
SELECTION-SCREEN END OF BLOCK BLK.
AT SELECTION-SCREEN OUTPUT.
PERFORM MODIFY_SCREEN.
START-OF-SELECTION.
PERFORM GET_DETAILS.
PERFORM GET_ALV.
*& Form modify_screen
text
--> p1 text
<-- p2 text
FORM MODIFY_SCREEN .
IF RB1 = 'X'.
LOOP AT SCREEN.
IF SCREEN-GROUP1 = 'Z1' .
SCREEN-INVISIBLE = 1.
SCREEN-ACTIVE = 0.
ELSE.
SCREEN-INVISIBLE = 0.
SCREEN-ACTIVE = 1.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
ENDIF.
ENDFORM. " modify_screen
*& Form GET_DETAILS
Get the details
FORM GET_DETAILS .
DATA: LD_COLOR(1) TYPE C.
SELECT EBELN
BUKRS
AEDAT
FROM EKKO
INTO TABLE IT_EKKO
WHERE EBELN IN S_EBELN.
IF SY-SUBRC = 0.
SORT IT_EKKO BY EBELN.
ELSE.
MESSAGE E000 WITH 'DATA NOT FOUND'.
ENDIF.
IF NOT IT_EKKO[] IS INITIAL.
SELECT EBELN
EBELP
MATNR
MENGE
MEINS
NETPR
NETWR
chk
FROM EKPO
INTO TABLE IT_EKPO
FOR ALL ENTRIES IN IT_EKKO
WHERE EBELN = IT_EKKO-EBELN.
IF SY-SUBRC = 0.
SORT IT_EKPO BY EBELN.
ENDIF.
ENDIF.
LOOP AT IT_EKPO.
IT_FINAL-EBELN = IT_EKPO-EBELN.
IT_FINAL-EBELP = IT_EKPO-EBELP.
IT_FINAL-MATNR = IT_EKPO-MATNR.
IT_FINAL-MENGE = IT_EKPO-MENGE.
IT_FINAL-MEINS = IT_EKPO-MEINS.
IT_FINAL-NETPR = IT_EKPO-NETPR.
IT_FINAL-NETWR = IT_EKPO-NETWR.
ON CHANGE OF IT_FINAL-EBELN.
LD_COLOR = 7.
CONCATENATE 'C' LD_COLOR '10' INTO IT_FINAL-LINE_COLOR.
ENDON.
APPEND IT_FINAL.
CLEAR IT_FINAL.
ENDLOOP.
ENDFORM. " GET_DETAILS
*& Form GET_ALV
text
FORM GET_ALV .
PERFORM GENERATE_FIELDCAT.
PERFORM GENERATE_LAYOUT.
PERFORM GENERATE_EVENTS.
PERFORM GENERATE_SORT.
PERFORM ALV_GRID_DISPLAY.
ENDFORM. " GET_ALV
*& Form GENERATE_FIELDCAT
Field catalog
FORM GENERATE_FIELDCAT .
IF RB1 = 'X' OR RB2 = 'X'.
WA_FIELDCAT-FIELDNAME = 'EBELN'.
WA_FIELDCAT-COL_POS = '1'.
WA_FIELDCAT-JUST = 'R'.
WA_FIELDCAT-SELTEXT_L = 'PO Number'.
WA_FIELDCAT-LOWERCASE = 'X'.
WA_FIELDCAT-DO_SUM = 'X'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'EBELP'.
WA_FIELDCAT-COL_POS = '2'.
WA_FIELDCAT-JUST = 'C'.
WA_FIELDCAT-SELTEXT_L = 'Item Number'.
WA_FIELDCAT-LOWERCASE = 'X'.
WA_FIELDCAT-edit = 'X'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'MATNR'.
WA_FIELDCAT-COL_POS = '3'.
WA_FIELDCAT-JUST = 'C'.
WA_FIELDCAT-SELTEXT_L = 'Material Number'.
WA_FIELDCAT-LOWERCASE = 'X'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'MENGE'.
WA_FIELDCAT-COL_POS = '4'.
WA_FIELDCAT-JUST = 'C'.
WA_FIELDCAT-SELTEXT_L = 'PO Quantity'.
WA_FIELDCAT-LOWERCASE = 'X'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'MEINS'.
WA_FIELDCAT-COL_POS = '5'.
WA_FIELDCAT-JUST = 'C'.
WA_FIELDCAT-SELTEXT_L = 'Order unit'.
WA_FIELDCAT-LOWERCASE = 'X'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'NETPR'.
WA_FIELDCAT-COL_POS = '6'.
WA_FIELDCAT-JUST = 'C'.
WA_FIELDCAT-SELTEXT_L = 'Net price'.
WA_FIELDCAT-LOWERCASE = 'X'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'NETWR'.
WA_FIELDCAT-COL_POS = '7'.
WA_FIELDCAT-JUST = 'C'.
WA_FIELDCAT-SELTEXT_L = 'Net order value'.
WA_FIELDCAT-LOWERCASE = 'X'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
wa_fieldcat-fieldname = 'CHK'.
wa_fieldcat-col_pos = '8'.
wa_fieldcat-just = 'C'.
wa_fieldcat-seltext_l = 'Check Box'.
wa_fieldcat-lowercase = 'X'.
wa_fieldcat-checkbox = 'X'.
wa_fieldcat-edit = 'X'.
append wa_fieldcat to it_fieldcat.
ELSE.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = V_REPID
I_INTERNAL_TABNAME = 'IT_EKKO'
I_STRUCTURE_NAME = I_STRUCTURE_NAME
I_CLIENT_NEVER_DISPLAY = 'X'
I_INCLNAME = V_REPID
I_BYPASSING_BUFFER = I_BYPASSING_BUFFER
I_BUFFER_ACTIVE = I_BUFFER_ACTIVE
CHANGING
CT_FIELDCAT = IT_FIELDCAT
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.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = V_REPID
I_INTERNAL_TABNAME = 'IT_EKPO'
I_STRUCTURE_NAME = I_STRUCTURE_NAME
I_CLIENT_NEVER_DISPLAY = 'X'
I_INCLNAME = V_REPID
I_BYPASSING_BUFFER = I_BYPASSING_BUFFER
I_BUFFER_ACTIVE = I_BUFFER_ACTIVE
CHANGING
CT_FIELDCAT = IT_FIELDCAT
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.
ENDIF.
ENDFORM. " GENERATE_FIELDCAT
*& Form GENERATE_EVENTS
Generate Events
FORM GENERATE_EVENTS .
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
IMPORTING
ET_EVENTS = IT_EVENT
EXCEPTIONS
LIST_TYPE_WRONG = 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 NOT IT_EVENT[] IS INITIAL.
READ TABLE IT_EVENT INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.
IF SY-SUBRC = 0.
WA_EVENT-FORM = 'TOP_OF_PAGE'.
MODIFY IT_EVENT FROM WA_EVENT INDEX SY-TABIX.
ENDIF.
<b> READ TABLE IT_EVENT INTO WA_EVENT WITH KEY NAME = 'USER_COMMAND'.
IF SY-SUBRC = 0.
WA_EVENT-FORM = 'IT_USER_COMMAND'.
MODIFY IT_EVENT FROM WA_EVENT INDEX SY-TABIX.
ENDIF.</b>
ENDIF.
ENDFORM. " GENERATE_EVENTS
*& Form TOP_OF_PAGE
TOP_OF_PAGE
FORM TOP_OF_PAGE.
DATA : V_CONCATE(50) TYPE C.
DATA : V_SPACE(10) TYPE C.
CONCATENATE 'VIKRANTH' 'RAJESH' INTO V_CONCATE.
WA_COMMENT-TYP = 'S'.
WA_COMMENT-KEY = 'USER :'.
WA_COMMENT-INFO = V_CONCATE.
APPEND WA_COMMENT TO IT_COMMENT.
WA_COMMENT-TYP = 'S'.
WA_COMMENT-KEY = 'DATE:'.
WA_COMMENT-INFO = SY-DATUM.
APPEND WA_COMMENT TO IT_COMMENT.
WA_COMMENT-TYP = 'S'.
WA_COMMENT-KEY = 'TIME:'.
WA_COMMENT-INFO = SY-TIMLO.
APPEND WA_COMMENT TO IT_COMMENT.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = IT_COMMENT.
CLEAR IT_COMMENT.
ENDFORM. "TOP_OF_PAGE
*& Form ALV_GRID_DISPLAY
Grid display
FORM ALV_GRID_DISPLAY .
IF RB1 = 'X'.
PERFORM GRID_DISPLAY.
ELSEIF RB2 = 'X'.
PERFORM LIST_DISPLAY.
ELSE.
PERFORM HIERSEQ_DISPLAY.
ENDIF.
ENDFORM. " ALV_GRID_DISPLAY
*& Form GENERATE_LAYOUT
LAYOUT
FORM GENERATE_LAYOUT .
WA_LAYOUT-COLWIDTH_OPTIMIZE = 'X'. "OPTIMIZING FIELD WIDTH
WA_LAYOUT-ZEBRA = 'X'. "PUTTING ZEBRA COLORS
WA_LAYOUT-TOTALS_TEXT = 'Total'.
WA_LAYOUT-SUBTOTALS_TEXT = 'SUB TOTAL'.
WA_LAYOUT-INFO_FIELDNAME = 'LINE_COLOR'.
ENDFORM. " GENERATE_LAYOUT
*& Form GENERATE_SORT
SORT
FORM GENERATE_SORT .
WA_SORT-FIELDNAME = 'EBELN'.
WA_SORT-SPOS = '1'.
WA_SORT-UP = 'X'.
WA_SORT-SUBTOT = 'X'.
APPEND WA_SORT TO IT_SORT.
ENDFORM. " GENERATE_SORT
*& Form GRID_DISPLAY
GRID DISPLAY
FORM GRID_DISPLAY .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = V_REPID
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = 'IT_USER_COMMAND'
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE = 'Purchase Order Details'
I_GRID_SETTINGS = I_GRID_SETTINGS
IS_LAYOUT = WA_LAYOUT
IT_FIELDCAT = IT_FIELDCAT
IT_EXCLUDING = IT_EXCLUDING
IT_SPECIAL_GROUPS = IT_SPECIAL_GROUPS
IT_SORT = IT_SORT
IT_FILTER = IT_FILTER
IS_SEL_HIDE = IS_SEL_HIDE
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT = IS_VARIANT
IT_EVENTS = IT_EVENT
IT_EVENT_EXIT = IT_EVENT_EXIT
IS_PRINT = IS_PRINT
IS_REPREP_ID = IS_REPREP_ID
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS = IT_ALV_GRAPHICS
IT_HYPERLINK = IT_HYPERLINK
IT_ADD_FIELDCAT = IT_ADD_FIELDCAT
IT_EXCEPT_QINFO = IT_EXCEPT_QINFO
IR_SALV_FULLSCREEN_ADAPTER = IR_SALV_FULLSCREEN_ADAPTER
IMPORTING
E_EXIT_CAUSED_BY_CALLER = E_EXIT_CAUSED_BY_CALLER
ES_EXIT_CAUSED_BY_USER = ES_EXIT_CAUSED_BY_USER
TABLES
T_OUTTAB = IT_FINAL
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. " GRID_DISPLAY
*& Form LIST_DISPLAY
LIST DISPLAY
FORM LIST_DISPLAY .
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = I_BYPASSING_BUFFER
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = V_REPID
I_CALLBACK_PF_STATUS_SET = ' '
<b> I_CALLBACK_USER_COMMAND = 'IT_USER_COMMAND'</b>
I_STRUCTURE_NAME = I_STRUCTURE_NAME
IS_LAYOUT = WA_LAYOUT
IT_FIELDCAT = IT_FIELDCAT
IT_EXCLUDING = IT_EXCLUDING
IT_SPECIAL_GROUPS = IT_SPECIAL_GROUPS
IT_SORT = IT_SORT
IT_FILTER = IT_FILTER
IS_SEL_HIDE = IS_SEL_HIDE
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT = IS_VARIANT
IT_EVENTS = IT_EVENT
IT_EVENT_EXIT = IT_EVENT_EXIT
IS_PRINT = IS_PRINT
IS_REPREP_ID = IS_REPREP_ID
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IR_SALV_LIST_ADAPTER = IR_SALV_LIST_ADAPTER
IT_EXCEPT_QINFO = IT_EXCEPT_QINFO
I_SUPPRESS_EMPTY_DATA = ABAP_FALSE
IMPORTING
E_EXIT_CAUSED_BY_CALLER = E_EXIT_CAUSED_BY_CALLER
ES_EXIT_CAUSED_BY_USER = ES_EXIT_CAUSED_BY_USER
TABLES
T_OUTTAB = IT_FINAL
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 HIERSEQ_DISPLAY
HIERSEQ DISPLAY
FORM HIERSEQ_DISPLAY .
IT_KEYINFO-HEADER01 = 'EBELN'.
IT_KEYINFO-ITEM01 = 'EBELN'.
CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_CALLBACK_PROGRAM = V_REPID
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
IS_LAYOUT = WA_LAYOUT
IT_FIELDCAT = IT_FIELDCAT
IT_EXCLUDING = IT_EXCLUDING
IT_SPECIAL_GROUPS = IT_SPECIAL_GROUPS
IT_SORT = IT_SORT
IT_FILTER = IT_FILTER
IS_SEL_HIDE = 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 = IS_VARIANT
IT_EVENTS = IT_EVENT
IT_EVENT_EXIT = IT_EVENT_EXIT
I_TABNAME_HEADER = 'IT_EKKO'
I_TABNAME_ITEM = 'IT_EKPO'
I_STRUCTURE_NAME_HEADER = I_STRUCTURE_NAME_HEADER
I_STRUCTURE_NAME_ITEM = I_STRUCTURE_NAME_ITEM
IS_KEYINFO = IT_KEYINFO
IS_PRINT = IS_PRINT
IS_REPREP_ID = IS_REPREP_ID
I_BYPASSING_BUFFER = I_BYPASSING_BUFFER
I_BUFFER_ACTIVE = I_BUFFER_ACTIVE
IR_SALV_HIERSEQ_ADAPTER = IR_SALV_HIERSEQ_ADAPTER
IT_EXCEPT_QINFO = IT_EXCEPT_QINFO
I_SUPPRESS_EMPTY_DATA = ABAP_FALSE
IMPORTING
E_EXIT_CAUSED_BY_CALLER = E_EXIT_CAUSED_BY_CALLER
ES_EXIT_CAUSED_BY_USER = ES_EXIT_CAUSED_BY_USER
TABLES
T_OUTTAB_HEADER = IT_EKKO
T_OUTTAB_ITEM = IT_EKPO
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. " HIERSEQ_DISPLAY
<b>
*& Form IT_USER_COMMAND
text
FORM IT_USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
FREE IT_FIELDCAT.
CASE R_UCOMM.
WHEN '&IC1'.
READ TABLE IT_FINAL INDEX RS_SELFIELD-TABINDEX.
PERFORM GET_EKBE.
PERFORM GET_FIELD_CATALOG.
PERFORM GET_LIST.
ENDCASE.
ENDFORM. "IT_USER_COMMAND</b>
*& Form GET_EKBE
text
FORM GET_EKBE .
IF NOT IT_FINAL[] IS INITIAL.
SELECT EBELN
EBELP
BELNR
MENGE
MATNR
INTO TABLE IT_EKBE
FROM EKBE
FOR ALL ENTRIES IN IT_FINAL
WHERE EBELN = IT_FINAL-EBELN
AND EBELP = IT_FINAL-EBELP.
ENDIF.
ENDFORM. " GET_EKBE
*& Form GET_FIELD_CATALOG
text
FORM GET_FIELD_CATALOG .
WA_FIELDCAT-FIELDNAME = 'EBELN'.
WA_FIELDCAT-COL_POS = '1'.
WA_FIELDCAT-JUST = 'R'.
WA_FIELDCAT-SELTEXT_L = 'PO Number'.
WA_FIELDCAT-LOWERCASE = 'X'.
WA_FIELDCAT-DO_SUM = 'X'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'EBELP'.
WA_FIELDCAT-COL_POS = '2'.
WA_FIELDCAT-JUST = 'R'.
WA_FIELDCAT-SELTEXT_L = 'Item Number'.
WA_FIELDCAT-LOWERCASE = 'X'.
WA_FIELDCAT-DO_SUM = 'X'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'BELNR'.
WA_FIELDCAT-COL_POS = '3'.
WA_FIELDCAT-JUST = 'R'.
WA_FIELDCAT-SELTEXT_L = 'Material Document'.
WA_FIELDCAT-LOWERCASE = 'X'.
WA_FIELDCAT-DO_SUM = 'X'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'MENGE'.
WA_FIELDCAT-COL_POS = '4'.
WA_FIELDCAT-JUST = 'R'.
WA_FIELDCAT-SELTEXT_L = 'Quantity'.
WA_FIELDCAT-LOWERCASE = 'X'.
WA_FIELDCAT-DO_SUM = 'X'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'MATNR'.
WA_FIELDCAT-COL_POS = '5'.
WA_FIELDCAT-JUST = 'R'.
WA_FIELDCAT-SELTEXT_L = 'Material Number'.
WA_FIELDCAT-LOWERCASE = 'X'.
WA_FIELDCAT-DO_SUM = 'X'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
ENDFORM. " GET_FIELD_CATALOG
*& Form get_list
text
FORM GET_LIST .
IF RB1 = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = V_REPID
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME = I_STRUCTURE_NAME
I_BACKGROUND_ID = ' '
I_GRID_TITLE = 'SECONDARY LIST'
I_GRID_SETTINGS = I_GRID_SETTINGS
IS_LAYOUT = IS_LAYOUT
IT_FIELDCAT = IT_FIELDCAT
IT_EXCLUDING = IT_EXCLUDING
IT_SPECIAL_GROUPS = IT_SPECIAL_GROUPS
IT_SORT = IT_SORT
IT_FILTER = IT_FILTER
IS_SEL_HIDE = IS_SEL_HIDE
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT = IS_VARIANT
IT_EVENTS = IT_EVENTS
IT_EVENT_EXIT = IT_EVENT_EXIT
IS_PRINT = IS_PRINT
IS_REPREP_ID = IS_REPREP_ID
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS = IT_ALV_GRAPHICS
IT_HYPERLINK = IT_HYPERLINK
IT_ADD_FIELDCAT = IT_ADD_FIELDCAT
IT_EXCEPT_QINFO = IT_EXCEPT_QINFO
IR_SALV_FULLSCREEN_ADAPTER = IR_SALV_FULLSCREEN_ADAPTER
IMPORTING
E_EXIT_CAUSED_BY_CALLER = E_EXIT_CAUSED_BY_CALLER
ES_EXIT_CAUSED_BY_USER = ES_EXIT_CAUSED_BY_USER
TABLES
T_OUTTAB = IT_EKBE
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.
ENDIF.
IF RB2 = 'X'.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = I_BYPASSING_BUFFER
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = V_REPID
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_STRUCTURE_NAME = I_STRUCTURE_NAME
IS_LAYOUT = IS_LAYOUT
IT_FIELDCAT = IT_FIELDCAT
IT_EXCLUDING = IT_EXCLUDING
IT_SPECIAL_GROUPS = IT_SPECIAL_GROUPS
IT_SORT = IT_SORT
IT_FILTER = IT_FILTER
IS_SEL_HIDE = IS_SEL_HIDE
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT = IS_VARIANT
IT_EVENTS = IT_EVENTS
IT_EVENT_EXIT = IT_EVENT_EXIT
IS_PRINT = IS_PRINT
IS_REPREP_ID = IS_REPREP_ID
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IR_SALV_LIST_ADAPTER = IR_SALV_LIST_ADAPTER
IT_EXCEPT_QINFO = IT_EXCEPT_QINFO
I_SUPPRESS_EMPTY_DATA = ABAP_FALSE
IMPORTING
E_EXIT_CAUSED_BY_CALLER = E_EXIT_CAUSED_BY_CALLER
ES_EXIT_CAUSED_BY_USER = ES_EXIT_CAUSED_BY_USER
TABLES
T_OUTTAB = IT_EKBE
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.
ENDIF.
ENDFORM. " get_list
Thanks
Vikranth Khimavath
Message was edited by:
Khimavath Vikranth -
Hi,
i need to add coloums for the existing report which picks from G/L account.
in this report I need to add some more columns from COSP-KSTAR, which shows the cost element details from G/L account.
I need to restrict that cost element number according to the company code.
Plz see this and let me know the things.
1. I need to add FISCAL YEAR(COEP-GJAHR) in selection screen.
2. I need to add column: Employee Cost (CSKS-KOSTL)
3. add a column Staff Welfare (COSP-KSTAR) this is to restrict for the cost element 3000200 from G/L account
4. add a column Recruitment restrict for the cost element(COSP-KSTAR) 3100040 from G/L account
5. add a column Travels (suppressing some cost elements(COSP-KSTAR) and putting into Travels)
6. add a column Subcontracts restrict for the cost element (COSP-KSTAR)3100360 from G/L account
7. add a column Communication suppressing some cost elements and putting into Communication)
8. add a column Rent restrict for the cost element (COSP-KSTAR)3100055 from G/L account
9. add a column Back end Cost restrict for the cost element (COSP-KSTAR)3100065 from G/L account
i can hardcode these cost elements.
i did according to some of our sdn friends guidence but it is going to dump.
hear i am sending the code what i changed.
it is giving the error with the select.
SELECT BUKRS KOKRS gjahr kstar OBJNR OBJNR_N1 PERIO BEKNZ WKGBTR WOGBTR FROM
COEP INTO TABLE
IT_COEP FOR ALL ENTRIES IN IT_AUFK WHERE OBJNR = IT_AUFK-OBJNR and
perio in S_PERIO.
plz try to help me out in this issue.
hear i am sending the complete code what i worte.
*& Report ZPROJECT_PROFIT2
REPORT ZPROJECT_PROFIT2.
*********************MAIN DOCUMENTATION BLOCK*************************
Project Code :
Program Name :Zproject_profit1.
Purpose of program :This report will give the gross margin for a project as
*a whole based on some selected input criteria.
Author of program :JAYA KRISHNA .B.
INPUT/OUTPUT FILE :nil
TYPE-POOLS : SLIS."For ALV display.
TABLES : COEP, "CO Object: Line Items (by period).
AUFK, "Order master data.
csks, "Cost center master data
cosp. "CO Objects
*& Include ZSTRUCTURE
types: BEGIN OF TY_COEP , "structure of table COEP.
BUKRS LIKE COEP-BUKRS,
KOKRS LIKE COEP-KOKRS,
OBJNR LIKE COEP-OBJNR,
gjahr like coep-gjahr,
kstar like coep-kstar,
OBJNR_N1 LIKE COEP-OBJNR_N1,
PERIO LIKE COEP-PERIO,
BEKNZ LIKE COEP-BEKNZ,
WKGBTR LIKE COEP-WKGBTR,
WOGBTR LIKE COEP-WOGBTR,
BELNR LIKE COEP-BELNR,
END OF TY_COEP,
BEGIN OF TY_AUFK , "structure of table AUFK.
BUKRS LIKE AUFK-BUKRS,
KOKRS LIKE AUFK-KOKRS,
OBJNR LIKE AUFK-OBJNR,
KTEXT LIKE AUFK-KTEXT,
ANFAUFNR LIKE AUFK-ANFAUFNR,
AUFEX LIKE AUFK-AUFEX,
USER2 LIKE AUFK-USER2,
USER0 LIKE AUFK-USER0,
USER1 LIKE AUFK-USER1,
USER3 LIKE AUFK-USER3,
USER6 LIKE AUFK-USER6,
USER7 LIKE AUFK-USER7,
USER8 LIKE AUFK-USER8,
ABKRS(10) TYPE C,
USER9 LIKE AUFK-USER9,
AUFNR LIKE AUFK-AUFNR,
END OF TY_AUFK,
begin of ty_csks,
kokrs like csks-kokrs,
kostl like csks-kostl,
bukrs like csks-bukrs,
objnr like csks-objnr,
end of ty_csks.
DATA : BEGIN OF IT_COSP occurs 100,
OBJNR LIKE COSP-OBJNR,
GJAHR LIKE COSP-GJAHR,
KSTAR LIKE COSP-KSTAR,
END OF IT_COSP.
DATA : IT_COEP TYPE TABLE OF TY_COEP, " Declaraton of tables COEP and AUFK.
IT_AUFK TYPE TABLE OF TY_AUFK,
IT_CSKS TYPE TABLE OF TY_CSKS.
IT_COSP TYPE TABLE OF TY_COSP.
DATA : WA_COEP LIKE LINE OF IT_COEP, " Declaration of work areas for tables COEP and AUFK.
WA_AUFK LIKE LINE OF IT_AUFK,
WA_CSKS LIKE LINE OF IT_CSKS.
WA_COSP LIKE LINE OF IT_COSP.
DATA : BEGIN OF IT_DISPLAY OCCURS 0, " Declaration of display table.
OBJNR_N1 LIKE COEP-OBJNR_N1,
OBJNR_N12 LIKE COEP-OBJNR_N1,
KTEXT1 LIKE AUFK-KTEXT,
WKGBTR LIKE COEP-WKGBTR,
WOGBTR LIKE COEP-WOGBTR,
WKGBTR1 LIKE COEP-WTGBTR,
WOGBTR1 LIKE COEP-WOGBTR,
ADDK LIKE COEP-WOGBTR,
ADDO LIKE COEP-WOGBTR,
ADDK1 LIKE COEP-WOGBTR,
ADDO1 LIKE COEP-WOGBTR,
PROFIT1 LIKE COEP-WOGBTR,
PROFIT2 LIKE COEP-WOGBTR,
BEKNZ LIKE COEP-BEKNZ,
BUKRS LIKE AUFK-BUKRS,
anfaufnr LIKE AUFK-anfaufnr,
aufex like aufk-aufex,
OBJNR LIKE AUFK-OBJNR,
USER2 LIKE AUFK-USER2,
USER0 LIKE AUFK-USER0,
USER1 LIKE AUFK-USER1,
USER3 LIKE AUFK-USER3,
USER6 LIKE AUFK-USER6,
USER7 LIKE AUFK-USER7,
USER8 LIKE AUFK-USER8,
ABKRS LIKE AUFK-ABKRS,
USER9 LIKE AUFK-USER9,
PERIO LIKE COEP-PERIO,
AUFNR LIKE AUFK-AUFNR,
STR(5) TYPE C,
WORK(10) TYPE C,
END OF IT_DISPLAY,
: BEGIN OF IT_DISPLAY1 OCCURS 0, " Declaration of second display table.
OBJNR_N1 LIKE COEP-OBJNR_N1,
OBJNR_N12 LIKE COEP-OBJNR_N1,
KTEXT1 LIKE AUFK-KTEXT,
WKGBTR LIKE COEP-WKGBTR,
WOGBTR LIKE COEP-WOGBTR,
WKGBTR1 LIKE COEP-WTGBTR,
WOGBTR1 LIKE COEP-WOGBTR,
ADDK LIKE COEP-WOGBTR,
ADDO LIKE COEP-WOGBTR,
ADDK1 LIKE COEP-WOGBTR,
ADDO1 LIKE COEP-WOGBTR,
PROFIT1 LIKE COEP-WOGBTR,
PROFIT2 LIKE COEP-WOGBTR,
BEKNZ LIKE COEP-BEKNZ,
BUKRS LIKE AUFK-BUKRS,
anfaufnr like aufk-anfaufnr,
aufex like aufk-aufex,
OBJNR LIKE AUFK-OBJNR,
USER2 LIKE AUFK-USER2,
USER0 LIKE AUFK-USER0,
USER1 LIKE AUFK-USER1,
USER3 LIKE AUFK-USER3,
USER6 LIKE AUFK-USER6,
USER7 LIKE AUFK-USER7,
USER8 LIKE AUFK-USER8,
ABKRS LIKE AUFK-ABKRS,
USER9 LIKE AUFK-USER9,
PERIO LIKE COEP-PERIO,
AUFNR LIKE AUFK-AUFNR,
STR(5) TYPE C,
WORK(10) TYPE C,
END OF IT_DISPLAY1.
data : it_field type slis_fieldcat_alv, " Declaration of ALV variables
it_field_t type slis_t_fieldcat_alv,
xlayout TYPE slis_layout_alv.
data : it_event type slis_t_event,
wa_event like line of it_event.
DATA : WA_TOP TYPE SLIS_LISTHEADER,
IT_TOP TYPE SLIS_T_LISTHEADER.
data:w_lines type i,
w_occurs type i,
STR(5) TYPE C,
WORK(10) TYPE C.
constants : c_selection type char20 value 'Selection based on'. " Declaration of a constant.
selection-screen BEGIN OF BLOCK BLK WITH FRAME TITLE TEXT-000.
SELECT-OPTIONS S_BUKRS FOR AUFK-BUKRS OBLIGATORY.
SELECT-OPTIONS S_OBJNR FOR AUFK-AUFNR.
SELECT-OPTIONS S_ANF FOR AUFK-ANFAUFNR.
SELECT-OPTIONS S_AUFEX FOR AUFK-AUFEX.
SELECT-OPTIONS S_USER2 FOR AUFK-USER2.
SELECT-OPTIONS S_USER0 FOR AUFK-USER0.
SELECT-OPTIONS S_USER1 FOR AUFK-USER1.
SELECT-OPTIONS S_USER3 FOR AUFK-USER3.
SELECT-OPTIONS S_USER6 FOR AUFK-USER6.
SELECT-OPTIONS S_ABKRS FOR AUFK-ABKRS.
SELECT-options s_gjahr for coep-gjahr obligatory.
SELECT-OPTIONS S_PERIO FOR COEP-PERIO OBLIGATORY.
SELECTION-SCREEN END OF BLOCK BLK .
SELECTION-SCREEN BEGIN OF BLOCK BLK1 WITH FRAME TITLE TEXT-001.
PARAMETERS : ONSITE RADIOBUTTON GROUP RADI.
PARAMETERS : OFFSHORE RADIOBUTTON GROUP RADI.
PARAMETERS : BOTH RADIOBUTTON GROUP RADI.
SELECTION-SCREEN END OF BLOCK BLK1 .
start-of-selection.
*ZAUFK
" Selection of records from aufk to internal table.
IF ONSITE EQ 'X' .
SELECT
BUKRS
KOKRS
OBJNR
KTEXT
anfaufnr
aufex
USER2
USER0
USER1
USER3
USER6
USER7
USER8
ABKRS
USER9
AUFNR
FROM AUFK INTO TABLE IT_AUFK WHERE BUKRS IN S_BUKRS AND
anfaufnr IN s_anf AND
aufex in s_aufex and
aufnr IN S_OBJNR AND
USER2 IN S_USER2 AND
USER0 IN S_USER0 AND
USER1 IN S_USER1 AND
USER3 IN S_USER3 AND
USER6 IN S_USER6 AND
ABKRS IN S_ABKRS AND
USER9 EQ 'X' .
ENDIF.
IF OFFSHORE EQ 'X'.
SELECT
BUKRS
KOKRS
OBJNR
KTEXT
anfaufnr
aufex
USER2
USER0
USER1
USER3
USER6
USER7
USER8
ABKRS
USER9
AUFNR
FROM AUFK INTO TABLE IT_AUFK WHERE BUKRS IN S_BUKRS AND
anfaufnr IN S_anf AND
aufex in s_aufex and
aufnR IN S_OBJNR AND
USER2 IN S_USER2 AND
USER0 IN S_USER0 AND
USER1 IN S_USER1 AND
USER3 IN S_USER3 AND
USER6 IN S_USER6 AND
ABKRS IN S_ABKRS AND
USER9 <> 'X'.
ENDIF.
IF BOTH EQ 'X'.
SELECT
BUKRS
KOKRS
OBJNR
KTEXT
anfaufnr
aufex
USER2
USER0
USER1
USER3
USER6
USER7
USER8
ABKRS
USER9
AUFNR
FROM AUFK INTO TABLE IT_AUFK WHERE BUKRS IN S_BUKRS AND
anfaufnr IN S_anf AND
aufex in s_aufex and
aufNR IN S_OBJNR AND
USER2 IN S_USER2 AND
USER0 IN S_USER0 AND
USER1 IN S_USER1 AND
USER3 IN S_USER3 AND
USER6 IN S_USER6 AND
ABKRS IN S_ABKRS.
ENDIF.
*& Include ZCOEP
" Selection of records from coep to internal table.
SELECT BUKRS KOKRS gjahr kstar OBJNR OBJNR_N1 PERIO BEKNZ WKGBTR WOGBTR FROM
COEP INTO TABLE
IT_COEP FOR ALL ENTRIES IN IT_AUFK WHERE OBJNR = IT_AUFK-OBJNR and
perio in S_PERIO.
*& Include ZPROFIT_CALC
" Calculations for income and Profit of the employee.
if not it_coep[] is initial.
select objnr gjahr wrttp versn kstar from cosp into TABLE It_cosp for
all entries in it_coep where objnr = IT_COEP-objnr .
endif.
LOOP AT IT_coep INTO WA_coep.
read table IT_aufk into WA_aufk with key OBJNR = wa_coep-OBJNR.
case it_cosp-kstar.
when '3000200'.
it_cosp-kstar = cosp-kstar.
when '3100040'.
it_cosp-kstar = cosp-kstar.
when '3100360'.
it_cosp-kstar = cosp-kstar.
when '3100055'.
it_cosp-kstar = cosp-kstar.
when '3100065'.
it_cosp-kstar = cosp-kstar.
when '3100115'.
it_cosp-kstar = cosp-kstar.
when '3100120'.
it_cosp-kstar = cosp-kstar.
when '3100130'.
it_cosp-kstar = cosp-kstar.
when '3100135'.
it_cosp-kstar = cosp-kstar.
when '3100140'.
it_cosp-kstar = cosp-kstar.
when '3100145'.
it_cosp-kstar = cosp-kstar.
when '3100150'.
it_cosp-kstar = cosp-kstar.
when '3100155'.
it_cosp-kstar = cosp-kstar.
when '3100160'.
it_cosp-kstar = cosp-kstar.
when '3100165'.
it_cosp-kstar = cosp-kstar.
when '3100170'.
it_cosp-kstar = cosp-kstar.
endcase.
IT_DISPLAY-BUKRS = WA_AUFK-BUKRS.
IT_DISPLAY-anfaufnr = WA_AUFK-anfaufnr.
it_display-aufex = wa_aufk-aufex.
IT_DISPLAY-OBJNR = WA_AUFK-OBJNR.
IT_DISPLAY-USER2 = WA_AUFK-USER2.
IT_DISPLAY-USER0 = WA_AUFK-USER0.
IT_DISPLAY-USER1 = WA_AUFK-USER1.
IT_DISPLAY-USER3 = WA_AUFK-USER3.
IT_DISPLAY-USER6 = WA_AUFK-USER6.
IT_DISPLAY-USER7 = WA_AUFK-USER7.
IT_DISPLAY-USER8 = WA_AUFK-USER8.
IT_DISPLAY-ABKRS = WA_AUFK-ABKRS.
IT_DISPLAY-USER9 = WA_AUFK-USER9.
IT_DISPLAY-KTEXT1 = WA_AUFK-KTEXT.
if WA_AUFK-abkrs = 01.
IT_DISPLAY-STR = 'TM'.
ENDIF.
IF WA_AUFK-ABKRS = 02.
IT_DISPLAY-STR = 'FP'.
ENDIF.
IF WA_AUFK-USER9 = 'X'.
IT_DISPLAY-WORK = 'ONSITE'.
ENDIF.
IF WA_AUFK-USER9 <> 'X'.
IT_DISPLAY-WORK = 'OFFSHORE'.
ENDIF.
it_display-ABKRS = it_display-user7.
IF wa_coep-BEKNZ = 'S'.
IT_DISPLAY-WKGBTR = WA_COEP-WKGBTR.
IT_DISPLAY-WOGBTR = WA_COEP-WOGBTR.
IT_DISPLAY-ADDK = IT_DISPLAY-ADDK + IT_DISPLAY-WKGBTR.
IT_DISPLAY-ADDO = IT_DISPLAY-ADDO + IT_DISPLAY-WOGBTR.
IT_DISPLAY-ADDK1 = 0.
IT_DISPLAY-ADDO1 = 0.
IT_DISPLAY-PROFIT1 = IT_DISPLAY-ADDK1 + IT_DISPLAY-ADDK.
IT_DISPLAY-PROFIT2 = IT_DISPLAY-ADDO1 + IT_DISPLAY-ADDO.
APPEND IT_DISPLAY.
ENDIF.
IF WA_COEP-BEKNZ = 'H'.
IT_DISPLAY-WKGBTR1 = WA_COEP-WKGBTR.
IT_DISPLAY-WOGBTR1 = WA_COEP-WOGBTR.
IT_DISPLAY-ADDK1 = IT_DISPLAY-ADDK + IT_DISPLAY-WKGBTR1.
IT_DISPLAY-ADDO1 = IT_DISPLAY-ADDO + IT_DISPLAY-WOGBTR1.
IT_DISPLAY-ADDK = 0.
IT_DISPLAY-ADDO = 0.
IT_DISPLAY-PROFIT1 = IT_DISPLAY-ADDK1 + IT_DISPLAY-ADDK.
IT_DISPLAY-PROFIT2 = IT_DISPLAY-ADDO1 + IT_DISPLAY-ADDO.
APPEND IT_DISPLAY.
ENDIF.
collect it_display into it_display1.
clear it_display.
ENDLOOP.
"calc
*& Include ZPROFIT_DISPLAY
LOOP AT IT_DISPLAY1. "it_display.
read table IT_COEP into WA_COEP with key OBJNR =
IT_DISPLAY-OBJNR.
read table IT_AUFK into WA_AUFK with key aufnr = IT_DISPLAY-aufnr.
if WA_AUFK-abkrs = 01.
STR = 'TM'.
ENDIF.
IF WA_AUFK-ABKRS = 02.
STR = 'FP'.
ENDIF.
IF WA_AUFK-USER9 = 'X'.
WORK = 'ONSITE'.
ENDIF.
IF WA_AUFK-USER9 <> 'X'.
WORK = 'OFFSHORE'.
ENDIF.
endloop.
clear it_field.
it_field-col_pos = 1.
it_field-fieldname = 'AUFNR'.
it_field-seltext_l = 'project id.'.
it_field-outputlen = 15.
append it_field to it_field_t.
CLEAR it_field.
clear it_field.
it_field-col_pos = 2.
it_field-fieldname = 'KTEXT1'.
it_field-seltext_l = 'Project Name'.
it_field-outputlen = 20.
append it_field to it_field_t.
CLEAR it_field.
clear it_field.
it_field-col_pos = 3.
it_field-fieldname = 'USER7'.
it_field-seltext_l = 'Start Date'.
it_field-do_sum = 'X'.
it_field-outputlen = 20.
append it_field to it_field_t.
CLEAR it_field.
clear it_field.
it_field-col_pos = 4.
it_field-fieldname = 'USER8'.
it_field-seltext_l = 'End Date'.
it_field-do_sum = 'X'.
it_field-outputlen = 20.
append it_field to it_field_t.
CLEAR it_field.
clear it_field.
it_field-col_pos = 5.
it_field-fieldname = 'USER2'.
it_field-seltext_l = 'Location'.
it_field-do_sum = 'X'.
it_field-outputlen = 20.
append it_field to it_field_t.
CLEAR it_field.
clear it_field.
it_field-col_pos = 6.
it_field-fieldname = 'USER0'.
it_field-seltext_l = 'Vertical'.
it_field-do_sum = 'X'.
it_field-outputlen = 20.
append it_field to it_field_t.
CLEAR it_field.
it_field-col_pos = 7.
it_field-fieldname = 'USER1'.
it_field-seltext_l = 'Sub_vertical'.
it_field-outputlen = 20.
it_field-do_sum = 'X'.
append it_field to it_field_t.
CLEAR it_field.
it_field-col_pos = 8.
it_field-fieldname = 'USER3'.
it_field-seltext_l = 'Technology'.
it_field-outputlen = 20.
it_field-do_sum = 'X'.
append it_field to it_field_t.
CLEAR it_field.
it_field-col_pos = 9.
it_field-fieldname = 'USER6'.
it_field-seltext_l = 'Department'.
it_field-outputlen = 20.
it_field-do_sum = 'X'.
append it_field to it_field_t.
CLEAR it_field.
it_field-col_pos = 10.
it_field-fieldname = 'WORK'.
it_field-seltext_l = 'Onsite/Offshore'.
it_field-outputlen = 20.
it_field-do_sum = 'X'.
append it_field to it_field_t.
CLEAR it_field.
it_field-col_pos = 11.
it_field-fieldname = 'STR'.
it_field-seltext_l = 'T&M/FP'.
it_field-outputlen = 20.
it_field-do_sum = 'X'.
append it_field to it_field_t.
CLEAR it_field.
it_field-col_pos = 12.
it_field-fieldname = 'KOSTL'.
it_field-seltext_l = 'EMP COST'.
it_field-outputlen = 10.
it_field-do_sum = 'X'.
append it_field to it_field_t.
CLEAR it_field.
it_field-col_pos = 13.
it_field-fieldname = 'KSTAR'.
it_field-seltext_l = 'STAFF WELFARE'.
it_field-outputlen = 10.
it_field-do_sum = 'X'.
append it_field to it_field_t.
CLEAR it_field.
it_field-col_pos = 14.
it_field-fieldname = 'KSTAR'.
it_field-seltext_l = 'RECRUITMENT'.
it_field-outputlen = 10.
it_field-do_sum = 'X'.
append it_field to it_field_t.
CLEAR it_field.
it_field-col_pos = 15.
it_field-fieldname = 'KSTAR'.
it_field-seltext_l = 'TRAVELS'.
it_field-outputlen = 10.
it_field-do_sum = 'X'.
append it_field to it_field_t.
CLEAR it_field.
it_field-col_pos = 16.
it_field-fieldname = 'KSTAR'.
it_field-seltext_l = 'SUBCONTRACT'.
it_field-outputlen = 10.
it_field-do_sum = 'X'.
append it_field to it_field_t.
CLEAR it_field.
it_field-col_pos = 17.
it_field-fieldname = 'KSTAR'.
it_field-seltext_l = 'COMMUNICATION'.
it_field-outputlen = 10.
it_field-do_sum = 'X'.
append it_field to it_field_t.
CLEAR it_field.
it_field-col_pos = 18.
it_field-fieldname = 'KSTAR'.
it_field-seltext_l = 'RENT'.
it_field-outputlen = 10.
it_field-do_sum = 'X'.
append it_field to it_field_t.
CLEAR it_field.
it_field-col_pos = 19.
it_field-fieldname = 'KSTAR'.
it_field-seltext_l = 'BACKEND COST (PROJECT EXP)'.
it_field-outputlen = 10.
it_field-do_sum = 'X'.
append it_field to it_field_t.
CLEAR it_field.
it_field-col_pos = 20.
it_field-fieldname = 'ADDO'.
it_field-seltext_l = 'Direct costs'.
it_field-outputlen = 20.
it_field-do_sum = 'X'.
append it_field to it_field_t.
CLEAR it_field.
it_field-col_pos = 21.
it_field-fieldname = 'ADDO1'.
it_field-seltext_l = 'Income'.
it_field-outputlen = 20.
it_field-do_sum = 'X'.
append it_field to it_field_t.
CLEAR it_field.
it_field-col_pos = 22.
it_field-fieldname = 'PROFIT2'.
it_field-seltext_l = 'Profit(income-costs)'.
it_field-outputlen = 20.
it_field-do_sum = 'X'.
append it_field to it_field_t.
CLEAR it_field.
it_field-col_pos = 23.
it_field-fieldname = 'ADDK'.
it_field-seltext_l = 'Direct costs(Grp cur)'.
it_field-outputlen = 20.
it_field-do_sum = 'X'.
append it_field to it_field_t.
CLEAR it_field.
it_field-col_pos = 24.
it_field-fieldname = 'ADDK1'.
it_field-seltext_l = 'Income(Grp Cur)'.
it_field-outputlen = 20.
it_field-do_sum = 'X'.
append it_field to it_field_t.
CLEAR it_field.
it_field-col_pos = 25.
it_field-fieldname = 'PROFIT1'.
it_field-seltext_l = 'Profit(income-costs)'.
it_field-outputlen = 20.
it_field-do_sum = 'X'.
append it_field to it_field_t.
CLEAR it_field.
xlayout-zebra = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = 'ZPROJECT_PROFIT1'
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE_PROFIT'
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT = xlayout
IT_FIELDCAT = it_field_t
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
IR_SALV_FULLSCREEN_ADAPTER =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = IT_DISPLAY1
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.
clear it_field_t.
"it_display.
FORM USER_COMMAND using r_ucomm like sy-ucomm rs type slis_selfield.
include zinteractive_profit."Secondary list for calling KO03.
ENDFORM. "USER_COMMAND.
Thanks & Regards,
Lakshmi..Hi,
i did according to ur suggession.
now it is going dump.
and it is telling like this.
2629 i_event_name = 'SUBTOTAL_TEXT'
2630 is_subtottxt_info = ls_subtot_info
2631 ip_subtot_line = lr_data
2632 changing
2633 c_subtottxt = l_subtottxt.
2634 ls_lvc_data-value = l_subtottxt.
2635
2636 append ls_lvc_data to ct_lvc_data.
2637 endif.
2638
2639 ************************************
2640 * Column per Fieldcat Entry
2641 ************************************
2642 clear ls_lvc_data-style.
2643 loop at it_fcat_local assigning <ls_fcat>
2644 where tech ne 'X' and no_out ne 'X'.
2645 if l_invisible eq 'X'.
2646 clear l_invisible.
2647 if <ls_fcat>-do_sum is initial.
2648 continue.
2649 else.
2650 clear ls_lvc_data-col_pos.
2651 endif.
2652 endif.
2653
2654 add 1 to ls_lvc_data-col_pos.
2655
2656 assign component <ls_fcat>-fieldname
2657 of structure <ls_data> to <l_field_val
2658 if sy-subrc ne 0.
>>>>> message x000(0k).
2660 endif.
2661
2662 *... work on average
2663 if <ls_fcat>-do_sum eq 'C'.
2664 clear l_entries.
2665
2666 assign space to <l_unit>.
2667 if not <ls_fcat>-cfieldname is initial.
2668 assign component <ls_fcat>-cfieldname
2669 of structure <ls_data> to <l_unit>.
2670 endif.
2671 if not <ls_fcat>-qfieldname is initial.
2672 assign component <ls_fcat>-qfieldname
2673 of structure <ls_data> to <l_unit>.
2674 endif.
2675
2676 l_from = ls_grpl-index_from.
2677 l_to = ls_grpl-index_to.
2678 if ls_grpl-index_from is initial and
plz any of u help me to come out with solution.
Thanks & Regards,
Lakshmi.. -
When clic in the field "i_ekpo-ebeln" tab exit in report ALV
Good Afternoon! *********************************************************
Coloquei all the code, I believe for better clarification. When clico in the field i_ekpo-ebeln in the report is called transaction ME23 c/o GRID this functioning normally, but with the reports List and Hierarquico it does not happen the same and it prints in the baseboard the message "Invalid Function". when standard use buttons, functions of course.
obs.: I had that to create a SET Pf-status for each type of report pos I wanted that when clicar in the field box and clicar in the button "TO PRINT REPORT" it printed sapscript. How I make to solve such problem?
Att, Carlos Eduardo.
REPORT ztreino NO STANDARD PAGE HEADING LINE-SIZE 220.
************************declarações*********************
DATA: BEGIN OF y_ekko OCCURS 0,
ebeln TYPE ekko-ebeln, "Nº documento de compra
bukrs TYPE ekko-bukrs, "Empresa
bsart TYPE ekko-bsart, "Documento de compra
loekz TYPE ekko-loekz, "Código de eliminação
aedat TYPE ekko-aedat, "Data de criação do registro
ernam TYPE ekko-ernam, "Nome do responsável que criou o objeto
lifnr TYPE ekko-lifnr, "Nº conta do fornecedor
ekgrp TYPE ekko-ekgrp, "Grupo de compradores
waers TYPE ekko-waers, "Chave da moeda
BOX TYPE ptrv_approval-box, "campo para chekinbox
END OF y_ekko,
BEGIN OF y_ekpo OCCURS 0,
ebeln TYPE ekpo-ebeln, "Nº documento de compra
ebelp TYPE ekpo-ebelp, "Nº item do documento de compra
loekz TYPE ekpo-loekz, "Código de eliminação
txz01 TYPE ekpo-txz01, "Texto breve
matnr TYPE ekpo-matnr, "Nº material
bukrs TYPE ekpo-bukrs, "Empresa
werks TYPE ekpo-werks, "Centro
menge TYPE ekpo-menge, "Quantidade do pedido
netpr TYPE ekpo-netpr, "Preço líquido no documento de compra
BOX TYPE ptrv_approval-box, "campo para chekinbox
END OF y_ekpo.
*início seleção de dados
SELECTION-SCREEN BEGIN OF BLOCK bl2 WITH FRAME TITLE text-000.
SELECTION-SCREEN BEGIN OF BLOCK bl1 WITH FRAME TITLE text-001.
SELECTION-SCREEN SKIP.
*Nº documento de compra
SELECT-OPTIONS : s_ebeln FOR ekko-ebeln NO INTERVALS OBLIGATORY,
s_bukrs FOR ekko-bukrs OBLIGATORY, "Empresa
s_bsart FOR ekko-bsart. "Documento de compra
SELECTION-SCREEN END OF BLOCK bl1.
SELECTION-SCREEN END OF BLOCK bl2.
**fim da seleção de dados----
**início da variante
SELECTION-SCREEN BEGIN OF BLOCK bl4 WITH FRAME TITLE text-000.
SELECTION-SCREEN BEGIN OF BLOCK bl3 WITH FRAME TITLE text-002.
PARAMETERS : p_vari LIKE disvariant-variant.
SELECTION-SCREEN END OF BLOCK bl3.
SELECTION-SCREEN END OF BLOCK bl4.
***fim variante -
***início modo relatório
SELECTION-SCREEN BEGIN OF BLOCK bl5 WITH FRAME TITLE text-000.
SELECTION-SCREEN BEGIN OF BLOCK bl6 WITH FRAME TITLE text-003.
SELECTION-SCREEN SKIP.
PARAMETERS : rb1 RADIOBUTTON GROUP TIPO DEFAULT 'X',
rb2 RADIOBUTTON GROUP TIPO,
rb3 RADIOBUTTON GROUP TIPO.
SELECTION-SCREEN END OF BLOCK bl6.
SELECTION-SCREEN END OF BLOCK bl5.
****fim modo relatório
*******início da opção de download
Dados do arquivo texto de saída.
SELECTION-SCREEN BEGIN OF BLOCK bl9 WITH FRAME TITLE text-004.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(15) text-005.
PARAMETERS: p_gerar AS CHECKBOX.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(15) text-006.
PARAMETERS: p_dir LIKE rlgrap-filename DEFAULT 'c:'.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(15) text-007.
PARAMETERS: p_arq LIKE rlgrap-filename DEFAULT 'nota-geral.txt'.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN END OF BLOCK bl9.
DATA :
i_ekko LIKE y_ekko OCCURS 0 WITH HEADER LINE,
i_ekpo LIKE y_ekpo OCCURS 0 WITH HEADER LINE.
i_tabsaida LIKE y_saida OCCURS 0 WITH HEADER LINE.
*********************Fim Declarações*******************************
*********************Declarações ALV*******************************
TYPE-POOLS : slis.
DATA :
s_layout TYPE slis_layout_alv,
t_sort TYPE slis_t_sortinfo_alv WITH HEADER LINE,
t_fieldcat TYPE slis_t_fieldcat_alv WITH HEADER LINE,
s_grupos TYPE slis_t_sp_group_alv WITH HEADER LINE,
s_keyinfo TYPE slis_keyinfo_alv,
extab TYPE slis_t_extab.
DATA :
variant_exit(1) TYPE c,
def_variant(1) TYPE c,
s_print TYPE slis_print_alv,
s_top TYPE slis_t_listheader,
variante TYPE disvariant,
def_variante TYPE disvariant,
v_repid LIKE sy-repid,
*------pega a data que esta rodando a transação
v_datasaida(10) TYPE C,
*------para saber quantos Pedidos na EKKO
v_exibe TYPE I,
s_selfield type slis_selfield,
v_ucomm like sy-ucomm.
**********************Fim declarações ALV*************************
Contants para Sapscript e declarações *
TABLES: ITCPO.
CONSTANTS: c_on(1) TYPE C VALUE 'X', "Parâmetro para o Sapscript
c_off(1) TYPE C VALUE ''. "Parâmetro para o Sapscript
Data:
v_element(15) TYPE C, "Elemento de texto do Sap Script
v_type(15) TYPE C, "BODY
v_window(15) TYPE C, "Janela
flag TYPE I, "Uma condição para impressão do sapscript
resp TYPE C, "resposta para confirmação do download tab
zlen TYPE I, "Para verificar o um diretório válido
Para a função WS_DOWNLOAD só em declarar as variaveis deste tipo já *
seria o bastante para passar o caminho para a função
TABLES : ekko, ekpo.
initialization *
INITIALIZATION.
PERFORM zf_verifica_variante.
at selection-screen on value-request *
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.
PERFORM zf_busca_variante_existente.
at seletion-screen *
AT SELECTION-SCREEN.
PERFORM zf_valida_variante.
validar os campo antes de fazer download do arquivo
PERFORM zf_trata_parametros_gerar_arqu.
start-of-selection *
START-OF-SELECTION.
PERFORM zf_seleciona_dados.
Criando ALV *
PERFORM zf_alv.
*& Form zf_verifica_variante
text
--> Verifica se a variante selecionada é existente
FORM zf_verifica_variante.
CLEAR variante.
v_repid = sy-repid.
variante-report = v_repid.
Buscar variante default
def_variante = variante.
CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
EXPORTING
i_save = 'A'
CHANGING
cs_variant = def_variante
EXCEPTIONS
wrong_input = 1
not_found = 2
program_error = 3
OTHERS = 4.
IF sy-subrc EQ 0.
p_vari = def_variante-variant.
ENDIF.
ENDFORM. " zf_verifica_variante
*& Form zf_busca_variante_existente
*- text
*- --> Vai buscar a variante existente
FORM zf_busca_variante_existente.
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
is_variant = variante " Report com as
i_save = 'A' " Variantes Salvas
i_tabname_header = 'I_EKPO' " Tabela interna saida
it_default_fieldcat = t_fieldcat[] " Tabela de formatação
i_display_via_grid = 'X' " Dispara POPUP em ALV
IMPORTING
e_exit = variant_exit " Se não existir variante X
es_variant = def_variante " Variante default
EXCEPTIONS
not_found = 1
program_error = 2
OTHERS = 3.
IF sy-subrc = 2.
MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
IF variant_exit = space.
p_vari = def_variante-variant. " Recebe variante escolhida
ENDIF.
ENDIF.
ENDFORM. " zf_busca_variante_existente
*-& Form zf_valida_variante
*- text
*- --> Verifica se a variante digitada é válida.
FORM zf_valida_variante.
IF NOT p_vari IS INITIAL.
variante = def_variante. "nome do report
def_variante-variant = p_vari. "nome que foi digitado
CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
EXPORTING
i_save = 'A'
CHANGING
cs_variant = def_variante
variante = def_variante.
ELSE.
clear variante.
variante-report = v_repid.
ENDIF.
ENDFORM. " zf_valida_variante
-& Form zf_seleciona_dados
*- text
--> Seleciona os dados da ekko e ekpo
FORM zf_seleciona_dados.
SELECT ebeln
bukrs
bsart
loekz
aedat
ernam
lifnr
ekgrp
waers
FROM ekko
INTO TABLE i_ekko
WHERE
( ebeln IN s_ebeln AND
bsart EQ 'NB' ).
SORT I_EKKO ASCENDING.
IF sy-subrc EQ 0.
SELECT ebeln
ebelp
loekz
txz01
matnr
bukrs
werks
menge
netpr
FROM ekpo
INTO TABLE i_ekpo
FOR ALL ENTRIES IN i_ekko
WHERE
( ebeln EQ i_ekko-ebeln ).
ENDIF.
SORT I_EKPO ASCENDING.
Para exibir no topo do relatório no grid
DESCRIBE TABLE I_EKKO LINES v_exibe.
ENDFORM. " zf_seleciona_dados
*-& Form zf_ALV
*- text
--> Opções de alv
FORM zf_alv.
IF rb1 = 'X'.
PERFORM zf_gri.
ENDIF.
IF rb2 = 'X'.
PERFORM ZF_HIERARQUICO.
ENDIF.
IF rb3 = 'X'.
PERFORM ZF_LIST.
ENDIF.
ENDFORM. " zf_ALV
*& Form zf_gri
*- text
*- --> Seqüência para gerar o alv grid
FORM zf_gri.
PERFORM zf_layout.
PERFORM zf_ordena_campos.
PERFORM zf_monta_campos_alv.
PERFORM zf_print.
PERFORM zf_grupo.
PERFORM zf_top USING s_top.
IF NOT I_EKPO[] IS INITIAL.
PERFORM zf_imprime_alv.
ELSE.
MESSAGE s000(zcl001) WITH 'Nenhum registro encontrado.'.
STOP.
ENDIF.
ENDFORM. " zf_gri
*-& Form zf_layout
*- text
--> cria o layout do alv
FORM zf_layout.
s_layout-box_tabname = 'I_EKPO'.
s_layout-box_fieldname = 'BOX'.
s_layout-get_selinfos = 'X'.
s_layout-detail_popup = 'X'.
s_layout-detail_initial_lines = 'X'.
s_layout-zebra = 'X'.
s_layout-colwidth_optimize = 'X'.
ENDFORM. " zf_layout
*-& Form zf_ordena_campos
*- text
--> Ordenação dos campos
FORM zf_ordena_campos.
CLEAR t_sort.
t_sort-spos = '1'. "prioridade de ordenação
t_sort-fieldname = 'EBELN'. "campo da tab int. de saida
t_sort-tabname = 'I_EKPO'. "tab inter de saida
t_sort-up = 'X'. "ordenação do maior para o menor
APPEND t_sort.
ENDFORM. " zf_ordena_campos
*-& Form zf_monta_campos_alv
text
--> è passado os campos de acordo com a ordem de exibição inicial
FORM zf_monta_campos_alv.
IF rb2 = 'X'.
CLEAR t_FIELDCAT.
t_FIELDCAT-FIELDNAME = 'BOX'.
t_FIELDCAT-TABNAME = 'I_EKKO'.
t_FIELDCAT-CHECKBOX = 'X'.
t_FIELDCAT-INPUT = 'X'.
APPEND t_FIELDCAT.
CLEAR t_fieldcat.
t_fieldcat-fieldname = 'EBELN'.
t_fieldcat-tabname = 'I_EKKO'.
t_fieldcat-ref_fieldname = 'EBELN'.
t_fieldcat-ref_tabname = 'EKKO'.
APPEND t_fieldcat.
CLEAR t_fieldcat.
t_fieldcat-fieldname = 'BUKRS'.
t_fieldcat-tabname = 'I_EKKO'.
t_fieldcat-ref_fieldname = 'BUKRS'.
t_fieldcat-ref_tabname = 'EKKO'.
APPEND t_fieldcat.
CLEAR t_fieldcat.
t_fieldcat-fieldname = 'BSART'.
t_fieldcat-tabname = 'I_EKKO'.
t_fieldcat-ref_fieldname = 'BSART'.
t_fieldcat-ref_tabname = 'EKKO'.
APPEND t_fieldcat.
CLEAR t_fieldcat.
t_fieldcat-fieldname = 'AEDAT'.
t_fieldcat-tabname = 'I_EKKO'.
t_fieldcat-ref_fieldname = 'AEDAT'.
t_fieldcat-ref_tabname = 'EKKO'.
APPEND t_fieldcat.
CLEAR t_fieldcat.
t_fieldcat-fieldname = 'ERNAM'.
t_fieldcat-tabname = 'I_EKKO'.
t_fieldcat-ref_fieldname = 'ERNAM'.
t_fieldcat-ref_tabname = 'EKKO'.
APPEND t_fieldcat.
CLEAR t_fieldcat.
t_fieldcat-fieldname = 'LIFNR'.
t_fieldcat-tabname = 'I_EKKO'.
t_fieldcat-ref_fieldname = 'LIFNR'.
t_fieldcat-ref_tabname = 'EKKO'.
APPEND t_fieldcat.
CLEAR t_fieldcat.
t_fieldcat-fieldname = 'EKGRP'.
t_fieldcat-tabname = 'I_EKKO'.
t_fieldcat-ref_fieldname = 'EKGRP'.
t_fieldcat-ref_tabname = 'EKKO'.
APPEND t_fieldcat.
ENDIF.
CLEAR t_fieldcat.
t_fieldcat-fieldname = 'EBELN'.
t_fieldcat-tabname = 'I_EKPO'.
t_fieldcat-ref_fieldname = 'EBELN'.
t_fieldcat-ref_tabname = 'EKPO'.
t_fieldcat-key = 'X'.
t_fieldcat-Hotspot = 'X'.
APPEND t_fieldcat.
CLEAR t_fieldcat.
T_fieldcat-fieldname = 'EBELP'.
T_fieldcat-tabname = 'I_EKPO'.
T_fieldcat-ref_fieldname = 'EBELP'.
T_fieldcat-ref_tabname = 'EKPO'.
APPEND t_fieldcat.
CLEAR t_fieldcat.
t_fieldcat-fieldname = 'MATNR'.
t_fieldcat-tabname = 'I_EKPO'.
t_fieldcat-ref_fieldname = 'MATNR'.
t_fieldcat-ref_tabname = 'EKPO'.
APPEND t_fieldcat.
CLEAR t_fieldcat.
t_fieldcat-fieldname = 'WERKS'.
t_fieldcat-tabname = 'I_EKPO'.
t_fieldcat-ref_fieldname = 'WERKS'.
t_fieldcat-ref_tabname = 'EKPO'.
APPEND t_fieldcat.
CLEAR t_fieldcat.
t_fieldcat-fieldname = 'MENGE'.
t_fieldcat-tabname = 'I_EKPO'.
t_fieldcat-ref_fieldname = 'MENGE'.
t_fieldcat-ref_tabname = 'EKPO'.
APPEND t_fieldcat.
CLEAR t_fieldcat.
t_fieldcat-fieldname = 'NETPR'.
t_fieldcat-tabname = 'I_EKPO'.
t_fieldcat-ref_fieldname = 'NETPR'.
t_fieldcat-ref_tabname = 'EKPO'.
t_fieldcat-do_sum = 'X'. "totalizar campo
APPEND t_fieldcat.
CLEAR t_fieldcat.
t_fieldcat-fieldname = 'TXZ01'.
t_fieldcat-tabname = 'I_EKPO'.
t_fieldcat-ref_fieldname = 'TXZ01'.
t_fieldcat-ref_tabname = 'EKPO'.
APPEND t_fieldcat.
ENDFORM. " zf_monta_campos_alv
*-& Form zf_top
*- text
*- --> Cria o texto de cabeçalho do ALV, passando por parametro o
--> p_S_TOP para s_top
FORM zf_top USING p_s_top TYPE slis_t_listheader.
DATA: ls_line TYPE slis_listheader.
CLEAR ls_line.
ls_line-typ = 'H'.
ls_line-info = 'Relatório de Compras por Classificação Contábil'.
APPEND ls_line TO p_s_top.
CLEAR ls_line.
ls_line-typ = 'S'.
ls_line-KEY = 'Parametros Seleção '.
ls_line-info = '- Documento de compra'.
APPEND ls_line TO p_s_top.
CLEAR ls_line.
ls_line-typ = 'S'.
ls_line-info = '- Empresa'.
APPEND ls_line TO p_s_top.
CLEAR ls_line.
ls_line-typ = 'S'.
ls_line-info = '- Tip.doc.compra'.
APPEND ls_line TO p_s_top.
CLEAR ls_line.
ls_line-typ = 'S'.
ls_line-KEY = 'Total Pedido'.
ls_line-info = v_exibe.
APPEND ls_line TO p_s_top.
início Formatar a data
CALL FUNCTION 'DATUMSAUFBEREITUNG'
EXPORTING
IDATE = SY-DATUM
IMPORTING
TDAT8 = v_datasaida.
Fim Formatar a data
CLEAR ls_line.
ls_line-typ = 'S'.
ls_line-KEY = 'Data da execução'.
ls_line-info = v_datasaida.
APPEND ls_line TO p_s_top.
CLEAR ls_line.
ls_line-typ = 'S'.
ls_line-KEY = 'Usuário'.
APPEND ls_line TO p_s_top.
CLEAR ls_line.
ls_line-typ = 'A'.
ls_line-info = sy-uname.
APPEND ls_line TO p_s_top.
ENDFORM. " zf_top
*-& Form zf_print
*- text
*- --> Parametros de Impressão para o ALV
FORM zf_print.
s_print-no_print_selinfos = 'N'.
s_print-no_print_listinfos = 'N'.
ENDFORM. " zf_print
*-& Form zf_imprime_alv
*- text
*- --> Imprime o ALV c/ seu parametros
FORM zf_imprime_alv.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PF_STATUS_SET = 'ZSET_PF_STATUS'
I_CALLBACK_USER_COMMAND = 'ZF_USER_COMMAND'
i_callback_program = v_repid
i_callback_top_of_page = 'TOP_OF_PAGE'
is_layout = s_layout
it_fieldcat = t_fieldcat[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS = S_GRUPOS[]
it_sort = t_sort[]
IT_FILTER =
IS_SEL_HIDE =
i_default = 'X'
i_save = 'A'
is_variant = variante
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT = S_PRINT
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IT_ALV_GRAPHICS =
IT_ADD_FIELDCAT =
IT_HYPERLINK =
I_HTML_HEIGHT_TOP =
I_HTML_HEIGHT_END =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = I_EKPO
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. " zf_imprime_alv
*-& Form zf_top-of-page
*- text
--> Cabeçalho ALV
FORM top_of_page.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = s_top
i_logo = 'CARLOS_LOGO3'.
I_END_OF_LIST_GRID = .
ENDFORM. " zf_top-of-page
*-& Form ZF_HIERARQUICO
*- text
*- --> RELATÓRIO HIERÁQUICO
form ZF_HIERARQUICO.
PERFORM zf_layout.
PERFORM zf_ordena_campos.
PERFORM zf_monta_campos_alv.
PERFORM zf_print.
PERFORM zf_grupo.
IF NOT I_EKPO[] IS INITIAL.
PERFORM zf_imprime_hierarquico_alv.
ELSE.
MESSAGE s000(zcl001) WITH 'Nenhum registro encontrado.'.
STOP.
ENDIF.
endform. " ZF_HIERARQUICO
*-& Form zf_grupo
text
--> Não é fundamental a criação de grupos de campos, mas facilita
ao usuário na hora de escolher os campos de exibição após o clique do
botão MODIFICAR LAYOUT . Vários campos da fieldcat podem ser
definidos para um mesmo grupo de campo.
form zf_grupo.
MOVE:'Moeda' TO S_GRUPOS-SP_GROUP,
'Campos moeda' TO S_GRUPOS-TEXT.
APPEND S_GRUPOS.
endform. " zf_grupo
*& Form zf_imprime_hierarquico_alv
text
--> p1 text
<-- p2 text
form zf_imprime_hierarquico_alv.
Vamos definir as ligações entre as tabelas para as quebras no momento
da impressão.
s_keyinfo-header01 = 'EBELN'.
s_keyinfo-item01 = 'EBELN'.
CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
EXPORTING
I_CALLBACK_USER_COMMAND = 'ZF_USER_COMMAND'
I_CALLBACK_PF_STATUS_SET = 'ZF_SET_PF_STATUS_HIERARQ'
I_CALLBACK_PROGRAM = v_repid
IS_LAYOUT = S_LAYOUT
IT_FIELDCAT = T_FIELDCAT[]
IT_SPECIAL_GROUPS = S_GRUPOS[]
IT_SORT =
IT_FILTER =
- Parâmetro p/executar sempre com a variante default
I_DEFAULT = 'X'
- Se é possível salvar as variantes
I_SAVE = 'A'
- Nome da variante selecionada
IS_VARIANT = VARIANTE
IT_EVENTS =
IT_EVENT_EXIT =
i_tabname_header = 'I_EKKO'
i_tabname_item = 'I_EKPO'
I_STRUCTURE_NAME_HEADER =
I_STRUCTURE_NAME_ITEM =
is_keyinfo = S_KEYINFO
IS_PRINT = S_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 = I_EKKO
t_outtab_item = I_EKPO.
endform. " zf_imprime_hierarquico_alv
*& Form ZF_LIST
text
--> p1 text
<-- p2 text
form ZF_LIST.
PERFORM zf_layout.
PERFORM zf_ordena_campos.
PERFORM zf_monta_campos_alv.
PERFORM zf_print.
PERFORM zf_grupo.
IF NOT I_EKPO[] IS INITIAL.
PERFORM zf_imprime_list_alv.
ELSE.
MESSAGE s000(zcl001) WITH 'Nenhum registro encontrado.'.
STOP.
ENDIF.
endform. " ZF_LIST
*& Form zf_imprime_list_alv
text
--> p1 text
<-- p2 text
form zf_imprime_list_alv.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PF_STATUS_SET = 'ZF_SET_PF_STATUS_LIST'
I_CALLBACK_USER_COMMAND = 'ZF_USER_COMMAND'
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = v_repid
I_STRUCTURE_NAME = 'I_EKPO'
IS_LAYOUT = S_LAYOUT
IT_FIELDCAT = T_FIELDCAT[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS = S_GRUPOS[]
IT_SORT = T_SORT[]
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = 'A'
IS_VARIANT = VARIANTE
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT = S_PRINT
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = I_EKPO.
endform. " zf_imprime_list_alv
*& Form zf_user_command
text
--> p1 text
<-- p2 text
form zf_user_command using p_v_ucomm like SY-UCOMM
p_s_selfield type slis_selfield.
*---tratamento de impressão do Sapscript----
CASE p_v_ucomm.
FLAG = 0.
WHEN 'IMPRIMIR' OR 'PRINT'.
LOOP AT i_ekpo.
IF NOT i_ekpo-BOX IS INITIAL.
FLAG = FLAG + 1.
ENDIF.
ENDLOOP.
se tiver selecionado apenas uma box
IF flag EQ 1.
IF p_gerar EQ 'X'.
*-----perform para confirmação de download
PERFORM zf_popup_to_confirm.
ENDIF.
*------chama o form para imprimir o sapscript
PERFORM zf_sapscript.
ENDIF.
box estiver vazia
IF flag EQ 0.
MESSAGE E017(ZCL_GRUPO04). "Selecione apenas uma BOX
"referente ao pedido de compras.
STOP.
ENDIF.
"estiver selecionado + de uma box
IF flag GT 1.
MESSAGE E017(ZCL_GRUPO04). "Selecione apenas uma
"BOX referente ao pedido de compra.
STOP.
ENDIF.
ENDCASE.
CASE p_s_selfield-sel_tab_field.
*observe na exibição do relatório(hierarquico) que temos o EKKO-EBELN
ficaria melhor visualmente, a utilização de clicar no mesmo
WHEN 'I_EKPO-EBELN'. "tab de saida
SET PARAMETER ID 'BES' FIELD p_s_selfield-VALUE.
CALL TRANSACTION 'ME23' AND SKIP FIRST SCREEN.
ENDCASE.
endform. " zf_user_command
*& Form ZSET_PF_STATUS
text
-->P_EXTAB text
form ZSET_PF_STATUS using p_extab.
set pf-status 'BOTOES' EXCLUDING extab.
endform. " ZSET_PF_STATUS
*& Form zf_sapscript
text
--> p1 text
<-- p2 text
form zf_sapscript.
--carregar a ITCPO----
PERFORM zf_itcpo.
----chamar a função Open_form
PERFORM zf_open_form.
*----buscar o fornecedor e seus dados
LOOP AT I_ekko.
v_element = 'CABPRIN'.
v_type = 'BODY'.
v_window = 'JANCABEC'.
PERFORM zf_imprime_form USING v_element
v_type
v_window.
ENDLOOP.
*----buscar o documento de compra selecionado
LOOP AT i_ekpo.
IF i_ekpo-BOX = 'X'.
v_element = 'MAIN'.
v_type = 'BODY'.
v_window = 'MAIN'.
PERFORM zf_imprime_form USING v_element
v_type
v_window.
*---o comando EXIT é para que somente quando 1 registro for selecionado
no relatório e a verificação da igualdade acontecer faz que saia do
Loop
EXIT.
ENDIF.
ENDLOOP.
PERFORM zf_close_form.
endform. " zf_sapscript
*& Form zf_itcpo
text
--> p1 text
<-- p2 text
form zf_itcpo.
*Parâmetros para impressão da tabela ITCPO
ITCPO-TDCOPIES = 1. "Quantidade de cópias
ITCPO-TDPAGESLCT = ''. "Seleção de páginas
ITCPO-TDPROGRAM = SY-REPID. "Captura o nome do programa
ITCPO-TDIMMED = c_on. "Saída imediata do relatório
ITCPO-TDPREVIEW = c_on. "Exibição prévia do relatório
ITCPO-TDDEST = 'LOCL'. "SPOOL: dispositivo de saída
ITCPO-TDFAXUSER = SY-UNAME. "Usuário logado naquele momento
ITCPO-TDSENDDATE = SY-DATUM. "Data de envio desejada
ITCPO-TDSENDTIME = SY-UZEIT. "Hora envio desejada
ITCPO-TDNEWID = c_on. "Nova ordem SPOOL
ITCPO-TDARMOD = c_on. "IMPRIMIR: modo de arquivamento
ITCPO-TDTITLE = 'Relatório de Compras por Classificação Contábil'.
endform. " zf_itcpo
*& Form zf_open_formBoa Tarde Carlos,
Welcome to the SDN Forums. SDN gets it's power from the large community throughout the world. To harvest that power of knowledge we have settled on one language for posts here which is English.
Clearly English is not your first language, but don't be afraid, I would vouch that for most of the participant here on SDN English is the second language.
As it is for me. I am just lucky, that I am living in the States long enough that German colleagues start to look at me strangely when I talk to them in German, because it doesn't totally sound right anymore
So we are very forgiving her in SDNland regarding grammar and spelling (although not as much anymore in the Weblogs), we even provide a spell checker.
Please post your question again in English.
If people don't understand you they will ask you about the things that they don't understand and you can then clarify.
Try it out. Your chance of an excellent responds is way higher.
Boa sorte, Mark. -
Regarding upload from excel to alv.
Hi
here is my code:
TABLES
TABLES: ioheader, " IOC Communication structure
ioitem, " IOC Communication structure
klah, " Class and Class type
ksml, " Characteristic Keys for Class and Type
cabn, " Characteristics
cabnt, " Characteristic Descriptions
vbap, " SAles details
sscrfields.
Includes
INCLUDE rvreuse_global_data. " ALV Types etc
DATA - INTERNAL TABLES AND FIELD LISTS
Types
TYPE-POOLS: ibco2. " Characteristic types
DATA - CONSTANTS
CONSTANTS: c_true(1) TYPE c VALUE 'X',
c_false(1) TYPE c VALUE ' ',
c_zioheader TYPE dd02l-tabname VALUE 'ZIOHEADER',
c_command TYPE slis_formname VALUE 'USER_COMMAND',
c_backhoe(7) TYPE c VALUE 'BACKHOE',
c_300(3) TYPE c VALUE '300',
c_no_data(7) TYPE c VALUE 'No Data',
c_save(1) TYPE c VALUE 'A'.
Internal Tables
Main IO Table
DATA: i_header LIKE zioheader OCCURS 0 WITH HEADER LINE.
Characteristic Values
DATA: i_config TYPE ibco2_instance_tab2.
Characteristics Keys
DATA: BEGIN OF i_imerk OCCURS 0,
imerk LIKE ksml-imerk,
END OF i_imerk.
ALV Grid Control
DATA: i_grid TYPE sd_alv.
Catalogues
DATA: wa_cat LIKE LINE OF i_grid-fieldcat.
Structures
Structure for layout variant
DATA: s_variant LIKE disvariant.
DATA : filename TYPE string.
DATA - WORKING VARIABLES
DATA - FIELD GROUPS
*field-groups:
SELECTION SCREEN
Variant control
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-t02.
PARAMETERS: p_var LIKE disvariant-variant.
SELECTION-SCREEN END OF BLOCK b1.
Printer Control
SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-t03.
PARAMETERS: rad1 RADIOBUTTON GROUP rad USER-COMMAND radio,
rad2 RADIOBUTTON GROUP rad,
rad3 RADIOBUTTON GROUP rad.
PARAMETER p_floc(128) DEFAULT '/usr/tmp/testfile.dat'
LOWER CASE.
SELECTION-SCREEN END OF BLOCK b3.
MAIN PROGRAM *************************
INITIALIZATION.
PERFORM initialise. " Set up program defaults
move 'Report Only' to rad1.
move 'Export Sequence List' to s_but2.
move 'Import Sequence List' to S_but3.
Selection Screen Options
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_var.
PERFORM get_variant CHANGING p_var. " ALV Layout
DATA : l_no_of_lines TYPE i,
la_matnr LIKE s_matnr.
DESCRIBE TABLE s_matnr LINES l_no_of_lines.
IF l_no_of_lines > 1.
MESSAGE e000(z1) WITH 'Enter only one product'.
ENDIF.
READ TABLE s_matnr INTO la_matnr WITH KEY sign = 'I'
option = 'EQ'.
IF sy-subrc NE 0.
MESSAGE e000(z1) WITH 'Enter only one product'.
ENDIF.
AT SELECTION-SCREEN.
DATA : l_no_of_lines TYPE i,
la_matnr LIKE s_matnr.
DESCRIBE TABLE s_matnr LINES l_no_of_lines.
IF l_no_of_lines > 1.
MESSAGE e000(z1) WITH 'Enter only one product'.
ENDIF.
READ TABLE s_matnr INTO la_matnr WITH KEY sign = 'I'
option = 'EQ'.
IF sy-subrc NE 0.
MESSAGE e000(z1) WITH 'Enter only one product'.
ENDIF.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_floc.
data : pname type syst-repid.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
PROGRAM_NAME = pname
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = 'P_FLOC'
STATIC = ' '
MASK = ' '
CHANGING
FILE_NAME = p_floc
EXCEPTIONS
MASK_TOO_LONG = 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.
START-OF-SELECTION.
PERFORM set_catalogue. " Set up basic headings from Itab
PERFORM get_char_keys. " Get the characteristic keys
PERFORM modify_catalogue_key. " Amend headings for char keys
IOC Logical Database Event
GET ioheader.
PERFORM get_subsequent_data. " Retrieve additional data
END-OF-SELECTION.
PERFORM modify_catalogue_title. " Place correct titles for AVL
PERFORM alv_display. " Display in ALV Grid
if rad1 = 'X' .
PERFORM modify_catalogue_title. " Place correct titles for AVL
PERFORM alv_display. " Display in ALV Grid
elseif rad2 = 'X' .
*if p_floc is initial .
MESSAGE e000(z1) WITH
' Enter the file location'.
*else.
PERFORM download. " Export sequence list to excel
PERFORM modify_catalogue_title. " Place correct titles for AVL
PERFORM alv_display. " Display in ALV Grid
*endif.
elseif rad3 = 'X' .
if p_floc is initial .
MESSAGE e000(z1) WITH
' Enter the file location'.
else .
PERFORM upload.
endif.
endif.
*AT SELECTION-SCREEN OUTPUT.
*TOP-OF-PAGE.
*END-OF-PAGE.
*AT USER-COMMAND.
perform PF_STATUS_SET.
SUBROUTINES *******************************
FORM get_variant *
Retrieve ALV display variant *
--> X_VAR Variant *
FORM get_variant CHANGING x_var.
PERFORM f4_alv_layout(ppio_entry) USING i_grid-program
CHANGING x_var.
ENDFORM.
FORM get_subsequent_data *
Retrieve additional data and place into I_HEADER Itab *
FORM get_subsequent_data.
Prime extended table
i_header = ioheader.
PERFORM get_serial_number. " Get Sales Order Serial No
PERFORM get_char_values. " Get Characteristic Values
PERFORM build_char_entries." Put Char Values into I_HEADER
Add to extended table
APPEND i_header.
ENDFORM.
FORM get_serial_number *
Retrieve the serial number *
FORM get_serial_number.
SELECT SINGLE zuonr submi
INTO (i_header-zuonr,i_header-submi)
FROM vbak
WHERE vbeln EQ i_header-kdauf_aufk.
ENDFORM.
FORM get_char_values *
Retrieve the characteristic values for the production order *
FORM get_char_values.
Get Ready
REFRESH i_config.
Get Object key
SELECT SINGLE cuobj
FROM vbap
INTO vbap-cuobj
WHERE vbeln EQ i_header-kdauf_aufk
AND matnr EQ i_header-plnbez.
Get characteristic config values
CALL FUNCTION 'CUCB_GET_CONFIGURATION'
EXPORTING
instance = vbap-cuobj
IMPORTING
configuration = i_config
EXCEPTIONS
invalid_input = 1
invalid_instance = 2
instance_is_a_classification = 3
OTHERS = 4.
Not found, no config values will be pulled through
IF sy-subrc <> 0.
ENDIF.
ENDFORM.
FORM build_char_entries *
For each character value. Find the relevent "slot" in the *
table by checking the characteristic key against the catalogue*
stored key
FORM build_char_entries.
DATA: la_config LIKE LINE OF i_config, " i_config header line
li_values TYPE ibvalue0 OCCURS 0, " Charact'ic Values Itab
la_values LIKE LINE OF li_values, " li_values header line
l_atwrt LIKE la_values-atwrt, " Characteristic Value
l_atinn LIKE la_values-atinn, " Characteristic Key
l_key(20), " Working built key
l_entry(20), " FieldName to be updated
l_len LIKE sy-tabix, " Length of string
l_tabix LIKE sy-tabix. " Index position of Itab
FIELD-SYMBOLS: <f_field>. " This will be the field to update
Loop on characteristics
LOOP AT i_config INTO la_config.
Extract the characteristic values imbedded table
MOVE la_config-values TO li_values.
Loop on the characteristics values
LOOP AT li_values INTO la_values.
We now have the charecteristic key la_values-atinn
and the value in la_values-atwrt. However, there may be
Multiple values for key la_values-atinn
So if they are the same append to one long string.
Is it a new value
IF la_values-atinn EQ l_atinn.
CONCATENATE l_atwrt '|' la_values-atwrt INTO l_atwrt.
CONTINUE.
ENDIF.
New Value (and not first pass) so save built values
IF NOT l_atinn IS INITIAL.
Find the correct field to place the value in.
This is done by finding the Itab field description in the AVL display
field Catalogue called "No Data|nnnnnn" where nnnn is the
characteristic Key
Build the key
CONCATENATE c_no_data '|' l_atinn INTO l_key.
Loop till we find it. This gives us the field name
LOOP AT i_grid-fieldcat INTO wa_cat WHERE seltext_l = l_key.
Set up the field name to be amended
CONCATENATE wa_cat-tabname '-' wa_cat-fieldname INTO l_entry.
ASSIGN (l_entry) TO <f_field>.
Update field with the Char value
MOVE l_atwrt TO <f_field>.
No need to continue this loop
EXIT.
ENDLOOP.
ENDIF.
Prime for next value
l_atinn = la_values-atinn.
l_atwrt = la_values-atwrt.
ENDLOOP.
ENDLOOP.
ENDFORM.
FORM alv_display *
Display data in ALV grid *
FORM alv_display.
Set up Variant
i_grid-variant-variant = p_var. " Variant
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
i_callback_program = i_grid-program
I_CALLBACK_PF_STATUS_SET = i_grid-pf_status_set
i_callback_user_command = i_grid-user_command
i_structure_name = i_grid-structure
is_layout = i_grid-layout
it_fieldcat = i_grid-fieldcat
IT_EXCLUDING = i_grid-excluding
IT_SPECIAL_GROUPS = i_grid-special_groups
IT_SORT = i_grid-sort
IT_FILTER = i_grid-filter
IS_SEL_HIDE = i_grid-sel_hide
I_DEFAULT = i_grid-default
i_save = I_grid-save
is_variant = i_grid-variant
IT_EVENTS = i_grid-events
IT_EVENT_EXIT = i_grid-event_exit
IS_PRINT = i_grid-print
IS_REPREP_ID =
I_SCREEN_START_COLUMN = i_grid-start_column
I_SCREEN_START_LINE = i_grid-start_line
I_SCREEN_END_COLUMN = i_grid-end_column
I_SCREEN_END_LINE = i_grid-end_line
IMPORTING
E_EXIT_CAUSED_BY_CALLER = i_grid-exit
ES_EXIT_CAUSED_BY_USER = i_grid-user_exit
TABLES
t_outtab = i_header
EXCEPTIONS
program_error = 1
OTHERS = 2.
ALV Failed.
IF sy-subrc <> 0.
WRITE: / 'Failed with',sy-subrc.
ENDIF.
ENDFORM.
FORM initialise *
Set up basic report details *
FORM initialise.
ALV controls
i_grid-program = sy-repid. " Program Name
i_grid-user_command = c_command. " ALV user FORM
i_grid-save = c_save. " Save Options
ALV Variant Details for saved report layouts
i_grid-variant-report = i_grid-program.
i_grid-variant-username = sy-uname.
ENDFORM.
FORM user_command *
Routine called by ALV *
--> X_UCOMM Function selected *
--> X_SELFIELD Selection field Itab *
FORM user_command USING x_ucomm LIKE sy-ucomm
x_selfield TYPE slis_selfield.
DATA: l_answer(1). " Answer returned from popup box
Only allow drill down on Order number
CHECK x_selfield-fieldname = 'AUFNR'.
Get option for display or modify
CALL FUNCTION 'POPUP_TO_DECIDE'
EXPORTING
textline1 = 'Please Choose'
text_option1 = 'Display'
text_option2 = 'Modify'
titel = 'Production Order'
IMPORTING
answer = l_answer.
Did they cancel
CHECK l_answer NE 'A'.
Set up parameters.
SET PARAMETER ID 'ANR' FIELD x_selfield-value.
Display
IF l_answer = '1'.
CALL TRANSACTION 'CO03' AND SKIP FIRST SCREEN.
Modify
ELSEIF l_answer = '2'.
CALL TRANSACTION 'CO02' AND SKIP FIRST SCREEN.
ENDIF.
*IF rad2 = 'X'.
If sy-ucomm ='%PC'.
IF sy-subrc <> 0.
WRITE: / 'Failed with',sy-subrc.
else.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
TITEL = 'File Transfer Status'
TXT1 = 'File transfered to location:'
TXT2 = filename
TXT3 = ' '
TXT4 = ' '
ENDIF.
endif.
ENDFORM.
FORM set_catalogue *
Retrieve the title and field information from the *
Data Dictionary. This will then be amended to the correct *
Characteristic titles during the end-of-selection event *
FORM set_catalogue.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = i_grid-program
i_internal_tabname = 'I_HEADER'
i_structure_name = c_zioheader
i_client_never_display = 'X'
CHANGING
ct_fieldcat = i_grid-fieldcat.
ENDFORM.
FORM get_char_keys *
Retrieve the list of characteristic keys *
template of BACKHOE class 300 *
FORM get_char_keys.
DATA : la_inob TYPE inob.
SELECT SINGLE * FROM inob INTO la_inob
WHERE objek = s_matnr-low.
IF sy-subrc NE 0.
MESSAGE e000(z1) WITH
' Could not get INOB table for ' s_matnr-low.
ENDIF.
Get Major Object key
SELECT SINGLE clint
FROM klah
INTO klah-clint
WHERE klart = la_inob-klart
AND class = s_matnr-low.
IF sy-subrc NE 0.
MESSAGE e001(z296) WITH c_backhoe c_300.
ENDIF.
Use Major key to retrieve Characteristics keys
This is the template for the headings
SELECT imerk
FROM ksml
INTO TABLE i_imerk
WHERE clint EQ klah-clint " Objct Key
AND lkenz EQ space " Delete Indicator
AND datuv LE sy-datum. " Validity to
IF sy-subrc NE 0.
MESSAGE e002(z296) WITH klah-clint.
ENDIF.
ENDFORM.
FORM modify_catalogue_key *
Change the default "No Data" titles with the characteristic *
key values in the form "No Data|nnnnnnn" where nnnnnn is *
the characteristic key. This is used as a method of allocating*
characteristic values to the I_HEADER Itab positions *
CHAR_001 to CHAR_100 *
FORM modify_catalogue_key.
DATA: l_index LIKE sy-tabix, " Table Index for Read
l_tabix LIKE sy-tabix, " Table Index Position
l_seltext_l LIKE dd03p-scrtext_l. " Heading Text
Get into Key Sequence
SORT i_imerk.
Loop on catalogue for dummy titles
LOOP AT i_grid-fieldcat INTO wa_cat WHERE seltext_l(7) = c_no_data.
l_tabix = sy-tabix.
Get the next characteristic
l_index = l_index + 1.
READ TABLE i_imerk INDEX l_index.
No Characteristic, No display
IF sy-subrc NE 0.
wa_cat-no_out = c_true.
wa_cat-tech = c_true.
MODIFY i_grid-fieldcat FROM wa_cat INDEX l_tabix.
CONTINUE.
ENDIF.
Place the char key against the "No Data" title
so that later we know what values to place against the keys
the title will become "No Data:nnnnnnnnnn" (nnn = Key)
CONCATENATE c_no_data '|' i_imerk-imerk INTO wa_cat-seltext_l.
MODIFY i_grid-fieldcat FROM wa_cat INDEX l_tabix.
ENDLOOP.
ENDFORM.
FORM modify_catalogue_title *
At this stage the catalogue titles for the characteristics *
are in the form "No Data|nnnnn" Where nnnn is the *
characteristic key. Using the Key, replace this text with *
the real characteristic title
FORM modify_catalogue_title.
DATA: l_key(20), " Characteristic Key in Alpha form
l_len LIKE sy-tabix. " Length of string
Loop on the characteristic keys
LOOP AT i_imerk.
Get the real title
SELECT SINGLE atbez
FROM cabnt
INTO cabnt-atbez
WHERE atinn EQ i_imerk-imerk.
Not found, leave alone
CHECK sy-subrc EQ 0.
Place key into char form for comparison in loop
l_key = i_imerk-imerk.
Now loop on the catalogue to get the key
LOOP AT i_grid-fieldcat INTO wa_cat WHERE seltext_l+8 = l_key.
Place the title into the catalogue
wa_cat-seltext_l = cabnt-atbez.
wa_cat-seltext_m = cabnt-atbez.
wa_cat-seltext_s = cabnt-atbez.
wa_cat-reptext_ddic = cabnt-atbez.
And update
MODIFY i_grid-fieldcat FROM wa_cat.
ENDLOOP.
ENDLOOP.
IF rad2 = 'X'.
LOOP AT i_grid-fieldcat INTO wa_cat.
*IF wa_cat-fieldname = 'AUFNR'.
*wa_cat-col_pos = '10'.
*endif.
case wa_cat-fieldname.
when 'AUFNR'.
wa_cat-fix_column = 'X'.
when 'CY_SEQNR'.
wa_cat-fix_column = 'X'.
when 'ZOUNR'.
wa_cat-fix_column = 'X'.
when 'GLTRP'.
wa_cat-fix_column = 'X'.
when 'SUBMI'.
wa_cat-fix_column = 'X'.
endcase.
modify i_grid-fieldcat FROM wa_cat.
endloop.
endif.
ENDFORM.
*SELECT z099seqno z099heading
INTO table i_header
FROM z099 join z100 ON
z099seqno = z100seqno WHERE
z100~product = s_matnr.
*& Form download
Download file to excel
*FORM download.
*filename = p_floc .
*CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
FILENAME = filename
FILETYPE = 'ASC'
APPEND = 'X'
WRITE_FIELD_SEPARATOR = ','
HEADER = 'l_seltext_l'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
IMPORTING
FILELENGTH =
TABLES
DATA_TAB = i_header
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22
IF sy-subrc <> 0.
WRITE: / 'Failed with',sy-subrc.
else.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
TITEL = 'File Transfer Status'
TXT1 = 'File transfered to location:'
TXT2 = filename
TXT3 = ' '
TXT4 = ' '
ENDIF.
*ENDFORM. " download
*& Form upload
text
--> p1 text
<-- p2 text
FORM upload.
*DATA : i_upload TYPE STANDARD TABLE OF alsmex_tabline.
**data : i_upload like zioheader occurs 0 with header line.
data file like RLGRAP-FILENAME.
file = p_floc .
DATA: BEGIN OF i_upload OCCURS 0.
INCLUDE STRUCTURE alsmex_tabline.
DATA: END OF i_upload.
DATA: BEGIN OF i_upload1 OCCURS 0.
INCLUDE STRUCTURE alsmex_tabline.
DATA: END OF i_upload1.
DATA: BEGIN OF t_col OCCURS 0,
col LIKE alsmex_tabline-col,
size TYPE i.
DATA: END OF t_col.
DATA: zwlen TYPE i,
zwlines TYPE i.
DATA: BEGIN OF fieldnames OCCURS 3,
title(60),
table(6),
field(10),
kz(1),
END OF fieldnames.
DATA: tind(4) TYPE n.
FIELD-SYMBOLS: <fs1>.
DATA: zwfeld(19).
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = file
I_BEGIN_COL = '1'
I_BEGIN_ROW = '1'
I_END_COL = '200'
I_END_ROW = '6500'
TABLES
INTERN = i_upload.
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 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.
LOOP AT i_upload.
i_upload1 = i_upload.
CLEAR i_upload1-row.
APPEND i_upload1.
ENDLOOP.
SORT i_upload1 BY col.
LOOP AT i_upload1.
AT NEW col.
t_col-col = i_upload1-col.
APPEND t_col.
ENDAT.
zwlen = strlen( i_upload1-value ).
READ TABLE t_col WITH KEY col = i_upload1-col.
IF sy-subrc EQ 0.
IF zwlen > t_col-size.
t_col-size = zwlen.
Internal Table, Current Row Index
MODIFY t_col INDEX sy-tabix.
ENDIF.
ENDIF.
ENDLOOP.
DESCRIBE TABLE t_col LINES zwlines.
SORT i_upload BY row col.
IF kzheader = 'X'.
LOOP AT i_upload.
fieldnames-title = i_upload-value.
APPEND fieldnames.
AT END OF row.
EXIT.
ENDAT.
ENDLOOP.
ELSE.
DO zwlines TIMES.
WRITE sy-index TO fieldnames-title.
APPEND fieldnames.
ENDDO.
ENDIF.
SORT i_upload BY row col.
LOOP AT i_upload.
IF kzheader = 'X'
i_upload-row = 1.
CONTINUE.
ENDIF.
tind = i_upload-col.
CONCATENATE 'DATA_TAB-VALUE_' tind INTO zwfeld.
ASSIGN (zwfeld) TO <fs1>.
<fs1> = i_upload-value.
AT END OF row.
APPEND i_upload.
CLEAR i_upload.
ENDAT.
ENDLOOP.
if sy-subrc = 0.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = i_grid-program
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT =
IT_FIELDCAT = i_grid-fieldcat
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = i_save
IS_VARIANT = i_grid-variant
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IT_ALV_GRAPHICS =
IT_ADD_FIELDCAT =
IT_HYPERLINK =
I_HTML_HEIGHT_TOP =
I_HTML_HEIGHT_END =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = i_upload.
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.
endif.
when i execute the program i am getting a short dump
GETWA_NOT_ASSIGNED
what might be the problem.
this is a very urgent question.
pls suggest me the clear way to over come this problem.HI
use this code for uploading the excel file to internal table....
data: begin of itab_string occurs 0,
record type char255,
end of itab_string.
data: L_FILETABLE TYPE FILETABLE,
L_FILETAB_H TYPE FILETABLE WITH HEADER LINE.
data: p_file1 type string.
selection screen .
PARAMETERS: P_FILE TYPE LOCALFILE.
initialization.
at selection-screen on value-request for P_FILE.
IF THE USER SELECT EXTENTION BUTTON IT WILL OPEN THE LOCAL DIRECTORY FOR SELECTING THE FILE LOCATION.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
EXPORTING
WINDOW_TITLE =
DEFAULT_EXTENSION = 'CSV'
DEFAULT_FILENAME = 'C:\Documents and Settings\196093\Desktop\STATUS.csv'
FILE_FILTER =
INITIAL_DIRECTORY = 'C:\Documents and Settings\196093\Desktop\'
MULTISELECTION =
WITH_ENCODING =
CHANGING
FILE_TABLE = L_FILETABLE
RC = RC
USER_ACTION =
FILE_ENCODING =
EXCEPTIONS
FILE_OPEN_DIALOG_FAILED = 1
CNTL_ERROR = 2
ERROR_NO_GUI = 3
NOT_SUPPORTED_BY_GUI = 4
others = 5
IF SY-SUBRC <> 0.
ELSE.
LOOP AT l_filetable INTO L_FILETAB_H.
P_FILE = L_FILETAB_H-FILENAME.
move p_file to p_file1.
EXIT.
ENDLOOP.
ENDIF.
passing the selected file name to gui_upload for loading the data
into internal table
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = p_file1
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = ' '
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
NO_AUTH_CHECK = ' '
IMPORTING
FILELENGTH =
HEADER =
TABLES
DATA_TAB = itab_string
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17
IF SY-SUBRC <> 0.
MESSAGE I000(Z00) WITH 'PLEASE PROVIDE CORRECT FILE NAME'.
ENDIF.
reward points to all helpful answers
kiran.M
Maybe you are looking for
-
How to call a private method in a JFrame
I have a Frame which has some properties like its size, bgcolor plus other parameters, as instance variables. There is a button on the Frame with the caption : "set properties". When one clicks on that button, a new frame should appear via which a us
-
Hi, Is there any FM that allowes you to convert a variable type char into another one type int4? I am working on SAP version 4.6C and haven't been able to find any except for 'CHAR_NUMC_CONVERSION' and 'MOVE_CHAR_TO_NUM', but none of them work with i
-
After installing PSE 8 Windows 7 no longer generates mpg thumbnails
I recently noticed that Windows 7 was no longer producing thumbnails of .mpg files in Windows Explorer. Much troubleshooting produced no solution. Finally I un-installed PSE8, and immediately Windows was able to generate mpg thumbnails again. Has a
-
How to create diagonal variable line pattern in CS6?
Hi guys I'm on the brink of insanity with creating my diagonal line pattern. I've tried everything I can think of but the pattern is an absolute mess! I want to create a diagonal line pattern but I want the lines not to be uniform. Basically I've mad
-
Logon Par - redirect to new JSP
Hi, I've to change the portal logon page. My requirement is to redirect the logon page to test.jsp page. from umLogonPage.jsp i'm trying to redirect to test.jsp in form method. <FORM name="logonForm" method="post" action=test.jsp> but the URL is not