09-26-2007 7:15 PM
hello folks,
I am working with CREMAS04 idoc.... I wrote the logic to capture the data into one internal table..
SO my internal table(idoc_data) type is EDIDD... in EDIDD there is one field called SDATA, which contains the data for all the segments of CREMAS04 like
E1LFA1M, E1ADRMAS, E1BPAD1VL....
now my requirement is to get the data for the specific segment into seperate internal tables like
if idoc_data-segnam = E1ADRMAS
then i have to move the data from SDATA into one internal table for that specific segement data.
I did like
loop at idoc_data.
if idoc_data-segnam = c_E1BPAD1VL.
lw_E1BPAD1VL = idoc_data-SDATA.
endloop.
but it is giving me error like I can't convert idoc_data-sdata to lw_e1bpad1vl.
Can anyone guide me how to do this
Its bit urgent
Thanks a lot for your aniticipation
Nitesha
09-26-2007 7:23 PM
Hi Nitesha,
What you have mentioned is correct...You need to check for segnam and transfer the data accordingly ...You can check any standard IDoc FM in the system and follow the same procesure to read the IDoc..For Ex: IDOC_INPUT_ACC_GOODS_MOVEMENT
LOOP AT T_EDIDD INTO IDOC_DATA.
CASE IDOC_DATA-SEGNAM.
WHEN 'E1BPACHE02'.
E1BPACHE02 = IDOC_DATA-SDATA.
MOVE-CORRESPONDING E1BPACHE02
TO DOCUMENTHEADER.
IF E1BPACHE02-DOC_DATE
IS INITIAL.
CLEAR DOCUMENTHEADER-DOC_DATE.
ENDIF.
IF E1BPACHE02-PSTNG_DATE
IS INITIAL.
CLEAR DOCUMENTHEADER-PSTNG_DATE.
ENDIF.
WHEN 'E1BPACGL02'.
E1BPACGL02 = IDOC_DATA-SDATA.
MOVE-CORRESPONDING E1BPACGL02
TO ACCOUNTGL.
.......
is part of code from the above mentioned FM...
Regards,
Vivek
09-26-2007 7:37 PM
09-26-2007 7:44 PM
Hey Vivek,
Thanks a lot for your quick response.
I got the problem solved now my next thing is
I have to assing all these values to bapi structures for this purpose I have to call a bapi,
Which way do u think would be preferrable like calling the bapi in the same loop assigning the values to the structures or
appending all the values to internal tables and then passing the values to the bapi structures...
09-26-2007 7:53 PM
Hi Nitesha,
I think you need to build your Internal tables before passing it to BAPI...So, I suppose calling BAPI after filling Header and Item Internal tables would be good idea....
Regards,
Vivek
09-27-2007 8:18 AM
Hi Nitesh,
Whenever you are calling the BAPI , the parameters should be passed based on the internal table values. First you need to different the data and fetch them into the internal table and then pass to the BAPI.
My suggesstion is to use the BAPI after the loop is done and all the values are moved to the respective Internal tables?
What is the BAPI you are using?
Thanks
Manju Beedam.