Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Screen Resolution Problem in Session Method

Former Member
0 Likes
633

Hi

How to resolve the screen resolution problem in BDC when we are using Session Method? Plz give me step by step.

I know how to do in Call Transaction Method.

4 REPLIES 4
Read only

Former Member
0 Likes
583

Only important thing in BDC, problems with screen resoution will occur onlyif you record in SHDB using default layout and thereafter, you try to fill with improper table control.

always search for the correct button for serial upload.

regards,

Sandeep Josyula

*Mark helpful answers

Read only

Former Member
0 Likes
583

Hi,

Check this example for session method

&----


*& Report Zxx_FK01_SESION *

*& *

&----


*& *

*& *

&----


REPORT Zxx_FK01_SESION message-id ztraining .

&----


*-- data declarationn

&----


types: begin of s_file ,

comp_code type lfb1-bukrs,

account_grp type lfa1-ktokk,

title type lfa1-anred,

name type lfa1-name1,

search type lfa1-sortl,

country type lfa1-land1,

end of s_file.

data:itab type s_file occurs 0 with header line.

data:it_bdc type bdcdata occurs 0 with header line.

&----


  • selection-screen

&----


selection-screen begin of block b1 with frame title text-001.

parameters:p_file type rlgrap-filename default 'c:\vendor.txt'

obligatory.

selection-screen end of block b1.

&----


*

&----


at selection-screen on value-request for p_file.

perform file_help using p_file.

start-of-selection.

perform upload_file using p_file.

perform open_session.

perform populate_bdctable .

perform close_session.

end-of-selection.

write:/ itab-comp_code.

&----


*& Form file_help

&----


  • text

----


  • -->P_P_FILE text

----


FORM file_help USING P_P_FILE.

data:l_file type ibipparms-path.

CALL FUNCTION 'F4_FILENAME'

  • EXPORTING

  • PROGRAM_NAME = SYST-CPROG

  • DYNPRO_NUMBER = SYST-DYNNR

  • FIELD_NAME = ' '

IMPORTING

FILE_NAME = l_file.

p_file = l_file .

ENDFORM. " file_help

&----


*& Form upload_file

&----


  • text

----


  • -->P_P_FILE text

----


FORM upload_file USING P_P_FILE.

CALL FUNCTION 'WS_UPLOAD'

EXPORTING

  • CODEPAGE = ' '

FILENAME = P_P_FILE

FILETYPE = 'ASC'

  • HEADLEN = ' '

  • LINE_EXIT = ' '

  • TRUNCLEN = ' '

  • USER_FORM = ' '

  • USER_PROG = ' '

  • DAT_D_FORMAT = ' '

  • IMPORTING

  • FILELENGTH =

TABLES

DATA_TAB = itab

EXCEPTIONS

CONVERSION_ERROR = 1

FILE_OPEN_ERROR = 2

FILE_READ_ERROR = 3

INVALID_TYPE = 4

NO_BATCH = 5

UNKNOWN_ERROR = 6

INVALID_TABLE_WIDTH = 7

GUI_REFUSE_FILETRANSFER = 8

CUSTOMER_ERROR = 9

NO_AUTHORITY = 10

OTHERS = 11

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

message i001.

ENDIF.

ENDFORM. " upload_file

&----


*& Form open_session

&----


  • text

----


  • -->P_P_FILE text

----


FORM open_session .

CALL FUNCTION 'BDC_OPEN_GROUP'

EXPORTING

CLIENT = SY-MANDT

  • DEST = FILLER8

GROUP = 'ZSUDHA1'

  • HOLDDATE = FILLER8

KEEP = 'X'

USER = sy-uname

  • RECORD = FILLER1

  • PROG = SY-CPROG

  • IMPORTING

  • QID =

EXCEPTIONS

CLIENT_INVALID = 1

DESTINATION_INVALID = 2

GROUP_INVALID = 3

GROUP_IS_LOCKED = 4

HOLDDATE_INVALID = 5

INTERNAL_ERROR = 6

QUEUE_ERROR = 7

RUNNING = 8

SYSTEM_LOCK_ERROR = 9

USER_INVALID = 10

OTHERS = 11

.

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. " open_session

&----


*& Form populate_bdctable

&----


  • text

----


  • -->P_P_FILE text

----


FORM populate_bdctable .

loop at itab.

perform bdc_dynpro using 'SAPMF02K' '0105'.

perform bdc_field using 'BDC_CURSOR'

'RF02K-KTOKK'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'RF02K-BUKRS'

'0001'.

perform bdc_field using 'RF02K-KTOKK'

'0001'.

perform bdc_dynpro using 'SAPMF02K' '0110'.

perform bdc_field using 'BDC_CURSOR'

'LFA1-SORTL'.

perform bdc_field using 'BDC_OKCODE'

'=UPDA'.

perform bdc_field using 'LFA1-ANRED'

'ITAB-ANRED'.

perform bdc_field using 'LFA1-NAME1'

'ITAB-NAME'.

perform bdc_field using 'LFA1-SORTL'

'ITAB-SEARCH'.

perform bdc_field using 'LFA1-LAND1'

'ITAB-COUNTRY'.

perform bdc_insert.

clear it_bdc.

refresh it_bdc.

endloop.

ENDFORM. " populate_bdctable

&----


*& Form bdc_dynpro

&----


  • text

----


  • -->P_P_FILE text

----


FORM bdc_dynpro USING value(p_program)

value(p_screen).

IT_BDC-PROGRAM = P_PROGRAM.

IT_BDC-DYNPRO = P_SCREEN.

IT_BDC-DYNBEGIN = 'X'.

APPEND IT_BDC.

CLEAR IT_BDC.

ENDFORM. " bdc_dynpro

&----


*& Form bdc_insert

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM bdc_insert .

CALL FUNCTION 'BDC_INSERT'

EXPORTING

TCODE = 'FK01'

TABLES

DYNPROTAB = IT_BDC

EXCEPTIONS

INTERNAL_ERROR = 1

NOT_OPEN = 2

QUEUE_ERROR = 3

TCODE_INVALID = 4

PRINTING_INVALID = 5

POSTING_INVALID = 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.

ENDFORM.

" bdc_insert

&----


*& Form close_session

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM close_session .

CALL FUNCTION 'BDC_CLOSE_GROUP'

EXCEPTIONS

NOT_OPEN = 1

QUEUE_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.

ENDFORM. " close_session

&----


*& Form bdc_field

&----


  • text

----


  • -->P_0247 text

  • -->P_0248 text

----


FORM bdc_field USING VALUE(P_FIELDNAME)

VALUE(P_FIELDVALUE).

IT_BDC-FNAM = P_FIELDNAME.

IT_BDC-FVAL = P_FIELDVALUE.

APPEND IT_BDC.

CLEAR IT_BDC.

ENDFORM. " bdc_field

Regards,

Laxmi.

Read only

Former Member
0 Likes
583

The BDC_INSERT function module has an importing parameter called CTUPARAMS which has a field DEFSIZE .

Pass that field as X.

Regards,

Ravi

Read only

Former Member
0 Likes
583

Hi

Ravi was right.

Once you set defsize to 'X', you will not face any problem regarding screen resolution.

DATA opt TYPE ctu_params.

*- Set the screen size to default for BDC

opt-defsize = 'X'.

**- Set mode for call trxn

opt-dismode = 'N'.

*- Call VL02N

CALL TRANSACTION 'VL02N'

USING bdcdata OPTIONS FROM <b>opt</b>

MODE l_mode

UPDATE l_sync

MESSAGES INTO messtab.

Regards,

Raj