Skip to Content
0
Former Member
Sep 03, 2007 at 07:10 AM

Hi All, I am getting problem in populating the item details for va01 t.code

29 Views

Hi All,

I am getting problem in populating the item details for va01 t.code with the code generated below .Please see the code below and make the corrections for incrementing the counter for item details and send me the code with the corections made.Please its urgent.

report ZBKVA01Y

no standard page heading line-size 255.

include bdcrecx1.

parameters: dataset(132) lower case.

  • DO NOT CHANGE - the generated data section - DO NOT CHANGE ***

*

  • If it is nessesary to change the data section use the rules:

  • 1.) Each definition of a field exists of two lines

  • 2.) The first line shows exactly the comment

  • '* data element: ' followed with the data element

  • which describes the field.

  • If you don't have a data element use the

  • comment without a data element name

  • 3.) The second line shows the fieldname of the

  • structure, the fieldname must consist of

  • a fieldname and optional the character '_' and

  • three numbers and the field length in brackets

  • 4.) Each field must be type C.

*

DATA: BEGIN OF IT_DUMMY OCCURS 0,

TEXT(1000),

END OF IT_DUMMY.

  • Generated data section with specific formatting - DO NOT CHANGE ***

data: begin of IT_HEADER OCCURS 0,

  • data element: AUART

AUART_001(004),

  • data element: VKORG

VKORG_002(004),

  • data element: VTWEG

VTWEG_003(002),

  • data element: SPART

SPART_004(002),

  • data element: BSTKD

BSTKD_005(035),

  • data element: BSTDK

BSTDK_006(010),

  • data element: KUNAG

KUNNR_007(010),

  • data element: KUNWE

KUNNR_008(010),

  • data element: ABHOZ

ABHOV_009(008),

  • data element: ABHOZ

ABHOB_010(008),

  • data element: PRSDT

PRSDT_011(010),

END OF IT_HEADER.

data: v_kwmeng like vbap-kwmeng.

DATA: BEGIN OF IT_ITEM OCCURS 0,

  • data element: MATNR

MABNR_01_012(018),

  • data element: KWMENG

KWMENG_01_013(019),

end of IT_ITEM.

DATA: DATE(10) TYPE C.

DATA: I_DATE TYPE SY-DATUM.

DATA: I_YEAR(4) TYPE C,

I_MONTH(2) TYPE C,

I_DAY(2) TYPE C .

DATA: V_INDEX TYPE I VALUE 0.

data: V_CNTR(5) type c.

*DATA:

  • End generated data section ***

start-of-selection.

CALL FUNCTION 'UPLOAD'

  • EXPORTING

  • CODEPAGE = ' '

  • FILENAME = ' '

  • FILETYPE = ' '

  • ITEM = ' '

  • FILEMASK_MASK = ' '

  • FILEMASK_TEXT = ' '

  • FILETYPE_NO_CHANGE = ' '

  • FILEMASK_ALL = ' '

  • FILETYPE_NO_SHOW = ' '

  • LINE_EXIT = ' '

  • USER_FORM = ' '

  • USER_PROG = ' '

  • SILENT = 'S'

  • IMPORTING

  • FILESIZE =

  • CANCEL =

  • ACT_FILENAME =

  • ACT_FILETYPE =

TABLES

DATA_TAB = IT_DUMMY

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

*

*perform open_dataset using dataset.

LOOP AT IT_DUMMY.

IF IT_DUMMY-TEXT+0(1) = 'H'.

*

IT_HEADER-AUART_001(004) = IT_DUMMY-TEXT+1(4).

  • data element: VKORG

IT_HEADER-VKORG_002(004) = IT_DUMMY-TEXT+5(4).

  • data element: VTWEG

IT_HEADER-VTWEG_003(002) = IT_DUMMY-TEXT+9(2).

  • data element: SPART

IT_HEADER-SPART_004(002) = IT_DUMMY-TEXT+11(2).

  • data element: BSTKD

IT_HEADER-BSTKD_005(035) = IT_DUMMY-TEXT+13(35).

  • data element: BSTDK

IT_HEADER-BSTDK_006(010) = IT_DUMMY-TEXT+48(8).

  • data element: KUNAG

IT_HEADER-KUNNR_007(010) = IT_DUMMY-TEXT+56(10).

  • data element: KUNWE

IT_HEADER-KUNNR_008(010) = IT_DUMMY-TEXT+66(10).

  • data element: ABHOZ

IT_HEADER-ABHOV_009(008) = IT_DUMMY-TEXT+76(6).

  • data element: ABHOZ

IT_HEADER-ABHOB_010(008) = IT_DUMMY-TEXT+82(6).

  • data element: PRSDT

IT_HEADER-PRSDT_011(010) = IT_DUMMY-TEXT+88(8).

APPEND IT_HEADER.

CLEAR IT_HEADER.

ELSEIF IT_DUMMY-TEXT+0(1) = 'I'.

  • data element: MATNR

IT_ITEM-MABNR_01_012(018) = IT_DUMMY-TEXT+1(18).

  • data element: KWMENG

IT_ITEM-KWMENG_01_013(019) = IT_DUMMY-TEXT+19(15).

APPEND IT_ITEM.

CLEAR IT_ITEM.

ENDIF.

ENDLOOP.

perform open_group.

LOOP AT IT_HEADER.

perform bdc_dynpro using 'SAPMV45A' '0101'.

perform bdc_field using 'BDC_CURSOR'

'VBAK-SPART'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'VBAK-AUART'

IT_HEADER-AUART_001.

perform bdc_field using 'VBAK-VKORG'

IT_HEADER-VKORG_002.

perform bdc_field using 'VBAK-VTWEG'

IT_HEADER-VTWEG_003.

perform bdc_field using 'VBAK-SPART'

IT_HEADER-SPART_004.

perform bdc_dynpro using 'SAPMV45A' '4001'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'VBKD-BSTKD'

IT_HEADER-BSTKD_005.

perform bdc_field using 'VBKD-BSTDK'

IT_HEADER-BSTDK_006.

perform bdc_field using 'KUAGV-KUNNR'

IT_HEADER-KUNNR_007.

perform bdc_field using 'KUWEV-KUNNR'

IT_HEADER-KUNNR_008.

perform bdc_dynpro using 'SAPMSSY0' '0120'.

perform bdc_field using 'BDC_CURSOR'

'04/05'.

perform bdc_field using 'BDC_OKCODE'

'=CHOO'.

perform bdc_dynpro using 'SAPMV45A' '4001'.

perform bdc_field using 'VBAK-ABHOV'

IT_HEADER-ABHOV_009.

perform bdc_field using 'VBAK-ABHOB'

IT_HEADER-ABHOB_010.

perform bdc_field using 'VBKD-PRSDT'

IT_HEADER-PRSDT_011.

perform bdc_field using 'BDC_CURSOR'

'RV45A-KWMENG(01)'.

endloop.

loop at it_item.

  • v_kwmeng = it_item-KWMENG_01_013 .

*

V_INDEX = V_INDEX + 1.

IF V_INDEX = 1.

*v_cntr = v_cntr + 1.

*perform bdc_field using 'RM06B-BNFPO'

  • V_CNTR.

**perform bdc_field using 'RM06B-TCSELFLAG(01)'

  • 'X'.

perform bdc_field using 'RV45A-MABNR(01)'

IT_ITEM-MABNR_01_012.

perform bdc_field using 'RV45A-KWMENG(01)'

IT_ITEM-KWMENG_01_013.

  • v_kwmeng.

perform bdc_transaction using 'VA01'.

*enddo.

ENDIF.

*RM06B-BNFPO

ENDLOOP.

perform close_group.

*perform close_dataset using dataset.

thanks&regards.

Bharat.