cancel
Showing results for 
Search instead for 
Did you mean: 

Meaning of logic

Former Member
0 Kudos

Hai all,

Can somebody please explain me the meaning of the logic of this code?

  • Pickup clearing document into internal table.

SELECT * FROM BSEG INTO TABLE ZCLEAR_DOC

WHERE BUKRS = FS_DTFIAR_3-BUKRS

AND BELNR = FS_DTFIAR_3-AUGBL

AND GJAHR = ZFISYEAR.

  • Calculate amount to clear by looking for residual items.

  • Find original invoice: Invoice reference or current item.

if FS_DTFIAR_3-REBZG = ''.

DOC_TO_LOOK = FS_DTFIAR_3-BELNR.

else.

DOC_TO_LOOK = FS_DTFIAR_3-REBZG.

endif.

Thank you.

Message was edited by: Visu Venkat

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

The first piece of code will copy all fields with records from database table 'BSEG' into internal table 'ZCLEAR_DOC' only when all the '=' conditions satisfy.

(eg: contents of BUKRS from BSEG table matches the contents of BUKRS in the extract structure of the datasource).

If the contents of field 'REBZG' in the extract structure of the FIAR data source is NULL,

then move the contents of field 'BELNR' to 'DOC_TO_LOOK' field.

If 'REBZG' has some value, then this value is moved to DOC_TO_LOOK.

Thanks.

Former Member
0 Kudos

Thanks a lot Ashwin and Govind. What does FS_DTFIAR_3 mean?

FIAR_3 is my standard data source.I understand that the system is searching for clearing invoice. It pics up an invoice, for which the following conditions meet:

BUKRS = FS_DTFIAR_3-BUKRS

AND BELNR = FS_DTFIAR_3-AUGBL

AND GJAHR = ZFISYEAR.

I have the original and clearing invoices but the BUKRS is matching. But BELNR and AUGBL are not matching. I couldnot find the field FISCYEAR. I think understand what FS_DTFIAR_3 may be helpful for me.

Thanks a lot.

Former Member
0 Kudos

Hi,

DTFIAR_3 is the extract structure of FIAR3 data source. There should be some declaration of type:

FS_DTFIAR_3 LIKE DTFIAR_3.

Don't mind the syntax. But it means that, you have defined 'FS_DTFIAR_3' to have the same structure as DTFAR_3.

BUKRS, BELNR and GJAHR are fields of BSEg table.

FS_DTFIAR_3-BUKRS, FS_DTFIAR_3-AUGBL and ZFISYEAR:

BUKRS, AUGBL and ZFISYEAR are fields of the FIAR-3 data source. ZFISYEAR is a custom defined filed which has been appended to the standard extract structure (DTFIAR_3). You should find it in the list if fields of the data source.

Thanks

Ashwin
Active Contributor
0 Kudos

hi!

i think govind's explination is clear just come post back if you need further explination.

with regards

ashwin

PS n: awarding points is the ways of saying thanks in SDN.

Answers (1)

Answers (1)

Ashwin
Active Contributor
0 Kudos

Hi!

i am not aware of the where this is being processed or used but i can give some explantion for the selection critera,

SELECT * FROM BSEG INTO TABLE ZCLEAR_DOC (selecting the clearing document from table BSEG in to ZCLEAR_DOC)

CONDITIONS

WHERE BUKRS = FS_DTFIAR_3-BUKRS (company code = FS_DTFIAR_3-company code) buchungskries(BUKRS)or accounting area i think this is mapping "company code".

AND BELNR = FS_DTFIAR_3-AUGBL (document no is selcted for field AUGBL)

AND GJAHR = ZFISYEAR.(matching the caleder year(Geschaftsjahr) field with the fiscal yaer)

in the second block it is just assigning the value of"document Number BELNR" to DOC_TO_LOOK if the field REBZG is empty

with regards

ashwin

Message was edited by: Ashwin Kumar Gadi