Skip to Content
author's profile photo Former Member
Former Member

bdc

please clarify why the 'fval' value is not getting transferred into it_bdcdata-fval for quantity field(present in second screen)in my program.

report Z_PP_BDC1

no standard page heading line-size 255.

*REQUEST NO.:DEVK903710

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

*& Table Declaration

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

TABLES : IBIPPARMS.

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

*& Types

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

TYPES : BEGIN OF TY_ITAB,

MATNR TYPE MATNR, "MATERIAL NO

WERKS TYPE WERKS, "PLANT

STLAN TYPE STLAN, "BOM USAGE

DATUV TYPE DATUV, "VALID DATE

BMENG TYPE BASMN, "BASE QUANTITY

IDNRK TYPE IDNRK, "COMPONENT

MENGE TYPE RC29P-MENGE, "QUANTITY

MEINS TYPE MEINS, "UNIT

POSTP TYPE POSTP, "ITEM CATEGORY

END OF TY_ITAB.

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

*& DATA Declaration

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

DATA : IT_ITAB TYPE TABLE OF TY_ITAB WITH HEADER LINE.

DATA : IT_BDCDATA TYPE TABLE OF BDCDATA WITH HEADER LINE.

DATA : IT_BDCMSGCOLL TYPE TABLE OF BDCMSGCOLL WITH HEADER LINE.

DATA : P_FILE1 TYPE STRING ,"FILE NAME

V_LINES TYPE I,

FNAM(20) TYPE C,

IDX TYPE C.

DATA : IT1_ITAB like IT_ITAB occurs 0 with header line.

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

*& SELECTION-SCREEN DECLARATION

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

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.

PARAMETERS : P_FILE TYPE LOCALFILE OBLIGATORY."FILE NAME

SELECTION-SCREEN END OF BLOCK B1 .

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

  • AT-SELECTION-SCREEN DECALRATION *

  • *

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

----


AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.

----


clear : P_FILE.

CALL FUNCTION 'F4_FILENAME'

EXPORTING

PROGRAM_NAME = SYST-CPROG

DYNPRO_NUMBER = SYST-DYNNR

IMPORTING

FILE_NAME = P_FILE.

IF P_FILE IS NOT INITIAL.

  • VALIDATE FILE TYPE

PERFORM SUB_VALIDATE_txt_TYPE.

ENDIF.

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

  • START-OF-SELECTION

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

start-of-selection.

  • perform upload.

  • perform bdc.

&----


*& Form upload

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


*FORM upload .

clear : P_FILE1.

P_FILE1 = P_FILE.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = P_FILE1

FILETYPE = 'ASC'

HAS_FIELD_SEPARATOR = 'X'

TABLES

DATA_TAB = IT_ITAB

EXCEPTIONS

FILE_OPEN_ERROR = 1

FILE_READ_ERROR = 2

NO_BATCH = 3

GUI_REFUSE_FILETRANSFER = 4

INVALID_TYPE = 5

NO_AUTHORITY = 6

UNKNOWN_ERROR = 7

BAD_DATA_FORMAT = 8

HEADER_NOT_ALLOWED = 9

SEPARATOR_NOT_ALLOWED = 10

HEADER_TOO_LONG = 11

UNKNOWN_DP_ERROR = 12

ACCESS_DENIED = 13

DP_OUT_OF_MEMORY = 14

DISK_FULL = 15

DP_TIMEOUT = 16

OTHERS = 17.

IF SY-SUBRC <> 0.

endif.

*ENDFORM. " upload

*

*LOOP AT IT_ITAB.

*WRITE : / IT_ITAB-MATNR,

  • IT_ITAB-WERKS,

  • IT_ITAB-STLAN,

  • IT_ITAB-DATUV,

  • IT_ITAB-BMENG,

  • IT_ITAB-IDNRK,

  • IT_ITAB-MENGE,

  • IT_ITAB-MEINS,

  • IT_ITAB-POSTP.

*ENDLOOP.

*form bdc.

*COPY DATA FROM IT_ITAB INTO IT_ITAB1

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

IT1_ITAB[] = IT_ITAB[].

*IF SY-SUBRC <> 0 OR IT_ITAB IS INITIAL.

  • UNABLE TO UPLOAD DATA FROM FLAT FILE

*MESSAGE I003(ZMSG).

*ENDIF.

&----


*& Form bdc

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


*FORM BDC.

LOOP AT IT_ITAB.

REFRESH IT_BDCDATA .

*FIRST SCREEN

perform bdc_dynpro using 'SAPLCSDI' '0100'.

perform bdc_field using 'BDC_CURSOR'

'RC29N-DATUV'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'RC29N-MATNR'

IT_ITAB-MATNR.

perform bdc_field using 'RC29N-WERKS'

IT_ITAB-WERKS.

perform bdc_field using 'RC29N-STLAN'

IT_ITAB-STLAN.

perform bdc_field using 'RC29N-DATUV'

IT_ITAB-DATUV.

*SECOND SCREEN

perform bdc_dynpro using 'SAPLCSDI' '0110'.

perform bdc_field using 'BDC_CURSOR'

'RC29K-BMENG'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'RC29K-BMENG'

IT_ITAB-BMENG.

perform bdc_field using 'RC29K-STLST'

'1'.

*THIRD SCREEN

perform bdc_dynpro using 'SAPLCSDI' '0111'.

perform bdc_field using 'BDC_CURSOR'

'RC29K-LABOR'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

*fourth screen

MOVE 1 TO IDX.

LOOP AT IT1_ITAB WHERE MATNR = IT_ITAB-MATNR.

perform bdc_dynpro using 'SAPLCSDI' '0140'.

perform bdc_field using 'BDC_CURSOR'

'RC29P-POSTP(02)'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

*perform bdc_field using 'RC29P-IDNRK(01)'

  • IT_ITAB-IDNRK.

concatenate 'RC29P-IDNRK(' IDX ')' INTO FNAM.

perform bdc_field using FNAM

IT1_ITAB-IDNRK.

*perform bdc_field using 'RC29P-IDNRK(02)'

  • '100017'.

concatenate 'RC29P-MENGE(' IDX ')' INTO FNAM.

perform bdc_field using FNAM

IT1_ITAB-MENGE.

*perform bdc_field using 'RC29P-MENGE(02)'

  • '200'.

concatenate 'RC29P-MEINS(' IDX ')' INTO FNAM.

perform bdc_field using FNAM

IT1_ITAB-MEINS.

*perform bdc_field using 'RC29P-MEINS(02)'

  • 'kg'.

*

concatenate 'RC29P-POSTP(' IDX ')' INTO FNAM.

perform bdc_field using FNAM

IT1_ITAB-POSTP.

*perform bdc_field using 'RC29P-POSTP(02)'

  • 'l'.

*

IDX = IDX + 1.

ENDLOOP.

*FOURTH SCREEN

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'

  • '100012'.

perform bdc_field using 'RC29P-IDNRK'

IT_ITAB-IDNRK.

*perform bdc_field using 'RC29P-MENGE'

  • '150'.

perform bdc_field using 'RC29P-MENGE'

IT_ITAB-MENGE.

*perform bdc_field using 'RC29P-MEINS'

  • 'KG'.

perform bdc_field using 'RC29P-MEINS'

IT_ITAB-MEINS.

*FIFTH SCREEN

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

*SIXTH SCREEN

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'

  • '100017'.

perform bdc_field using 'RC29P-IDNRK'

IT_ITAB-IDNRK.

*perform bdc_field using 'RC29P-MENGE'

  • '200'.

perform bdc_field using 'RC29P-MENGE'

IT_ITAB-MENGE.

*perform bdc_field using 'RC29P-MEINS'

  • 'KG'.

perform bdc_field using 'RC29P-MEINS'

IT_ITAB-MEINS.

*seventh screen

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'

'=FCBU'.

*perform bdc_transaction using 'CS01'.

*perform close_group.

CALL TRANSACTION 'CS01' USING IT_BDCDATA MODE 'A'

UPDATE 'A'.

  • MESSAGES INTO IT_BDCMSGCOLL.

  • CLEAR IT_ITAB.

ENDLOOP.

*endform.

**GET THE NUMBER OF LINES

*DESCRIBE TABLE IT_BDCMSGCOLL LINES V_LINES.

**ENDFORM.

&----


*& Form SUB_VALIDATE_TXT_TYPE

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM SUB_VALIDATE_txt_TYPE .

DATA : STR1 TYPE LOCALFILE,

STR2 TYPE CHAR3.

SPLIT P_FILE AT '.' INTO STR1 STR2.

TRANSLATE STR2 TO LOWER CASE.

IF STR2 NE 'txt'.

  • please enter '.txt' file format

MESSAGE I001(ZMSG).

LEAVE LIST-PROCESSING.

ENDIF.

ENDFORM. " SUB_VALIDATE_TXT_TYPE

&----


*& Form bdc_dynpro

&----


  • text

----


  • -->P_0160 text

  • -->P_0161 text

----


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

&----


*& Form bdc_field

&----


  • text

----


  • -->P_0160 text

  • -->P_ENDLOOP text

----


FORM bdc_field USING FNAM FVAL.

CLEAR IT_BDCDATA. .

IT_BDCDATA-FNAM = FNAM.

IT_BDCDATA-FVAL = FVAL.

APPEND IT_BDCDATA.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Apr 25, 2007 at 11:12 AM

    Make the Quantity field of type Character.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 25, 2007 at 11:38 AM

    hi,

    just change BMENG of char type

    TYPES : BEGIN OF TY_ITAB,

    MATNR TYPE MATNR, "MATERIAL NO

    WERKS TYPE WERKS, "PLANT

    STLAN TYPE STLAN, "BOM USAGE

    DATUV TYPE DATUV, "VALID DATE

    BMENG(10) TYPE c,

    IDNRK TYPE IDNRK, "COMPONENT

    MENGE TYPE RC29P-MENGE, "QUANTITY

    MEINS TYPE MEINS, "UNIT

    POSTP TYPE POSTP, "ITEM CATEGORY

    END OF TY_ITAB.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.