Skip to Content
avatar image
Former Member

ABAP code to "catch" current field value of currently opened transaction (FBCJ)

Hi experts,

in ABAP code of my ZReport (cash receipt of FBCJ transaction), I have simple ABAP code looking like this

SELECT SINGLE PERSON1 FROM TCJ_C_JOURNALS INTO usrname

but problem with this code is that it is missing WHERE part, which should look like this

SELECT SINGLE PERSON1 FROM TCJ_C_JOURNALS INTO usrname
WHERE CAJO_NUMBER = *currently selected cash journal on FBCJ Tcode
* (item no. 1 on screenshot)

Please see screenshot bellow.

https://s16.postimg.org/zark5oao5/2016_10_12_8_55_38.jpg

If I would need for example in WHERE clause, SAP username, I would easily use SY-UNAME which would read currently login username, BUT how about currently selected cash journal in FBCJ Tcode, is it possible to find such value so I could use it for my ABAP query?

Thank you.
Sam

Add comment
10|10000 characters needed characters exceeded

  • Is a "selected cash journal" a username? Question makes little sense to me.

  • Former Member

    Hi Matthew,

    "selected cash journal" if field on FBCJ Tcode, please see screenshot bellow. I have mention SY-UNAME just as an example, my mistake. Also this is the right code

    SELECT SINGLE PERSON1 FROM TCJ_C_JOURNALS INTO prsname
    WHERE CAJO_NUMBER = *currently selected cash journal on FBCJ Tcode
    * (item no. 1 on screenshot)

    i4rum.png (59.1 kB)
  • Former Member

    Hi

    How do you submit your custom program?

    Max

  • Get RSS Feed

4 Answers

  • Best Answer
    Oct 14, 2016 at 12:47 PM

    Look in customizing of 'Financial Accounting Global Settings, Correspondence' for 'Cash document' in 'Define Correspondence Types', and then in either'SAPscript-Based Forms' or 'PDF-Based Forms', also (last and not least) 'Assign Programs for Correspondence Types'.


    Regards,
    Raymond

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 13, 2016 at 06:54 AM

    Didn't you get the required information(s) in the signature of the form interface (ISCJ_POSTINGS-CAJO_NUMBER)?

    Regards,

    Raymond

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 13, 2016 at 09:08 AM

    Hi Raymond,

    thank you very much for useful reply.

    No, because I can't manage to achieve that using my ABAP code. Please see my screenshot and code bellow. Since ISCJ_POSTINGS is structure and not actual table it doesn't contain any transactional data, I can't pull any data from it so I guess I have to find other way to pull data about *currently selected cash journal*?

    Thank you so much for helping me with this issue.
    Sam

    https://s12.postimg.org/eibdxcm8t/2016_10_13_10_55_09.jpg


    *&---------------------------------------------------------------------*
    *& Form F_GETPERSON1NAME
    *&---------------------------------------------------------------------*
    * read the full person's name
    *----------------------------------------------------------------------*
    * --> p1 text
    * <-- p2 text
    *----------------------------------------------------------------------*
    FORM F_GETPERSON1NAME TABLES int_cond STRUCTURE itcsy
    outt_cond STRUCTURE itcsy.
    DATA cajonum TYPE ISCJ_POSTINGS.
    DATA person1name TYPE string.
    person1name = ''.
    * read the username:
    * TCJ_C_JOURNALS contains PERSON1 and CAJO_NUMBER
    * ADRP indice PERSNUMBER contains NAME_LAST NAME_FIRST name_text

    SELECT SINGLE CAJO_NUMBER FROM ISCJ_POSTINGS INTO cajonum.

    SELECT SINGLE PERSON1 FROM TCJ_C_JOURNALS INTO person1name
    WHERE CAJO_NUMBER = cajonum.

    READ TABLE outt_cond INDEX 1.
    outt_cond-value = person1name.
    MODIFY outt_cond INDEX 1.

    ENDFORM. " F_GETPERSON1NAME

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi

      You should indicate which Sapscript you're using

      In SE71 try to go to Form->Check->Texts

      The driver program is often shown here

  • avatar image
    Former Member
    Oct 13, 2016 at 09:22 AM

    Hi

    It seems you're in a form for a sapscript so the CAJONUM should be transfered by it

    That mean CAJONUM has to be available in your sapscript

    Try to check in the structures or variable used by your sapscript if there's CAJONUM

    Max

    Add comment
    10|10000 characters needed characters exceeded