06-12-2007 6:23 AM
Hi,
How to see the screen resolution in SAP on my screen?
Suppose I wanted to write the logic in call transaction & need to set by default lowest screen resolution.
How we can do it??
I wanted to write the page down logic in BDC after certain line. Anybody will pls tell me how to write it??
06-12-2007 6:29 AM
Hi,
For Screen Resolution we use the CTU_PARAMS,
look at the below for an example program
http://www.sap-img.com/ab001.htm
Here is the Example Program for Table Control
http://www.sap-basis-abap.com/abap/handling-table-control-in-bdc.htm
Regards
Sudheer
06-12-2007 6:37 AM
Hi neha,
Use CTU_PARAMS as OPTIONS in your BDC and it will handle the screen resolution.
See the help on CTU_PARAMS
You have to count the lines manually on the screen and to handle
see the sample code for ME51 tcode
REPORT zmm_pr_upload_mat
NO STANDARD PAGE HEADING
LINE-SIZE 255.
Standard Include for Selection Screen
INCLUDE bdcrecx1.
Internal Table for Upload Data
DATA: BEGIN OF i_pr OCCURS 0,
Header Screen
sno(3), " SNo
bsart(004), " PR Type
epstp(001), " Item Category
knttp(001), " Account Assignment
eeind(010), " Delivery Date
lpein(001), " Category of Del Date
werks(004), " Plant
lgort(004), " Storage Location
ekgrp(003), " Purchasing Group
matkl(009), " Material Group
bednr(010), " Tracking No
afnam(012), " Requisitioner
Item Details
matnr(018), " Material No
menge(017), " Quantity
badat(010),
frgdt(010),
preis(014), " Valuation Price
waers(005), " Currency
peinh(005),
wepos(001),
repos(001),
sakto(010), " GL Account
kostl(010), " Cost Center
bnfpo(005),
END OF i_pr.
Internal Table for header Data
DATA: BEGIN OF it_header OCCURS 0,
sno(3), " SNo
bsart(004), " PR Type
epstp(001), " Item Category
knttp(001), " Account Assignment
eeind(010), " Delivery Date
werks(004), " Plant
lgort(004), " Storage Location
ekgrp(003), " Purchasing Group
matkl(009), " Material Group
bednr(010), " Tracking No
afnam(012), " Requisitioner
END OF it_header.
Internal Table for Item Data
DATA: BEGIN OF it_item OCCURS 0,
sno(3), " SNo
matnr(018), " Material No
menge(017), " Quantity
preis(014), " Valuation Price
sakto(010), " GL Account
kostl(010), " Cost Center
END OF it_item.
Data Variables & Constants
CONSTANTS : c_x VALUE 'X'. " Flag
DATA : v_l(2), " Counter
v_rowno(5), " Row No
v_2(2), " Counter
v_rows LIKE sy-srows, " Rows in TC
v_field(45). " String
Parameters
PARAMETERS: p_file LIKE ibipparms-path. " Filename
At selection-screen on Value Request for file Name
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
Get the F4 Values for the File
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
IMPORTING
file_name = p_file.
Start of Selection
START-OF-SELECTION.
Open the BDC Session
PERFORM open_group.
Upload the File into internal Table
CALL FUNCTION 'UPLOAD'
EXPORTING
filename = p_file
filetype = 'DAT'
TABLES
data_tab = i_pr
EXCEPTIONS
conversion_error = 1
invalid_table_width = 2
invalid_type = 3
no_batch = 4
unknown_error = 5
gui_refuse_filetransfer = 6
OTHERS = 7.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
SORT i_pr BY sno.
LOOP AT i_pr.
MOVE-CORRESPONDING i_pr TO it_item.
APPEND it_item.
CLEAR it_item.
AT END OF sno.
READ TABLE i_pr INDEX sy-tabix.
MOVE-CORRESPONDING i_pr TO it_header.
APPEND it_header.
CLEAR it_header.
ENDAT.
ENDLOOP.
SORT it_header BY sno.
SORT it_item BY sno.
v_rows = sy-srows - 6.
Upload the Data from Internal Table
LOOP AT it_header.
Header Data
PERFORM bdc_dynpro USING 'SAPMM06B' '0100'.
PERFORM bdc_field USING 'BDC_CURSOR'
'EBAN-BEDNR'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'EBAN-BSART'
it_header-bsart.
PERFORM bdc_field USING 'RM06B-EPSTP'
it_header-epstp.
PERFORM bdc_field USING 'EBAN-KNTTP'
it_header-knttp.
PERFORM bdc_field USING 'RM06B-EEIND'
it_header-eeind.
PERFORM bdc_field USING 'RM06B-LPEIN'
it_header-lpein.
PERFORM bdc_field USING 'EBAN-WERKS'
it_header-werks.
PERFORM bdc_field USING 'EBAN-LGORT'
it_header-lgort.
PERFORM bdc_field USING 'EBAN-EKGRP'
it_header-ekgrp.
PERFORM bdc_field USING 'EBAN-MATKL'
it_header-matkl.
PERFORM bdc_field USING 'EBAN-BEDNR'
it_header-bednr.
PERFORM bdc_field USING 'EBAN-AFNAM'
it_header-afnam.
Item Details
v_l = 0.
To add no. of rows
v_2 = 0 .
As the screen is showing 13 rows defaulted to 130
v_rowno = 130 .
LOOP AT it_item WHERE sno = it_header-sno.
v_l = v_l + 1.
IF v_l = 14 .
IF v_2 = 12 .
v_2 = 12 .
v_l = 2 .
From second time onwards it is displaying 12 rows only
v_rowno = v_rowno + 120 .
PERFORM bdc_dynpro USING 'SAPMM06B' '0106'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RM06B-BNFPO'.
PERFORM bdc_field USING 'RM06B-BNFPO'
v_rowno.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
ELSE.
V_2 initialized to 12 for second screen purpose
v_2 = 12 .
v_l = 2 .
PERFORM bdc_dynpro USING 'SAPMM06B' '0106'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RM06B-BNFPO'.
PERFORM bdc_field USING 'RM06B-BNFPO'
v_rowno .
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
ENDIF.
ENDIF.
PERFORM bdc_dynpro USING 'SAPMM06B' '0106'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
CLEAR v_field.
CONCATENATE 'EBAN-MATNR(' v_l ')' INTO v_field.
PERFORM bdc_field USING v_field it_item-matnr.
CLEAR v_field.
CONCATENATE 'EBAN-MENGE(' v_l ')' INTO v_field.
PERFORM bdc_field USING v_field it_item-menge.
PERFORM bdc_dynpro USING 'SAPMM06B' '0102'.
PERFORM bdc_field USING 'BDC_CURSOR'
'EBAN-PREIS'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'EBAN-PREIS'
it_item-preis.
PERFORM bdc_dynpro USING 'SAPMM06B' '0505'.
PERFORM bdc_field USING 'BDC_CURSOR'
'EBKN-SAKTO'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTE'.
PERFORM bdc_field USING 'EBKN-SAKTO'
it_item-sakto.
Cost Center
PERFORM bdc_dynpro USING 'SAPLKACB' '0002'.
PERFORM bdc_field USING 'BDC_CURSOR'
'COBL-KOSTL'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTE'.
PERFORM bdc_field USING 'COBL-KOSTL'
it_item-kostl.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTE'.
ENDLOOP.
PERFORM bdc_dynpro USING 'SAPMM06B' '0106'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RM06B-BNFPO'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=BU'.
Call The Transaction
PERFORM bdc_transaction USING 'ME51'.
ENDLOOP.
Close the BDC Session
PERFORM close_group.
*Reward points
Regards
06-12-2007 7:20 AM
Hi,
I wanted to set the minimum screen resolution??
Please tell me how to set the minimum screen resolution??
06-12-2007 7:25 AM
Hi,
First thing: it should be better user BAPI.
Second thing: you should simulate the PLACE ITEM TO TOP functionality.
So if you have n items in your order, you have to place the n-item to top and so you can add the new item in second position.
If you have to insert another item, you place the last item you have added in top and so you insert it in second position.
In this way you can always add tne new item in the second position of table control
Regards
06-12-2007 10:05 AM
Hi,
I am trying to set the default screen resolution. While using the OPTIONS FROM in call transaction I am getting the
message that "You can't use the 'MODE' and 'UPDATE' additions together with the 'OPTIONS FROM' parameter."
I have wrote
Call transaction 'ZXY' using ITAB mode 'E' update 'S' options from i_ctu.
Anybody will pls tell me what I can do??
06-12-2007 7:22 AM
Hi Neha,
I encountered the similar problem of page down with CO-PA bdc program. What actually happens is, while recording the transaction the resolution of the screen will be with 13 rows/screen. But after recording it comes with the original number of rows. So to balance the screen resolution and the page down, we need to use CTU_PARAMS while calling the transaction with 'options' addition.
It is not required to write a separate code for page-down. The bdc itself will do it while recording the transaction, when you click on the page down after entering the value for a field. You can refer to the following code:
REPORT ZCOPA_POST_ACTUALDATA_LINEITEM NO STANDARD PAGE HEADING
LINE-SIZE 255.
**************************************************************
Declaring the Internal Table Variables **************
**************************************************************
DATA: BEGIN OF ITEM_INFO_TAB OCCURS 0,
BUDAT(10) TYPE C,
PERDE(3) TYPE C,
BUKRS(4) TYPE C,
VKORG(4) TYPE C,
KNDNR(10) TYPE C,
ARTNR(18) TYPE C,
WERKS(4) TYPE C,
FKART(4) TYPE C,
RKAUFNR(12) TYPE C,
BILL_QTY LIKE EKPO-MENGE,
REVEN LIKE BSEG-DMBTR,
WADAT(10) TYPE C,
FADAT(10) TYPE C,
END OF ITEM_INFO_TAB.
**************************************************************
Variable to store the successful & error messages *******
**************************************************************
DATA : V_MESSG TYPE STRING.
**************************************************************
Other external Variables ********************************
**************************************************************
DATA: V_MENGE(16) TYPE C,
V_REVEN(15) TYPE C,
V_ERR TYPE I,
V_LIN TYPE I,
DATE TYPE SY-DATUM.
data: i_ctu type ctu_params,
IT_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
*************************************************************
Internal Table for storing Error & Successful Messages **
*************************************************************
DATA: BEGIN OF I_BDCMSGCOLL OCCURS 0.
INCLUDE STRUCTURE BDCMSGCOLL.
DATA: END OF I_BDCMSGCOLL.
*************************************************************
Options mode for displaying with original resolution ***
*************************************************************
initialization.
i_ctu-dismode = 'A'.
i_ctu-updmode = 'S'.
i_ctu-cattmode = ' '.
i_ctu-defsize = 'X'.
i_ctu-nobinpt = 'X'.
----
Name & Location of the Flat File *
----
SELECTION-SCREEN BEGIN OF BLOCK A WITH FRAME TITLE TEXT-001.
SELECTION-SCREEN SKIP 1.
PARAMETER:P_FILE LIKE RLGRAP-FILENAME.
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN END OF BLOCK A.
CLEAR ITEM_INFO_TAB.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = SYST-CPROG
DYNPRO_NUMBER = SYST-DYNNR
IMPORTING
FILE_NAME = P_FILE.
****************************************************************
Pass Data to the Internal Table *******************
****************************************************************
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
FILENAME = P_FILE
FILETYPE = 'DAT'
TABLES
DATA_TAB = ITEM_INFO_TAB
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2.
CASE SY-SUBRC.
WHEN 1.
MESSAGE E704(FB) .
WHEN 2.
MESSAGE E705(FB).
WHEN OTHERS.
ENDCASE.
PERFORM CHECK_ITAB_DATA.
***********************************************************
Fill BDCDATA **
***********************************************************
START-OF-SELECTION.
REFRESH IT_BDCDATA.
***********************************************************
By Default the current 6.40 ver is taking the value for the Operating
*Concern and It allows the user to enter the values as per that
*consideration.
***********************************************************
perform bdc_dynpro using 'SAPLKEA3' '0200'.
perform bdc_field using 'BDC_CURSOR'
'RKEA2-ERKRS'.
perform bdc_field using 'BDC_OKCODE'
'=ENTE'.
perform bdc_field using 'RKEA2-ERKRS'
'TQSO'.
perform bdc_field using 'RKEA2-PA_TYPE_1'
'X'.
LOOP AT ITEM_INFO_TAB.
CLEAR : V_MENGE,V_REVEN.
**********************************************************
Operating Concern Pop-Up with TQSO *****************
**********************************************************
perform bdc_dynpro using 'SAPLKEA3' '0200'.
perform bdc_field using 'BDC_CURSOR'
'RKEA2-ERKRS'.
perform bdc_field using 'BDC_OKCODE'
'=ENTE'.
perform bdc_field using 'RKEA2-ERKRS'
'TQSO'.
perform bdc_field using 'RKEA2-PA_TYPE_1'
'X'.
**********************************************************
Screen Number '100' ***************************
**********************************************************
PERFORM BDC_DYNPRO USING 'SAPMKEI2' '0100'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'CEST1-PERDE'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=NEXT'.
PERFORM BDC_FIELD USING 'CEST1-VRGAR'
'f'.
PERFORM CHANGE_DATE USING ITEM_INFO_TAB-BUDAT.
PERFORM BDC_FIELD USING 'CEST1-BUDAT'
ITEM_INFO_TAB-BUDAT.
PERFORM BDC_FIELD USING 'CEST1-PERDE'
ITEM_INFO_TAB-PERDE.
PERFORM BDC_FIELD USING 'RADIOVAL1'
'X'.
PERFORM BDC_FIELD USING 'RADIOCURR1'
'X'.
**********************************************************
Screen Number '200' TabStrip*******************
**********************************************************
PERFORM BDC_DYNPRO USING 'SAPMKEI2' '0200'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=NEXT'.
**********************************************************
Tab1 of TabStrip ******************************
**********************************************************
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'GT_LINES-VALUE(12)'.
PERFORM BDC_FIELD USING 'GT_LINES-VALUE(02)'
ITEM_INFO_TAB-BUKRS.
PERFORM BDC_FIELD USING 'GT_LINES-VALUE(03)'
ITEM_INFO_TAB-VKORG.
PERFORM BDC_FIELD USING 'GT_LINES-VALUE(06)'
ITEM_INFO_TAB-KNDNR.
PERFORM BDC_FIELD USING 'GT_LINES-VALUE(11)'
ITEM_INFO_TAB-ARTNR.
PERFORM BDC_FIELD USING 'GT_LINES-VALUE(12)'
ITEM_INFO_TAB-WERKS.
PERFORM BDC_DYNPRO USING 'SAPMKEI2' '0200'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=NEXT'.
**********************************************************
Tab2 of TabStrip ******************************
**********************************************************
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'GT_LINES-VALUE(02)'.
PERFORM BDC_DYNPRO USING 'SAPMKEI2' '0200'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=NEXT'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'GT_LINES_VAL-VALUE(05)'.
PERFORM BDC_FIELD USING 'CEST1-FRWAE'
'USD'.
MOVE ITEM_INFO_TAB-BILL_QTY TO V_MENGE.
PERFORM BDC_FIELD USING 'GT_LINES_VAL-VALUE(01)'
V_MENGE.
MOVE ITEM_INFO_TAB-BILL_QTY TO V_REVEN.
V_REVEN = ITEM_INFO_TAB-REVEN.
PERFORM BDC_FIELD USING 'GT_LINES_VAL-VALUE(05)'
V_REVEN.
**********************************************************
Tab3 of TabStrip ******************************
**********************************************************
PERFORM BDC_DYNPRO USING 'SAPMKEI2' '0200'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=NEXT'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'GT_LINES_VAL-VALUE(01)'.
PERFORM BDC_FIELD USING 'CEST1-FRWAE'
'USD'.
PERFORM BDC_DYNPRO USING 'SAPMKEI2' '0200'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=NEXT'.
PERFORM BDC_DYNPRO USING 'SAPMKEI2' '0200'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=ABLT'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'CEST1-WADAT'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'CEST1-fADAT'.
PERFORM CHANGE_DATE USING ITEM_INFO_TAB-WADAT.
PERFORM BDC_FIELD USING 'CEST1-WADAT'
ITEM_INFO_TAB-WADAT.
PERFORM CHANGE_DATE USING ITEM_INFO_TAB-FADAT.
PERFORM BDC_FIELD USING 'CEST1-FADAT'
ITEM_INFO_TAB-FADAT.
PERFORM BDC_DYNPRO USING 'SAPMKEI2' '0200'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=BUCH'.
CALL TRANSACTION 'KE21N' USING IT_BDCDATA MODE 'A' UPDATE 'S' MESSAGES
INTO I_BDCMSGCOLL OPTIONS FROM I_CTU.
CLEAR: IT_BDCDATA[], ITEM_INFO_TAB.
ENDLOOP.
**********************************************************
Looping at BDCMSGCOLL to Trap the Errors ********
**********************************************************
LOOP AT I_BDCMSGCOLL.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = I_BDCMSGCOLL-MSGID
LANG = I_BDCMSGCOLL-MSGSPRA
NO = I_BDCMSGCOLL-MSGNR
V1 = I_BDCMSGCOLL-MSGV1
V2 = I_BDCMSGCOLL-MSGV2
V3 = I_BDCMSGCOLL-MSGV3
V4 = I_BDCMSGCOLL-MSGV4
IMPORTING
MSG = V_MESSG
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.
ELSE.
WRITE:/ I_BDCMSGCOLL-MSGTYP, V_MESSG.
ENDIF.
ENDLOOP.
----
Start new screen *
----
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR IT_BDCDATA.
IT_BDCDATA-PROGRAM = PROGRAM.
IT_BDCDATA-DYNPRO = DYNPRO.
IT_BDCDATA-DYNBEGIN = 'X'.
APPEND IT_BDCDATA.
ENDFORM. "BDC_DYNPRO
----
Insert field *
----
FORM BDC_FIELD USING FNAM FVAL.
CLEAR IT_BDCDATA.
IT_BDCDATA-FNAM = FNAM.
IT_BDCDATA-FVAL = FVAL.
APPEND IT_BDCDATA.
ENDFORM. "BDC_FIELD
&----
*& Form check_itab_data
&----
text
----
--> p1 text
<-- p2 text
----
FORM CHECK_ITAB_DATA .
DESCRIBE TABLE ITEM_INFO_TAB LINES V_LIN.
IF V_LIN = 0.
WRITE: 'File Empty or error uploading file'.
V_ERR = V_ERR + 1.
EXIT.
ENDIF.
ENDFORM. " check_itab_data
&----
*& Form change_date
&----
text
----
-->P_ITEM_INFO_TAB_BUDAT text
----
FORM CHANGE_DATE USING P_DATE.
CLEAR DATE.
DATE = P_DATE.
WRITE DATE TO P_DATE.
ENDFORM. " change_date
***Reward points if helpful.
Regards,
-Syed.