03-27-2009 4:53 PM
Hi,
My internal table has follwing entries and now I should create 3 documents using BAPI.
How do i do this?
job Phase Quantity
100 9700 60
100 9700 90
**************
200 9500 10
200 9500 20
200 9600 10
200 9600 70
*************
300 9800 30
300 9800 80
300 9900 20
300 9900 50
wa_header is always
wa_header-co_area = 1000.
wa_header-docdate = sy-datum.
wa_header-username = sy-uname.
doc_items -1 -
100 9700 60
100 9700 90
doc_items -2-
200 9500 10
200 9500 20
200 9600 10
200 9600 70
....
CALL FUNCTION 'BAPI_ACC_STAT_KEY_FIG_POST'
EXPORTING
doc_header = wa_header
ignore_warnings = 'X'
TABLES
doc_items = doc_items
return = return
03-27-2009 5:00 PM
HI,
Can you be more specific about your qestion.
Or looking for this
wa_header-co_area = 1000.
wa_header-docdate = sy-datum.
wa_header-username = sy-uname.
SORT item BY job.
LOOP AT item INTO wa_item.
APPEND wa_item TO doc_item.
AT END OF job.
CALL FUNCTION 'BAPI_ACC_STAT_KEY_FIG_POST'
EXPORTING
doc_header = wa_header
ignore_warnings = 'X'
TABLES
doc_items = doc_items
return = return.
REFRESH doc_item.
ENDAT.
ENDLOOP.
Edited by: Avinash Kodarapu on Mar 27, 2009 10:36 PM
03-27-2009 5:00 PM
HI,
Can you be more specific about your qestion.
Or looking for this
wa_header-co_area = 1000.
wa_header-docdate = sy-datum.
wa_header-username = sy-uname.
SORT item BY job.
LOOP AT item INTO wa_item.
APPEND wa_item TO doc_item.
AT END OF job.
CALL FUNCTION 'BAPI_ACC_STAT_KEY_FIG_POST'
EXPORTING
doc_header = wa_header
ignore_warnings = 'X'
TABLES
doc_items = doc_items
return = return.
REFRESH doc_item.
ENDAT.
ENDLOOP.
Edited by: Avinash Kodarapu on Mar 27, 2009 10:36 PM
03-27-2009 5:00 PM
Loop
At end of 'Job'
Call Function 'BAPI........'
Endloop
I think this way you can create a FI doc when job will change
Kuntal
03-27-2009 5:04 PM
If your internal table is job - phase - quantity
You can do this
wa_header-co_area = 1000.
wa_header-docdate = sy-datum.
wa_header-username = sy-uname.
loop at internal table into work_area.
at new job.
fill fields on DOC_ITEMS structures using phase and quantity.
endat.
at end of job.
CALL FUNCTION 'BAPI_ACC_STAT_KEY_FIG_POST'
EXPORTING
doc_header = wa_header
ignore_warnings = 'X'
TABLES
doc_items = doc_items
return = return
endat.
endloop.
03-27-2009 5:10 PM
Avinash,
Now that I have Internal table in my requried format.
I want to create a document for each Job using BAPI.
There are 3 jobs i.e 100,200,300 & Items should be their respective records
like
doc_items -1 -
100 9700 60
100 9700 90
et..
rgds
Praveen
03-27-2009 5:11 PM
Hi,
Just try this code once... and then tell if its working or not
wa_header-co_area = 1000.
wa_header-docdate = sy-datum.
wa_header-username = sy-uname.
loop at internal table into work_area.
append work_area to doc_items. " if the structure is different then move work_area to doc_items structure
" and then append it..... no at events required here
at end of job.
CALL FUNCTION 'BAPI_ACC_STAT_KEY_FIG_POST'
EXPORTING
doc_header = wa_header
ignore_warnings = 'X'
TABLES
doc_items = doc_items
return = return.
clear doc_items. " Clearing doc_items is very important.
endat.
endloop.
regards,
Siddarth