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

Question in BDC session method.

YayatiEkbote
Contributor
0 Likes
432

Hi guys,

I am trying to upload BOM using BDC session method.

While doing this, i have learnt the steps by heart. But i do not understrand the logic behind the steps. For example, why do we include this statement

Data: IT-BDC like BDCDATA occurs 0 with headerline.

What if we don't include this statement?

Moderator message: sorry, these forums are not targeted to provide step by step guides to beginners, please search for available information, take courses, etc.

locked by: Thomas Zloch on Sep 10, 2010 1:06 PM

2 REPLIES 2
Read only

dhirendra_pandit
Active Participant
0 Likes
394

Hi Yayati,

Every BDC screen would capture in the standard structure.

In with following contends are

Field Name Description

PROGRAM BDC module pool

DYNPRO BDC Screen number

DYNBEGIN BDC screen start

FNAM Field name

FVAL BDC field value

This structure is populated during the BDC and posted using call transaction or Session method.

Hence The following statement define the internal table declaration of the same, the addition with header line would allow you to use that table as work area at the same time.

Data: IT-BDC like BDCDATA occurs 0 with header line.

So IT_BDC is workarea and IT_BDC[] is internal table.

Regards

Dhirendra

Read only

YayatiEkbote
Contributor
0 Likes
394

Hello Dhirendra,

Thanks for immediate reply. I want to understand BDC method conceptually. What exactly happens by performing each step.

I am putting up the BDC i made. I copied some of the code from here and there. It works fine but i don't understand the purpose of BDCDATA,

call transaction 'cs01'

and form bdc_dynpro and form bdc_field.

____________________________________________________________________________________________________

I am quite new to ABAP. Please don't mind if i ask dumb questions.

I am unable to understand how control flows through the code logic.

____________________________________________________________________________________________________

report ZBDCFORCS01

no standard page heading line-size 255.

*include bdcrecx1.

DATA: IT_BDC LIKE BDCDATA OCCURS 0 WITH HEADER LINE,

IT_MSGCOLL LIKE BDCMSGCOLL OCCURS 0.

TYPES TRUXS_T_TEXT_DATA(4096) TYPE C OCCURS 0.

DATA: I_TAB_RAW_DATA TYPE TRUXS_T_TEXT_DATA.

DATA: BEGIN OF ITAB OCCURS 0,

MATNR(18),

WERKS(4),

STLAN(1),

IDNRK(18),

MENGE(20),

END OF ITAB.

SELECTION-SCREEN: BEGIN OF BLOCK b1.

PARAMETERS: CS01FILE TYPE RLGRAP-FILENAME.

SELECTION-SCREEN: END OF BLOCK b1.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR CS01FILE.

CALL FUNCTION 'F4_FILENAME'

EXPORTING

PROGRAM_NAME = SYST-CPROG

DYNPRO_NUMBER = SYST-DYNNR

FIELD_NAME = ' '

IMPORTING

FILE_NAME = CS01FILE

.

start-of-selection.

CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'

EXPORTING

  • I_FIELD_SEPERATOR =

  • I_LINE_HEADER =

I_TAB_RAW_DATA = I_TAB_RAW_DATA

I_FILENAME = CS01FILE

TABLES

I_TAB_CONVERTED_DATA = ITAB[]

EXCEPTIONS

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

*perform open_group.

LOOP AT ITAB.

perform bdc_dynpro using 'SAPLCSDI' '0100'.

perform bdc_field using 'BDC_CURSOR'

'RC29N-STLAN'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'RC29N-MATNR'

  • '1400-500'.

itab-matnr.

perform bdc_field using 'RC29N-WERKS'

  • '1000'.

itab-werks.

perform bdc_field using 'RC29N-STLAN'

  • '1'.

itab-stlan.

perform bdc_field using 'RC29N-DATUV'

'10.09.2010'.

perform bdc_dynpro using 'SAPLCSDI' '0110'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'RC29K-BMENG'

'1'.

perform bdc_field using 'RC29K-STLST'

'1'.

perform bdc_field using 'BDC_CURSOR'

'RC29K-EXSTL'.

perform bdc_dynpro using 'SAPLCSDI' '0111'.

perform bdc_field using 'BDC_CURSOR'

'RC29K-LABOR'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_dynpro using 'SAPLCSDI' '0140'.

perform bdc_field using 'BDC_CURSOR'

'RC29P-MENGE(02)'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'RC29P-IDNRK(01)'

  • '1300-320'.

ITAB-IDNRK.

perform bdc_field using 'RC29P-IDNRK(02)'

  • '1300-312'.

ITAB-IDNRK.

perform bdc_field using 'RC29P-MENGE(01)'

  • '2'.

ITAB-MENGE.

perform bdc_field using 'RC29P-MENGE(02)'

  • '2'.

ITAB-MENGE.

perform bdc_dynpro using 'SAPLCSDI' '0130'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'BDC_CURSOR'

'RC29P-POSNR'.

perform bdc_field using 'RC29P-POSNR'

'0010'.

perform bdc_field using 'RC29P-IDNRK'

'1300-320'.

perform bdc_field using 'RC29P-MENGE'

'2'.

perform bdc_field using 'RC29P-MEINS'

'PC'.

perform bdc_dynpro using 'SAPLCSDI' '0131'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'BDC_CURSOR'

'RC29P-POTX1'.

perform bdc_field using 'RC29P-SANKA'

'X'.

perform bdc_dynpro using 'SAPLCSDI' '0130'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'BDC_CURSOR'

'RC29P-POSNR'.

perform bdc_field using 'RC29P-POSNR'

'0020'.

perform bdc_field using 'RC29P-IDNRK'

'1300-312'.

perform bdc_field using 'RC29P-MENGE'

'2'.

perform bdc_field using 'RC29P-MEINS'

'PC'.

perform bdc_dynpro using 'SAPLCSDI' '0131'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'BDC_CURSOR'

'RC29P-POTX1'.

perform bdc_field using 'RC29P-SANKA'

'X'.

perform bdc_dynpro using 'SAPLCSDI' '0140'.

perform bdc_field using 'BDC_CURSOR'

'RC29P-POSNR(01)'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_dynpro using 'SAPLCSDI' '0140'.

perform bdc_field using 'BDC_CURSOR'

'RC29P-POSNR(01)'.

perform bdc_field using 'BDC_OKCODE'

'=FCBU'.

perform bdc_transaction using 'CS01'.

*perform close_group.

CALL TRANSACTION 'CS01' USING IT_BDC

MODE 'A'

UPDATE 'S'

MESSAGES INTO IT_MSGCOLL.

REFRESH IT_BDC.

ENDLOOP.

FORM BDC_DYNPRO USING PROGRAM_DYNPRO.

CLEAR IT_BDC.

BDCDATA-PROGRAM = PROGRAM.

BDCDATA-DYNPRO = DYNPRO.

BDCDATA-DYNBEGIN = 'X'.

APPEND IT_BDC.

ENDFORM.

FORM BDC_FIELD USING FNAM FVAL.

CLEAR BDCDATA.

BDCDATA-FNAM = FNAM.

BDCDATA-FVAL = FVAL.

APPEND BDCDATA.

ENDFORM.

____________________________________________________________________________________________________

Edited by: Yayati6260 on Sep 10, 2010 12:29 PM