Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

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

Tags:
Not what you were looking for? View more on this topic or Ask a question