Application Development 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: 

regarding header data and item data

Former Member
0 Kudos

could u plz explain clearly

regarding Header data and Item data with example.

with code in BDC,

could u plz mentioned which is headr data and item data

plz

5 REPLIES 5

Former Member
0 Kudos

Hi,

Consider a Sales Order. A customer would like to buy many products from a vendor. So customer would raise a Purchase order for all the materials he.she would buy. the customer need not raise one purchase order per product.

thus, in a purchase order there could be more than one product/ material to be purchase. the purchase order becomes Sales order for the vendor. for each sales order there could be more than one material.

Thus, One Order(purchase or sales) can have more than one material...in simple terms ITEMS. The attributes of the document created would be same for all materials/ items. These attributes could be Document Date, Document number, Customer or Vendor etc. These attributes remain same for all the items. Hence they are called Header details.

Consider the transaction VA01 ( Sales Order). In BDC document date, Sold to party, shipto party, document type etc become header data. Material to be purchased, Quantity, Unit of measure and schedule items become Items.

Regards,

Vara

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

For eg.. Header data vbeln

Item data posnr.

1 header data will have more item data.

Check this link for bdc in table control.

http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm

Former Member

Former Member
0 Kudos

hi,

pls go through this code,

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

0 Kudos

yes