I_tabs in function module
Hello,
Is it possible to use a table of a self-made structure in a function module? And how do you do it.
For example: My main program uses internal able datafields. Is it possible to pass this to the function module, and how do I do that?
DATA : BEGIN OF datafields_struc.
DATA: infotype(4),
index TYPE i,
field_name(30),
field_roll(20),
field_length TYPE i,
field_start TYPE i.
DATA : END OF datafields_struc.
DATA: datafields LIKE datafields_struc OCCURS 0 WITH HEADER LINE.
Hi,
There is the possibilty that you can use i_tabs as the functionmodule ... wht u need to do is intially create a structure in se11 and declare all the fileds which u will be declaring in the internal table and declare that structure name in the tcode se37 there we can find the tab as tables and u declare in it..
Now u can declare the fileds in the inernal table or call the function module and use it .....
Try this hope u can solve it !
Regards,
Sana.
Reward with points if found helpful!
Similar Messages
-
Has anyone used the FORMAT_MESSAGE function module in ECC 6.0 ??
We've upgraded to ECC 6.0 and now I have a BDC program using FORMAT_MESSAGE function module that has a problem. The number after the & (&1, &2, &3, &4) in the function mod isn't replaced, it stays as a literal and only the & is replaced with a valid value which it then passes back to the program.
Anyone else have this problem? Any ideas how to fix?
thanks
lzHi,
try like this....
*& Form CALL_TRANSACTION
* text
* --> p1 text
* <-- p2 text
FORM call_transaction .
CALL TRANSACTION '<Y......>' USING it_bdcdata
MESSAGES INTO messtab
MODE 'N'
UPDATE 'S'.
LOOP AT messtab.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
id = messtab-msgid
lang = sy-langu
no = messtab-msgnr
v1 = messtab-msgv1
v2 = messtab-msgv2
v3 = messtab-msgv3
v4 = messtab-msgv4
IMPORTING
msg = msg_txt
EXCEPTIONS
not_found = 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 messtab-msgtyp EQ 'E'.
WRITE:/ icon_checked AS ICON, 10 msg_txt.
WRITE: 5 i_tab-wb_book COLOR 6.
* ELSEIF messtab-msgtyp EQ 'S'.
* WRITE:/10 msg_txt COLOR 6.
* ELSEIF messtab-msgtyp EQ 'W'.
* WRITE:/10 msg_txt COLOR 3.
* ELSE.
* WRITE:/10 msg_txt COLOR 4.
ENDIF.
CLEAR msg_txt.
ENDLOOP.
REFRESH:it_bdcdata,messtab.
ENDFORM. " CALL_TRANSACTION
Arunima -
hai all
iwant to know about few function modules in alv
1) reuse_alv_default_varients_get.
2)reuse alv_varients_f4
what is the use of these function modules
how to use these function modules, what r the structures used to use these function module. where to pass this in
in list and grid display function modules.
plz help me.
thanks & regards
sinduHI,
check this.
REPORT Z_TEST_alv_variant .
TYPE-POOLS : SLIS.
PARAMETERS: ONE RADIOBUTTON GROUP G1 DEFAULT 'X',
TWO RADIOBUTTON GROUP G1.
DATA: BEGIN OF I_TAB OCCURS 0,
FIELD1 TYPE I,
FIELD2 TYPE I,
END OF I_TAB.
DATA: GT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
LS_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
DATA: L_VARIANT TYPE DISVARIANT,
LX_VARIANT LIKE DISVARIANT,
L_SAVE TYPE C,
L_EXIT(1) TYPE C.
SELECTION-SCREEN BEGIN OF BLOCK 0 WITH FRAME TITLE TEXT-VAR.
PARAMETERS: P_VARI LIKE DISVARIANT-VARIANT.
SELECTION-SCREEN END OF BLOCK 0.
INITIALIZATION.
L_SAVE = 'A'.
PERFORM VARIANT_INIT.
Get default variant
LX_VARIANT = L_VARIANT.
CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
EXPORTING
I_SAVE = L_SAVE
CHANGING
CS_VARIANT = LX_VARIANT
EXCEPTIONS
NOT_FOUND = 2.
IF SY-SUBRC = 0.
P_VARI = LX_VARIANT-VARIANT.
ENDIF.
Process on value request
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_VARI.
PERFORM F4_FOR_VARIANT.
I_TAB-FIELD1 = 19.
I_TAB-FIELD2 = 20.
APPEND I_TAB.
I_TAB-FIELD1 = 19.
I_TAB-FIELD2 = 20.
APPEND I_TAB.
I_TAB-FIELD1 = 19.
I_TAB-FIELD2 = 20.
APPEND I_TAB.
I_TAB-FIELD1 = 19.
I_TAB-FIELD2 = 20.
APPEND I_TAB.
I_TAB-FIELD1 = 19.
I_TAB-FIELD2 = 20.
APPEND I_TAB.
PERFORM INITIALIZE_FIELDCAT USING GT_FIELDCAT[].
PERFORM CALL_ALV TABLES I_TAB[]
USING GT_FIELDCAT.
*& Form initialize_fieldcat
text
-->P_GT_FIELDCAT[] text
FORM INITIALIZE_FIELDCAT USING L_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
LS_FIELDCAT-FIELDNAME = 'FIELD1'.
LS_FIELDCAT-KEY = 'X'.
LS_FIELDCAT-COL_POS = 1.
LS_FIELDCAT-SELTEXT_S = 'Work center'.
LS_FIELDCAT-SELTEXT_L = 'Work center'.
APPEND LS_FIELDCAT TO L_FIELDCAT.
CLEAR LS_FIELDCAT.
LS_FIELDCAT-FIELDNAME = 'FIELD2'.
LS_FIELDCAT-KEY = ' '.
LS_FIELDCAT-COL_POS = 2.
LS_FIELDCAT-SELTEXT_S = 'Work center2'.
LS_FIELDCAT-SELTEXT_L = 'Work center2'.
APPEND LS_FIELDCAT TO L_FIELDCAT.
CLEAR LS_FIELDCAT.
ENDFORM. " initialize_fieldcat
*& Form call_alv
text
-->P_GT_FIELDCAT text
-->P_I_TAB text
FORM CALL_ALV TABLES P_TAB
USING P_GT_FIELDCAT .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IT_FIELDCAT = P_GT_FIELDCAT
I_DEFAULT = 'X'
IS_VARIANT = L_VARIANT
I_SAVE = L_SAVE
TABLES
T_OUTTAB = P_TAB[]
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. " call_alv
*& Form VARIANT_INIT
text
FORM VARIANT_INIT.
CLEAR L_VARIANT.
L_VARIANT-REPORT = SY-REPID.
ENDFORM. " VARIANT_INIT
*& Form variant_SELECTION_SCREEN
text
FORM VARIANT_SELECTION_SCREEN .
IF NOT P_VARI IS INITIAL.
MOVE L_VARIANT TO LX_VARIANT.
MOVE P_VARI TO LX_VARIANT-VARIANT.
CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
EXPORTING
I_SAVE = L_SAVE
CHANGING
CS_VARIANT = LX_VARIANT.
L_VARIANT = LX_VARIANT.
ELSE.
PERFORM VARIANT_INIT.
ENDIF.
ENDFORM. " variant_SELECTION_SCREEN
*& Form F4_FOR_VARIANT
text
FORM F4_FOR_VARIANT.
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
IS_VARIANT = L_VARIANT
I_SAVE = L_SAVE
IMPORTING
E_EXIT = L_EXIT
ES_VARIANT = LX_VARIANT
EXCEPTIONS
NOT_FOUND = 2.
IF SY-SUBRC = 2.
MESSAGE ID SY-MSGID TYPE 'S' NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ELSE.
IF L_EXIT = SPACE.
P_VARI = LX_VARIANT-VARIANT.
ENDIF.
ENDIF.
ENDFORM. "F4_FOR_VARIANT
Regards,
Laxmi. -
Exporting int table in a function module
Hi,
How to export the resultant table in function module ? I have created a itab in my function module and it's getting filled up.I need to export this table ? how to do it?
DATA : BEGIN of itab occurs 0,
empno type p0001-pernr,
ename type p0001-ename,
END of itab.
I don't want to create structure in se11.
Rgds,
jothi.PHello Mr. Jothi,
This is Venkat.O here.
Just follow this ..
<b>1. Function module source code.</b>
FUNCTION zvenkat_testfun.
""Local Interface:
*" IMPORTING
*" REFERENCE(PERNR) TYPE PERNR-PERNR
*" TABLES
*" II_TAB
DATA:
BEGIN OF li_output occurs 0,
pernr TYPE pa0001-pernr,
ename TYPE pa0001-ename,
END OF li_output.
SELECT pernr ename
FROM pa0001
into table li_output
WHERE pernr = pernr.
IF sy-subrc = 0.
ii_tab[] = li_output[].
ENDIF.
ENDFUNCTION.
<b>2.Sample abap program with Logical database PNP.</b>
REPORT zvenkat_notebook.
TABLES pernr.
DATA: BEGIN OF i_tab OCCURS 0,
pernr TYPE pa0001-pernr,
ename TYPE pa0001-ename,
END OF i_tab.
START-OF-SELECTION.
GET pernr.
CALL FUNCTION 'ZVENKAT_TESTFUN'
EXPORTING
pernr = pernr-pernr
TABLES
ii_tab = i_tab.
loop at i_tab.
write:/ i_tab-pernr,
i_tab-ename.
endloop.
It is working fine.
By the way How are you .
Thanks,
Venkat.O -
Function modules to display graph in a container
Hi,
Can anyone suggest me is there any other function module to display graph in a container other than "GFW_PRES_SHOW_MULT" why because when I am displaying the graph using that function module I am getting boxes in the graph display which is not needed so please send me other function module or tell me whether there is any way to remove the boxes in the graph at the time of display by using the same function module given above.
Thanks in Advance.
Bhushanam.Hi,
To add a graphics functionality to ALV Grid;
1. Add a user button on the ALV Grid control, utilizing "toolbar" event and "set_toolbar_interactive" methods of the class "cl_gui_alv_grid".
2. As the function of this button, your routine should use GFW objects or "GRAPH_MATRIX..." function modules to display your graph. You implement your routine at the event "user_command".
Additionaly, you can have a look at this
SAP Graphics Help
http://help.sap.com/saphelp_46c/helpdata/en/a1/d9883672d57c73e10000009b38f889/frameset.htm
data: begin of i_tab occurs 0,
name(5) type c,
value type p,
end of i_tab.
i_tab-name = 'SAP'.
i_tab-value = '40'.
append i_tab.
clear i_tab.
i_tab-name = 'MSN'.
i_tab-value = '30'.
append i_tab.
clear i_tab.
i_tab-name = 'CNN'.
i_tab-value = '27'.
append i_tab.
clear i_tab.
i_tab-name = 'ABC'.
i_tab-value = '56'.
append i_tab.
clear i_tab.
call function 'GRAPH_2D'
EXPORTING
TYPE = 'PI'
TITL = 'My Graph'
tables
data = i_tab
EXCEPTIONS
GUI_REFUSE_GRAPHIC = 1
OTHERS = 2
if sy-subrc <> 0.
endif.
Also,Check the fun modules
GRAPH_2D Calling up the 2D business graphics
GRAPH_2D_MENUE DO NOT USE (use 'GRAPH_2D' and 'GRAPH_BUSG_MENU_SET')
GRAPH_3D Calling up the 3D presentation graphics
GRAPH_BUSG_COLOR_SET Definition of color pallets for business graphics
GRAPH_BUSG_MENU_SET Pushbutton menu (tool bar) for all BUSG modules
GRAPH_MATRIX Calling up SAP Business Graphics (2D, 3D and 4D)
GRAPH_MATRIX_2D Calling up the 2D graphics (user-friendly version)
GRAPH_MATRIX_3D Structure of 3D graphics (user-friendly version)
GRAPH_MATRIX_4D Calling up a 3D graphic (4th dimension stacked representation)
Regards,
Padmam. -
I have a problem - I am trying to create a generic extract function module. The problem is that the template RSAX_BIW_GET_DATA_SIMPLE uses one database select. However for my purpose I need to select from various tables in order to build up my internal table.
It is for PO Service orders so I have to read headers then detailed lines then other tables to get account assignments etc. How do I transfer this to E_T_Data using the required logic for the fetch and open curser etc.OK I have written an ABAP report which gets the information I need. This is crude code that I know I can tidy up with joins but I just wanted to make sure I could get the information and that it was correct first.
The code is below. I have two scenarios one for full load and one for delta (which will be the same process but reading the po's that have changed from a bespoke table populated from a user exit EXIT_SAPLRSAP_001
from 2LIS_02_SCL.)
Anyway here it is:-
FULL LOAD ************************************
IF FLAG = 'F'.
EKKO FIRST READ
SELECT * FROM EKKO
WHERE EBELN IN PO
AND AEDAT IN DDATE
AND BUKRS = 'OPCS'
AND BSTYP = 'F'
AND LOEKZ NE 'X'.
MOVE-CORRESPONDING EKKO TO I_TAB.
APPEND I_TAB.
ENDSELECT.
EKPO SECOND READ POULATING i_tab2
LOOP AT I_TAB.
SELECT * FROM EKPO
WHERE EBELN = I_TAB-EBELN
AND PSTYP = '9'
AND EREKZ NE 'X'
AND ELIKZ NE 'X'
AND LOEKZ NE 'X'.
I_TAB2-WAERS = I_TAB-WAERS.
MOVE-CORRESPONDING EKPO TO I_TAB2.
APPEND I_TAB2.
ENDSELECT.
ENDLOOP.
SORT I_TAB2 BY EBELN EBELP.
CLEAR W_PACKNO.
POPULATE ITAB_ESLL FINAL TABLE
LOOP AT I_TAB2.
SELECT SINGLE SUB_PACKNO INTO W_PACKNO FROM ESLL
WHERE PACKNO = I_TAB2-PACKNO.
IF SY-SUBRC = 0.
SELECT * FROM ESLL
WHERE PACKNO = W_PACKNO.
ITAB_ESLL-ERDAT = I_TAB2-AEDAT.
ITAB_ESLL-WAERS = I_TAB2-WAERS.
MOVE-CORRESPONDING ESLL TO ITAB_ESLL.
ITAB_ESLL-EBELN = I_TAB2-EBELN.
ITAB_ESLL-EBELP = I_TAB2-EBELP.
account assignment
CLEAR W_ZEKKN.
SELECT SINGLE ZEKKN FROM ESKL INTO W_ZEKKN
WHERE PACKNO = W_PACKNO
AND INTROW = ESLL-INTROW.
IF SY-SUBRC = 0.
CLEAR EKKN.
SELECT SINGLE * FROM EKKN
WHERE EBELN = ITAB_ESLL-EBELN
AND EBELP =
ITAB_ESLL-EBELP AND ZEKKN = W_ZEKKN.
ITAB_ESLL-PS_PSP_PNR = EKKN-PS_PSP_PNR.
ITAB_ESLL-SAKTO = EKKN-SAKTO.
ITAB_ESLL-KOSTL = EKKN-KOSTL.
ITAB_ESLL-KOKRS = EKKN-KOKRS.
I_TAB2-SAKTO = EKKN-SAKTO.
I_TAB2-KOSTL = EKKN-KOSTL.
I_TAB2-KOKRS = EKKN-KOKRS.
ENDIF.
MODIFY I_TAB2.
APPEND ITAB_ESLL.
ENDSELECT.
ENDIF.
ENDLOOP.
NOW READ EKBE
LOOP AT I_TAB2.
SELECT * FROM EKBE
WHERE EBELN = I_TAB2-EBELN
AND EBELP = I_TAB2-EBELP
AND ( BEWTP = 'E' OR BEWTP = 'R' OR BEWTP = 'Q' ).
IF SY-SUBRC = 0.
MOVE-CORRESPONDING EKBE TO ITAB_EKBE.
APPEND ITAB_EKBE.
ENDIF.
ENDSELECT.
ENDLOOP.
get rid of duplicate lines in ekbe
SORT ITAB_EKBE BY EBELN EBELP BELNR.
DATA: FIRST(1) TYPE C.
FIRST = 'x'.
DATA: D_BELNR LIKE EKBE-BELNR.
LOOP AT ITAB_EKBE.
IF FIRST = 'x'.
D_BELNR = ITAB_EKBE-BELNR.
FIRST = ''.
ELSE.
IF ITAB_EKBE-BELNR = D_BELNR.
DELETE ITAB_EKBE.
ELSE.
D_BELNR = ITAB_EKBE-BELNR.
ENDIF.
ENDIF.
ENDLOOP.
LOOP AT ITAB_EKBE.
CLEAR W_PACKNO1.
SELECT SINGLE * FROM ESSR
WHERE LBLNI = ITAB_EKBE-LFBNR.
W_PACKNO1 = ESSR-PACKNO.
CLEAR W_PACKNO.
IF SY-SUBRC = 0.
SELECT SINGLE SUB_PACKNO FROM ESLL INTO W_PACKNO
WHERE PACKNO = W_PACKNO1.
get service line items from esll
SELECT * FROM ESLL
WHERE PACKNO = W_PACKNO.
IF SY-SUBRC = 0.
ACCOUNT ASSIGNMENT INSERVICE PACKAGE
CLEAR W_ZEKKN.
SELECT SINGLE ZEKKN FROM ESKL INTO W_ZEKKN
WHERE PACKNO = W_PACKNO
AND INTROW = ESLL-INTROW.
IF SY-SUBRC = 0.
CLEAR EKKN.
SELECT SINGLE * FROM EKKN
WHERE EBELN = ITAB_EKBE-EBELN
AND EBELP =
ITAB_EKBE-EBELP AND ZEKKN = W_ZEKKN.
IF SY-SUBRC = 0.
CLEAR ITAB_ESLL.
MOVE-CORRESPONDING ESLL TO ITAB_ESLL.
ITAB_ESLL-EBELN = ITAB_EKBE-EBELN.
ITAB_ESLL-EBELP = ITAB_EKBE-EBELP.
ITAB_ESLL-ZEKKN = W_ZEKKN.
ITAB_ESLL-VGABE = ITAB_EKBE-VGABE.
ITAB_ESLL-BELNR = ITAB_EKBE-BELNR.
ITAB_ESLL-BEWTP = ITAB_EKBE-BEWTP.
ITAB_ESLL-SAKTO = EKKN-SAKTO.
ITAB_ESLL-KOSTL = EKKN-KOSTL.
ITAB_ESLL-KOKRS = EKKN-KOKRS.
ITAB_ESLL-PS_PSP_PNR = EKKN-PS_PSP_PNR.
ENDIF.
ENDIF.
CHECK IF CREDIT OR DEBIT AND ADJUST
IF ITAB_EKBE-SHKZG = 'H'.
ESLL-MENGE = ESLL-MENGE * -1.
ESLL-NETWR = ESLL-NETWR * -1.
ENDIF.
ITAB_ESLL-MENGE = ESLL-MENGE.
ITAB_ESLL-NETWR = ESLL-NETWR.
ITAB_ESLL-ERDAT = ESSR-ERDAT.
ITAB_ESLL-WAERS = ESSR-WAERS.
ITAB_ESLL-LOEKZ = ESSR-LOEKZ.
ITAB_ESLL-KZABN = ESSR-KZABN.
ITAB_ESLL-FRGKL = ESSR-FRGKL.
ITAB_ESLL-BUZEI = ITAB_EKBE-BUZEI.
ITAB_ESLL-GJAHR = ITAB_EKBE-GJAHR.
ITAB_ESLL-EBELN = ITAB_EKBE-EBELN.
ITAB_ESLL-EBELP = ITAB_EKBE-EBELP.
APPEND ITAB_ESLL.
ENDIF.
ENDSELECT.
ENDIF.
ENDLOOP.
report print out
WRITE:/5 'doc',
20 'PO Line',
30 'date created',
45 'Currency',
55 'deletion Ind',
70 'ACCEPT IND',
85 'Rel Ind',
95 'Line No',
115 'Service',
135 'Quantity',
155 'UOM',
175 'Net Value',
195 'Mat Grp',
215 'G/L Acc',
230 'Cost Centre',
245 'Cont Area',
255 'Acc *** line',
275 'Trans/Event Type',
295 'Posting Year',
315 'Mat Doc No',
335 'Mat Doc Line no',
355 'bewtp',
375 'WBS'.
SORT ITAB_ESLL BY EBELN EBELP SRVPOS EXTROW.
LOOP AT ITAB_ESLL.
WRITE:/5 ITAB_ESLL-EBELN,
20 ITAB_ESLL-EBELP,
30 ITAB_ESLL-ERDAT,
45 ITAB_ESLL-WAERS,
55 ITAB_ESLL-LOEKZ,
70 ITAB_ESLL-KZABN,
85 ITAB_ESLL-FRGKL,
95 ITAB_ESLL-EXTROW,
115 ITAB_ESLL-SRVPOS,
135 ITAB_ESLL-MENGE,
155 ITAB_ESLL-MEINS,
175 ITAB_ESLL-NETWR,
195 ITAB_ESLL-MATKL,
215 ITAB_ESLL-SAKTO,
230 ITAB_ESLL-KOSTL,
245 ITAB_ESLL-KOKRS,
255 ITAB_ESLL-ZEKKN,
275 ITAB_ESLL-VGABE,
295 ITAB_ESLL-GJAHR,
315 ITAB_ESLL-BELNR,
335 ITAB_ESLL-BUZEI,
355 ITAB_ESLL-BEWTP,
375 ITAB_ESLL-PS_PSP_PNR.
ENDLOOP.
DELTA LOAD ****************
ELSE.
IF FLAG = 'D'.
WRITE: /'Test DELTA Part'.
SELECT * FROM ZBWSERVICEPOS
WHERE DATE_UPDATED IN DDATE.
MOVE-CORRESPONDING ZBWSERVICEPOS TO I_TAB-DELTA.
APPEND I_TAB-DELTA.
ENDSELECT.
*LOOP AT I_TAB-DELTA.
WRITE:/ I_TAB-DELTA-DATE_UPDATED,
I_TAB-DELTA-EBELN, I_TAB-DELTA-EBELP.
*ENDLOOP.
ELSE.
MESSAGE I100.
ENDIF.
ENDIF. -
URGENT: Function modules or BAPIs
Hi Experts,
I need function modules or BAPI to get the open items and cleared items G/L Account wise.
Useful replies will be surely awarded.Hi Chakradhar,
Check tcode : BAPI
u will get all bapis there.
Regards,
Hemant -
How to attached class or function module in FD03
Hi Guys
I want to attached CL_ATTACHMENT_LIST for retriving attachment list from fd03 please help to attached the function module in my program?
regards
Piroz
report zfir_aged_debtors no standard page heading
line-size 255.
Type group
type-pools:
slis. " ALV types
Tables
tables:
adrc, " Addresses
bsad, " Accounting: Customer secondary index (Cleared)
bsid, " Accounting: Customer secondary index (Open)
kna1, " Customer master: General data
knkk, " Customer master: Credit management
knvk. " Customer master: Contact persons
Types
types:
begin of ty_bsadbsid,
bukrs like bsad-bukrs, " Company code
kunnr like bsad-kunnr, " Customer
gjahr like bsad-gjahr, " Fiscal year
belnr like bsad-belnr, " Accounting document number
buzei like bsad-buzei, " Line item
budat like bsad-budat, " Posting date
bldat like bsad-bldat, " Document date
waers like bsad-waers, " Currency
xblnr like bsad-xblnr, " Reference
shkzg like bsad-shkzg, " Debit/credit indicator
dmbtr like bsad-dmbtr, " Amount
zfbdt like bsad-zfbdt, " Baseline date for due date
" calculation
zbd1t like bsad-zbd1t, " Cash discount days 1
zbd2t like bsad-zbd2t, " Cash discount days 2
zbd3t like bsad-zbd3t, " Net payment terms period
rebzg like bsad-rebzg, " Number of the invoice
rebzt like bsad-rebzt, " Follow on document type
end of ty_bsadbsid,
ty_it_bsadbsid type ty_bsadbsid occurs 0,
begin of ty_merged,
kunnr like kna1-kunnr, " Customer number
name1 like adrc-name1, " Name
city1 like adrc-city1, " City
post_code1 like adrc-post_code1, " Post code
street like adrc-street, " Street
house_num1 like adrc-house_num1, " House number
tel_number like adrc-tel_number, " Telephone number
fax_number like adrc-fax_number, " Fax number
namev like knvk-namev, " First name
namew like knvk-name1, " Last name
telf1 like knvk-telf1, " Telephone number
klimk like knkk-klimk, " Credit limit
skfor like knkk-skfor, " Total receivables
total like bsad-dmbtr, " Total amount
rast1 like bsad-dmbtr, " Amount period 1
rast2 like bsad-dmbtr, " Amount period 2
rast3 like bsad-dmbtr, " Amount period 3
rast4 like bsad-dmbtr, " Amount period 4
rast5 like bsad-dmbtr, " Amount period 5
rast6 like bsad-dmbtr, " Amount period 6
end of ty_merged,
ty_it_merged type ty_merged occurs 0.
Internal tables
data:
Internal table to store customer line items from BSAD and BSID
it_bsadbsid type ty_it_bsadbsid,
Internal table to store field catalog for ALV function call
it_fieldcat type slis_t_fieldcat_alv,
Internal table to store summarised data for report output
it_merged type ty_it_merged.
Structures
data:
Display variant structures
st_tvariant like disvariant,
st_variant like disvariant.
Constants
constants:
co_delim_dash type c
value '-',
co_false type c " False
value space,
co_koart_d like faede-koart " Customer account type
value 'D',
co_save_u type c " User display variant
value 'U', " saving allowed.
co_shkzg_h like bsid-shkzg " Debit/Credit indicator
value 'H', " for credit
co_shkzg_s like bsid-shkzg " Debit/Credit indicator
value 'S', " for debit
co_selected type c " Value of selected radio
value 'X', " button or checkbox
co_true type c " True
value co_selected.
Variables
data:
va_exit type c.
Selection screen definition
selection-screen: begin of block b1 with frame title text-001.
select-options:
s_kunnr for bsad-kunnr. " Customer number
parameters:
p_kkber like knkk-kkber, " Credit control area
p_pafkt like knvk-pafkt, " Contact function
p_datum like sy-datum. " Report date
selection-screen: begin of line,
comment 01(30) text-006,
position pos_low.
parameters:
rastbis1 like rfpdo1-allgrogr " Due date sorted 1
default '000',
rastbis2 like rfpdo1-allgrogr " Due date sorted 2
default '000',
rastbis3 like rfpdo1-allgrogr " Due date sorted 3
default '000',
rastbis4 like rfpdo1-allgrogr " Due date sorted 4
default '000',
rastbis5 like rfpdo1-allgrogr " Due date sorted 5
default '000'.
selection-screen: end of line.
selection-screen: end of block b1,
begin of block b2 with frame title text-002.
parameters:
p_varint like disvariant-variant. " Display variant.
selection-screen: end of block b2.
Initialisation
initialization.
Provide default periods for due date sorted list.
rastbis1 = 0.
rastbis2 = 30.
rastbis3 = 60.
rastbis4 = 90.
rastbis5 = 120.
Default report date to current.
p_datum = sy-datlo.
Default credit control area to BP01.
p_kkber = 'BP01'.
At selection screen on value request for
at selection-screen on value-request for p_varint.
Provide display variant list for this program.
call function 'REUSE_ALV_VARIANT_F4'
exporting
is_variant = st_variant
i_save = co_save_u
importing
e_exit = va_exit
es_variant = st_tvariant
exceptions
not_found = 2.
if sy-subrc eq 2.
message id sy-msgid type 'S'
number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
else.
if va_exit eq space.
st_variant = st_tvariant.
p_varint = st_tvariant-variant.
endif.
endif.
At selection screen
at selection-screen.
Load display variant.
if not p_varint is initial.
move st_variant to st_tvariant.
move p_varint to st_tvariant-variant.
call function 'REUSE_ALV_VARIANT_EXISTENCE'
exporting
i_save = co_save_u
changing
cs_variant = st_tvariant.
st_variant = st_tvariant.
else.
clear st_variant.
st_variant-report = sy-repid.
endif.
if p_kkber is initial.
Ensure credit control area is specified.
message e000(zgen) with 'Credit control area must be specified'.
endif.
if p_pafkt is initial.
Ensure contact person function is specified.
message e000(zgen) with 'Contact person function must be specified'.
endif.
Start of selection
start-of-selection.
Extract open customer items from BSID
select bukrs kunnr gjahr belnr buzei budat bldat waers xblnr shkzg
dmbtr zfbdt zbd1t zbd2t zbd3t rebzg rebzt
from bsid
into table it_bsadbsid
where kunnr in s_kunnr
and budat le p_datum.
Extracct cleared customer items from BSAD
select bukrs kunnr gjahr belnr buzei budat bldat waers xblnr shkzg
dmbtr zfbdt zbd1t zbd2t zbd3t rebzg rebzt
from bsad
appending table it_bsadbsid
where kunnr in s_kunnr
and budat le p_datum
and augdt ge p_datum.
Ensure that items were not selected twice while getting data from the
open and cleared items tables (Only if transaction occured during
report run).
sort it_bsadbsid by bukrs belnr gjahr buzei.
delete adjacent duplicates from it_bsadbsid
comparing bukrs belnr gjahr buzei.
if it_bsadbsid[] is initial.
No data found for selection
message s001(zgen).
exit.
endif.
Merge data for report output
perform merge_data tables it_bsadbsid
it_merged.
Build field catalog
perform build_field_catalog tables it_fieldcat.
Output report via ALV
perform output_report_via_alv tables it_fieldcat
it_merged.
*& Form merge_data
text
form merge_data tables pa_it_bsadbsid type ty_it_bsadbsid
pa_it_merged type ty_it_merged.
Local work areas
data:
lwa_bsadbsid type ty_bsadbsid,
lwa_merged type ty_merged.
Local structures
data:
lst_faede like faede.
Local variables
data:
lva_daysover type i,
lva_merged_tabix like sy-tabix.
loop at pa_it_bsadbsid into lwa_bsadbsid.
Lookup merged entry for customer
clear lwa_merged.
read table pa_it_merged into lwa_merged
with key kunnr = lwa_bsadbsid-kunnr
binary search.
lva_merged_tabix = sy-tabix.
if sy-subrc ne 0.
Create new merged record for customer
lwa_merged-kunnr = lwa_bsadbsid-kunnr.
Get customer details from KNA1
clear kna1.
select single *
from kna1
where kunnr eq lwa_bsadbsid-kunnr.
Get customer address details from ADRC
clear adrc.
select single *
from adrc
where addrnumber eq kna1-adrnr
and date_from le p_datum.
lwa_merged-name1 = adrc-name1.
lwa_merged-city1 = adrc-city1.
lwa_merged-post_code1 = adrc-post_code1.
lwa_merged-street = adrc-street.
lwa_merged-house_num1 = adrc-house_num1.
lwa_merged-tel_number = adrc-tel_number.
lwa_merged-fax_number = adrc-fax_number.
Get credit limit details from KNKK
clear knkk.
select single *
from knkk
where kunnr eq lwa_bsadbsid-kunnr
and kkber eq p_kkber.
lwa_merged-klimk = knkk-klimk.
lwa_merged-skfor = knkk-skfor.
Get customer contact person details from KNVK
clear knvk.
select single *
from knvk
where kunnr eq lwa_bsadbsid-kunnr
and pafkt eq p_pafkt.
lwa_merged-namev = knvk-namev.
lwa_merged-namew = knvk-name1.
lwa_merged-telf1 = knvk-telf1.
insert lwa_merged into pa_it_merged index lva_merged_tabix.
endif.
Interpret debit/credit indicator
case lwa_bsadbsid-shkzg.
when co_shkzg_h.
Credit
lwa_bsadbsid-dmbtr = 0 - lwa_bsadbsid-dmbtr.
when co_shkzg_s.
Debit
endcase.
Perform ageing
clear lst_faede.
move-corresponding lwa_bsadbsid to lst_faede.
lst_faede-koart = co_koart_d.
call function 'DETERMINE_DUE_DATE'
exporting
i_faede = lst_faede
importing
e_faede = lst_faede
exceptions
others = 1.
lva_daysover = p_datum - lst_faede-netdt.
Accumulate total.
add lwa_bsadbsid-dmbtr to lwa_merged-total.
if lva_daysover le rastbis1.
add lwa_bsadbsid-dmbtr to lwa_merged-rast1.
else.
if lva_daysover le rastbis2 or
rastbis3 is initial.
add lwa_bsadbsid-dmbtr to lwa_merged-rast2.
else.
if lva_daysover le rastbis3 or
rastbis4 is initial.
add lwa_bsadbsid-dmbtr to lwa_merged-rast3.
else.
if lva_daysover le rastbis4 or
rastbis5 is initial.
add lwa_bsadbsid-dmbtr to lwa_merged-rast4.
else.
if lva_daysover le rastbis5.
add lwa_bsadbsid-dmbtr to lwa_merged-rast5.
else.
add lwa_bsadbsid-dmbtr to lwa_merged-rast6.
endif.
endif.
endif.
endif.
endif.
Update the merged record
modify pa_it_merged from lwa_merged index lva_merged_tabix.
endloop.
endform. " merge_data
*& Form build_field_catalog
text
form build_field_catalog tables pa_it_fieldcat type slis_t_fieldcat_alv.
Local work areas
data:
lwa_fieldcat type slis_fieldcat_alv.
--WG1K903216: Start Insert-
data: v_datum type datum,
v_mdmth type datum,
v_datxt type string,
v_noday type i.
--WG1K903216: End Insert---
refresh pa_it_fieldcat.
clear lwa_fieldcat.
lwa_fieldcat-tabname = 'PA_IT_MERGED'.
lwa_fieldcat-fieldname = 'KUNNR'.
lwa_fieldcat-ref_tabname = 'KNA1'.
lwa_fieldcat-ref_fieldname = 'KUNNR'.
lwa_fieldcat-row_pos = '1'.
lwa_fieldcat-col_pos = '1'.
append lwa_fieldcat to pa_it_fieldcat.
clear lwa_fieldcat.
lwa_fieldcat-tabname = 'PA_IT_MERGED'.
lwa_fieldcat-fieldname = 'NAME1'.
lwa_fieldcat-ref_tabname = 'ADRC'.
lwa_fieldcat-ref_fieldname = 'NAME1'.
lwa_fieldcat-row_pos = '1'.
lwa_fieldcat-col_pos = '2'.
append lwa_fieldcat to pa_it_fieldcat.
clear lwa_fieldcat.
lwa_fieldcat-tabname = 'PA_IT_MERGED'.
lwa_fieldcat-fieldname = 'CITY1'.
lwa_fieldcat-ref_tabname = 'ADRC'.
lwa_fieldcat-ref_fieldname = 'CITY1'.
lwa_fieldcat-row_pos = '1'.
lwa_fieldcat-col_pos = '3'.
append lwa_fieldcat to pa_it_fieldcat.
clear lwa_fieldcat.
lwa_fieldcat-tabname = 'PA_IT_MERGED'.
lwa_fieldcat-fieldname = 'POST_CODE1'.
lwa_fieldcat-ref_tabname = 'ADRC'.
lwa_fieldcat-ref_fieldname = 'POST_CODE1'.
lwa_fieldcat-row_pos = '1'.
lwa_fieldcat-col_pos = '4'.
append lwa_fieldcat to pa_it_fieldcat.
clear lwa_fieldcat.
lwa_fieldcat-tabname = 'PA_IT_MERGED'.
lwa_fieldcat-fieldname = 'STREET'.
lwa_fieldcat-ref_tabname = 'ADRC'.
lwa_fieldcat-ref_fieldname = 'STREET'.
lwa_fieldcat-row_pos = '1'.
lwa_fieldcat-col_pos = '5'.
append lwa_fieldcat to pa_it_fieldcat.
clear lwa_fieldcat.
lwa_fieldcat-tabname = 'PA_IT_MERGED'.
lwa_fieldcat-fieldname = 'HOUSE_NUM1'.
lwa_fieldcat-ref_tabname = 'ADRC'.
lwa_fieldcat-ref_fieldname = 'HOUSE_NUM1'.
lwa_fieldcat-row_pos = '1'.
lwa_fieldcat-col_pos = '6'.
append lwa_fieldcat to pa_it_fieldcat.
clear lwa_fieldcat.
lwa_fieldcat-tabname = 'PA_IT_MERGED'.
lwa_fieldcat-fieldname = 'TEL_NUMBER'.
lwa_fieldcat-ref_tabname = 'ADRC'.
lwa_fieldcat-ref_fieldname = 'TEL_NUMBER'.
lwa_fieldcat-row_pos = '1'.
lwa_fieldcat-col_pos = '7'.
append lwa_fieldcat to pa_it_fieldcat.
clear lwa_fieldcat.
lwa_fieldcat-tabname = 'PA_IT_MERGED'.
lwa_fieldcat-fieldname = 'FAX_NUMBER'.
lwa_fieldcat-ref_tabname = 'ADRC'.
lwa_fieldcat-ref_fieldname = 'FAX_NUMBER'.
lwa_fieldcat-row_pos = '1'.
lwa_fieldcat-col_pos = '8'.
append lwa_fieldcat to pa_it_fieldcat.
clear lwa_fieldcat.
lwa_fieldcat-tabname = 'PA_IT_MERGED'.
lwa_fieldcat-fieldname = 'NAMEV'.
lwa_fieldcat-ref_tabname = 'KNVK'.
lwa_fieldcat-ref_fieldname = 'NAMEV'.
lwa_fieldcat-row_pos = '1'.
lwa_fieldcat-col_pos = '9'.
lwa_fieldcat-seltext_l = 'Contact first name'.
lwa_fieldcat-seltext_m = 'Contact Fname'.
lwa_fieldcat-seltext_s = 'Ctct Fname'.
lwa_fieldcat-ddictxt = 'L'.
append lwa_fieldcat to pa_it_fieldcat.
clear lwa_fieldcat.
lwa_fieldcat-tabname = 'PA_IT_MERGED'.
lwa_fieldcat-fieldname = 'NAMEW'.
lwa_fieldcat-ref_tabname = 'KNVK'.
lwa_fieldcat-ref_fieldname = 'NAME1'.
lwa_fieldcat-row_pos = '1'.
lwa_fieldcat-col_pos = '10'.
lwa_fieldcat-seltext_l = 'Contact last name'.
lwa_fieldcat-seltext_m = 'Contact Lname'.
lwa_fieldcat-seltext_s = 'Ctxt Lname'.
lwa_fieldcat-ddictxt = 'L'.
append lwa_fieldcat to pa_it_fieldcat.
clear lwa_fieldcat.
lwa_fieldcat-tabname = 'PA_IT_MERGED'.
lwa_fieldcat-fieldname = 'TELF1'.
lwa_fieldcat-ref_tabname = 'KNVK'.
lwa_fieldcat-ref_fieldname = 'TELF1'.
lwa_fieldcat-row_pos = '1'.
lwa_fieldcat-col_pos = '11'.
lwa_fieldcat-seltext_l = 'Contact phone no.'.
lwa_fieldcat-seltext_m = 'Contact phone'.
lwa_fieldcat-seltext_s = 'Ctct Phne'.
lwa_fieldcat-ddictxt = 'L'.
append lwa_fieldcat to pa_it_fieldcat.
clear lwa_fieldcat.
lwa_fieldcat-tabname = 'PA_IT_MERGED'.
lwa_fieldcat-fieldname = 'KLIMK'.
lwa_fieldcat-ref_tabname = 'KNKK'.
lwa_fieldcat-ref_fieldname = 'KLIMK'.
lwa_fieldcat-row_pos = '1'.
lwa_fieldcat-col_pos = '12'.
lwa_fieldcat-seltext_l = 'Credit limit'.
lwa_fieldcat-seltext_m = 'Credit limit'.
lwa_fieldcat-seltext_s = 'Crdt limit'.
lwa_fieldcat-ddictxt = 'L'.
append lwa_fieldcat to pa_it_fieldcat.
clear lwa_fieldcat.
lwa_fieldcat-tabname = 'PA_IT_MERGED'.
lwa_fieldcat-fieldname = 'SKFOR'.
lwa_fieldcat-ref_tabname = 'KNKK'.
lwa_fieldcat-ref_fieldname = 'SKFOR'.
lwa_fieldcat-row_pos = '1'.
lwa_fieldcat-col_pos = '13'.
lwa_fieldcat-seltext_l = 'Credit used'.
lwa_fieldcat-seltext_m = 'Credit used'.
lwa_fieldcat-seltext_s = 'Crdt used'.
lwa_fieldcat-ddictxt = 'L'.
append lwa_fieldcat to pa_it_fieldcat.
clear lwa_fieldcat.
lwa_fieldcat-tabname = 'PA_IT_MERGED'.
lwa_fieldcat-fieldname = 'TOTAL'.
lwa_fieldcat-ref_tabname = 'BSAD'.
lwa_fieldcat-ref_fieldname = 'DMBTR'.
lwa_fieldcat-row_pos = '1'.
lwa_fieldcat-col_pos = '14'.
lwa_fieldcat-seltext_l = 'Total'.
lwa_fieldcat-seltext_m = 'Total'.
lwa_fieldcat-seltext_s = 'Total'.
lwa_fieldcat-ddictxt = 'L'.
append lwa_fieldcat to pa_it_fieldcat.
clear lwa_fieldcat.
lwa_fieldcat-tabname = 'PA_IT_MERGED'.
lwa_fieldcat-fieldname = 'RAST1'.
lwa_fieldcat-ref_tabname = 'BSAD'.
lwa_fieldcat-ref_fieldname = 'DMBTR'.
lwa_fieldcat-row_pos = '1'.
lwa_fieldcat-col_pos = '15'.
--WG1K903216: Start Delete-
concatenate '<'
rastbis2
into lwa_fieldcat-seltext_l
separated by space.
--WG1K903216: End Delete---
--WG1K903216: Start Insert-
clear: v_datum,
v_datxt.
v_noday = rastbis2.
Always use the middle of the report month as a heading reference date.
concatenate p_datum+0(6) '15' into v_mdmth.
call function 'ZWAG_DATE_CALCULATOR'
exporting i_datum = v_mdmth
i_noday = v_noday
i_oprnd = '+'
importing e_datum = v_datum
exceptions invalid_operand = 1.
call function 'ZWAG_END_MONTH'
exporting i_datum = v_datum
importing e_datum = v_datum
e_datxt = v_datxt
exceptions invalid_date = 1.
concatenate 'Due' v_datxt into lwa_fieldcat-seltext_l
separated by space.
--WG1K903216: End Insert---
lwa_fieldcat-seltext_m = lwa_fieldcat-seltext_l.
lwa_fieldcat-seltext_s = lwa_fieldcat-seltext_l.
lwa_fieldcat-ddictxt = 'L'.
append lwa_fieldcat to pa_it_fieldcat.
clear lwa_fieldcat.
lwa_fieldcat-tabname = 'PA_IT_MERGED'.
lwa_fieldcat-fieldname = 'RAST2'.
lwa_fieldcat-ref_tabname = 'BSAD'.
lwa_fieldcat-ref_fieldname = 'DMBTR'.
lwa_fieldcat-row_pos = '1'.
lwa_fieldcat-col_pos = '16'.
--WG1K903216: Start Delete-
concatenate rastbis1
rastbis2
into lwa_fieldcat-seltext_l
separated by co_delim_dash.
--WG1K903216: End Delete---
--WG1K903216: Start Insert-
clear: v_datum,
v_datxt.
v_noday = rastbis1.
call function 'ZWAG_DATE_CALCULATOR'
exporting i_datum = v_mdmth
i_noday = v_noday
i_oprnd = '+'
importing e_datum = v_datum
exceptions invalid_operand = 1.
call function 'ZWAG_END_MONTH'
exporting i_datum = v_datum
importing e_datum = v_datum
e_datxt = v_datxt
exceptions invalid_date = 1.
concatenate 'Due' v_datxt into lwa_fieldcat-seltext_l
separated by space.
--WG1K903216: End Insert---
lwa_fieldcat-seltext_m = lwa_fieldcat-seltext_l.
lwa_fieldcat-seltext_s = lwa_fieldcat-seltext_l.
lwa_fieldcat-ddictxt = 'L'.
append lwa_fieldcat to pa_it_fieldcat.
clear lwa_fieldcat.
lwa_fieldcat-tabname = 'PA_IT_MERGED'.
lwa_fieldcat-fieldname = 'RAST3'.
lwa_fieldcat-ref_tabname = 'BSAD'.
lwa_fieldcat-ref_fieldname = 'DMBTR'.
lwa_fieldcat-row_pos = '1'.
lwa_fieldcat-col_pos = '17'.
--WG1K903216: Start Delete-
concatenate rastbis2
rastbis3
into lwa_fieldcat-seltext_l
separated by co_delim_dash.
--WG1K903216: End Delete---
--WG1K903216: Start Insert-
clear: v_datum,
v_datxt.
v_noday = rastbis2.
call function 'ZWAG_DATE_CALCULATOR'
exporting i_datum = v_mdmth
i_noday = v_noday
i_oprnd = '-'
importing e_datum = v_datum
exceptions invalid_operand = 1.
call function 'ZWAG_END_MONTH'
exporting i_datum = v_datum
importing e_datum = v_datum
e_datxt = v_datxt
exceptions invalid_date = 1.
concatenate 'Due' v_datxt into lwa_fieldcat-seltext_l
separated by space.
--WG1K903216: End Insert---
lwa_fieldcat-seltext_m = lwa_fieldcat-seltext_l.
lwa_fieldcat-seltext_s = lwa_fieldcat-seltext_l.
lwa_fieldcat-ddictxt = 'L'.
append lwa_fieldcat to pa_it_fieldcat.
clear lwa_fieldcat.
lwa_fieldcat-tabname = 'PA_IT_MERGED'.
lwa_fieldcat-fieldname = 'RAST4'.
lwa_fieldcat-ref_tabname = 'BSAD'.
lwa_fieldcat-ref_fieldname = 'DMBTR'.
lwa_fieldcat-row_pos = '1'.
lwa_fieldcat-col_pos = '18'.
--WG1K903216: Start Delete-
concatenate rastbis3
rastbis4
into lwa_fieldcat-seltext_l
separated by co_delim_dash.
--WG1K903216: End Delete---
--WG1K903216: Start Insert-
clear: v_datum,
v_datxt.
v_noday = rastbis3.
call function 'ZWAG_DATE_CALCULATOR'
exporting i_datum = v_mdmth
i_noday = v_noday
i_oprnd = '-'
importing e_datum = v_datum
exceptions invalid_operand = 1.
call function 'ZWAG_END_MONTH'
exporting i_datum = v_datum
importing e_datum = v_datum
e_datxt = v_datxt
exceptions invalid_date = 1.
concatenate 'Due' v_datxt into lwa_fieldcat-seltext_l
separated by space.
--WG1K903216: End Insert---
lwa_fieldcat-seltext_m = lwa_fieldcat-seltext_l.
lwa_fieldcat-seltext_s = lwa_fieldcat-seltext_l.
lwa_fieldcat-ddictxt = 'L'.
append lwa_fieldcat to pa_it_fieldcat.
clear lwa_fieldcat.
lwa_fieldcat-tabname = 'PA_IT_MERGED'.
lwa_fieldcat-fieldname = 'RAST5'.
lwa_fieldcat-ref_tabname = 'BSAD'.
lwa_fieldcat-ref_fieldname = 'DMBTR'.
lwa_fieldcat-row_pos = '1'.
lwa_fieldcat-col_pos = '19'.
--WG1K903216: Start Delete-
concatenate rastbis4
rastbis5
into lwa_fieldcat-seltext_l
separated by co_delim_dash.
--WG1K903216: End Delete---
--WG1K903216: Start Insert-
clear: v_datum,
v_datxt.
v_noday = rastbis4.
call function 'ZWAG_DATE_CALCULATOR'
exporting i_datum = v_mdmth
i_noday = v_noday
i_oprnd = '-'
importing e_datum = v_datum
exceptions invalid_operand = 1.
call function 'ZWAG_END_MONTH'
exporting i_datum = v_datum
importing e_datum = v_datum
e_datxt = v_datxt
exceptions invalid_date = 1.
concatenate 'Due' v_datxt into lwa_fieldcat-seltext_l
separated by space.
--WG1K903216: End Insert---
lwa_fieldcat-seltext_m = lwa_fieldcat-seltext_l.
lwa_fieldcat-seltext_s = lwa_fieldcat-seltext_l.
lwa_fieldcat-ddictxt = 'L'.
append lwa_fieldcat to pa_it_fieldcat.
clear lwa_fieldcat.
lwa_fieldcat-tabname = 'PA_IT_MERGED'.
lwa_fieldcat-fieldname = 'RAST6'.
lwa_fieldcat-ref_tabname = 'BSAD'.
lwa_fieldcat-ref_fieldname = 'DMBTR'.
lwa_fieldcat-row_pos = '1'.
lwa_fieldcat-col_pos = '20'.
--WG1K903216: Start Delete-
concatenate '>'
rastbis5
into lwa_fieldcat-seltext_l
separated by space.
--WG1K903216: End Delete---
--WG1K903216: Start Insert-
clear: v_datum,
v_datxt.
v_noday = rastbis5.
call function 'ZWAG_DATE_CALCULATOR'
exporting i_datum = v_mdmth
i_noday = v_noday
i_oprnd = '-'
importing e_datum = v_datum
exceptions invalid_operand = 1.
call function 'ZWAG_END_MONTH'
exporting i_datum = v_datum
importing e_datum = v_datum
e_datxt = v_datxt
exceptions invalid_date = 1.
concatenate 'Due By' v_datxt into lwa_fieldcat-seltext_l
separated by space.
--WG1K903216: End Insert---
lwa_fieldcat-seltext_m = lwa_fieldcat-seltext_l.
lwa_fieldcat-seltext_s = lwa_fieldcat-seltext_l.
lwa_fieldcat-ddictxt = 'L'.
append lwa_fieldcat to pa_it_fieldcat.
endform. " build_field_catalog
*& Form output_report_via_alv
text
form output_report_via_alv
tables pa_it_fieldcat type slis_t_fieldcat_alv
pa_it_merged type ty_it_merged.
Local variables
data:
lva_repid like sy-repid,
lva_formname type slis_formname.
lva_repid = sy-repid.
lva_formname = 'USER_COMMAND'.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = lva_repid
i_callback_user_command = lva_formname
i_save = 'A'
is_variant = st_variant
it_fieldcat = pa_it_fieldcat[]
tables
t_outtab = pa_it_merged
exceptions
program_error = 1
others = 2.
endform. " output_report_via_alvHi shiva
Thanks for your help,
Can you check this coding and revert me back ASAP Please.
REPORT BDS_GOS_CONNECTION.
DATA : logical_system LIKE BAPIBDS01-log_system.
CLASSNAME LIKE BAPIBDS01-CLASSNAME
OBJKEY LIKE SWOTOBJID-objkey.
PARAMETERS: pa_lo_sys BAPIBDS01-log_system,
pa_class like BPIBDS01-CLASSNAME,
pa_objkey like swotobjidobjkey.
AT SELECTION-SCREEN.
CALL FUNCTION 'BDS_GOS_CONNECTIONS_GET'
EXPORTING
bor_id = bor_id
IMPORTING
logical_sytem = pa_lo_sys.
classname = pa_class.
objkey = pa_objkey.
EXCEPTIONS
no_objects_found = 1
internal_error = 2
internal_gos_error = 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.
clear v_attno1.
i_object1-typeid = 'BUS2012'.
i_object1-catid = 'BO'.
i_object1-instid = i_yItem-docno.
call method cl_gos_attachment_query=>count_for_object
exporting
is_object = i_object1
ip_arl = space
receiving
rt_stat = i_stat1.
read table i_stat1 into wa_stat1 index 1.
if sy-subrc eq c_0.
move wa_stat1-counter to v_attno1.
endif.
CALL METHOD cl_gos_attachment_query=>count_for_object
EXPORTING
is_object = object
ip_arl = space
RECEIVING
rt_stat = lt_stat.
READ TABLE lt_stat INDEX 1 into ls_stat.
count = ls_stat-counter.
*The object has to be a concatenation of your document, like this:
CONCATENATE object-instid tab-gjahr INTO object-instid.
ELSE.
CONCATENATE tab-bukrs tab-belnr tab-gjahr INTO
object-instid.
ENDIF. -
Function Module to Release Scheduled Jobs
Dear All,
I have a requirement to create all the background jobs in SCHEDULED status, this is achieved by using the function modules JOB_OPEN, JOB_SUBMIT and JOB_CLOSE.
Now at a later point of time, i want to release only a few jobs, which were created using the above mentioned procedure. Insead of doing it manually, is there any way to automate this step ??
Regards,
kartikDear Mr. Parupalli,
That solved my problem. Thank you.
Regards,
kartik -
Call RFC Function Module and return 1000 records at a time
I would like to call a Remote Enabled Function Module from a non SAP system. This function module will select data from the database and return it to the calling program.
Suppose there are 100,000 records that need to be returned, but the calling module would like the data in chunks of 1000 records. Therefore the calling program would call the FM 100 times.
How do I code the function module to know on each subsequent call to grab the next chunk of 1000 records?
Let me know if additional information is needed.
Thanks,
AaronHello,
Here is how you can go for this issue:
1. Create one RFC function module with following parameter. These parameters are with respective of chunking logic.
Import: Package Size
Export: Total number of records
Changing: chunk count
Implement following logic:
1. First of you need to know how many chunks you need to fetch for that get the count of total number of records. This is one
time activity so you better maintain one flag import parameter will be set to 'X' only first call.
2. Get the number of chunk using total number of records / chunk size for e.g. 1000 / 100 so chunk count = 10.
3. Define internal chunk counter in function module which will be used to locate the correct chunk depending on the chunk
counter value sent from calling program.
4. Send first call with package size 100 and chunk count = 1, execute select statement and increment internal
chunk count check if chunk count = internal chunk count in current case chunk count = 1 so exit select statement and return
with first chunk.
5. Send second call with package size 100 and chunk count = 2. Execute select statement and check chunk count with internal
chunk counter, in current case it will be 1 so skip that data and go for next chunk of 100 records increment internal chunk
counter. In this case it will match with external chunk count = 2. load output table with that data and return to calling program.
6. Repeat step 4 until you reach last chunk.
You need to use SELECT...ENDSELECT with PACKAGE SIZE addition so for every loop it will return number of records mentioned in package size.
Hope this helps.
Thanks,
Augustin. -
Error while passing a table to a function module
Hi Iam passing a table g_tab of length 376 flat structure to the function module..under TABLES section parameter.
Changedocument_read_headers.
iam getting a complile time error like the below displayed thing. Can u tell me how to solve this ?
In the function module interface, you can specify only
fields of a specific type and length under "I_CDHDR".
Although the currently specified field
"G_CDHDR_TAB" is the correct type, its length is incorrect.
Edited by: kiran kumar on Jul 7, 2008 8:53 AMprobably u making a mistake while declaring the table
declare it like this in the tables section:
S_JOB LIKE RNGE_OBJID
where s_job is the internal table name and RANGE_OBJID is a structure type and NOT an internal table type. -
RFC Error While Invoking A Remote Function Module.
I am invoking A remote function module while invoking it get an exception when i see the error logs
com.sap.tc.webdynpro.modelimpl.dynamicrfc.WDDynamicRFCExecuteException: Screen output without connection to user. , error key: RFC_ERROR_SYSTEM_FAILURE at com.sap.tc.webdynpro.modelimpl.dynamicrfc.DynamicRFCModelClassExecutable.execute(DynamicRFCModelClassExecutable.java:101) at... [see details]
can anyone pls tell me what the error is..
regards
Nilesh Taunk.Hi Nilesh Taunk,
You can go through the following steps
-o JCO Exceptions 1. http://help.sap.com/saphelp_nw04s/helpdata/en/f6/daea401675752ae10000000a155106/frameset.htm
-o JCO Exceptions 2. http://help.sap.com/saphelp_nw04/helpdata/en/f6/e002416225f023e10000000a155106/frameset.htm
-o Restart of the J2EE instance and try re-importing the RFC model. Sometimes it helps.
-o Logon into WebDynpro Content Administrator as a J2EE Admin and check if the JCO Connections and User /pwd of your application is correct. You can <b>ping </b>or <b>test your JCO connections</b>. if something is wrong, enter the values again for JCO n retest them.
-o Try undeploying or removing the complete application and redeploy it.
Tu undeploy please go to
Go to <b>Visual Admin -> Server -> Services -> Deploy ->
</b>
Under Runtime Tab
select the server, open the tree , you would find the webdypro list there.
Now select an application, first stop it, remove it and redeploy if necessary.
Let us know if you could solve the problem or not, gud luck!
Rgds,
Sreenivas. -
Error while generating Web Service from a function module.
Hi Experts,
I am trying to create a web service from function module by doing the steps as mentioned in the below document:
http://www.sdn.sap.com/irj/scn/index;jsessionid=(J2EE3417800)ID1146834250DB10778842957931285337End?rid=/library/uuid/80fa3dff-ce76-2a10-3f94-f3df8f2db5a2&overridelayout=true
When i save it as an local object instead of generating the Web Service it gives me the below error:
"Error during activation of Web Service"
Kindly let me know what needs to be done inorder to resolve this issue.
I have a feeling that this error may be with respect to some authorizations, in that case how do we resolve it
Helpful Inputs Awaited.!!!
Thanks
DhwaniHi Dhawani,
Hi Pavan,
Can you please elaborate...how this will help??
Thanks
Dhwani
I dont know the specific reason but internally there may some inconsistancy but i faced the same error and i tried with saving it in the package.
Thanks -
CNTL_ERROR while calling a function module from Java webdynpro
I am calling a RFC function module from javawebdynpro app
which inturn calls a function module performing BDC on CAPP transaction. When I run this from SE37 of the same system or a different system everything works fine. But when called from Java webdynpro app, it raises a CNTL_ERROR exception and creates a short dump.
Any help on this is highly appreciatedGood catch, BI Learner. This was exactly it: when assigning the values from SOURCEFIELDS directly to the import/export parameters, you have to make sure that the types are EXACTLY the same, otherwise it will not work (the routine stops with an error when calling the FM, but there is no dump).
Therefore, to solve my problem, I created the declarations precisely as expected by the FM and assigned the values to these fields:
DATA:
SOURCEVAL TYPE /BIC/OIINVQTY,
SOURCEUOM TYPE /BIC/OIUSUOM,
USITM TYPE /BIC/OIUSITM,
TARGETUOM TYPE /BIC/OIUSUOM,
CONVERTED_COST TYPE /BIC/OIINVQTY.
DATA PRODUCTION_UOM TYPE /BIC/OIUSUOM.
" get the Production UOM
SELECT SINGLE I~/BIC/USPRDUOM
FROM /BIC/PUSITM AS I
INTO PRODUCTION_UOM
WHERE I~/BIC/USITM = SOURCE_FIELDS-/BIC/USITM AND I~OBJVERS = 'A'.
IF ( SY-SUBRC = 4 ). " no records found
"RAISE PARTNO_NOT_FOUND.
RAISE EXCEPTION TYPE CX_RSROUT_SKIP_RECORD.
ENDIF.
" load the parameters
SOURCEVAL = SOURCE_FIELDS-/BIC/USFRZMFC.
SOURCEUOM = SOURCE_FIELDS-BASE_UOM.
USITM = SOURCE_FIELDS-/BIC/USITM.
" then you can call the FM
CALL FUNCTION 'Z_CA_CONVERT_US_COST'
EXPORTING
PSOURCEVAL = SOURCEVAL
PSOURCEUOM = SOURCEUOM
PUSITM = USITM
PTARGETUOM = PRODUCTION_UOM
IMPORTING
PTARGETVAL = CONVERTED_COST
EXCEPTIONS
CONVERSION_NOT_MAINTAINED = 1
PARTNO_NOT_FOUND = 2
OTHERS = 3.
" ... [do the rest]
Thanks for your help,
Dennis -
Error in creation of function module in e.c.c 6.0
HI GURUS,
i encountered a problem while creating function module in e.c.c 6.0, the error is 'THE MAIN PROGRAM OF DOES NOT BEGIN WITH "FUNCTION-POOL". kindly help me in solving this issue.Hi,
You need to activate the Function Group.
GO to Se80 --> Select function group from list box --> press enter --> Select you function group > Right click> Activate.
Thanks,
Sriram Ponna.
Maybe you are looking for
-
Satellite A135-S2246: Question about warranty from Toshiba USA
Hello Everyone! Have question, My Father buyed me a toshiba Satellite A135-S2246 in USA he has got Laptop without any cd /windows vista home bassic/ and documents /like a warranty/. Anyone can tell me if the Toshiba in USA give cd and warranty with t
-
Ipod no longer works when I hook it up to stereo
I have a 30GB ipod and when I ordered it a year ago, I also ordered a cable to connect it to a stereo system (with the red and white plugs). It has always worked before, but when I tried it a couple of weeks ago, I got nothing. I tried turning up the
-
Autopatch - Error running adutlrcmp.pls in adprdcAdUtilrcmp()
Hi, We have recently migrated our EBS 10g database from 32 bit RHEL4 server to 64 bit OEL5 server. All the apps servers are runing on 32 bit RHEL 4 server. After migrating all apps services are working fine. Now i am trying to upgrade the database to
-
MM01 material copy from at plant levele
Hi, I have a simple but very important question to ask about MM01 material "copy from" function. When you copy a material at an organisational level other than general data (at plant level for exemple), SAP copies some data and left some others blank
-
AS3: DisplayList and EventListeners
I was wondering if there's a way to monitor the DisplayList so that you can see when items get removed/Garbage Collected. And is there a way to monitor EventListeners so that you can see if you're effectively removing them when they're no longer need