2007 Jul 18 2:34 PM
hi this is kumar please clarify my doubt in table control
1. hw to take care of screen resolution while working with table control i.e..some system may have the GUI setting as 15 lines while some other system may have 10 lines per screen so hw to set n take care of this issue please clarify this doubt it important
2.wht is transactional data? hw to do bdc fr tansactional data?if anybody is having sample programe regarding this transactional data bdc, please send it to me.
2007 Jul 18 4:37 PM
hi,
screen resolution:
in bdc we can set the screen resolution by using ctu_params structure.
data : opt like ctu_params occurs 0 with header line,
bdcdata like itbdcdata occurs 0 with header line.
opt-updmode = 's'.
opt-dismode = 'a'.
opt--defsize = 'x'.
call transaction 'xk01' using itbdcdata options from opt.
Data : s_res type CTU_PARAMS,
s_res-updmode = 'S'. " Update S/A
s_res-defsize = 'X'. " it shows default table control line
s_res-dismode = 'N'. " Screen display mode = A/E/N
call transaction <Tcode> using <bdcdata> options from s_res.
2007 Jul 18 3:29 PM
hi,
2.wht is transactional data? hw to do bdc fr tansactional data?if anybody is having sample programe regarding this transactional data bdc, please send it to me.
ans:Transaction data are nothing but the Purchase order datas,sales order datas ,Enquiry data and not material master ,customer master datas.
Program
&----
*& Report Z243_KA_BD_01
*&
&----
*&
*&
&----
REPORT Z243_KA_BD_01.
TABLES : ZSALES_ORDER.
&----
DATA:OK_CODE LIKE SY-UCOMM.
DATA : BATCH(6),CALL(6) .
DATA :I TYPE I,A TYPE I.
DATA: IT_TAB LIKE TABLE OF ZSALES_ORDER WITH HEADER LINE,
WA_TAB LIKE LINE OF IT_TAB.
DATA: IT_BDCTAB LIKE TABLE OF BDCDATA WITH HEADER LINE .
DATA: IT_MESS LIKE TABLE OF BDCMSGCOLL WITH HEADER LINE,
WA_MESS LIKE LINE OF IT_MESS.
DATA: R(10) TYPE C.
&--
SELECTION-SCREEN : BEGIN OF SCREEN 9004.
SELECT-OPTIONS MAT_NO FOR ZSALES_ORDER-MATERIAL_NO.SKIP.
SELECT-OPTIONS CUST_NO FOR ZSALES_ORDER-CUSTOMER_NO .SKIP.
PARAMETERS: UPLOADED.
SELECTION-SCREEN : END OF SCREEN 9004.
CALL SCREEN 9002.
&----
*& Module USER_COMMAND_9002 INPUT
&----
text
----
MODULE USER_COMMAND_9002 INPUT.
CASE OK_CODE.
WHEN 'UPLOAD'.
CALL SCREEN 9003.
WHEN 'REPORT'.
LEAVE TO LIST-PROCESSING.
WRITE :'NO OF RECORDS READ'.
DESCRIBE TABLE IT_TAB LINES A.
WRITE A.
SELECT COUNT(*) FROM ZSALES_ORDER INTO I.
SKIP.
ULINE.
WRITE: / 'NO OF RECORDS UPLOADED'. WRITE I.
ULINE.
SELECT * FROM ZSALES_ORDER INTO ZSALES_ORDER.
WRITE: / 'MATERIAL NO ', 'CUSTOMER NO','CUSTOMER MATE NO','SLAES ORGANISATION','PROCESSING ORG',' TRAN AMT'.
WRITE: / ZSALES_ORDER-MATERIAL_NO UNDER 'MATERIAL NO '.write:12 sy-vline, ZSALES_ORDER-CUSTOMER_NO UNDER 'CUSTOMER NO'.write:20 sy-vline,
ZSALES_ORDER-CUST_MAT_NO UNDER 'CUSTOMER MATE NO'.write:30 sy-vline, ZSALES_ORDER-SALE_ORG UNDER 'SLAES ORGANISATION'.write:40 sy-vline,
ZSALES_ORDER-PROCESS_DATE UNDER 'PROCESSING ORG'.write:50 sy-vline, ZSALES_ORDER-TRAN_AMT UNDER 'TRAN AMT'.write:60 sy-vline.
ENDSELECT.
SKIP.
ULINE.
WRITE: ' NO OF ERRORS RECORDS'.
DESCRIBE TABLE IT_TAB LINES A.
WRITE: A.
SET PF-STATUS SPACE.
WHEN 'EXIT'.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE. " USER_COMMAND_9002 INPUT
&----
*& Module USER_COMMAND_9003 INPUT
&----
text
----
MODULE USER_COMMAND_9003 INPUT.
CLEAR OK_CODE.
IF CALL = 'X'.
CALL SELECTION-SCREEN 9004.
REFRESH IT_TAB.
SELECT * FROM ZSALES_ORDER.
CHECK MAT_NO.
IT_TAB-MATERIAL_NO = ZSALES_ORDER-MATERIAL_NO.
APPEND IT_TAB.
ENDSELECT.
PERFORM GUI_UPLOAD.
PERFORM TRAN USING 'Z243BDC'.
ELSEIF BATCH = 'X'.
CALL SELECTION-SCREEN 9004.
PERFORM GUI_UPLOAD.
PERFORM BATCH_TRANSACTION.
ENDIF.
ENDMODULE. " USER_COMMAND_9003 INPUT
&----
*& Form GUI_UPLOAD
&----
text
----
--> p1 text
<-- p2 text
----
FORM GUI_UPLOAD .
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = 'C:\siva\bdcflatfile.TXT'
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
TABLES
DATA_TAB = IT_TAB
.
IF SY-SUBRC <> 0.
ENDIF.
LOOP AT IT_TAB INTO WA_TAB.
PERFORM PNAME USING 'Z243_KA_BDC_01' '9001'.
PERFORM FNAME USING 'ZSALES_ORDER-MATERIAL_NO' WA_TAB-MATERIAL_NO.
PERFORM FNAME USING 'ZSALES_ORDER-CUSTOMER_NO' WA_TAB-CUSTOMER_NO.
PERFORM FNAME USING 'ZSALES_ORDER-CUST_MAT_NO' WA_TAB-CUST_MAT_NO.
PERFORM FNAME USING 'ZSALES_ORDER-SALE_ORG' WA_TAB-SALE_ORG.
PERFORM FNAME USING 'ZSALES_ORDER-PROCESS_DATE' WA_TAB-PROCESS_DATE.
PERFORM FNAME USING 'ZSALES_ORDER-TRAN_AMT' WA_TAB-TRAN_AMT.
PERFORM FNAME USING 'BDC_OKCODE' '=SAVE'.
ENDLOOP.
PERFORM PNAME USING 'Z243_KA_BDC_01' '9001'.
PERFORM FNAME USING 'BDC_OKCODE' '=EXIT'.
DESCRIBE TABLE IT_TAB LINES A.
ENDFORM. " GUI_UPLOAD
&----
*& Form PNAME
&----
text
----
-->P_0105 text
-->P_0106 text
----
FORM PNAME USING PRGNAME
SCRNAME.
CLEAR IT_BDCTAB.
IT_BDCTAB-PROGRAM = PRGNAME.
IT_BDCTAB-DYNPRO = SCRNAME.
IT_BDCTAB-DYNBEGIN = 'X'.
APPEND IT_BDCTAB.
ENDFORM. " PNAME
&----
*& Form FNAME
&----
text
----
-->P_0110 text
-->P_WA_TAB_MATERIAL_NO text
----
FORM FNAME USING FIELDNAME
FIELDVAL.
CLEAR : IT_BDCTAB.
IT_BDCTAB-FNAM = FIELDNAME.
IT_BDCTAB-FVAL = FIELDVAL.
APPEND IT_BDCTAB.
ENDFORM. " FNAME
&----
*& Form TRAN
&----
text
----
-->P_0054 text
----
FORM TRAN USING STRAN.
CALL TRANSACTION STRAN USING IT_BDCTAB
MODE 'N'
UPDATE 'S'
MESSAGES INTO IT_MESS.
ENDFORM. " TRAN
&----
*& Form BATCH_TRANSACTION
&----
text
----
--> p1 text
<-- p2 text
----
FORM BATCH_TRANSACTION .
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
CLIENT = SY-MANDT
GROUP = 'SIVA'
USER = sy-uname.
IF SY-SUBRC <> 0.
ENDIF.
CALL FUNCTION 'BDC_INSERT'
EXPORTING
TCODE = 'Z243BDC'
TABLES
DYNPROTAB = IT_BDCTAB
.
IF SY-SUBRC <> 0.
ENDIF.
CALL FUNCTION 'BDC_CLOSE_GROUP'
.
IF SY-SUBRC <> 0.
ENDIF.
CALL TRANSACTION 'SM35'.
ENDFORM. " BATCH_TRANSACTION
&----
*& Module STATUS_9003 OUTPUT
&----
text
----
MODULE STATUS_9003 OUTPUT.
SET PF-STATUS 'SCREEN'.
SET TITLEBAR 'xxx'.
ENDMODULE. " STATUS_9003 OUTPUT
<b>Reward points if you feel this helpful</b>
Siva
2007 Jul 18 4:37 PM
hi,
screen resolution:
in bdc we can set the screen resolution by using ctu_params structure.
data : opt like ctu_params occurs 0 with header line,
bdcdata like itbdcdata occurs 0 with header line.
opt-updmode = 's'.
opt-dismode = 'a'.
opt--defsize = 'x'.
call transaction 'xk01' using itbdcdata options from opt.
Data : s_res type CTU_PARAMS,
s_res-updmode = 'S'. " Update S/A
s_res-defsize = 'X'. " it shows default table control line
s_res-dismode = 'N'. " Screen display mode = A/E/N
call transaction <Tcode> using <bdcdata> options from s_res.