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

regarding table control in BDC

Former Member
0 Likes
665

in table control we are using

1 perform BDC_dynpro using BDC_cursor

xxxx-kunnr.

2 perform BDC_okcode

/00

could u plz explain clearly of this two of statements

" Concatenate "

why we are using Concatenate

plz explain clearly

in table control we are using

1 perform BDC_dynpro using BDC_cursor

xxxx-kunnr.

2 perform BDC_okcode

/00

could u plz explain clearly of this two of statements

" Concatenate "

why we are using Concatenate

plz explain clearly

5 REPLIES 5
Read only

Former Member
0 Likes
617

Hi Rajesh,

First try to learn searching the SDN and the web for the questions you post, the questions you post , SDN is answered already.

Try to reward/close threads which answered your questions.So, that other people can help you if the thread is not closed , or still if you will be strucked with that.

Regards,

Raghav

Read only

0 Likes
617

thanks

Read only

Former Member
0 Likes
617

Hi,

<b> perform BDC_dynpro using BDC_cursor

xxxx-kunnr.</b>

This specifies the Cursor position on the field when data is being upload in the corresponding screen.

<b>perform BDC_okcode

/00</b>

This basically specifies what user-actions should be performed on the screen. For example, if you check XK01 (Vendor creation), in the first screen initially cursor will be placed on certian field. Then the user enters values in the fields. At the end the user either clicks execute button or hits enter button.

Regards,

Vara

Read only

Former Member
0 Likes
617

hi,

here is the sample code go through it,

SELECTION-SCREEN BEGIN OF BLOCK error_options WITH FRAME TITLE text-003.

PARAMETERS : p_file LIKE rlgrap-filename DEFAULT

'C:\BDC_file_INSP_PLAN.txt'.

SELECTION-SCREEN END OF BLOCK error_options.

INCLUDE bdcrecx1.

  • Data Declarations

CONSTANTS: c_grp(11) VALUE 'MAPL-PLNAL(',

c_mat(11) VALUE 'MAPL-MATNR(',

c_wrk(11) VALUE 'MAPL-WERKS(',

c_brace VALUE ')'.

DATA: ctr(2) TYPE n,

fld_matnr(16),

fld_group(16),

fld_werks(16).

DATA: w_lines(5) TYPE c.

data: n(2).

data: prev_group(8).

  • Internal Tables

DATA : BEGIN OF itab_file OCCURS 0,

group(8), "Group Number

grp_cntr(2), "Group Counter

Material(18), "Material

Plant(4), "Plant

END OF itab_file.

data: begin of igroup occurs 0,

group(8),

end of igroup.

  • At selection screen

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

*CALL FUNCTION 'TMP_GUI_BROWSE_FOR_FOLDER'

  • EXPORTING

  • window_title = 'Select destination folder'(f01)

  • initial_folder = 'C:\'

  • IMPORTING

  • selected_folder = p_file

  • EXCEPTIONS

  • cntl_error = 1

  • OTHERS = 2.

  • This function module will help select the file for upload using "F4"

  • functionality

CALL FUNCTION '/SAPDMC/LSM_F4_FRONTEND_FILE'

EXPORTING

PATHNAME = 'C:\'

CHANGING

PATHFILE = P_FILE

EXCEPTIONS

CANCELED_BY_USER = 1

SYSTEM_ERROR = 2

OTHERS = 3.

  • Start of Selection

START-OF-SELECTION.

n = '01' .

PERFORM load_file USING p_file.

PERFORM open_group.

sort itab_file by group.

sort igroup by group.

  • loop at itab_file

loop at igroup.

perform build_screens.

endloop.

  • PERFORM close_group.

&----


*& Form LOAD_FILE

&----


  • Upload Data file

----


FORM load_file USING p_file.

CALL FUNCTION 'WS_UPLOAD'

EXPORTING

filename = p_file

filetype = 'DAT'

TABLES

data_tab = itab_file

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

OTHERS = 10.

IF sy-subrc NE 0.

WRITE:/ text-001.

STOP.

ENDIF.

DESCRIBE TABLE itab_file LINES w_lines.

CLEAR itab_file.

sort itab_file by group.

loop at itab_file.

at new group.

igroup-group = itab_file-group.

append igroup.

clear igroup.

endat.

endloop.

delete igroup[] where group = space.

ENDFORM. " LOAD_FILE

&----


*& Form BUILD_SCREENS

&----


  • Build QP02 Screens

----


FORM BUILD_SCREENS.

perform bdc_dynpro using 'SAPLCPDI' '8010'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'RC27M-WERKS'

space.

perform bdc_field using 'RC271-PLNNR'

igroup-group.

perform bdc_dynpro using 'SAPLCPDI' '1400'.

perform bdc_field using 'BDC_OKCODE'

'=MTUE'.

perform bdc_field using 'RC27X-FLG_SEL(01)'

'X'.

perform bdc_dynpro using 'SAPLCZDI' '4010'.

perform bdc_field using 'BDC_OKCODE'

'=BACK'.

CLEAR ctr.

LOOP AT itab_file WHERE group EQ igroup-group.

ADD 1 TO ctr.

CONCATENATE c_grp ctr c_brace INTO fld_group.

CONCATENATE c_mat ctr c_brace INTO fld_matnr.

CONCATENATE c_wrk ctr c_brace INTO fld_werks.

perform bdc_field using fld_group

'1'.

perform bdc_field using fld_matnr

itab_file-material.

perform bdc_field using fld_werks

itab_file-plant.

endloop.

************************************************

  • perform bdc_field using 'MAPL-PLNAL(n)'

  • '1'.

**perform bdc_field using 'MAPL-PLNAL(02)'

    • '1'.

  • perform bdc_field using 'MAPL-MATNR(n)'

  • itab_file-material.

**perform bdc_field using 'MAPL-MATNR(02)'

    • itab_file-material.

  • perform bdc_field using 'MAPL-WERKS(n)'

  • itab_file-plant.

**perform bdc_field using 'MAPL-WERKS(02)'

    • itab_file-plant.

************************************************

perform bdc_dynpro using 'SAPLCPDI' '1400'.

perform bdc_field using 'BDC_OKCODE'

'=BU'.

perform bdc_transaction using 'QP02'.

  • call transaction 'QP02' using bdcdata

  • mode 'A'.

prev_group = itab_file-group.

ENDFORM. " BUILD_SCREENS

if helpful get me some points.

regards.

Praveen

Read only

Former Member
0 Likes
617

Hi Rajesh,

1. For the first perform:

buy using the KUNNR value the subrouten fill the table BDCDATA table.

like program = program name

dynpro = screen number

dynbingin = x.

fieldname = KUNNR

fieldval = 44000111

2 this second subroutine fill the ok command after the entering the values.

like supposs in MM01, u entered values after that u will do either enter/save or other action this will populate in the second perform.

Regards,

Sunill.