Skip to Content

internal table. field change

i have a flat file of multiple header and multiple line items.

to read the header there is a column v_doc = 'x'.

when i execute the below code it print all the line item in one doc...but i want separate doc as per the posting date.

I WANT TO KNOW WHEN EVER V_DOC = 'X', I WANT TO TRIGGER A bapi

V_DOC DOC_DATE PSTG_DATE COST_CTR BUSS_AREA MAT_NO ITEM_QTY

X 20.08.2007 20.08.2007 1HOLO001 BHAN

100606 1

100274 1

X 21.08.2007 21.08.2007 1HOLO001 BHAN

100606 1

100274 1

LOOP AT it_data.

IF it_data-v_doc = 'X' .

PERFORM validate_header.

PERFORM fill_header.

v_header = 'X'.

ELSE.

CLEAR gm_item.

PERFORM fill_item.

ENDIF.

AT LAST.

PERFORM call_bapi.

ENDAT.

ENDLOOP.

FORM fill_header.

gm_header-pstng_date = it_data-pstg_date.

gm_header-doc_date = it_data-doc_date.

doc_mvt_type = it_data-mvt_type.

doc_plant = it_data-plant.

doc_costcenter = it_data-cost_ctr.

doc_buss_area = it_data-buss_area.

gm_code-gm_code = c_gm_code.

ENDFORM. " FILL_HEADER

&----


*& Form FILL_ITEM

&----


FORM fill_item.

IF v_header = 'X'.

gm_item-material = it_data-mat_no.

gm_item-stge_loc = it_data-store_loc.

gm_item-entry_qnt = it_data-item_qty.

gm_item-move_type = doc_mvt_type.

gm_item-plant = doc_plant.

gm_item-costcenter = doc_costcenter.

gm_item-tr_part_ba = doc_buss_area.

PERFORM validate_item.

APPEND gm_item.

CLEAR v_header.

ELSE.

gm_item-material = it_data-mat_no.

gm_item-stge_loc = it_data-store_loc.

gm_item-entry_qnt = it_data-item_qty.

gm_item-move_type = doc_mvt_type.

gm_item-plant = doc_plant.

gm_item-costcenter = doc_costcenter.

gm_item-tr_part_ba = doc_buss_area.

PERFORM validate_item.

APPEND gm_item.

ENDIF.

ENDFORM. " FILL_ITEM

Message was edited by:

shahid mohammed syed

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Aug 21, 2007 at 05:01 AM

    why are u putting this vOheader = 'x' in the fill_item perform

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 21, 2007 at 05:12 AM

    Hi Shahid,

    Its just a guess and i am not sure if i noticed it right as dont have the full code.

    see in this code

    FORM fill_header.

    gm_header-pstng_date = it_data-pstg_date.

    gm_header-doc_date = it_data-doc_date.

    doc_mvt_type = it_data-mvt_type.

    doc_plant = it_data-plant.

    doc_costcenter = it_data-cost_ctr.

    doc_buss_area = it_data-buss_area.

    gm_code-gm_code = c_gm_code.

    ENDFORM. " FILL_HEADER

    if i am not wrong you are passing header information for every loop pass however since its not being appeneded may be because its not a table and when the bapi is called its the last entry of IT_DATA for which this form gets called so , <b>you are getting it against only one document and i.e the last header data in table it_data.</b>

    Hope this helps. revert for clarifications if any.

    regards,

    Vikas

    <b>Always reward points to helpful suggestions.</b>

    Add comment
    10|10000 characters needed characters exceeded